mirror of
https://github.com/bitlair/bitlair_doorduino.git
synced 2025-05-13 12:20:07 +02:00
added: only signal authentication failed if denied 3 times in a row
This commit is contained in:
parent
f3c182af9e
commit
cea173f0fa
1 changed files with 16 additions and 5 deletions
|
@ -459,6 +459,7 @@ void ToggleLock()
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
uint8_t addr[ADDRSIZE];
|
uint8_t addr[ADDRSIZE];
|
||||||
|
uint32_t deniedcount = 0;
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
@ -495,16 +496,26 @@ void loop()
|
||||||
SetLEDState(LEDState_Authorized);
|
SetLEDState(LEDState_Authorized);
|
||||||
Serial.print("iButton authenticated\n");
|
Serial.print("iButton authenticated\n");
|
||||||
ToggleLock();
|
ToggleLock();
|
||||||
|
deniedcount = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Serial.print("iButton not authenticated\n");
|
deniedcount++;
|
||||||
SetLEDState(LEDState_Busy);
|
if (deniedcount == 3)
|
||||||
digitalWrite(PIN_HORN, HIGH);
|
{
|
||||||
DelayLEDs(500);
|
Serial.print("iButton not authenticated\n");
|
||||||
digitalWrite(PIN_HORN, LOW);
|
SetLEDState(LEDState_Busy);
|
||||||
|
digitalWrite(PIN_HORN, HIGH);
|
||||||
|
DelayLEDs(500);
|
||||||
|
digitalWrite(PIN_HORN, LOW);
|
||||||
|
deniedcount = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deniedcount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ProcessLEDs();
|
ProcessLEDs();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue