sforkowany z mirror/meshtastic-firmware
only show bootscreen once
rodzic
0a369da4a2
commit
6f592fbb6b
1
TODO.md
1
TODO.md
|
@ -8,6 +8,7 @@
|
|||
* 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
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ bool disp; // true if we are using display
|
|||
|
||||
OLEDDisplayUi ui(&dispdev);
|
||||
|
||||
|
||||
void msOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
||||
{
|
||||
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
||||
|
@ -101,14 +100,19 @@ void drawFrame3(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int1
|
|||
}
|
||||
|
||||
/// Draw the last text message we received
|
||||
void drawLastTextFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
// Demo for drawStringMaxWidth:
|
||||
// with the third parameter you can define the width after which words will be wrapped.
|
||||
// Currently only spaces and "-" are allowed for wrapping
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->setFont(ArialMT_Plain_16);
|
||||
String sender = "KH:";
|
||||
display->drawString(0 + x, 0 + y, sender);
|
||||
display->setFont(ArialMT_Plain_10);
|
||||
display->drawStringMaxWidth(0 + x, 10 + y, 128, "Lorem ipsum\n dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore.");
|
||||
display->drawStringMaxWidth(4 + x, 10 + y, 128, " Lorem ipsum\n dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore.");
|
||||
|
||||
ui.disableIndicator();
|
||||
}
|
||||
|
||||
void drawFrame5(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
|
@ -117,15 +121,19 @@ void drawFrame5(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int1
|
|||
|
||||
// This array keeps function pointers to all frames
|
||||
// frames are the single views that slide in
|
||||
FrameCallback frames[] = {drawBootScreen, drawFrame2, drawFrame3, drawLastTextFrame, drawFrame5};
|
||||
FrameCallback frames[] = {drawBootScreen, drawTextMessageFrame};
|
||||
FrameCallback *nonBootFrames = frames + 1;
|
||||
|
||||
// how many frames are there?
|
||||
int frameCount = 5;
|
||||
int overlaysCount = 1;
|
||||
|
||||
// Overlays are statically drawn on top of a frame eg. a clock
|
||||
OverlayCallback overlays[] = {msOverlay};
|
||||
|
||||
// how many frames are there?
|
||||
const int frameCount = sizeof(frames) / sizeof(frames[0]);
|
||||
const int overlaysCount = sizeof(overlays) / sizeof(overlays[0]);
|
||||
|
||||
|
||||
|
||||
void _screen_header()
|
||||
{
|
||||
if (!disp)
|
||||
|
@ -247,7 +255,7 @@ void screen_setup()
|
|||
dispdev.setLogBuffer(5, 30);
|
||||
|
||||
// dispdev.flipScreenVertically(); // looks better without this on lora32
|
||||
dispdev.setFont(Custom_ArialMT_Plain_10);
|
||||
// dispdev.setFont(Custom_ArialMT_Plain_10);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -285,5 +293,13 @@ void screen_loop()
|
|||
display->drawLogBuffer(0, SCREEN_HEADER_HEIGHT);
|
||||
display->display();
|
||||
#endif
|
||||
static bool showingBootScreen = true;
|
||||
|
||||
ui.update();
|
||||
|
||||
// Once we finish showing the bootscreen, remove it from the loop
|
||||
if (showingBootScreen && ui.getUiState()->currentFrame == 1)
|
||||
{
|
||||
ui.setFrames(nonBootFrames, frameCount - 1);
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue