use press to cycle between screens

pull/1/head
geeksville 2020-02-07 17:48:12 -08:00
rodzic e1f06bff6d
commit 0c0d4025f1
5 zmienionych plików z 26 dodań i 11 usunięć

15
TODO.md
Wyświetl plik

@ -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
@ -104,3 +102,8 @@ until the phone pulls those packets. Ever so often power on bluetooth just so w
* make jtag work on second board
* implement regen owner and radio prefs
* 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

Wyświetl plik

@ -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());
}

Wyświetl plik

@ -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);
}

Wyświetl plik

@ -365,3 +365,11 @@ uint32_t screen_loop()
// 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();
}

Wyświetl plik

@ -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();
void screen_setup(), screen_on(), screen_off(), screen_press();