added: only signal authentication failed if denied 3 times in a row

This commit is contained in:
Bob 2015-11-09 02:06:53 +01:00
parent f3c182af9e
commit cea173f0fa

View file

@ -459,6 +459,7 @@ void ToggleLock()
void loop()
{
uint8_t addr[ADDRSIZE];
uint32_t deniedcount = 0;
for(;;)
{
@ -495,16 +496,26 @@ void loop()
SetLEDState(LEDState_Authorized);
Serial.print("iButton authenticated\n");
ToggleLock();
deniedcount = 0;
}
else
{
deniedcount++;
if (deniedcount == 3)
{
Serial.print("iButton not authenticated\n");
SetLEDState(LEDState_Busy);
digitalWrite(PIN_HORN, HIGH);
DelayLEDs(500);
digitalWrite(PIN_HORN, LOW);
deniedcount = 0;
}
}
}
else
{
deniedcount = 0;
}
ProcessLEDs();
}