Skip to content

Commit

Permalink
Improve behaviour for failed cards and PINs when they are fitted and …
Browse files Browse the repository at this point in the history
…unused.
  • Loading branch information
ncmreynolds committed May 22, 2024
1 parent 33579e7 commit 8f92cd5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/LarpHackableRfidLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ bool ICACHE_FLASH_ATTR LarpHackableRfidLock::loadConfiguration(const char* filen
tap_code_revoke_ = doc[tap_code_revoke_key_] | tap_code_revoke_default_;
tap_code_revoke_all_ = doc[tap_code_revoke_all_key_] | tap_code_revoke_all_default_;
//PIN codes
pin_entry_enabled_ == doc[pin_entry_enabled_key_];
pin_entry_enabled_ = doc[pin_entry_enabled_key_] | pin_entry_enabled_default_;
pin_to_open_ = doc[pin_to_open_key_] | pin_to_open_default_;
pin_to_seal_ = doc[pin_to_seal_key_] | pin_to_seal_default_;
pin_to_unseal_ = doc[pin_to_unseal_key_] | pin_to_unseal_default_;
Expand Down Expand Up @@ -700,7 +700,7 @@ bool ICACHE_FLASH_ATTR LarpHackableRfidLock::saveConfiguration(const char* filen
doc[tap_code_revoke_key_] = tap_code_revoke_;
doc[tap_code_revoke_all_key_] = tap_code_revoke_all_;
//PIN codes
//doc[pin_entry_enabled_key_] = pin_entry_enabled_;
doc[pin_entry_enabled_key_] = pin_entry_enabled_;
doc[pin_to_open_key_] = pin_to_open_;
doc[pin_to_seal_key_] = pin_to_seal_;
doc[pin_to_unseal_key_] = pin_to_unseal_;
Expand Down Expand Up @@ -1043,7 +1043,7 @@ void ICACHE_FLASH_ATTR LarpHackableRfidLock::housekeeping(){
#ifdef HOUSEKEEPING_DEBUG
Serial.println(housekeepingdebug++); //8
#endif
if(rfid_reader_intialised_ == true && rfid_ != nullptr) { //Only run the RFID reader code if enabled
if(rfid_authorisation_enabled_ == true && rfid_reader_intialised_ == true && rfid_ != nullptr) { //Only run the RFID reader code if enabled and initialised
rfid_->pollForCard();
}
//Manage TapCode
Expand Down Expand Up @@ -1212,7 +1212,8 @@ void ICACHE_FLASH_ATTR LarpHackableRfidLock::housekeeping(){
#ifdef HOUSEKEEPING_DEBUG
Serial.println(housekeepingdebug++); //15
#endif
if(pinEntered()) { //Check if a pin has been entered and clear if it has
//Check for entered pins from the matrix
if(pin_entered_ == true && millis() - last_pin_entry_ > 250) { //Check if a pin has been entered and clear if it has
if(pin_entry_enabled_ == true) {
if(pin_to_open_.length() != 0 && pinMatches(pin_to_open_)) { //PIN matches the 'open' one
if(multi_factor_enabled_ == true) {
Expand Down Expand Up @@ -1267,6 +1268,8 @@ void ICACHE_FLASH_ATTR LarpHackableRfidLock::housekeeping(){
} else { //Deny access
deny();
}
} else { //Deny access
deny();
}
clearEnteredPin();
}
Expand Down
3 changes: 2 additions & 1 deletion src/LarpHackableRfidLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,8 @@ class LarpHackableRfidLock {
char lock_access_group_key_[9] = "accessId";
uint8_t lock_access_group_default_ = 0;
//Is PIN entry enabled
bool pin_entry_enabled_ = true;
bool pin_entry_enabled_ = false;
bool pin_entry_enabled_default_ = false;
String pin_entry_enabled_key_ = "pin_entry_enabled_";
String pin_to_open_ = "";
String pin_to_open_key_ = "pin_to_open_";
Expand Down

0 comments on commit 8f92cd5

Please sign in to comment.