r123: a bench flag that keeps light sleep out of the state machine

Light sleep suspends the USB-serial/JTAG console, and a CPU-only reset does not
bring it back, so a capture goes dark for as long as the node sleeps - the same
thing that cost r120 most of its runs. Nothing in r123 needs light sleep: the
fix under test is on the deep-sleep path.

MESHTASTIC_NO_LIGHT_SLEEP leaves the two timed transitions into stateLS out of
PowerFSM, so no config can put the capture back in the dark. It is not an early
return from doLightSleep(): lsIdle() reads an immediate ESP_SLEEP_WAKEUP_TIMER
as a completed sleep chunk, so that shape would churn through ls_secs at loop
speed instead of sleeping. Deep sleep is untouched.

Only tbeam-s3-core-r123 defines it.

Co-Authored-By: Jonathan Bennett <jbennett@incomsystems.biz>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTiifXrVc4YdonmLRCeWhw
This commit is contained in:
Jonathan BennettandClaude Opus 5 authored and Claude committed 2026-10-12 16:02:47 +00:00
1 parent 7c516bf591
commit bdd107b35d
2 files changed
+13 -1

No files matched your search

+12 -1
View File
@@ -443,7 +443,18 @@ void PowerFSM_setup()
config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER ||
config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR;
if ((isRouter || config.power.is_power_saving) && !isWifiAvailable() && !isTrackerOrSensor) {
#ifdef MESHTASTIC_NO_LIGHT_SLEEP
// Bench flag (r123). Light sleep suspends the USB-serial/JTAG console and a CPU-only reset does not
// bring it back, so a capture goes dark for as long as the node sleeps. Keep the two transitions into
// stateLS out of the machine entirely rather than returning early from doLightSleep(): lsIdle() reads
// an immediate ESP_SLEEP_WAKEUP_TIMER as a completed sleep chunk, so it would churn through ls_secs at
// loop speed instead. Deep sleep is unaffected.
const bool addLightSleepTransitions = false;
LOG_WARN("MESHTASTIC_NO_LIGHT_SLEEP: light sleep is disabled in this build");
#else
const bool addLightSleepTransitions = true;
#endif
if (addLightSleepTransitions && (isRouter || config.power.is_power_saving) && !isWifiAvailable() && !isTrackerOrSensor) {
powerFSM.add_timed_transition(&stateNB, &stateLS,
Default::getConfiguredOrDefaultMs(config.power.min_wake_secs, default_min_wake_secs), NULL,
"Min wake timeout");
@@ -33,3 +33,4 @@ board_level = extra
build_flags =
${env:tbeam-s3-core.build_flags}
-D MESHTASTIC_WAKE_PIN_PROBE=1
-D MESHTASTIC_NO_LIGHT_SLEEP=1