From 8fda42b08d14b0fa2633c678d1883d28714eb914 Mon Sep 17 00:00:00 2001 From: Jason P Date: Sun, 31 Aug 2025 07:54:15 -0500 Subject: [PATCH] Mascots are fun --- src/graphics/Screen.cpp | 10 ++++++++++ src/graphics/Screen.h | 2 ++ src/graphics/draw/DebugRenderer.cpp | 17 ++++++++++++++++ src/graphics/draw/DebugRenderer.h | 3 +++ src/graphics/draw/MenuHandler.cpp | 8 ++++++-- src/graphics/images.h | 30 +++++++++++++++++++++++++++++ 6 files changed, 68 insertions(+), 2 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 76c423133..517944b47 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1018,6 +1018,11 @@ void Screen::setFrames(FrameFocus focus) indicatorIcons.push_back(digital_icon_clock); } #endif + if (!hiddenFrames.chirpy) { + fsi.positions.chirpy = numframes; + normalFrames[numframes++] = graphics::DebugRenderer::drawChirpy; + indicatorIcons.push_back(small_chirpy); + } #if HAS_WIFI && !defined(ARCH_PORTDUINO) if (!hiddenFrames.wifi && isWifiAvailable()) { @@ -1186,6 +1191,9 @@ void Screen::toggleFrameVisibility(const std::string &frameName) if (frameName == "show_favorites") { hiddenFrames.show_favorites = !hiddenFrames.show_favorites; } + if (frameName == "chirpy") { + hiddenFrames.chirpy = !hiddenFrames.chirpy; + } } bool Screen::isFrameHidden(const std::string &frameName) const @@ -1214,6 +1222,8 @@ bool Screen::isFrameHidden(const std::string &frameName) const return hiddenFrames.clock; if (frameName == "show_favorites") return hiddenFrames.show_favorites; + if (frameName == "chirpy") + return hiddenFrames.chirpy; return false; } diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 8c13bcf9a..55ce20052 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -669,6 +669,7 @@ class Screen : public concurrency::OSThread uint8_t nodelist_distance = 255; uint8_t nodelist_bearings = 255; uint8_t clock = 255; + uint8_t chirpy = 255; uint8_t firstFavorite = 255; uint8_t lastFavorite = 255; uint8_t lora = 255; @@ -698,6 +699,7 @@ class Screen : public concurrency::OSThread #endif bool lora = false; bool show_favorites = false; + bool chirpy = true; } hiddenFrames; /// Try to start drawing ASAP diff --git a/src/graphics/draw/DebugRenderer.cpp b/src/graphics/draw/DebugRenderer.cpp index 9e94ae154..b02d2dc71 100644 --- a/src/graphics/draw/DebugRenderer.cpp +++ b/src/graphics/draw/DebugRenderer.cpp @@ -639,6 +639,23 @@ void drawSystemScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x display->drawString(nameX, getTextPositions(display)[line], uptimeStr); } } + +// **************************** +// * Chirpy Screen * +// **************************** +void drawChirpy(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) +{ + display->clear(); + display->setTextAlignment(TEXT_ALIGN_LEFT); + display->setFont(FONT_SMALL); + int line = 1; + int iconX = (SCREEN_WIDTH - (chirpy_width + comment_ballon_width)) / 2; + int iconY = (SCREEN_HEIGHT - chirpy_height) / 2; + display->drawXbm(iconX, iconY, comment_ballon_width, comment_ballon_height, comment_balloon); + display->drawXbm(iconX + comment_ballon_width + 3, iconY, chirpy_width, chirpy_height, chirpy); + display->drawString(iconX + 4, iconY, "Hello"); + display->drawString(iconX + 4, iconY + 10, "World"); +} } // namespace DebugRenderer } // namespace graphics #endif \ No newline at end of file diff --git a/src/graphics/draw/DebugRenderer.h b/src/graphics/draw/DebugRenderer.h index 3382e931d..563a6c1ce 100644 --- a/src/graphics/draw/DebugRenderer.h +++ b/src/graphics/draw/DebugRenderer.h @@ -33,6 +33,9 @@ void drawLoRaFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, // System screen display void drawSystemScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); + +// Chirpy screen display +void drawChirpy(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); } // namespace DebugRenderer } // namespace graphics diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index ff10ca6c7..24e150eb5 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -1004,16 +1004,20 @@ void menuHandler::traceRouteMenu() void menuHandler::testMenu() { - static const char *optionsArray[] = {"Back", "Number Picker"}; + static const char *optionsArray[] = {"Back", "Number Picker", "Show Chirpy"}; BannerOverlayOptions bannerOptions; std::string message = "Test to Run?\n"; bannerOptions.message = message.c_str(); bannerOptions.optionsArrayPtr = optionsArray; - bannerOptions.optionsCount = 2; + bannerOptions.optionsCount = 3; bannerOptions.bannerCallback = [](int selected) -> void { if (selected == 1) { menuQueue = number_test; screen->runNow(); + } else if (selected == 2) { + // Show Chirpy + screen->toggleFrameVisibility("chirpy"); + screen->setFrames(Screen::FOCUS_SYSTEM); } }; screen->showOverlayBanner(bannerOptions); diff --git a/src/graphics/images.h b/src/graphics/images.h index e349cb6e0..7d4874ae3 100644 --- a/src/graphics/images.h +++ b/src/graphics/images.h @@ -288,5 +288,35 @@ const uint8_t digital_icon_clock[] PROGMEM = {0b00111100, 0b01000010, 0b10000101 const uint8_t analog_icon_clock[] PROGMEM = {0b11111111, 0b01000010, 0b00100100, 0b00011000, 0b00100100, 0b01000010, 0b01000010, 0b11111111}; +#define comment_ballon_width 40 +#define comment_ballon_height 24 +static unsigned char comment_balloon[] = { + 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, + 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, + 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, + 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, + 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x20, + 0x01, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x80, 0xfe, 0xff, 0xff, 0xff, 0x7f}; + +#define chirpy_width 38 +#define chirpy_height 50 +static unsigned char chirpy[] = { + 0xfe, 0xff, 0xff, 0xff, 0xdf, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xc0, 0xe1, 0x01, + 0x00, 0x00, 0xe0, 0xe3, 0x01, 0x00, 0x00, 0xe0, 0xe3, 0x01, 0x00, 0x00, 0xe0, 0xe3, 0x01, 0x00, 0x00, 0xc0, 0xe1, 0x01, 0x00, + 0x00, 0x00, 0xe0, 0x81, 0xff, 0xff, 0x7f, 0xe0, 0xc1, 0xff, 0xff, 0xff, 0xe0, 0xc1, 0xff, 0xff, 0xff, 0xe0, 0xc1, 0xcf, 0x7f, + 0xfe, 0xe0, 0xc1, 0x87, 0x3f, 0xfc, 0xe0, 0xc1, 0x87, 0x3f, 0xfc, 0xe0, 0xc1, 0x87, 0x3f, 0xfc, 0xe0, 0xc1, 0x87, 0x3f, 0xfc, + 0xe0, 0xc1, 0x87, 0x3f, 0xfc, 0xe0, 0xc1, 0x87, 0x3f, 0xfc, 0xe0, 0xc1, 0x87, 0x3f, 0xfc, 0xe0, 0xc1, 0x87, 0x3f, 0xfc, 0xe0, + 0xc1, 0x87, 0x3f, 0xfc, 0xe0, 0xc1, 0x87, 0x3f, 0xfc, 0xe0, 0xc1, 0x87, 0x3f, 0xfc, 0xe0, 0xc1, 0x87, 0x3f, 0xfc, 0xe0, 0xc1, + 0x87, 0x3f, 0xfc, 0xe0, 0xc1, 0xcf, 0x7f, 0xfe, 0xe0, 0xc1, 0xff, 0xff, 0xff, 0xe0, 0xc1, 0xff, 0xff, 0xff, 0xe0, 0x81, 0xff, + 0xff, 0x7f, 0xe0, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0xc3, 0x00, 0xe0, 0x01, 0x00, 0xc3, + 0x00, 0xe0, 0x01, 0x80, 0xe1, 0x01, 0xe0, 0x01, 0x80, 0xe1, 0x01, 0xe0, 0x01, 0xc0, 0x30, 0x03, 0xe0, 0x01, 0xc0, 0x30, 0x03, + 0xe0, 0x01, 0x60, 0x18, 0x06, 0xe0, 0x01, 0x60, 0x18, 0x06, 0xe0, 0x01, 0x30, 0x0c, 0x0c, 0xe0, 0x01, 0x30, 0x0c, 0x0c, 0xe0, + 0x01, 0x18, 0x06, 0x18, 0xe0, 0x01, 0x18, 0x06, 0x18, 0xe0, 0x01, 0x0c, 0x03, 0x30, 0xe0, 0x01, 0x0c, 0x03, 0x30, 0xe0, 0x01, + 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0xe0, 0xfe, 0xff, 0xff, 0xff, 0xdf}; + +#define chirpy_small_image_width 8 +#define chirpy_small_image_height 8 +static unsigned char small_chirpy[] = {0x7f, 0x41, 0x55, 0x55, 0x55, 0x55, 0x41, 0x7f}; + #include "img/icon.xbm" static_assert(sizeof(icon_bits) >= 0, "Silence unused variable warning"); \ No newline at end of file