mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-23 17:13:38 +00:00
Optionally disable blink during light-sleep
This commit is contained in:
parent
a0f07be96e
commit
66347ce19b
@ -17,6 +17,7 @@
|
||||
#include "sleep.h"
|
||||
#include "target_specific.h"
|
||||
|
||||
// How long between LED blinks during light-sleep
|
||||
#ifndef SLEEP_TIME
|
||||
#define SLEEP_TIME 30
|
||||
#endif
|
||||
@ -84,19 +85,27 @@ static void lsIdle()
|
||||
if (secsSlept < config.power.ls_secs) {
|
||||
// If some other service would stall sleep, don't let sleep happen yet
|
||||
if (doPreflightSleep()) {
|
||||
|
||||
#ifdef LS_NO_BLINK
|
||||
// Sleep now for the full duration
|
||||
uint32_t sleepTime = config.power.ls_secs;
|
||||
#else
|
||||
// Briefly come out of sleep long enough to blink the led once every few seconds
|
||||
uint32_t sleepTime = SLEEP_TIME;
|
||||
|
||||
#endif
|
||||
setLed(false); // Never leave led on while in light sleep
|
||||
esp_sleep_source_t wakeCause2 = doLightSleep(sleepTime * 1000LL);
|
||||
|
||||
switch (wakeCause2) {
|
||||
case ESP_SLEEP_WAKEUP_TIMER:
|
||||
// Normal case: timer expired, we should just go back to sleep ASAP
|
||||
|
||||
#ifndef LS_NO_BLINK
|
||||
// Normal case: timer expired, we should just go back to sleep ASAP
|
||||
setLed(true); // briefly turn on led
|
||||
wakeCause2 = doLightSleep(100); // leave led on for 1ms
|
||||
|
||||
#else
|
||||
// If LS_NO_BLINK, no action here. Mark complete (secsSlept), and handle next time lsIdle() is called
|
||||
#endif
|
||||
secsSlept += sleepTime;
|
||||
// LOG_INFO("sleeping, flash led!\n");
|
||||
break;
|
||||
|
@ -58,3 +58,4 @@
|
||||
|
||||
// Power management
|
||||
#define NIMBLE_DEINIT_FOR_DEEPSLEEP // Required to reach manufacturers claim of 18uA
|
||||
#define LS_NO_BLINK // Prevent LED blink during light-sleep. BLE hardware has slow current ramp-down; too wasteful
|
@ -58,3 +58,4 @@
|
||||
|
||||
// Power management
|
||||
#define NIMBLE_DEINIT_FOR_DEEPSLEEP // Required to reach manufacturers claim of 18uA
|
||||
#define LS_NO_BLINK // Prevent LED blink during light-sleep. BLE hardware has slow current ramp-down; too wasteful
|
Loading…
Reference in New Issue
Block a user