From 0081e7af2b7c69a219afbd4cd95a9a27db1443c3 Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Thu, 21 May 2026 13:29:57 +0200 Subject: [PATCH] joystick UI: share the button-UI splash wordmark MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the 128×13 zephcore_logo bitmap from ui-button/ui_pages.c into the shared ui_common.c (linkage extern), with the dimensions and declaration in display.h. Both UI splash renders now share the same data — no duplicated array. Joystick SplashScreen::render() now draws the wordmark at the top, "MeshCore on Zephyr" beneath it, and the build date below — matching the button-UI layout. Replaces the earlier text-only "MeshCore / / " placeholder. --- zephcore/helpers/ui-button/ui_pages.c | 31 ++---------------- zephcore/helpers/ui-joystick/screens/home.cpp | 20 +++++++++--- zephcore/helpers/ui/display.h | 8 +++++ zephcore/helpers/ui/ui_common.c | 32 +++++++++++++++++++ 4 files changed, 58 insertions(+), 33 deletions(-) diff --git a/zephcore/helpers/ui-button/ui_pages.c b/zephcore/helpers/ui-button/ui_pages.c index 97a1bfd..97406e9 100644 --- a/zephcore/helpers/ui-button/ui_pages.c +++ b/zephcore/helpers/ui-button/ui_pages.c @@ -28,35 +28,8 @@ #include LOG_MODULE_REGISTER(ui_pages, CONFIG_ZEPHCORE_BOARD_LOG_LEVEL); -/* ZephCore logo bitmap - 128x13px, MSB-first (Adafruit drawBitmap format) */ -static const uint8_t zephcore_logo[] = { - 0x00, 0x01, 0xff, 0x7f, 0xe7, 0xf8, 0x70, 0x70, - 0x3c, 0x01, 0xe0, 0x7f, 0xc3, 0xff, 0x00, 0x00, - 0x00, 0x01, 0xff, 0x7f, 0xe7, 0xfc, 0x70, 0x70, - 0xff, 0x07, 0xf8, 0x7f, 0xe3, 0xff, 0x00, 0x00, - 0x00, 0x01, 0xff, 0x7f, 0xe7, 0xfe, 0x70, 0x71, - 0xff, 0x0f, 0xfc, 0x7f, 0xf3, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x0e, 0x70, 0x07, 0x0e, 0x70, 0x71, - 0xc7, 0x8e, 0x1c, 0x70, 0x73, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0x70, 0x07, 0x0e, 0x70, 0x73, - 0x83, 0x1c, 0x0e, 0x70, 0x73, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x7f, 0xe7, 0xfe, 0x7f, 0xf3, - 0x80, 0x1c, 0x0e, 0x7f, 0xf3, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x78, 0x7f, 0xe7, 0xfc, 0x7f, 0xf3, - 0x80, 0x1c, 0x0e, 0x7f, 0xe3, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x70, 0x7f, 0xe7, 0xf8, 0x7f, 0xf3, - 0x80, 0x1c, 0x0e, 0x7f, 0x83, 0xff, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0x70, 0x07, 0x00, 0x70, 0x73, - 0x83, 0x1c, 0x0e, 0x73, 0xc3, 0x80, 0x00, 0x00, - 0x00, 0x01, 0xc0, 0x70, 0x07, 0x00, 0x70, 0x71, - 0xc7, 0x8e, 0x1c, 0x71, 0xe3, 0x80, 0x00, 0x00, - 0x00, 0x03, 0xff, 0x7f, 0xe7, 0x00, 0x70, 0x71, - 0xff, 0x0f, 0xfc, 0x70, 0xe3, 0xff, 0x00, 0x00, - 0x00, 0x03, 0xff, 0x7f, 0xe7, 0x00, 0x70, 0x70, - 0xff, 0x07, 0xf8, 0x70, 0xf3, 0xff, 0x00, 0x00, - 0x00, 0x03, 0xff, 0x7f, 0xe7, 0x00, 0x70, 0x70, - 0x3c, 0x01, 0xe0, 0x70, 0x7b, 0xff, 0x00, 0x00, -}; +/* ZephCore logo bitmap is defined in helpers/ui/ui_common.c and shared with + * the joystick UI's splash. See display.h for declaration. */ /* ========== Layout ========== */ /* All layout is derived from the actual display and font dimensions diff --git a/zephcore/helpers/ui-joystick/screens/home.cpp b/zephcore/helpers/ui-joystick/screens/home.cpp index ee02c3b..3905565 100644 --- a/zephcore/helpers/ui-joystick/screens/home.cpp +++ b/zephcore/helpers/ui-joystick/screens/home.cpp @@ -243,11 +243,23 @@ int SplashScreen::render(JoystickDisplay &display) _task->gotoHomeScreen(); return 0; } - int cx = display.width() / 2; + + /* Match the button-UI splash: ZephCore wordmark bitmap centered at top, + * "MeshCore on Zephyr" beneath it, build date at the bottom. Logo and + * its dimensions live in helpers/ui/ui_common.c — declared in display.h. */ + int w = display.width(); + int fh = display.fontH(); + int line_h = fh + 2; + int logo_x = (w >= ZEPHCORE_LOGO_W) ? (w - ZEPHCORE_LOGO_W) / 2 : 0; + int y = 3; + mc_display_xbm(logo_x, y, zephcore_logo, ZEPHCORE_LOGO_W, ZEPHCORE_LOGO_H); + y += ZEPHCORE_LOGO_H + line_h; + + int cx = w / 2; display.setColor(JoystickDisplay::GREEN); - display.drawTextCentered(cx, display.height() / 4, "MeshCore"); + display.drawTextCentered(cx, y + fh / 2, "MeshCore on Zephyr"); + y += line_h * 2; display.setColor(JoystickDisplay::LIGHT); - display.drawTextCentered(cx, display.height() / 2 + 4, FIRMWARE_VERSION); - display.drawTextCentered(cx, display.height() / 2 + 4 + display.fontH() + 2, FIRMWARE_BUILD_DATE); + display.drawTextCentered(cx, y + fh / 2, FIRMWARE_BUILD_DATE); return 250; } diff --git a/zephcore/helpers/ui/display.h b/zephcore/helpers/ui/display.h index 100db11..b0506f7 100644 --- a/zephcore/helpers/ui/display.h +++ b/zephcore/helpers/ui/display.h @@ -134,6 +134,14 @@ void mc_display_invert_rect(int x, int y, int w, int h); */ void mc_display_xbm(int x, int y, const uint8_t *data, int w, int h); +/** + * ZephCore logo bitmap (128 × 13 px, MSB-first, row-major). + * Shared by both UI variants' splash screens. Defined in ui_common.c. + */ +#define ZEPHCORE_LOGO_W 128 +#define ZEPHCORE_LOGO_H 13 +extern const uint8_t zephcore_logo[]; + /** * Flush the framebuffer to the display hardware. * Call after all drawing operations for a frame are complete. diff --git a/zephcore/helpers/ui/ui_common.c b/zephcore/helpers/ui/ui_common.c index 6872933..828b8c4 100644 --- a/zephcore/helpers/ui/ui_common.c +++ b/zephcore/helpers/ui/ui_common.c @@ -233,3 +233,35 @@ void ui_invalidate_battery_cache(void) s_batt_ever_read = false; s_batt_last_read_ms = 0; } + +/* ========== Shared splash logo ========== + * 128×13 ZephCore wordmark, MSB-first row-major (Adafruit XBM/drawBitmap + * format). Used by both UI variants' splash renders via mc_display_xbm(). */ +const uint8_t zephcore_logo[] = { + 0x00, 0x01, 0xff, 0x7f, 0xe7, 0xf8, 0x70, 0x70, + 0x3c, 0x01, 0xe0, 0x7f, 0xc3, 0xff, 0x00, 0x00, + 0x00, 0x01, 0xff, 0x7f, 0xe7, 0xfc, 0x70, 0x70, + 0xff, 0x07, 0xf8, 0x7f, 0xe3, 0xff, 0x00, 0x00, + 0x00, 0x01, 0xff, 0x7f, 0xe7, 0xfe, 0x70, 0x71, + 0xff, 0x0f, 0xfc, 0x7f, 0xf3, 0xff, 0x00, 0x00, + 0x00, 0x00, 0x0e, 0x70, 0x07, 0x0e, 0x70, 0x71, + 0xc7, 0x8e, 0x1c, 0x70, 0x73, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x1c, 0x70, 0x07, 0x0e, 0x70, 0x73, + 0x83, 0x1c, 0x0e, 0x70, 0x73, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x7f, 0xe7, 0xfe, 0x7f, 0xf3, + 0x80, 0x1c, 0x0e, 0x7f, 0xf3, 0xff, 0x00, 0x00, + 0x00, 0x00, 0x78, 0x7f, 0xe7, 0xfc, 0x7f, 0xf3, + 0x80, 0x1c, 0x0e, 0x7f, 0xe3, 0xff, 0x00, 0x00, + 0x00, 0x00, 0x70, 0x7f, 0xe7, 0xf8, 0x7f, 0xf3, + 0x80, 0x1c, 0x0e, 0x7f, 0x83, 0xff, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0x70, 0x07, 0x00, 0x70, 0x73, + 0x83, 0x1c, 0x0e, 0x73, 0xc3, 0x80, 0x00, 0x00, + 0x00, 0x01, 0xc0, 0x70, 0x07, 0x00, 0x70, 0x71, + 0xc7, 0x8e, 0x1c, 0x71, 0xe3, 0x80, 0x00, 0x00, + 0x00, 0x03, 0xff, 0x7f, 0xe7, 0x00, 0x70, 0x71, + 0xff, 0x0f, 0xfc, 0x70, 0xe3, 0xff, 0x00, 0x00, + 0x00, 0x03, 0xff, 0x7f, 0xe7, 0x00, 0x70, 0x70, + 0xff, 0x07, 0xf8, 0x70, 0xf3, 0xff, 0x00, 0x00, + 0x00, 0x03, 0xff, 0x7f, 0xe7, 0x00, 0x70, 0x70, + 0x3c, 0x01, 0xe0, 0x70, 0x7b, 0xff, 0x00, 0x00, +};