diff --git a/firmware/firmware.ino b/firmware/firmware.ino index a999cbe..7fcbce2 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -403,7 +403,7 @@ void postState() if (LOGGING) Serial.println(lockPayload); String action = deserializeLockJson(lockPayload); - if (action == "arm" && lockState == LOCK_OFF) { + if (action == "arm" && lockState == LOCK_OFF && LEDState == LED_OFF) { lockState = LOCK_PREARM; } else if (action == "disarm") { lockState = LOCK_OFF; @@ -442,11 +442,13 @@ void getCards() cardPayload += "$"; // Mark the end if (LOGGING) Serial.println(cardPayload); + noInterrupts(); // commit() disables interrupts, but we want an atomic EEPROM buffer write for (int i = 0; i < cardPayload.length(); i++) { if (i >= EEPROM_SIZE) break; EEPROM.write(i, cardPayload.charAt(i)); } EEPROM.commit(); + interrupts(); if (LOGGING) Serial.println("[INFO] Finished getting card data."); } else {