From 6b5e892b38406d73d848c467689f7df2a3fb752b Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Mon, 24 Aug 2026 10:44:28 +0200 Subject: [PATCH] wirelesstracker improvements --- .../heltec_wireless_tracker/board.overlay | 7 +++++ .../heltec_wireless_tracker_v2/board.overlay | 22 +++++++++++-- zephcore/helpers/ui/display.c | 2 +- zephcore/helpers/ui/display.h | 31 +++++++++++++++---- 4 files changed, 53 insertions(+), 9 deletions(-) diff --git a/zephcore/boards/esp32/heltec_wireless_tracker/board.overlay b/zephcore/boards/esp32/heltec_wireless_tracker/board.overlay index 0245f72..ceb97f2 100644 --- a/zephcore/boards/esp32/heltec_wireless_tracker/board.overlay +++ b/zephcore/boards/esp32/heltec_wireless_tracker/board.overlay @@ -40,6 +40,13 @@ * and converts each row to RGB565 for the ST7735R. Direct RGB565 to CFB * causes random noise because CFB doesn't drive colour TFTs correctly. */ zephyr,display = &mono_tft; + + /* Same panel drawn a second way: the colour overlay renderer writes + * raw RGB565 straight to the ST7735R, bypassing the mono wrapper. + * A chosen property rather than a `tft` nodelabel because the panel + * node lives in the upstream Zephyr DTS, which an overlay cannot + * relabel. */ + zephcore,color-tft = &st7735r_160x80; }; /* Monochrome wrapper around the ST7735R 160x80 colour TFT */ diff --git a/zephcore/boards/esp32/heltec_wireless_tracker_v2/board.overlay b/zephcore/boards/esp32/heltec_wireless_tracker_v2/board.overlay index 251487e..bbb74d0 100644 --- a/zephcore/boards/esp32/heltec_wireless_tracker_v2/board.overlay +++ b/zephcore/boards/esp32/heltec_wireless_tracker_v2/board.overlay @@ -18,6 +18,12 @@ /* Mono-TFT wrapper: presents PIXEL_FORMAT_MONO01 to CFB and converts * each row to RGB565 for the ST7735R colour TFT. */ zephyr,display = &mono_tft; + + /* Same panel drawn a second way: the colour overlay renderer writes + * raw RGB565 straight to the ST7735R, bypassing the mono wrapper. + * Identical panel and init sequence to the T096, so the same badges, + * coloured text and activity graph apply here. */ + zephcore,color-tft = &st7735r_160x80; }; mono_tft: mono-tft { @@ -27,7 +33,19 @@ height = <80>; }; - /* Button chain: short tap scrolls pages, double tap goes back, long press enters. */ + /* + * Button chain: long press enters, taps drive the gesture ladder below. + * + * 1 tap (400ms wait) → KEY_1 = page next + * 2 taps (400ms wait) → KEY_LEFT = page previous + * 3 taps (400ms wait) → KEY_B = LED heartbeat toggle + * 4 taps (400ms wait) → KEY_C = GPS on/off + * 5 taps (immediate) → KEY_E = flood advert + * + * This is the T096 variant of the 5-tap ladder — page-prev stays at slot + * 2 because this board has a screen. Screenless boards use KEY_B there + * instead, where page-prev would be a no-op. + */ user_btn_longpress { compatible = "zephyr,input-longpress"; input = <&buttons>; @@ -40,7 +58,7 @@ page_btn_multitap { compatible = "zephcore,input-multi-tap"; input-codes = ; - tap-codes = ; + tap-codes = ; tap-delay-ms = <400>; }; }; diff --git a/zephcore/helpers/ui/display.c b/zephcore/helpers/ui/display.c index 1a675f0..8d0d6d2 100644 --- a/zephcore/helpers/ui/display.c +++ b/zephcore/helpers/ui/display.c @@ -96,7 +96,7 @@ static uint8_t color_op_count; static uint16_t color_line[COLOR_MAX_WIDTH]; static const struct device *color_dev = - DEVICE_DT_GET_OR_NULL(DT_NODELABEL(tft)); + DEVICE_DT_GET_OR_NULL(MC_DISPLAY_COLOR_NODE); #endif /* MC_DISPLAY_COLOR_PANEL */ /* Optional symmetric inset (pixels). Shrinks reported width/height and diff --git a/zephcore/helpers/ui/display.h b/zephcore/helpers/ui/display.h index bed9f81..160a959 100644 --- a/zephcore/helpers/ui/display.h +++ b/zephcore/helpers/ui/display.h @@ -85,12 +85,31 @@ bool mc_display_is_on(void); */ bool mc_display_is_epd(void); -/* Color overlay support is compiled only when the devicetree has a raw - * RGB565 TFT under the `tft` nodelabel (the runtime probe still verifies - * pixel format and readiness). Boards without one get constant-false / - * mono-fallback inlines so every color code path — including the ~3.8 KB - * overlay op queue in display.c — is dropped at compile time. */ -#define MC_DISPLAY_COLOR_PANEL DT_NODE_EXISTS(DT_NODELABEL(tft)) +/* Color overlay support is compiled only when the devicetree points at a raw + * RGB565 TFT (the runtime probe still verifies pixel format and readiness). + * Boards without one get constant-false / mono-fallback inlines so every + * color code path — including the ~3.8 KB overlay op queue in display.c — + * is dropped at compile time. + * + * Two ways to name the panel, in priority order: + * + * 1. chosen { zephcore,color-tft = <&some_panel>; } + * 2. the `tft` nodelabel on the panel node + * + * (1) exists for boards whose panel node lives in an upstream Zephyr DTS: + * an overlay cannot add a nodelabel to an existing node, but it can always + * set a chosen property. (2) is kept because every in-tree board that had + * color before this indirection names its panel `tft:` — they need no edit. + */ +#if DT_HAS_CHOSEN(zephcore_color_tft) +#define MC_DISPLAY_COLOR_NODE DT_CHOSEN(zephcore_color_tft) +#elif DT_NODE_EXISTS(DT_NODELABEL(tft)) +#define MC_DISPLAY_COLOR_NODE DT_NODELABEL(tft) +#else +#define MC_DISPLAY_COLOR_NODE DT_INVALID_NODE +#endif + +#define MC_DISPLAY_COLOR_PANEL DT_NODE_EXISTS(MC_DISPLAY_COLOR_NODE) /** * @return true when a raw RGB565-capable color panel is available for