More precise logging of door opens

This commit is contained in:
Will Bradley 2013-03-21 09:00:28 -07:00
parent 055754b484
commit 464a3f2e29

View File

@ -1046,11 +1046,20 @@ int processTagAccess(long reader, int doorNum) {
{ {
ds1307.getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year); ds1307.getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
if((hour >=17) && (hour <=23)){ if((hour >=17) && (hour <=23)){
log(LOG_ACCESS_GRANTED,reader, doorNum); // Log and unlock door
alarmState(0); alarmState(0);
armAlarm(0); // Deactivate Alarm armAlarm(0); // Deactivate Alarm
door2locktimer=millis(); switch(doorNum){
doorUnlock(doorNum); // Unlock the door. case 1:
log(LOG_ACCESS_GRANTED,reader, 1); // Log and unlock door
door1locktimer=millis();
doorUnlock(doorNum);
break;
case 2:
log(LOG_ACCESS_GRANTED,reader, 2); // Log and unlock door
door2locktimer=millis();
doorUnlock(doorNum);
break;
}
keypadGranted=1; keypadGranted=1;
} }
break; break;
@ -1064,15 +1073,16 @@ int processTagAccess(long reader, int doorNum) {
default: default:
{ {
log(LOG_ACCESS_GRANTED,reader, doorNum); // Log and unlock door
alarmState(0); alarmState(0);
armAlarm(0); // Deactivate Alarm armAlarm(0); // Deactivate Alarm
switch(doorNum){ switch(doorNum){
case 1: case 1:
log(LOG_ACCESS_GRANTED,reader, 1); // Log and unlock door
door1locktimer=millis(); door1locktimer=millis();
doorUnlock(doorNum); doorUnlock(doorNum);
break; break;
case 2: case 2:
log(LOG_ACCESS_GRANTED,reader, 2); // Log and unlock door
door2locktimer=millis(); door2locktimer=millis();
doorUnlock(doorNum); doorUnlock(doorNum);
break; break;
@ -1087,16 +1097,17 @@ int processTagAccess(long reader, int doorNum) {
else else
{ {
if(checkSuperuser(reader) >= 0) { // Check if a superuser, grant access. if(checkSuperuser(reader) >= 0) { // Check if a superuser, grant access.
log(LOG_ACCESS_GRANTED,reader, doorNum); // Log and unlock door 2
alarmState(0); alarmState(0);
armAlarm(0); // Deactivate Alarm armAlarm(0); // Deactivate Alarm
chirpAlarm(1); chirpAlarm(1);
switch(doorNum){ switch(doorNum){
case 1: case 1:
log(LOG_ACCESS_GRANTED,reader, 1); // Log and unlock door
door1locktimer=millis(); door1locktimer=millis();
doorUnlock(doorNum); doorUnlock(doorNum);
break; break;
case 2: case 2:
log(LOG_ACCESS_GRANTED,reader, 2); // Log and unlock door
door2locktimer=millis(); door2locktimer=millis();
doorUnlock(doorNum); doorUnlock(doorNum);
break; break;