mirror of https://github.com/arendst/Tasmota.git
AdafruitFingerprint library from v2.0.4 to v2.1.0
AdafruitFingerprint library from v2.0.4 to v2.1.0 (#18163)
This commit is contained in:
parent
7c92a2186b
commit
80afc8793f
|
@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
|
||||||
### Changed
|
### Changed
|
||||||
- InfluxDb resolves DNS name before request (#18015)
|
- InfluxDb resolves DNS name before request (#18015)
|
||||||
- Shutter sliders in WEBGUI automatically appear and disappear during configuration and update during movement (#18701)
|
- Shutter sliders in WEBGUI automatically appear and disappear during configuration and update during movement (#18701)
|
||||||
|
- AdafruitFingerprint library from v2.0.4 to v2.1.0
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- ESP32 InfluxDb initial connection delays using HTTPClient (#18015)
|
- ESP32 InfluxDb initial connection delays using HTTPClient (#18015)
|
||||||
|
|
|
@ -133,6 +133,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||||
- Change command ``FileUpload`` index binary data detection from >199 to >299
|
- Change command ``FileUpload`` index binary data detection from >199 to >299
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- AdafruitFingerprint library from v2.0.4 to v2.1.0
|
||||||
- IRremoteESP8266 library from v2.8.4 to v2.8.5
|
- IRremoteESP8266 library from v2.8.4 to v2.8.5
|
||||||
- ESP32 Framework (Core) from v2.0.7 to v2.0.9
|
- ESP32 Framework (Core) from v2.0.7 to v2.0.9
|
||||||
- InfluxDb resolves DNS name before request [#18015](https://github.com/arendst/Tasmota/issues/18015)
|
- InfluxDb resolves DNS name before request [#18015](https://github.com/arendst/Tasmota/issues/18015)
|
||||||
|
|
Binary file not shown.
|
@ -5,7 +5,11 @@ on: [pull_request, push, repository_dispatch]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arduino-platform: ["uno", "leonardo", "mega2560", "zero", "esp8266", "esp32", "metro_m4", "trinket_m0"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-python@v1
|
- uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
|
@ -20,7 +24,7 @@ jobs:
|
||||||
run: bash ci/actions_install.sh
|
run: bash ci/actions_install.sh
|
||||||
|
|
||||||
- name: test platforms
|
- name: test platforms
|
||||||
run: python3 ci/build_platform.py main_platforms
|
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}
|
||||||
|
|
||||||
- name: clang
|
- name: clang
|
||||||
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
|
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
|
|
@ -64,6 +64,7 @@
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
//Adafruit_Fingerprint::Adafruit_Fingerprint(SoftwareSerial *ss,
|
//Adafruit_Fingerprint::Adafruit_Fingerprint(SoftwareSerial *ss,
|
||||||
Adafruit_Fingerprint::Adafruit_Fingerprint(TasmotaSerial *ss,
|
Adafruit_Fingerprint::Adafruit_Fingerprint(TasmotaSerial *ss,
|
||||||
|
|
||||||
uint32_t password) {
|
uint32_t password) {
|
||||||
thePassword = password;
|
thePassword = password;
|
||||||
theAddress = 0xFFFFFFFF;
|
theAddress = 0xFFFFFFFF;
|
||||||
|
@ -413,10 +414,64 @@ uint8_t Adafruit_Fingerprint::getTemplateCount(void) {
|
||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
uint8_t Adafruit_Fingerprint::setPassword(uint32_t password) {
|
uint8_t Adafruit_Fingerprint::setPassword(uint32_t password) {
|
||||||
SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (uint8_t)(password >> 24), (uint8_t)(password >> 16),
|
SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (uint8_t)(password >> 24),
|
||||||
(uint8_t)(password >> 8), (uint8_t)password);
|
(uint8_t)(password >> 16), (uint8_t)(password >> 8),
|
||||||
|
(uint8_t)(password & 0xFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Writing module registers
|
||||||
|
@param regAdd 8-bit address of register
|
||||||
|
@param value 8-bit value will write to register
|
||||||
|
@returns <code>FINGERPRINT_OK</code> on success
|
||||||
|
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
|
||||||
|
@returns <code>FINGERPRINT_ADDRESS_ERROR</code> on register address error
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
uint8_t Adafruit_Fingerprint::writeRegister(uint8_t regAdd, uint8_t value) {
|
||||||
|
|
||||||
|
SEND_CMD_PACKET(FINGERPRINT_WRITE_REG, regAdd, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Change UART baudrate
|
||||||
|
@param baudrate 8-bit Uart baudrate
|
||||||
|
@returns <code>FINGERPRINT_OK</code> on success
|
||||||
|
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
uint8_t Adafruit_Fingerprint::setBaudRate(uint8_t baudrate) {
|
||||||
|
|
||||||
|
return (writeRegister(FINGERPRINT_BAUD_REG_ADDR, baud_rate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Change security level
|
||||||
|
@param level 8-bit security level
|
||||||
|
@returns <code>FINGERPRINT_OK</code> on success
|
||||||
|
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
uint8_t Adafruit_Fingerprint::setSecurityLevel(uint8_t level) {
|
||||||
|
|
||||||
|
return (writeRegister(FINGERPRINT_SECURITY_REG_ADDR, level));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Change packet size
|
||||||
|
@param size 8-bit packet size
|
||||||
|
@returns <code>FINGERPRINT_OK</code> on success
|
||||||
|
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
uint8_t Adafruit_Fingerprint::setPacketSize(uint8_t size) {
|
||||||
|
|
||||||
|
return (writeRegister(FINGERPRINT_PACKET_REG_ADDR, size));
|
||||||
|
}
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Helper function to process a packet and send it over UART to the
|
@brief Helper function to process a packet and send it over UART to the
|
||||||
|
@ -559,6 +614,9 @@ Adafruit_Fingerprint::getStructuredPacket(Adafruit_Fingerprint_Packet *packet,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
|
if ((idx + 9) >= sizeof(packet->data)) {
|
||||||
|
return FINGERPRINT_BADPACKET;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Shouldn't get here so...
|
// Shouldn't get here so...
|
||||||
return FINGERPRINT_BADPACKET;
|
return FINGERPRINT_BADPACKET;
|
|
@ -87,7 +87,40 @@
|
||||||
#define FINGERPRINT_LED_GRADUAL_OFF 0x06 //!< Gradually off
|
#define FINGERPRINT_LED_GRADUAL_OFF 0x06 //!< Gradually off
|
||||||
#define FINGERPRINT_LED_RED 0x01 //!< Red LED
|
#define FINGERPRINT_LED_RED 0x01 //!< Red LED
|
||||||
#define FINGERPRINT_LED_BLUE 0x02 //!< Blue LED
|
#define FINGERPRINT_LED_BLUE 0x02 //!< Blue LED
|
||||||
#define FINGERPRINT_LED_PURPLE 0x03 //!< Purple LED
|
#define FINGERPRINT_LED_PURPLE 0x03 //!< Purple LEDpassword
|
||||||
|
|
||||||
|
#define FINGERPRINT_REG_ADDR_ERROR 0x1A //!< shows register address error
|
||||||
|
#define FINGERPRINT_WRITE_REG 0x0E //!< Write system register instruction
|
||||||
|
|
||||||
|
#define FINGERPRINT_BAUD_REG_ADDR 0x4 //!< BAUDRATE register address
|
||||||
|
#define FINGERPRINT_BAUDRATE_9600 0x1 //!< UART baud 9600
|
||||||
|
#define FINGERPRINT_BAUDRATE_19200 0x2 //!< UART baud 19200
|
||||||
|
#define FINGERPRINT_BAUDRATE_28800 0x3 //!< UART baud 28800
|
||||||
|
#define FINGERPRINT_BAUDRATE_38400 0x4 //!< UART baud 38400
|
||||||
|
#define FINGERPRINT_BAUDRATE_48000 0x5 //!< UART baud 48000
|
||||||
|
#define FINGERPRINT_BAUDRATE_57600 0x6 //!< UART baud 57600
|
||||||
|
#define FINGERPRINT_BAUDRATE_67200 0x7 //!< UART baud 67200
|
||||||
|
#define FINGERPRINT_BAUDRATE_76800 0x8 //!< UART baud 76800
|
||||||
|
#define FINGERPRINT_BAUDRATE_86400 0x9 //!< UART baud 86400
|
||||||
|
#define FINGERPRINT_BAUDRATE_96000 0xA //!< UART baud 96000
|
||||||
|
#define FINGERPRINT_BAUDRATE_105600 0xB //!< UART baud 105600
|
||||||
|
#define FINGERPRINT_BAUDRATE_115200 0xC //!< UART baud 115200
|
||||||
|
|
||||||
|
#define FINGERPRINT_SECURITY_REG_ADDR 0x5 //!< Security level register address
|
||||||
|
// The safety level is 1 The highest rate of false recognition , The rejection
|
||||||
|
// rate is the lowest . The safety level is 5 The lowest tate of false
|
||||||
|
// recognition, The rejection rate is the highest .
|
||||||
|
#define FINGERPRINT_SECURITY_LEVEL_1 0X1 //!< Security level 1
|
||||||
|
#define FINGERPRINT_SECURITY_LEVEL_2 0X2 //!< Security level 2
|
||||||
|
#define FINGERPRINT_SECURITY_LEVEL_3 0X3 //!< Security level 3
|
||||||
|
#define FINGERPRINT_SECURITY_LEVEL_4 0X4 //!< Security level 4
|
||||||
|
#define FINGERPRINT_SECURITY_LEVEL_5 0X5 //!< Security level 5
|
||||||
|
|
||||||
|
#define FINGERPRINT_PACKET_REG_ADDR 0x6 //!< Packet size register address
|
||||||
|
#define FINGERPRINT_PACKET_SIZE_32 0X0 //!< Packet size is 32 Byte
|
||||||
|
#define FINGERPRINT_PACKET_SIZE_64 0X1 //!< Packet size is 64 Byte
|
||||||
|
#define FINGERPRINT_PACKET_SIZE_128 0X2 //!< Packet size is 128 Byte
|
||||||
|
#define FINGERPRINT_PACKET_SIZE_256 0X3 //!< Packet size is 256 Byte
|
||||||
|
|
||||||
//#define FINGERPRINT_DEBUG
|
//#define FINGERPRINT_DEBUG
|
||||||
|
|
||||||
|
@ -158,6 +191,10 @@ public:
|
||||||
uint8_t LEDcontrol(uint8_t control, uint8_t speed, uint8_t coloridx,
|
uint8_t LEDcontrol(uint8_t control, uint8_t speed, uint8_t coloridx,
|
||||||
uint8_t count = 0);
|
uint8_t count = 0);
|
||||||
|
|
||||||
|
uint8_t setBaudRate(uint8_t baudrate);
|
||||||
|
uint8_t setSecurityLevel(uint8_t level);
|
||||||
|
uint8_t setPacketSize(uint8_t size);
|
||||||
|
|
||||||
void writeStructuredPacket(const Adafruit_Fingerprint_Packet &p);
|
void writeStructuredPacket(const Adafruit_Fingerprint_Packet &p);
|
||||||
uint8_t getStructuredPacket(Adafruit_Fingerprint_Packet *p,
|
uint8_t getStructuredPacket(Adafruit_Fingerprint_Packet *p,
|
||||||
uint16_t timeout = DEFAULTTIMEOUT);
|
uint16_t timeout = DEFAULTTIMEOUT);
|
||||||
|
@ -181,6 +218,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t checkPassword(void);
|
uint8_t checkPassword(void);
|
||||||
|
uint8_t writeRegister(uint8_t regAdd, uint8_t value);
|
||||||
uint32_t thePassword;
|
uint32_t thePassword;
|
||||||
uint32_t theAddress;
|
uint32_t theAddress;
|
||||||
uint8_t recvPacket[20];
|
uint8_t recvPacket[20];
|
File diff suppressed because it is too large
Load Diff
|
@ -86,15 +86,13 @@ uint8_t deleteFingerprint(uint8_t id) {
|
||||||
Serial.println("Deleted!");
|
Serial.println("Deleted!");
|
||||||
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
|
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
|
||||||
Serial.println("Communication error");
|
Serial.println("Communication error");
|
||||||
return p;
|
|
||||||
} else if (p == FINGERPRINT_BADLOCATION) {
|
} else if (p == FINGERPRINT_BADLOCATION) {
|
||||||
Serial.println("Could not delete in that location");
|
Serial.println("Could not delete in that location");
|
||||||
return p;
|
|
||||||
} else if (p == FINGERPRINT_FLASHERR) {
|
} else if (p == FINGERPRINT_FLASHERR) {
|
||||||
Serial.println("Error writing to flash");
|
Serial.println("Error writing to flash");
|
||||||
return p;
|
|
||||||
} else {
|
} else {
|
||||||
Serial.print("Unknown error: 0x"); Serial.println(p, HEX);
|
Serial.print("Unknown error: 0x"); Serial.println(p, HEX);
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return p;
|
||||||
}
|
}
|
|
@ -33,7 +33,7 @@ int getFingerprintIDez();
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
while(!Serial);
|
while (!Serial);
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
Serial.println("Fingerprint template extractor");
|
Serial.println("Fingerprint template extractor");
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ uint8_t downloadFingerprintTemplate(uint16_t id)
|
||||||
case FINGERPRINT_OK:
|
case FINGERPRINT_OK:
|
||||||
Serial.print("Template "); Serial.print(id); Serial.println(" transferring:");
|
Serial.print("Template "); Serial.print(id); Serial.println(" transferring:");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Serial.print("Unknown error "); Serial.println(p);
|
Serial.print("Unknown error "); Serial.println(p);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -90,9 +90,9 @@ uint8_t downloadFingerprintTemplate(uint16_t id)
|
||||||
uint32_t starttime = millis();
|
uint32_t starttime = millis();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < 534 && (millis() - starttime) < 20000) {
|
while (i < 534 && (millis() - starttime) < 20000) {
|
||||||
if (mySerial.available()) {
|
if (mySerial.available()) {
|
||||||
bytesReceived[i++] = mySerial.read();
|
bytesReceived[i++] = mySerial.read();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Serial.print(i); Serial.println(" bytes read.");
|
Serial.print(i); Serial.println(" bytes read.");
|
||||||
Serial.println("Decoding packet...");
|
Serial.println("Decoding packet...");
|
||||||
|
@ -102,42 +102,41 @@ uint8_t downloadFingerprintTemplate(uint16_t id)
|
||||||
|
|
||||||
// filtering only the data packets
|
// filtering only the data packets
|
||||||
int uindx = 9, index = 0;
|
int uindx = 9, index = 0;
|
||||||
while (index < 534) {
|
memcpy(fingerTemplate + index, bytesReceived + uindx, 256); // first 256 bytes
|
||||||
while (index < uindx) ++index;
|
uindx += 256; // skip data
|
||||||
uindx += 256;
|
uindx += 2; // skip checksum
|
||||||
while (index < uindx) {
|
uindx += 9; // skip next header
|
||||||
fingerTemplate[index++] = bytesReceived[index];
|
index += 256; // advance pointer
|
||||||
}
|
memcpy(fingerTemplate + index, bytesReceived + uindx, 256); // second 256 bytes
|
||||||
uindx += 2;
|
|
||||||
while (index < uindx) ++index;
|
|
||||||
uindx = index + 9;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 512; ++i) {
|
for (int i = 0; i < 512; ++i) {
|
||||||
//Serial.print("0x");
|
//Serial.print("0x");
|
||||||
printHex(fingerTemplate[i], 2);
|
printHex(fingerTemplate[i], 2);
|
||||||
//Serial.print(", ");
|
//Serial.print(", ");
|
||||||
}
|
}
|
||||||
Serial.println("\ndone.");
|
Serial.println("\ndone.");
|
||||||
|
|
||||||
|
return p;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
uint8_t templateBuffer[256];
|
uint8_t templateBuffer[256];
|
||||||
memset(templateBuffer, 0xff, 256); //zero out template buffer
|
memset(templateBuffer, 0xff, 256); //zero out template buffer
|
||||||
int index=0;
|
int index=0;
|
||||||
uint32_t starttime = millis();
|
uint32_t starttime = millis();
|
||||||
while ((index < 256) && ((millis() - starttime) < 1000))
|
while ((index < 256) && ((millis() - starttime) < 1000))
|
||||||
{
|
{
|
||||||
if (mySerial.available())
|
if (mySerial.available())
|
||||||
{
|
{
|
||||||
templateBuffer[index] = mySerial.read();
|
templateBuffer[index] = mySerial.read();
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.print(index); Serial.println(" bytes read");
|
Serial.print(index); Serial.println(" bytes read");
|
||||||
|
|
||||||
//dump entire templateBuffer. This prints out 16 lines of 16 bytes
|
//dump entire templateBuffer. This prints out 16 lines of 16 bytes
|
||||||
for (int count= 0; count < 16; count++)
|
for (int count= 0; count < 16; count++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
Serial.print("0x");
|
Serial.print("0x");
|
||||||
|
@ -145,22 +144,21 @@ uint8_t downloadFingerprintTemplate(uint16_t id)
|
||||||
Serial.print(", ");
|
Serial.print(", ");
|
||||||
}
|
}
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void printHex(int num, int precision) {
|
void printHex(int num, int precision) {
|
||||||
char tmp[16];
|
char tmp[16];
|
||||||
char format[128];
|
char format[128];
|
||||||
|
|
||||||
sprintf(format, "%%.%dX", precision);
|
sprintf(format, "%%.%dX", precision);
|
||||||
|
|
||||||
sprintf(tmp, format, num);
|
sprintf(tmp, format, num);
|
||||||
Serial.print(tmp);
|
Serial.print(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name=Adafruit Fingerprint Sensor Library
|
name=Adafruit Fingerprint Sensor Library
|
||||||
version=2.0.4
|
version=2.1.0
|
||||||
author=Adafruit
|
author=Adafruit
|
||||||
maintainer=Adafruit <info@adafruit.com>
|
maintainer=Adafruit <info@adafruit.com>
|
||||||
sentence=Arduino library for interfacing to the fingerprint sensor in the Adafruit shop
|
sentence=Arduino library for interfacing to the fingerprint sensor in the Adafruit shop
|
|
@ -32,6 +32,10 @@
|
||||||
|
|
||||||
//#define USE_AS608_MESSAGES
|
//#define USE_AS608_MESSAGES
|
||||||
|
|
||||||
|
#ifndef AS608_DUPLICATE
|
||||||
|
#define AS608_DUPLICATE 4 // Number of 0.25Sec to disable detection
|
||||||
|
#endif
|
||||||
|
|
||||||
#define D_JSON_FPRINT "FPrint"
|
#define D_JSON_FPRINT "FPrint"
|
||||||
|
|
||||||
#define D_PRFX_FP "Fp"
|
#define D_PRFX_FP "Fp"
|
||||||
|
@ -62,9 +66,12 @@ Adafruit_Fingerprint *As608Finger;
|
||||||
TasmotaSerial *As608Serial;
|
TasmotaSerial *As608Serial;
|
||||||
|
|
||||||
struct AS608 {
|
struct AS608 {
|
||||||
|
uint16_t finger_id;
|
||||||
|
uint16_t confidence;
|
||||||
bool selected = false;
|
bool selected = false;
|
||||||
uint8_t enroll_step = 0;
|
uint8_t enroll_step = 0;
|
||||||
uint8_t model_number = 0;
|
uint8_t model_number = 0;
|
||||||
|
uint8_t duplicate;
|
||||||
} As608;
|
} As608;
|
||||||
|
|
||||||
char* As608Message(char* response, uint32_t index) {
|
char* As608Message(char* response, uint32_t index) {
|
||||||
|
@ -131,6 +138,13 @@ void As608Loop(void) {
|
||||||
uint32_t p = 0;
|
uint32_t p = 0;
|
||||||
|
|
||||||
if (!As608.enroll_step) {
|
if (!As608.enroll_step) {
|
||||||
|
if (As608.duplicate) {
|
||||||
|
As608.duplicate--;
|
||||||
|
}
|
||||||
|
if (!As608.duplicate) {
|
||||||
|
As608Finger->LEDcontrol(FINGERPRINT_LED_OFF, 0, FINGERPRINT_LED_PURPLE);
|
||||||
|
}
|
||||||
|
|
||||||
// Search for Finger
|
// Search for Finger
|
||||||
|
|
||||||
// As608Finger->LEDcontrol(FINGERPRINT_LED_OFF, 0, FINGERPRINT_LED_RED);
|
// As608Finger->LEDcontrol(FINGERPRINT_LED_OFF, 0, FINGERPRINT_LED_RED);
|
||||||
|
@ -152,7 +166,15 @@ void As608Loop(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Found a match
|
// Found a match
|
||||||
Response_P(PSTR("{\"" D_JSON_FPRINT "\":{\"" D_JSON_ID "\":%d,\"" D_JSON_CONFIDENCE "\":%d}}"), As608Finger->fingerID, As608Finger->confidence);
|
if (As608.duplicate && (As608.finger_id == As608Finger->fingerID)) {
|
||||||
|
return; // Skip duplicate during AS608_DUPLICATE * 0.25 second
|
||||||
|
}
|
||||||
|
As608.duplicate = AS608_DUPLICATE; // AS608_DUPLICATE * 250mS
|
||||||
|
As608Finger->LEDcontrol(FINGERPRINT_LED_ON, 0, FINGERPRINT_LED_PURPLE);
|
||||||
|
|
||||||
|
As608.finger_id = As608Finger->fingerID;
|
||||||
|
As608.confidence = As608Finger->confidence;
|
||||||
|
Response_P(PSTR("{\"" D_JSON_FPRINT "\":{\"" D_JSON_ID "\":%d,\"" D_JSON_CONFIDENCE "\":%d}}"), As608.finger_id, As608.confidence);
|
||||||
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_STAT, PSTR(D_JSON_FPRINT));
|
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_STAT, PSTR(D_JSON_FPRINT));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -305,6 +327,11 @@ bool Xsns79(uint32_t function) {
|
||||||
case FUNC_EVERY_250_MSECOND:
|
case FUNC_EVERY_250_MSECOND:
|
||||||
As608Loop();
|
As608Loop();
|
||||||
break;
|
break;
|
||||||
|
#ifdef USE_WEBSERVER
|
||||||
|
case FUNC_WEB_SENSOR:
|
||||||
|
WSContentSend_PD(PSTR("{s}AS608{m}%d-%d{e}"), As608.finger_id, As608.confidence);
|
||||||
|
break;
|
||||||
|
#endif // USE_WEBSERVER
|
||||||
case FUNC_COMMAND:
|
case FUNC_COMMAND:
|
||||||
result = DecodeCommand(kAs608Commands, As608Commands);
|
result = DecodeCommand(kAs608Commands, As608Commands);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue