Skip to content

Commit d9ac1bb

Browse files
committed
HOTFIX: Fixed bug in the enroll process, where any error in the EnrollX() method would be ignored in Arduino code.
1 parent 032ed6d commit d9ac1bb

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

examples/FPS_Enroll/FPS_Enroll.ino

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,20 @@ void Enroll()
101101
if (bret != false)
102102
{
103103
Serial.println("Remove finger");
104-
fps.Enroll1();
104+
iret = fps.Enroll1();
105105
while(fps.IsPressFinger() == true) delay(100);
106106
Serial.println("Press same finger again");
107107
while(fps.IsPressFinger() == false) delay(100);
108108
bret = fps.CaptureFinger(true);
109-
if (bret != false)
109+
if (bret != false && !iret)
110110
{
111111
Serial.println("Remove finger");
112-
fps.Enroll2();
112+
iret = fps.Enroll2();
113113
while(fps.IsPressFinger() == true) delay(100);
114114
Serial.println("Press same finger yet again");
115115
while(fps.IsPressFinger() == false) delay(100);
116116
bret = fps.CaptureFinger(true);
117-
if (bret != false)
117+
if (bret != false && !iret)
118118
{
119119
Serial.println("Remove finger");
120120
iret = fps.Enroll3();
@@ -128,8 +128,18 @@ void Enroll()
128128
Serial.println(iret);
129129
}
130130
}
131+
else if (iret)
132+
{
133+
Serial.print("Enrolling Failed with error code:");
134+
Serial.println(iret);
135+
}
131136
else Serial.println("Failed to capture third finger");
132137
}
138+
else if (iret)
139+
{
140+
Serial.print("Enrolling Failed with error code:");
141+
Serial.println(iret);
142+
}
133143
else Serial.println("Failed to capture second finger");
134144
}
135145
else Serial.println("Failed to capture first finger");

src/FPS_GT511C3.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,9 @@ uint8_t FPS_GT511C3::Enroll1()
602602
{
603603
if (rp->Error == Response_Packet::ErrorCodes::NACK_ENROLL_FAILED) retval = 1;
604604
if (rp->Error == Response_Packet::ErrorCodes::NACK_BAD_FINGER) retval = 2;
605-
}
605+
} else retval = 0;
606606
delete rp;
607-
if (rp->ACK) return 0; else return retval;
607+
return retval;
608608
}
609609

610610
// Gets the Second scan of an enrollment
@@ -633,9 +633,9 @@ uint8_t FPS_GT511C3::Enroll2()
633633
{
634634
if (rp->Error == Response_Packet::ErrorCodes::NACK_ENROLL_FAILED) retval = 1;
635635
if (rp->Error == Response_Packet::ErrorCodes::NACK_BAD_FINGER) retval = 2;
636-
}
636+
} else retval = 0;
637637
delete rp;
638-
if (rp->ACK) return 0; else return retval;
638+
return retval;
639639
}
640640

641641
// Gets the Third scan of an enrollment
@@ -665,9 +665,9 @@ uint8_t FPS_GT511C3::Enroll3()
665665
{
666666
if (rp->Error == Response_Packet::ErrorCodes::NACK_ENROLL_FAILED) retval = 1;
667667
if (rp->Error == Response_Packet::ErrorCodes::NACK_BAD_FINGER) retval = 2;
668-
}
668+
} else retval = 0;
669669
delete rp;
670-
if (rp->ACK) return 0; else return retval;
670+
return retval;
671671
}
672672

673673
// Checks to see if a finger is pressed on the FPS

0 commit comments

Comments
 (0)