From 3841c1a5e0bde63ba9524c57ab6dffe12fad77be Mon Sep 17 00:00:00 2001 From: notbucki <103531753+notbucki@users.noreply.github.com> Date: Mon, 10 Aug 2026 15:53:11 +0200 Subject: [PATCH] Fix V4-R8 waking from hibernate on LoRa traffic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since c644720e UITask::shutdown() no longer puts the radio to sleep — that moved into the boards' powerOff(). HeltecV4R8Board::powerOff() however reused the wake-on-LoRa enterDeepSleep(), which keeps the FEM in RX and arms DIO1 as EXT1 wakeup, so any received packet rebooted the device within seconds. Shut the FEM down (latched) and use the base deep sleep: radio to sleep, no wakeup sources armed. Co-Authored-By: Claude Fable 5 --- variants/heltec_v4_r8/HeltecV4R8Board.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/variants/heltec_v4_r8/HeltecV4R8Board.cpp b/variants/heltec_v4_r8/HeltecV4R8Board.cpp index 1fb123b2f6..370d48e76e 100644 --- a/variants/heltec_v4_r8/HeltecV4R8Board.cpp +++ b/variants/heltec_v4_r8/HeltecV4R8Board.cpp @@ -62,7 +62,17 @@ void HeltecV4R8Board::enterDeepSleep(uint32_t secs, int pin_wake_btn) { } void HeltecV4R8Board::powerOff() { - enterDeepSleep(0); + // enterDeepSleep() is wake-on-LoRa: it keeps the FEM in RX and arms DIO1 + // as an EXT1 wakeup source, so with the radio still running any received + // packet boots the device again. Hibernate needs the FEM off (latched + // through deep sleep; init() releases the holds on the next boot) and the + // base behaviour: radio put to sleep, no wakeup sources armed. + loRaFEMControl.setSleepModeEnable(); + digitalWrite(P_LORA_PA_POWER, LOW); + rtc_gpio_hold_en((gpio_num_t)P_LORA_KCT8103L_PA_CSD); + rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_POWER); + + ESP32Board::enterDeepSleep(0); } uint16_t HeltecV4R8Board::getBattMilliVolts() {