mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-04 18:49:00 +00:00
do not use ifdef for HAS_XYZ capability flags
This commit is contained in:
parent
b2b5bc1a6d
commit
0fbf7f7e4f
@ -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");
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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<void *> notifyLightSleep;
|
||||
/// Called to tell observers that light sleep has just ended, and why it ended
|
||||
Observable<esp_sleep_wakeup_cause_t> 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
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user