mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-13 16:42:07 +00:00
Tweaking Power FSM states (#2676)
* Tweaking Power FSM states * Turn bluetooth back on after serial disconnected * Remove references to deprecated mesh_sds_timeout_secs
This commit is contained in:
parent
4e54bec525
commit
cfe5c7f31d
@ -1 +1 @@
|
|||||||
Subproject commit 8e7500278f32a0f8096961843aad9b431916dcb0
|
Subproject commit c5fa71fbb68b8d4044cb6a6d72f06257ac29dd9c
|
@ -146,7 +146,10 @@ static void nbEnter()
|
|||||||
{
|
{
|
||||||
LOG_DEBUG("Enter state: NB\n");
|
LOG_DEBUG("Enter state: NB\n");
|
||||||
screen->setOn(false);
|
screen->setOn(false);
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
|
// Only ESP32 should turn off bluetooth
|
||||||
setBluetoothEnable(false);
|
setBluetoothEnable(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
// FIXME - check if we already have packets for phone and immediately trigger EVENT_PACKETS_FOR_PHONE
|
// FIXME - check if we already have packets for phone and immediately trigger EVENT_PACKETS_FOR_PHONE
|
||||||
}
|
}
|
||||||
@ -167,6 +170,8 @@ static void serialEnter()
|
|||||||
|
|
||||||
static void serialExit()
|
static void serialExit()
|
||||||
{
|
{
|
||||||
|
// Turn bluetooth back on when we leave serial stream API
|
||||||
|
setBluetoothEnable(true);
|
||||||
screen->print("Serial disconnected\n");
|
screen->print("Serial disconnected\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +256,11 @@ void PowerFSM_setup()
|
|||||||
|
|
||||||
// wake timer expired or a packet arrived
|
// wake timer expired or a packet arrived
|
||||||
// if we are a router node, we go to NB (no need for bluetooth) otherwise we go to DARK (so we can send message to phone)
|
// if we are a router node, we go to NB (no need for bluetooth) otherwise we go to DARK (so we can send message to phone)
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
powerFSM.add_transition(&stateLS, isRouter ? &stateNB : &stateDARK, EVENT_WAKE_TIMER, NULL, "Wake timer");
|
powerFSM.add_transition(&stateLS, isRouter ? &stateNB : &stateDARK, EVENT_WAKE_TIMER, NULL, "Wake timer");
|
||||||
|
#else // Don't go into a no-bluetooth state on low power platforms
|
||||||
|
powerFSM.add_transition(&stateLS, &stateDARK, EVENT_WAKE_TIMER, NULL, "Wake timer");
|
||||||
|
#endif
|
||||||
|
|
||||||
// We need this transition, because we might not transition if we were waiting to enter light-sleep, because when we wake from
|
// We need this transition, because we might not transition if we were waiting to enter light-sleep, because when we wake from
|
||||||
// light sleep we _always_ transition to NB or dark and
|
// light sleep we _always_ transition to NB or dark and
|
||||||
|
@ -109,7 +109,6 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
|
|||||||
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_TW;
|
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_TW;
|
||||||
|
|
||||||
// Enter super deep sleep soon and stay there not very long
|
// Enter super deep sleep soon and stay there not very long
|
||||||
// radioConfig.preferences.mesh_sds_timeout_secs = 10;
|
|
||||||
// radioConfig.preferences.sds_secs = 60;
|
// radioConfig.preferences.sds_secs = 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +210,6 @@ void NodeDB::initConfigIntervals()
|
|||||||
config.position.position_broadcast_secs = default_broadcast_interval_secs;
|
config.position.position_broadcast_secs = default_broadcast_interval_secs;
|
||||||
|
|
||||||
config.power.ls_secs = default_ls_secs;
|
config.power.ls_secs = default_ls_secs;
|
||||||
config.power.mesh_sds_timeout_secs = default_mesh_sds_timeout_secs;
|
|
||||||
config.power.min_wake_secs = default_min_wake_secs;
|
config.power.min_wake_secs = default_min_wake_secs;
|
||||||
config.power.sds_secs = default_sds_secs;
|
config.power.sds_secs = default_sds_secs;
|
||||||
config.power.wait_bluetooth_secs = default_wait_bluetooth_secs;
|
config.power.wait_bluetooth_secs = default_wait_bluetooth_secs;
|
||||||
|
@ -174,7 +174,6 @@ extern NodeDB nodeDB;
|
|||||||
|
|
||||||
# prefs.position_broadcast_secs = FIXME possibly broadcast only once an hr
|
# prefs.position_broadcast_secs = FIXME possibly broadcast only once an hr
|
||||||
prefs.wait_bluetooth_secs = 1 # Don't stay in bluetooth mode
|
prefs.wait_bluetooth_secs = 1 # Don't stay in bluetooth mode
|
||||||
prefs.mesh_sds_timeout_secs = never
|
|
||||||
# try to stay in light sleep one full day, then briefly wake and sleep again
|
# try to stay in light sleep one full day, then briefly wake and sleep again
|
||||||
|
|
||||||
prefs.ls_secs = oneday
|
prefs.ls_secs = oneday
|
||||||
@ -202,7 +201,6 @@ extern NodeDB nodeDB;
|
|||||||
#define default_gps_update_interval IF_ROUTER(ONE_DAY, 2 * 60)
|
#define default_gps_update_interval IF_ROUTER(ONE_DAY, 2 * 60)
|
||||||
#define default_broadcast_interval_secs IF_ROUTER(ONE_DAY / 2, 15 * 60)
|
#define default_broadcast_interval_secs IF_ROUTER(ONE_DAY / 2, 15 * 60)
|
||||||
#define default_wait_bluetooth_secs IF_ROUTER(1, 60)
|
#define default_wait_bluetooth_secs IF_ROUTER(1, 60)
|
||||||
#define default_mesh_sds_timeout_secs IF_ROUTER(NODE_DELAY_FOREVER, 2 * 60 * 60)
|
|
||||||
#define default_sds_secs IF_ROUTER(ONE_DAY, UINT32_MAX) // Default to forever super deep sleep
|
#define default_sds_secs IF_ROUTER(ONE_DAY, UINT32_MAX) // Default to forever super deep sleep
|
||||||
#define default_ls_secs IF_ROUTER(ONE_DAY, 5 * 60)
|
#define default_ls_secs IF_ROUTER(ONE_DAY, 5 * 60)
|
||||||
#define default_min_wake_secs 10
|
#define default_min_wake_secs 10
|
||||||
|
@ -292,7 +292,8 @@ typedef struct _meshtastic_Config_PowerConfig {
|
|||||||
The number of seconds for to wait before turning off BLE in No Bluetooth states
|
The number of seconds for to wait before turning off BLE in No Bluetooth states
|
||||||
0 for default of 1 minute */
|
0 for default of 1 minute */
|
||||||
uint32_t wait_bluetooth_secs;
|
uint32_t wait_bluetooth_secs;
|
||||||
/* Mesh Super Deep Sleep Timeout Seconds
|
/* Deprecated in 2.1.X
|
||||||
|
Mesh Super Deep Sleep Timeout Seconds
|
||||||
While in Light Sleep if this value is exceeded we will lower into super deep sleep
|
While in Light Sleep if this value is exceeded we will lower into super deep sleep
|
||||||
for sds_secs (default 1 year) or a button press
|
for sds_secs (default 1 year) or a button press
|
||||||
0 for default of two hours, MAXUINT for disabled */
|
0 for default of two hours, MAXUINT for disabled */
|
||||||
|
Loading…
Reference in New Issue
Block a user