diff --git a/src/helpers/ESP32Board.cpp b/src/helpers/ESP32Board.cpp index d190fca190..4cad75367a 100644 --- a/src/helpers/ESP32Board.cpp +++ b/src/helpers/ESP32Board.cpp @@ -63,11 +63,13 @@ void ESP32Board::enterDeepSleep(uint32_t secs) { radio_driver.powerOff(); // Keep LoRa inactive during deepsleep +#ifdef P_LORA_NSS digitalWrite(P_LORA_NSS, HIGH); #if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) gpio_hold_en((gpio_num_t)P_LORA_NSS); #else rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS); +#endif #endif // Power off GPS if any diff --git a/src/helpers/ESP32Board.h b/src/helpers/ESP32Board.h index cd274cd931..a47981255b 100644 --- a/src/helpers/ESP32Board.h +++ b/src/helpers/ESP32Board.h @@ -69,9 +69,11 @@ class ESP32Board : public mesh::MainBoard { virtual void powerOff() override; void enterDeepSleep(uint32_t secs); +#ifdef P_LORA_DIO_1 uint32_t getIRQGpio() override { return P_LORA_DIO_1; // default for SX1262 } +#endif void sleep(uint32_t secs) override { // Skip if not allow to sleep @@ -82,6 +84,10 @@ class ESP32Board : public mesh::MainBoard { // Set GPIO wakeup gpio_num_t wakeupPin = (gpio_num_t)getIRQGpio(); + if (wakeupPin == GPIO_NUM_NC) { // no radio IRQ pin to wake on + delay(1); + return; + } // Configure timer wakeup if (secs > 0) {