diff --git a/TODO.md b/TODO.md index f8ca81d7..3d43d04f 100644 --- a/TODO.md +++ b/TODO.md @@ -1,17 +1,14 @@ # High priority -* make nice screens (boot, about to sleep, debug info (gps signal, #people), latest text, person info - one frame per person on network) -* we are currently spinning like crazy in loop, instead sleep unless we have work to do -* have radiohead ISR send messages to RX queue directly, to allow that thread to block until we have something to send -* turn framerate from ui->state.frameState to 1 fps (or less) unless in transition +* have node info screen show real info (including distance and heading) * very occasionally send our position and user packet (if for nothing else so that other nodes update last_seen) -* switch to my gui layout manager -* make basic gui. different screens: debug, one page for each user in the user db, last received text message * save our node db on entry to sleep * make a screen for bluetooth not yet configured # Medium priority +* make an about to sleep screen +* make a no bluetooth configured yet screen * don't send location packets if we haven't moved * scrub default radio config settings for bandwidth/range/speed * add basic crypto - http://rweather.github.io/arduinolibs/crypto.html with speck https://www.airspayce.com/mikem/arduino/RadioHead/rf95_encrypted_client_8pde-example.html @@ -25,6 +22,7 @@ # Low power consumption tasks +* have radiohead ISR send messages to RX queue directly, to allow that thread to block until we have something to send * use https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/ association sleep pattern to save power - but see https://github.com/espressif/esp-idf/issues/2070 * stop using loop() instead use a job queue and let cpu sleep * move lora rx/tx to own thread and block on IO @@ -103,4 +101,9 @@ until the phone pulls those packets. Ever so often power on bluetooth just so w * add interrupt detach/sleep mode config to lora radio so we can enable deepsleep without panicing * make jtag work on second board * implement regen owner and radio prefs -* use a better font \ No newline at end of file +* use a better font +* make nice screens (boot, about to sleep, debug info (gps signal, #people), latest text, person info - one frame per person on network) +* turn framerate from ui->state.frameState to 1 fps (or less) unless in transition +* switch to my gui layout manager +* make basic gui. different screens: debug, one page for each user in the user db, last received text message +* make button press cycle between screens diff --git a/src/MeshService.cpp b/src/MeshService.cpp index 696d68c5..7fc2a235 100644 --- a/src/MeshService.cpp +++ b/src/MeshService.cpp @@ -74,7 +74,7 @@ void MeshService::loop() DEBUG_MSG("Received broadcast Owner from 0x%x, replying with our owner\n", mp->from); sendOurOwner(mp->from); - String lcd = String("Joined: ") + mp->payload.variant.user.long_name; + String lcd = String("Joined: ") + mp->payload.variant.user.long_name + "\n"; screen_print(lcd.c_str()); } diff --git a/src/main.ino b/src/main.ino index c15f1e33..6c68bf62 100644 --- a/src/main.ino +++ b/src/main.ino @@ -352,7 +352,7 @@ void setup() // Init GPS gps.setup(); - screen_print("Started..."); + screen_print("Started...\n"); service.init(); @@ -401,6 +401,7 @@ void loop() DEBUG_MSG("pressing\n"); wasPressed = true; minPressMs = millis() + 3000; + screen_press(); } } else if (wasPressed) @@ -427,5 +428,8 @@ void loop() // No GPS lock yet, let the OS put the main CPU in low power mode for 100ms (or until another interrupt comes in) // i.e. don't just keep spinning in loop as fast as we can. //DEBUG_MSG("msecs %d\n", msecstosleep); + + // FIXME - until button press handling is done by interrupt (see polling above) we can't sleep very long at all or buttons feel slow + msecstosleep = 10; delay(msecstosleep); } \ No newline at end of file diff --git a/src/screen.cpp b/src/screen.cpp index 462d2ac2..ecc43669 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -359,9 +359,17 @@ uint32_t screen_loop() if (showingBootScreen && ui.getUiState()->currentFrame == 1) { showingBootScreen = false; - ui.setFrames(nonBootFrames, frameCount - 1); + ui.setFrames(nonBootFrames, frameCount - 1); } // If we are scrolling do 30fps, otherwise just 1 fps (to save CPU) return (ui.getUiState()->frameState == IN_TRANSITION ? 10 : 500); } + + +/// handle press of the button +void screen_press() { + // Once the user presses a button, stop auto scrolling between screens + ui.disableAutoTransition(); // we now require presses + ui.nextFrame(); +} \ No newline at end of file diff --git a/src/screen.h b/src/screen.h index 747ffbed..6909ce4c 100644 --- a/src/screen.h +++ b/src/screen.h @@ -5,4 +5,4 @@ void screen_print(const char * text); /// @return how many msecs can we sleep before we want service again uint32_t screen_loop(); -void screen_setup(), screen_on(), screen_off(), screen_show_logo(); \ No newline at end of file +void screen_setup(), screen_on(), screen_off(), screen_press(); \ No newline at end of file