mirror of
https://github.com/zyphlar/open-access-control-minimal-http.git
synced 2024-03-08 15:57:47 +00:00
Made extend button able to extend past 30 minutes
This commit is contained in:
parent
f4d6aa5d70
commit
99e899a2ce
@ -100,6 +100,7 @@ bool authorized = false;
|
|||||||
bool relay1high = false;
|
bool relay1high = false;
|
||||||
bool relay2high = false;
|
bool relay2high = false;
|
||||||
unsigned long relay1timer=0;
|
unsigned long relay1timer=0;
|
||||||
|
int extendButtonDebounce = 0;
|
||||||
|
|
||||||
|
|
||||||
void setup(){ // Runs once at Arduino boot-up
|
void setup(){ // Runs once at Arduino boot-up
|
||||||
@ -144,20 +145,20 @@ void loop() // Main branch, runs over and ov
|
|||||||
|
|
||||||
if(authorized && relay1high) {
|
if(authorized && relay1high) {
|
||||||
|
|
||||||
// Detect button push
|
// Detect logout button push
|
||||||
lcd.setCursor(6,0);
|
|
||||||
lcd.print(analogRead(logoutButton));
|
|
||||||
lcd.print(" ");
|
|
||||||
if (analogRead(logoutButton) < 50) {
|
if (analogRead(logoutButton) < 50) {
|
||||||
authorized = false;
|
authorized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect extend button push
|
// Detect extend button push with debounce/repeat
|
||||||
lcd.setCursor(12,0);
|
|
||||||
lcd.print(analogRead(extendButton));
|
|
||||||
lcd.print(" ");
|
|
||||||
if (analogRead(extendButton) < 50) {
|
if (analogRead(extendButton) < 50) {
|
||||||
relay1timer = millis();
|
extendButtonDebounce++;
|
||||||
|
} else {
|
||||||
|
extendButtonDebounce = 0;
|
||||||
|
}
|
||||||
|
if(extendButtonDebounce > 5){
|
||||||
|
relay1timer += RELAYDELAY;
|
||||||
|
extendButtonDebounce = -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate current time elapsed
|
// calculate current time elapsed
|
||||||
@ -193,6 +194,7 @@ void loop() // Main branch, runs over and ov
|
|||||||
|
|
||||||
// not authorized -- turn off relay
|
// not authorized -- turn off relay
|
||||||
relayLow(1);
|
relayLow(1);
|
||||||
|
wiegand26.initReaderOne(); // Reset for next tag scan
|
||||||
}
|
}
|
||||||
if(authorized && !relay1high) {
|
if(authorized && !relay1high) {
|
||||||
lcd.clear();
|
lcd.clear();
|
||||||
@ -203,6 +205,7 @@ void loop() // Main branch, runs over and ov
|
|||||||
|
|
||||||
// authorized -- turn on relay
|
// authorized -- turn on relay
|
||||||
relayHigh(1);
|
relayHigh(1);
|
||||||
|
wiegand26.initReaderOne(); // Reset for next tag scan
|
||||||
}
|
}
|
||||||
if(!authorized && !relay1high) {
|
if(!authorized && !relay1high) {
|
||||||
// display login message
|
// display login message
|
||||||
|
Loading…
x
Reference in New Issue
Block a user