From a3b9ad91a5bf04e7e00713595469dc868de53628 Mon Sep 17 00:00:00 2001 From: Kevin Le Date: Wed, 19 Aug 2026 19:19:16 +0700 Subject: [PATCH] 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 4817f35e..224369fd 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");