Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions src/PowerFSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,6 @@ static bool isPowered()
return !isPowerSavingMode && powerStatus && (!powerStatus->getHasBattery() || powerStatus->getHasUSB());
}

static bool isBluetoothEnabledForPowerFSM()
{
#if HAS_BLUETOOTH && !MESHTASTIC_EXCLUDE_BLUETOOTH
return config.bluetooth.enabled;
#else
return false;
#endif
}

static uint32_t getBluetoothWaitMs()
{
if (!isBluetoothEnabledForPowerFSM())
return 0;

return Default::getConfiguredOrDefaultMs(config.power.wait_bluetooth_secs, default_wait_bluetooth_secs);
}

#if defined(T5_S3_EPAPER_PRO)
static void t5BacklightOffForSleep()
{
Expand Down Expand Up @@ -446,7 +429,10 @@ void PowerFSM_setup()

// If ESP32 and using power-saving, timer mover from DARK to light-sleep
// Also serves purpose of the old DARK to DARK transition(?) See https://github.com/meshtastic/firmware/issues/3517
powerFSM.add_timed_transition(&stateDARK, &stateLS, getBluetoothWaitMs(), NULL, "Bluetooth timeout");
powerFSM.add_timed_transition(
&stateDARK, &stateLS,
Default::getConfiguredOrDefaultMs(config.power.wait_bluetooth_secs, default_wait_bluetooth_secs), NULL,
"Bluetooth timeout");
} else {
// If ESP32, but not using power-saving, check periodically if config has drifted out of stateDark
powerFSM.add_timed_transition(&stateDARK, &stateDARK,
Expand Down
Loading