mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-15 09:32:08 +00:00
Show welcome screen if region unset
This commit is contained in:
parent
69ed477040
commit
16ae867c2d
@ -42,7 +42,7 @@ build_flags = -Wno-missing-field-initializers
|
|||||||
monitor_speed = 921600
|
monitor_speed = 921600
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/meshtastic/esp8266-oled-ssd1306.git ; ESP8266_SSD1306
|
https://github.com/meshtastic/esp8266-oled-ssd1306.git#53580644255b48ebb7a737343c6b4e71c7e11cf2 ; ESP8266_SSD1306
|
||||||
mathertel/OneButton@^2.0.3 ; OneButton library for non-blocking button debounce
|
mathertel/OneButton@^2.0.3 ; OneButton library for non-blocking button debounce
|
||||||
1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib
|
1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib
|
||||||
https://github.com/meshtastic/arduino-fsm.git
|
https://github.com/meshtastic/arduino-fsm.git
|
||||||
|
@ -168,6 +168,28 @@ static void drawSSLScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used when booting without a region set
|
||||||
|
static void drawWelcomeScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
|
{
|
||||||
|
|
||||||
|
display->setFont(FONT_SMALL);
|
||||||
|
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
|
display->drawString(64 + x, y, "Welcome to Meshtastic!");
|
||||||
|
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
|
|
||||||
|
display->drawString(x, y + FONT_HEIGHT_SMALL * 2 - 3, "Set the region using the");
|
||||||
|
display->drawString(x, y + FONT_HEIGHT_SMALL * 3 - 3, "Android, iOS, Flasher or");
|
||||||
|
display->drawString(x, y + FONT_HEIGHT_SMALL * 4 - 3, "CLI.");
|
||||||
|
|
||||||
|
#ifndef NO_ESP32
|
||||||
|
yield();
|
||||||
|
esp_task_wdt_reset();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAS_EINK
|
#ifdef HAS_EINK
|
||||||
/// Used on eink displays while in deep sleep
|
/// Used on eink displays while in deep sleep
|
||||||
static void drawSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
static void drawSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
@ -766,7 +788,7 @@ void Screen::setup()
|
|||||||
useDisplay = true;
|
useDisplay = true;
|
||||||
|
|
||||||
#ifdef AutoOLEDWire_h
|
#ifdef AutoOLEDWire_h
|
||||||
dispdev.setDetected(screen_model);
|
dispdev.setDetected(screen_model);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// I think this is not needed - redundant with ui.init
|
// I think this is not needed - redundant with ui.init
|
||||||
@ -862,6 +884,10 @@ int32_t Screen::runOnce()
|
|||||||
showingBootScreen = false;
|
showingBootScreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (radioConfig.preferences.region == RegionCode_Unset) {
|
||||||
|
setWelcomeFrames();
|
||||||
|
}
|
||||||
|
|
||||||
// Process incoming commands.
|
// Process incoming commands.
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ScreenCmd cmd;
|
ScreenCmd cmd;
|
||||||
@ -975,6 +1001,18 @@ void Screen::setSSLFrames()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* show a message that the SSL cert is being built
|
||||||
|
* it is expected that this will be used during the boot phase */
|
||||||
|
void Screen::setWelcomeFrames()
|
||||||
|
{
|
||||||
|
if (address_found) {
|
||||||
|
// DEBUG_MSG("showing Welcome frames\n");
|
||||||
|
static FrameCallback welcomeFrames[] = {drawWelcomeScreen};
|
||||||
|
ui.setFrames(welcomeFrames, 1);
|
||||||
|
ui.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// restore our regular frame list
|
// restore our regular frame list
|
||||||
void Screen::setFrames()
|
void Screen::setFrames()
|
||||||
{
|
{
|
||||||
@ -1432,8 +1470,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|||||||
// Display Channel Utilization
|
// Display Channel Utilization
|
||||||
char chUtil[13];
|
char chUtil[13];
|
||||||
sprintf(chUtil, "ChUtil %2.0f%%", airTime->channelUtilizationPercent());
|
sprintf(chUtil, "ChUtil %2.0f%%", airTime->channelUtilizationPercent());
|
||||||
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil),
|
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil), y + FONT_HEIGHT_SMALL * 1, chUtil);
|
||||||
y + FONT_HEIGHT_SMALL * 1, chUtil);
|
|
||||||
|
|
||||||
// Line 3
|
// Line 3
|
||||||
if (radioConfig.preferences.gps_format != GpsCoordinateFormat_GpsFormatDMS) // if DMS then don't draw altitude
|
if (radioConfig.preferences.gps_format != GpsCoordinateFormat_GpsFormatDMS) // if DMS then don't draw altitude
|
||||||
@ -1491,16 +1528,13 @@ int Screen::handleTextMessage(const MeshPacket *packet)
|
|||||||
int Screen::handleUIFrameEvent(const UIFrameEvent *event)
|
int Screen::handleUIFrameEvent(const UIFrameEvent *event)
|
||||||
{
|
{
|
||||||
if (showingNormalScreen) {
|
if (showingNormalScreen) {
|
||||||
if (event->frameChanged)
|
if (event->frameChanged) {
|
||||||
{
|
|
||||||
setFrames(); // Regen the list of screens (will show new text message)
|
setFrames(); // Regen the list of screens (will show new text message)
|
||||||
}
|
} else if (event->needRedraw) {
|
||||||
else if (event->needRedraw)
|
|
||||||
{
|
|
||||||
setFastFramerate();
|
setFastFramerate();
|
||||||
// TODO: We might also want switch to corresponding frame,
|
// TODO: We might also want switch to corresponding frame,
|
||||||
// but we don't know the exact frame number.
|
// but we don't know the exact frame number.
|
||||||
//ui.switchToFrame(0);
|
// ui.switchToFrame(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,6 +235,8 @@ class Screen : public concurrency::OSThread
|
|||||||
/// Draws our SSL cert screen during boot (called from WebServer)
|
/// Draws our SSL cert screen during boot (called from WebServer)
|
||||||
void setSSLFrames();
|
void setSSLFrames();
|
||||||
|
|
||||||
|
void setWelcomeFrames();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Updates the UI.
|
/// Updates the UI.
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user