Merge pull request #1368 from mc-hamster/region_unset

Show welcome screen if region unset
pull/1370/head^2
Jm Casler 2022-04-10 19:55:05 -07:00 zatwierdzone przez GitHub
commit 9bd970c55e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 50 dodań i 12 usunięć

Wyświetl plik

@ -42,7 +42,7 @@ build_flags = -Wno-missing-field-initializers
monitor_speed = 921600
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
1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib
https://github.com/meshtastic/arduino-fsm.git

Wyświetl plik

@ -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, "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, "Meshtastic Android, iOS,");
display->drawString(x, y + FONT_HEIGHT_SMALL * 4 - 3, "Flasher or CLI client.");
#ifndef NO_ESP32
yield();
esp_task_wdt_reset();
#endif
}
#ifdef HAS_EINK
/// Used on eink displays while in deep sleep
static void drawSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
@ -766,7 +788,7 @@ void Screen::setup()
useDisplay = true;
#ifdef AutoOLEDWire_h
dispdev.setDetected(screen_model);
dispdev.setDetected(screen_model);
#endif
// I think this is not needed - redundant with ui.init
@ -862,6 +884,10 @@ int32_t Screen::runOnce()
showingBootScreen = false;
}
if (radioConfig.preferences.region == RegionCode_Unset) {
setWelcomeFrames();
}
// Process incoming commands.
for (;;) {
ScreenCmd cmd;
@ -975,6 +1001,20 @@ 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");
ui.disableAllIndicators();
static FrameCallback welcomeFrames[] = {drawWelcomeScreen};
ui.setFrames(welcomeFrames, 1);
ui.update();
}
}
// restore our regular frame list
void Screen::setFrames()
{
@ -1366,7 +1406,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
}
auto mode = "";
if (channels.getPrimary().modem_config == 0) {
mode = "VLongSlow";
} else if (channels.getPrimary().modem_config == 1) {
@ -1380,7 +1420,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
} else if (channels.getPrimary().modem_config == 5) {
mode = "ShortSlow";
} else if (channels.getPrimary().modem_config == 6) {
mode = "ShortFast";
mode = "ShortFast";
} else {
mode = "Custom";
}
@ -1432,8 +1472,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
// Display Channel Utilization
char chUtil[13];
sprintf(chUtil, "ChUtil %2.0f%%", airTime->channelUtilizationPercent());
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil),
y + FONT_HEIGHT_SMALL * 1, chUtil);
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil), y + FONT_HEIGHT_SMALL * 1, chUtil);
// Line 3
if (radioConfig.preferences.gps_format != GpsCoordinateFormat_GpsFormatDMS) // if DMS then don't draw altitude
@ -1491,16 +1530,13 @@ int Screen::handleTextMessage(const MeshPacket *packet)
int Screen::handleUIFrameEvent(const UIFrameEvent *event)
{
if (showingNormalScreen) {
if (event->frameChanged)
{
if (event->frameChanged) {
setFrames(); // Regen the list of screens (will show new text message)
}
else if (event->needRedraw)
{
} else if (event->needRedraw) {
setFastFramerate();
// TODO: We might also want switch to corresponding frame,
// but we don't know the exact frame number.
//ui.switchToFrame(0);
// ui.switchToFrame(0);
}
}

Wyświetl plik

@ -235,6 +235,8 @@ class Screen : public concurrency::OSThread
/// Draws our SSL cert screen during boot (called from WebServer)
void setSSLFrames();
void setWelcomeFrames();
protected:
/// Updates the UI.
//