From 61048f58682d406e2b48165185008392e1e33cb4 Mon Sep 17 00:00:00 2001 From: Kevin Le Date: Wed, 19 Aug 2026 10:19:05 +0700 Subject: [PATCH 1/3] Added missing POWERSAVING_FIRSTSLEEP_SECS for room servers --- examples/simple_room_server/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/simple_room_server/main.cpp b/examples/simple_room_server/main.cpp index 156c77ee8..efa5c8b82 100644 --- a/examples/simple_room_server/main.cpp +++ b/examples/simple_room_server/main.cpp @@ -26,6 +26,9 @@ static char command[MAX_POST_TEXT_LEN+1]; static char ethernet_command[MAX_POST_TEXT_LEN+1]; #endif +// For power saving +unsigned long POWERSAVING_FIRSTSLEEP_SECS = 120; // The first sleep (if enabled) from boot + void setup() { Serial.begin(115200); delay(1000); From 1a7f70e7b30941151d5e6e7ae64401eaa39bab23 Mon Sep 17 00:00:00 2001 From: Kevin Le Date: Wed, 19 Aug 2026 11:36:47 +0700 Subject: [PATCH 2/3] Added ARDUINO_USB_MODE=1 back to Heltec v4. ARDUINO_USB_MODE in heltec_v4.json has no effect. --- variants/heltec_v4/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/heltec_v4/platformio.ini b/variants/heltec_v4/platformio.ini index 54d9a8cd7..fb6deed2a 100644 --- a/variants/heltec_v4/platformio.ini +++ b/variants/heltec_v4/platformio.ini @@ -7,6 +7,7 @@ build_flags = -I variants/heltec_v4 -D HELTEC_LORA_V4 -D USE_SX1262 + -D ARDUINO_USB_MODE=1 ; ARDUINO_USB_MODE in heltec_v4.json has no effect -D ESP32_CPU_FREQ=80 -D RADIO_CLASS=CustomSX1262 -D WRAPPER_CLASS=CustomSX1262Wrapper From a3b9ad91a5bf04e7e00713595469dc868de53628 Mon Sep 17 00:00:00 2001 From: Kevin Le Date: Wed, 19 Aug 2026 19:19:16 +0700 Subject: [PATCH 3/3] Disabled automatic light sleep for companions with USB CDC Serial --- examples/companion_radio/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 4817f35ee..224369fd0 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -265,11 +265,13 @@ void setup() { #endif // Configure Power Management - #if CONFIG_IDF_TARGET_ESP32C3 && defined(ENABLE_USB_INTERFACE) - pm_config = { .max_freq_mhz = 80, .min_freq_mhz = 40, .light_sleep_enable = false }; - #else - pm_config = { .max_freq_mhz = 80, .min_freq_mhz = 40, .light_sleep_enable = true }; - #endif +#if defined(ARDUINO_USB_CDC_ON_BOOT) && ARDUINO_USB_CDC_ON_BOOT + // Disable automatic light sleep for USB CDC Serial + pm_config = { .max_freq_mhz = 80, .min_freq_mhz = 40, .light_sleep_enable = false }; +#else + pm_config = { .max_freq_mhz = 80, .min_freq_mhz = 40, .light_sleep_enable = true }; +#endif + esp_err_t errPM = esp_pm_configure(&pm_config); if (errPM == ESP_OK) { Serial.println("Power Management configured successfully");