kopia lustrzana https://github.com/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
|
* 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 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
|
* save our node db on entry to sleep
|
||||||
|
* make a screen for bluetooth not yet configured
|
||||||
|
|
||||||
# Medium priority
|
# Medium priority
|
||||||
|
|
||||||
|
|
|
@ -35,16 +35,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define SCREEN_HEIGHT 64
|
#define SCREEN_HEIGHT 64
|
||||||
|
|
||||||
#ifdef I2C_SDA
|
#ifdef I2C_SDA
|
||||||
SSD1306Wire dispdev(SSD1306_ADDRESS, I2C_SDA, I2C_SCL);
|
SSD1306Wire dispdev(SSD1306_ADDRESS, I2C_SDA, I2C_SCL);
|
||||||
#else
|
#else
|
||||||
SSD1306Wire dispdev(SSD1306_ADDRESS, 0, 0); // fake values to keep build happy, we won't ever init
|
SSD1306Wire dispdev(SSD1306_ADDRESS, 0, 0); // fake values to keep build happy, we won't ever init
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool disp; // true if we are using display
|
bool disp; // true if we are using display
|
||||||
|
|
||||||
OLEDDisplayUi ui(&dispdev);
|
OLEDDisplayUi ui(&dispdev);
|
||||||
|
|
||||||
|
|
||||||
void msOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
void msOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
||||||
{
|
{
|
||||||
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
||||||
|
@ -58,7 +57,7 @@ void drawBootScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x,
|
||||||
// Please note that everything that should be transitioned
|
// Please note that everything that should be transitioned
|
||||||
// needs to be drawn relative to x and y
|
// needs to be drawn relative to x and y
|
||||||
|
|
||||||
display->drawXbm(x + 32, y, icon_width, icon_height,(const uint8_t *) icon_bits);
|
display->drawXbm(x + 32, y, icon_width, icon_height, (const uint8_t *)icon_bits);
|
||||||
|
|
||||||
display->setFont(ArialMT_Plain_10);
|
display->setFont(ArialMT_Plain_10);
|
||||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
|
@ -101,14 +100,19 @@ void drawFrame3(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int1
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw the last text message we received
|
/// 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:
|
// Demo for drawStringMaxWidth:
|
||||||
// with the third parameter you can define the width after which words will be wrapped.
|
// with the third parameter you can define the width after which words will be wrapped.
|
||||||
// Currently only spaces and "-" are allowed for wrapping
|
// Currently only spaces and "-" are allowed for wrapping
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
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->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)
|
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
|
// This array keeps function pointers to all frames
|
||||||
// frames are the single views that slide in
|
// 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
|
// Overlays are statically drawn on top of a frame eg. a clock
|
||||||
OverlayCallback overlays[] = {msOverlay};
|
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()
|
void _screen_header()
|
||||||
{
|
{
|
||||||
if (!disp)
|
if (!disp)
|
||||||
|
@ -247,7 +255,7 @@ void screen_setup()
|
||||||
dispdev.setLogBuffer(5, 30);
|
dispdev.setLogBuffer(5, 30);
|
||||||
|
|
||||||
// dispdev.flipScreenVertically(); // looks better without this on lora32
|
// dispdev.flipScreenVertically(); // looks better without this on lora32
|
||||||
dispdev.setFont(Custom_ArialMT_Plain_10);
|
// dispdev.setFont(Custom_ArialMT_Plain_10);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,5 +293,13 @@ void screen_loop()
|
||||||
display->drawLogBuffer(0, SCREEN_HEADER_HEIGHT);
|
display->drawLogBuffer(0, SCREEN_HEADER_HEIGHT);
|
||||||
display->display();
|
display->display();
|
||||||
#endif
|
#endif
|
||||||
|
static bool showingBootScreen = true;
|
||||||
|
|
||||||
ui.update();
|
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