Skip to content

Commit

Permalink
HOTFIX: Fixed bug in the enroll process, where any error in the Enrol…
Browse files Browse the repository at this point in the history
…lX() method would be ignored in Arduino code.
  • Loading branch information
Fasgort committed Mar 18, 2019
1 parent 032ed6d commit d9ac1bb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
18 changes: 14 additions & 4 deletions examples/FPS_Enroll/FPS_Enroll.ino
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,20 @@ void Enroll()
if (bret != false)
{
Serial.println("Remove finger");
fps.Enroll1();
iret = fps.Enroll1();
while(fps.IsPressFinger() == true) delay(100);
Serial.println("Press same finger again");
while(fps.IsPressFinger() == false) delay(100);
bret = fps.CaptureFinger(true);
if (bret != false)
if (bret != false && !iret)
{
Serial.println("Remove finger");
fps.Enroll2();
iret = fps.Enroll2();
while(fps.IsPressFinger() == true) delay(100);
Serial.println("Press same finger yet again");
while(fps.IsPressFinger() == false) delay(100);
bret = fps.CaptureFinger(true);
if (bret != false)
if (bret != false && !iret)
{
Serial.println("Remove finger");
iret = fps.Enroll3();
Expand All @@ -128,8 +128,18 @@ void Enroll()
Serial.println(iret);
}
}
else if (iret)
{
Serial.print("Enrolling Failed with error code:");
Serial.println(iret);
}
else Serial.println("Failed to capture third finger");
}
else if (iret)
{
Serial.print("Enrolling Failed with error code:");
Serial.println(iret);
}
else Serial.println("Failed to capture second finger");
}
else Serial.println("Failed to capture first finger");
Expand Down
12 changes: 6 additions & 6 deletions src/FPS_GT511C3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,9 @@ uint8_t FPS_GT511C3::Enroll1()
{
if (rp->Error == Response_Packet::ErrorCodes::NACK_ENROLL_FAILED) retval = 1;
if (rp->Error == Response_Packet::ErrorCodes::NACK_BAD_FINGER) retval = 2;
}
} else retval = 0;
delete rp;
if (rp->ACK) return 0; else return retval;
return retval;
}

// Gets the Second scan of an enrollment
Expand Down Expand Up @@ -633,9 +633,9 @@ uint8_t FPS_GT511C3::Enroll2()
{
if (rp->Error == Response_Packet::ErrorCodes::NACK_ENROLL_FAILED) retval = 1;
if (rp->Error == Response_Packet::ErrorCodes::NACK_BAD_FINGER) retval = 2;
}
} else retval = 0;
delete rp;
if (rp->ACK) return 0; else return retval;
return retval;
}

// Gets the Third scan of an enrollment
Expand Down Expand Up @@ -665,9 +665,9 @@ uint8_t FPS_GT511C3::Enroll3()
{
if (rp->Error == Response_Packet::ErrorCodes::NACK_ENROLL_FAILED) retval = 1;
if (rp->Error == Response_Packet::ErrorCodes::NACK_BAD_FINGER) retval = 2;
}
} else retval = 0;
delete rp;
if (rp->ACK) return 0; else return retval;
return retval;
}

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

0 comments on commit d9ac1bb

Please sign in to comment.