mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-31 07:01:03 +00:00
use press to cycle between screens
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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();
|
||||
Reference in New Issue
Block a user