Commit b63fa8a0 authored by Ondřej Kučera's avatar Ondřej Kučera
Browse files

make authorization possible AFTER entering & add small delay before a person...

make authorization possible AFTER entering & add small delay before a person is identified as unauthorized
parent 1b0b91bb
......@@ -167,7 +167,7 @@ void checkIntruder() {
response = pulseIn(pEcho, HIGH);
distance = response / 58.31;
if (distance < 60 & intruder == false) {
if (distance < 60 & intruder == false & (accmillis - lastIntruderTime) > 500) {
intruder = true;
lastIntruderTime = accmillis;
//Serial.println("someone is inside");
......@@ -191,6 +191,11 @@ void takeAction() {
if (alarmStat & !intruder & !alarmOverride) {
SetAlarm(false);
}
//stop alarm if inruder authorizes; respect manual alarm
if (alarmStat & intruder & authorized & !alarmOverride) {
SetAlarm(false);
}
//start an entering timeout to let an authorized person get in
if (authorized & !entered & !entering & !leaving) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment