Skip to content
Open
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
18 changes: 13 additions & 5 deletions src/helpers/HeltecV3Board.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ class HeltecV3Board : public ESP32Board {

rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS);

if (pin_wake_btn < 0) {
esp_sleep_enable_ext1_wakeup( (1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH); // wake up on: recv LoRa packet
} else {
esp_sleep_enable_ext1_wakeup( (1L << P_LORA_DIO_1) | (1L << pin_wake_btn), ESP_EXT1_WAKEUP_ANY_HIGH); // wake up on: recv LoRa packet OR wake btn
esp_sleep_enable_ext1_wakeup((1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH); // wake up on: recv LoRa packet

if (pin_wake_btn >= 0) {
esp_sleep_enable_ext0_wakeup((gpio_num_t)pin_wake_btn, 0); // wake up on: button press (LOW)
}

if (secs > 0) {
Expand All @@ -85,7 +85,15 @@ class HeltecV3Board : public ESP32Board {
}

void powerOff() override {
enterDeepSleep(0);
#ifdef PIN_USER_BTN
// Wait for button release to avoid immediate re-trigger
while (digitalRead(PIN_USER_BTN) == LOW) {
delay(10);
}
delay(50); // Debounce
#endif

enterDeepSleep(0, PIN_USER_BTN);
}

uint16_t getBattMilliVolts() override {
Expand Down