Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/helpers/ESP32Board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/helpers/ESP32Board.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down