diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 5d9add8af..ef6931d5e 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -85,7 +85,7 @@ static void lsEnter() sleepStart = -1; sleepTime = 0; -#ifdef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if HAS_ESP32_DYNAMIC_LIGHT_SLEEP if (!doPreflightSleep()) { LOG_DEBUG("Transition to LS state aborted because of tasks pending"); powerFSM.trigger(EVENT_WAKE_TIMER); @@ -102,7 +102,7 @@ static void lsEnter() static void lsIdle() { if (!doPreflightSleep()) { -#ifdef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if HAS_ESP32_DYNAMIC_LIGHT_SLEEP powerFSM.trigger(EVENT_WAKE_TIMER); #endif return; @@ -119,7 +119,7 @@ static void lsIdle() } #ifdef ARCH_ESP32 -#ifndef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if !HAS_ESP32_DYNAMIC_LIGHT_SLEEP doLightSleep(sleepLeft); #endif @@ -158,7 +158,7 @@ static void lsIdle() static void lsExit() { -#ifdef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if HAS_ESP32_DYNAMIC_LIGHT_SLEEP doLightSleep(LIGHT_SLEEP_ABORT); #endif @@ -333,7 +333,7 @@ void PowerFSM_setup() powerFSM.add_transition(&stateLS, &stateDARK, EVENT_WEB_REQUEST, NULL, "Web request"); powerFSM.add_transition(&stateDARK, &stateDARK, EVENT_WEB_REQUEST, NULL, "Web request"); -#ifdef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if HAS_ESP32_DYNAMIC_LIGHT_SLEEP // it's better to exit dynamic light sleep when packet is received to ensure routing is properly handled powerFSM.add_transition(&stateLS, &stateDARK, EVENT_RADIO_INTERRUPT, NULL, "Radio interrupt"); powerFSM.add_transition(&stateDARK, &stateDARK, EVENT_RADIO_INTERRUPT, NULL, "Radio interrupt"); diff --git a/src/PowerFSM.h b/src/PowerFSM.h index 362c1af86..cb91d1ef5 100644 --- a/src/PowerFSM.h +++ b/src/PowerFSM.h @@ -24,7 +24,7 @@ #define EVENT_RADIO_INTERRUPT 18 #define EVENT_WEB_REQUEST 19 -#ifdef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if HAS_ESP32_DYNAMIC_LIGHT_SLEEP #define WAKE_TIME_MS 500 #else #define WAKE_TIME_MS (Default::getConfiguredOrDefaultMs(config.power.min_wake_secs, default_min_wake_secs)) diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index be6113632..ab7de0935 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -227,6 +227,6 @@ #endif // Setup flag, which indicates if our device supports dynamic light sleep -#if defined(HAS_ESP32_PM_SUPPORT) && defined(CONFIG_FREERTOS_USE_TICKLESS_IDLE) +#if HAS_ESP32_PM_SUPPORT && defined(CONFIG_FREERTOS_USE_TICKLESS_IDLE) #define HAS_ESP32_DYNAMIC_LIGHT_SLEEP 1 #endif diff --git a/src/sleep.cpp b/src/sleep.cpp index 70d431798..bf9dba99f 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -18,7 +18,7 @@ #include "target_specific.h" #ifdef ARCH_ESP32 -#ifdef HAS_ESP32_PM_SUPPORT +#if HAS_ESP32_PM_SUPPORT #include "esp32/pm.h" #include "esp_pm.h" #endif @@ -54,7 +54,7 @@ Observable notifyLightSleep; /// Called to tell observers that light sleep has just ended, and why it ended Observable notifyLightSleepEnd; -#ifdef HAS_ESP32_PM_SUPPORT +#if HAS_ESP32_PM_SUPPORT esp_pm_lock_handle_t pmLightSleepLock; #endif @@ -318,7 +318,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveN } #ifdef ARCH_ESP32 -#ifdef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if HAS_ESP32_DYNAMIC_LIGHT_SLEEP static bool pmLightSleepLockAcquired; #endif static concurrency::Lock *lightSleepConcurrencyLock; @@ -335,7 +335,7 @@ void doLightSleep(uint32_t sleepMsec) assert(lightSleepConcurrencyLock); lightSleepConcurrencyLock->lock(); -#ifndef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if !HAS_ESP32_DYNAMIC_LIGHT_SLEEP assert(sleepMsec != LIGHT_SLEEP_ABORT); assert(sleepMsec != LIGHT_SLEEP_DYNAMIC); #else @@ -419,7 +419,7 @@ void doLightSleep(uint32_t sleepMsec) notifyLightSleepEnd.notifyObservers(wakeCause); } else { -#ifdef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if HAS_ESP32_DYNAMIC_LIGHT_SLEEP res = esp_pm_lock_release(pmLightSleepLock); assert(res == ESP_OK); pmLightSleepLockAcquired = false; @@ -441,7 +441,7 @@ void initLightSleep() } #endif -#ifdef HAS_ESP32_PM_SUPPORT +#if HAS_ESP32_PM_SUPPORT res = esp_pm_lock_create(ESP_PM_NO_LIGHT_SLEEP, 0, "meshtastic", &pmLightSleepLock); assert(res == ESP_OK); @@ -451,7 +451,7 @@ void initLightSleep() esp_pm_config_esp32_t pm_config; pm_config.max_freq_mhz = 80; pm_config.min_freq_mhz = dfsSupported ? 20 : pm_config.max_freq_mhz; -#ifdef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if HAS_ESP32_DYNAMIC_LIGHT_SLEEP pm_config.light_sleep_enable = true; #else pm_config.light_sleep_enable = false; @@ -466,7 +466,7 @@ void initLightSleep() lightSleepConcurrencyLock = new concurrency::Lock(); -#ifdef HAS_ESP32_DYNAMIC_LIGHT_SLEEP +#if HAS_ESP32_DYNAMIC_LIGHT_SLEEP pmLightSleepLockAcquired = true; #endif } diff --git a/variants/esp32s3/heltec_v3/variant.h b/variants/esp32s3/heltec_v3/variant.h index c888f56f0..13f41411a 100644 --- a/variants/esp32s3/heltec_v3/variant.h +++ b/variants/esp32s3/heltec_v3/variant.h @@ -1,7 +1,5 @@ #define LED_PIN LED -#define HAS_32768HZ - #define USE_SSD1306 // Heltec_v3 has a SSD1306 display #define RESET_OLED RST_OLED @@ -43,4 +41,4 @@ #define SX126X_DIO2_AS_RF_SWITCH #define SX126X_DIO3_TCXO_VOLTAGE 1.8 -#define HAS_32768HZ 1 \ No newline at end of file +#define HAS_32768HZ 1