diff --git a/src/RfidPn5180.cpp b/src/RfidPn5180.cpp index eab8f24..ceb7400 100644 --- a/src/RfidPn5180.cpp +++ b/src/RfidPn5180.cpp @@ -358,7 +358,7 @@ extern unsigned long Rfid_LastRfidCheckTimestamp; if (nfc14443.switchToLPCD(wakeupCounterInMs)) { Log_Println((char *) FPSTR(lowPowerCardSuccess), LOGLEVEL_INFO); // configure wakeup pin for deep-sleep wake-up, use ext1 - esp_sleep_enable_ext1_wakeup((1ULL << (RFID_IRQ)), ESP_EXT1_WAKEUP_ANY_HIGH); + esp_sleep_enable_ext1_wakeup((1ULL << (RFID_IRQ)), ESP_EXT1_WAKEUP_ALL_LOW); // freeze pin states in deep sleep gpio_hold_en(gpio_num_t(RFID_CS)); // CS/NSS gpio_hold_en(gpio_num_t(RFID_RST)); // RST diff --git a/src/main.cpp b/src/main.cpp index c80c1ae..c423097 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -129,7 +129,10 @@ void printWakeUpReason() { void setup() { Log_Init(); Queues_Init(); + + // make sure all wakeups can be enabled *before* initializing RFID, which can enter sleep immediately #ifdef RFID_READER_TYPE_PN5180 + Button_Init(); Rfid_Init(); #endif @@ -214,8 +217,8 @@ void setup() { AudioPlayer_Init(); Mqtt_Init(); Battery_Init(); - Button_Init(); #ifndef RFID_READER_TYPE_PN5180 + Button_Init(); Rfid_Init(); #endif RotaryEncoder_Init();