From c66e24aa4de33980cc1325627d56bc502416edb5 Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 4 Mar 2020 18:59:10 -0800 Subject: [PATCH] most users are not using the phone app now, don't enter SDS state because of no phone comms --- docs/sw-design.md | 3 ++- release/latest/curfirmwareversion.xml | 2 +- src/PowerFSM.cpp | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/sw-design.md b/docs/sw-design.md index dd400e8f9..c34bd3378 100644 --- a/docs/sw-design.md +++ b/docs/sw-design.md @@ -53,7 +53,8 @@ off during light sleep, but there is a TODO item to fix this. * While in ON: If it has been more than screen_on_secs since a press, lower to DARK * While in DARK: If time since last contact by our phone exceeds phone_timeout_secs (15 minutes), we transition down into NB mode * While in DARK or NB: If nothing above is forcing us to stay in a higher mode (wait_bluetooth_secs, min_wake_secs) we will lower down to LS state -* While in LS: If either phone_sds_timeout_secs (default 2 hr) or mesh_sds_timeout_secs (default 2 hr) are exceeded we will lower into SDS mode for sds_secs (default 1 yr) (or a button press). +* While in LS: If either phone_sds_timeout_secs (default 2 hr) or mesh_sds_timeout_secs (default 2 hr) are exceeded we will lower into SDS mode for sds_secs (default 1 yr) (or a button press). (Note: phone_sds_timeout_secs is currently disabled for now, because most users +are using without a phone) * Any time we enter LS mode: We stay in that until an interrupt, button press or other state transition. Every ls_secs (default 1 hr) and let the arduino loop() run one iteration (FIXME, not sure if we need this at all), and then immediately reenter lightsleep mode on the CPU. TODO: Eventually these scheduled intervals should be synchronized to the GPS clock, so that we can consider leaving the lora receiver off to save even more power. diff --git a/release/latest/curfirmwareversion.xml b/release/latest/curfirmwareversion.xml index fd1f1a647..d692f8b3c 100644 --- a/release/latest/curfirmwareversion.xml +++ b/release/latest/curfirmwareversion.xml @@ -5,5 +5,5 @@ release. It is used by the android app for forcing software updates. Do not ed Generated by bin/buildall.sh --> - 0.0.9 + 0.1.0 diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 6a406c19a..2ad5816aa 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -26,7 +26,7 @@ static void sdsEnter() static void lsEnter() { screen.setOn(false); - + while (!service.radio.rf95.canSleep()) delay(10); // Kinda yucky - wait until radio says say we can shutdown (finished in process sends/receives) @@ -158,7 +158,8 @@ void PowerFSM_setup() powerFSM.add_timed_transition(&stateDARK, &stateLS, radioConfig.preferences.wait_bluetooth_secs * 1000, NULL, "Bluetooth timeout"); powerFSM.add_timed_transition(&stateLS, &stateSDS, radioConfig.preferences.mesh_sds_timeout_secs * 1000, NULL, "mesh timeout"); - powerFSM.add_timed_transition(&stateLS, &stateSDS, radioConfig.preferences.phone_sds_timeout_sec * 1000, NULL, "phone timeout"); + // removing for now, because some users don't even have phones + // powerFSM.add_timed_transition(&stateLS, &stateSDS, radioConfig.preferences.phone_sds_timeout_sec * 1000, NULL, "phone timeout"); powerFSM.run_machine(); // run one interation of the state machine, so we run our on enter tasks for the initial DARK state } \ No newline at end of file