Skip to content

Commit

Permalink
Increase UART timeout for "createModel" to 10000 ms.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Breitschopp committed Oct 15, 2024
1 parent da0596d commit 45b69f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Adafruit_Fingerprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
Adafruit_Fingerprint_Packet packet(FINGERPRINT_COMMANDPACKET, sizeof(data), \
data); \
writeStructuredPacket(packet); \
if (getStructuredPacket(&packet) != FINGERPRINT_OK) \
uint16_t timeout = data[0] == \
FINGERPRINT_REGMODEL ? TIMEOUT_CREATEMODEL : DEFAULTTIMEOUT; \
if (getStructuredPacket(&packet, timeout) != FINGERPRINT_OK) \
return FINGERPRINT_PACKETRECIEVEERR; \
if (packet.type != FINGERPRINT_ACKPACKET) \
return FINGERPRINT_PACKETRECIEVEERR;
Expand Down Expand Up @@ -780,7 +782,9 @@ Adafruit_Fingerprint::getStructuredPacket(Adafruit_Fingerprint_Packet *packet,
uint16_t idx = 0, timer = 0;

#ifdef FINGERPRINT_DEBUG
Serial.print("<- ");
Serial.print("max. ");
Serial.print(timeout);
Serial.print(" ms: <- ");
#endif

while (true) {
Expand Down
1 change: 1 addition & 0 deletions src/Adafruit_Fingerprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
//#define FINGERPRINT_DEBUG

#define DEFAULTTIMEOUT 2000 //!< UART reading timeout in milliseconds
#define TIMEOUT_CREATEMODEL 10000 //!< UART reading timeout in milliseconds

///! Helper class to craft UART packets
struct Adafruit_Fingerprint_Packet {
Expand Down

0 comments on commit 45b69f1

Please sign in to comment.