From 3df81682b3014580e7d518e4908003a3a781eb85 Mon Sep 17 00:00:00 2001 From: geeksville Date: Fri, 21 Feb 2020 11:32:33 -0800 Subject: [PATCH] now that light-sleep kinda works, use deep-sleep far more rarely --- TODO.md | 2 ++ src/configuration.h | 2 +- src/main.ino | 2 +- src/screen.cpp | 8 +++++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 78b689e2..520f36d7 100644 --- a/TODO.md +++ b/TODO.md @@ -4,6 +4,7 @@ Items to complete before the first alpha release. * implement CustomRF95::canSleep * document rules for sleep wrt lora/bluetooth/screen/gps. also: if I have text messages (only) for the phone, then give a few seconds in the hopes BLE can get it across before we have to go back to sleep. +* make gps prevent light sleep if we are waiting for data * wake from light sleep as needed for our next scheduled periodic task (needed for gps position broadcasts etc) * turn bluetooth off based on our sleep policy * if the phone doesn't read fromradio mailbox within X seconds, assume the phone is gone and we can stop queing location msgs @@ -45,6 +46,7 @@ Items to complete before the first beta release. * How do avalanche beacons work? Could this do that as well? possibly by using beacon mode feature of the RF95? * use std::map in node db * make a HAM build: yep - that's a great idea. I'll add it to the TODO. should be pretty painless - just a new frequency list, a bool to say 'never do encryption' and use hte callsign as that node's unique id. -from Girts +* add frequency hopping # Low power consumption tasks General ideas to hit the power draws our spreadsheet predicts. Do the easy ones before beta, the last 15% can be done after 1.0. diff --git a/src/configuration.h b/src/configuration.h index a1602c56..c37feaf7 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -66,7 +66,7 @@ along with this program. If not, see . // If not defined, we will wait for lock forever -#define MINWAKE_MSECS (10 * 60 * 1000) // stay awake a long time (30 mins) for debugging +#define MINWAKE_MSECS (60 * 60 * 1000) // stay awake a long time (30 mins) for debugging - FIXME, change per the TBD sleep rules doc // #define MINWAKE_MSECS (30 * 1000) // Wait after every boot for GPS lock (may need longer than 5s because we turned the gps off during deep sleep) // ----------------------------------------------------------------------------- diff --git a/src/main.ino b/src/main.ino index 714461ab..3f5b1642 100644 --- a/src/main.ino +++ b/src/main.ino @@ -493,7 +493,7 @@ void setup() } setBluetoothEnable(false); - setCPUFast(true); // FIXME, switch to low speed now + setCPUFast(false); // 80MHz is fine for our slow peripherals } uint32_t ledBlinker() diff --git a/src/screen.cpp b/src/screen.cpp index b76b2496..bbb7fde5 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -554,6 +554,8 @@ void Screen::setup() //ui.setActiveSymbol(activeSymbol); //ui.setInactiveSymbol(inactiveSymbol); + ui.setTimePerTransition(300); // msecs + // You can change this to // TOP, LEFT, BOTTOM, RIGHT ui.setIndicatorPosition(BOTTOM); @@ -593,7 +595,7 @@ void Screen::setup() /// Turn off the screen this many ms after last press or wake #define SCREEN_SLEEP_MS (60 * 1000) -#define TRANSITION_FRAMERATE 60 // fps +#define TRANSITION_FRAMERATE 30 // fps #define IDLE_FRAMERATE 10 // in fps static uint32_t targetFramerate = IDLE_FRAMERATE; @@ -637,7 +639,7 @@ void Screen::doTask() // Once we finish showing the bootscreen, remove it from the loop if (showingBootScreen) { - if (millis() > 5 * 1000) // we show the boot screen for a few seconds only + if (millis() > 3 * 1000) // we show the boot screen for a few seconds only { showingBootScreen = false; screen_set_frames(); @@ -665,7 +667,7 @@ void Screen::doTask() // If we are scrolling we need to be called soon, otherwise just 1 fps (to save CPU) // We also ask to be called twice as fast as we really need so that any rounding errors still result // with the correct framerate - setPeriod(1000 / targetFramerate / 2); + setPeriod(1000 / targetFramerate); } // Show the bluetooth PIN screen