From b332b06304787c2048c65a2aeeb9b7d965ebdec0 Mon Sep 17 00:00:00 2001 From: Florent Date: Sat, 16 Aug 2025 18:13:50 +0200 Subject: [PATCH] techo_ui: some tweaks --- examples/companion_radio/ui-new/UITask.cpp | 10 +++++++--- src/helpers/ui/GxEPDDisplay.cpp | 4 ++-- variants/techo/platformio.ini | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 64b788b2..9f34d913 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -14,6 +14,10 @@ #define LONG_PRESS_MILLIS 1200 +#ifndef UI_RECENT_LIST_SIZE + #define UI_RECENT_LIST_SIZE 4 +#endif + #define PRESS_LABEL "long press" #include "icons.h" @@ -79,7 +83,7 @@ class HomeScreen : public UIScreen { NodePrefs* _node_prefs; uint8_t _page; bool _shutdown_init; - AdvertPath recent[4]; + AdvertPath recent[UI_RECENT_LIST_SIZE]; void renderBatteryIndicator(DisplayDriver& display, uint16_t batteryMilliVolts) { // Convert millivolts to percentage @@ -156,10 +160,10 @@ public: display.drawTextCentered(display.width() / 2, 43, tmp); } } else if (_page == HomePage::RECENT) { - the_mesh.getRecentlyHeard(recent, 4); + the_mesh.getRecentlyHeard(recent, UI_RECENT_LIST_SIZE); display.setColor(DisplayDriver::GREEN); int y = 20; - for (int i = 0; i < 4; i++, y += 11) { + for (int i = 0; i < UI_RECENT_LIST_SIZE; i++, y += 11) { auto a = &recent[i]; if (a->name[0] == 0) continue; // empty slot display.setCursor(0, y); diff --git a/src/helpers/ui/GxEPDDisplay.cpp b/src/helpers/ui/GxEPDDisplay.cpp index c3d75bbd..ace25460 100644 --- a/src/helpers/ui/GxEPDDisplay.cpp +++ b/src/helpers/ui/GxEPDDisplay.cpp @@ -29,8 +29,8 @@ void GxEPDDisplay::turnOn() { if (!_init) begin(); #if DISP_BACKLIGHT digitalWrite(DISP_BACKLIGHT, HIGH); - _isOn = true; #endif + _isOn = true; } void GxEPDDisplay::turnOff() { @@ -132,7 +132,7 @@ uint16_t GxEPDDisplay::getTextWidth(const char* str) { int16_t x1, y1; uint16_t w, h; display.getTextBounds(str, 0, 0, &x1, &y1, &w, &h); - return w / SCALE_X; + return ceil((w + 1) / SCALE_X); } void GxEPDDisplay::endFrame() { diff --git a/variants/techo/platformio.ini b/variants/techo/platformio.ini index 2c82f38a..2e6ad3b0 100644 --- a/variants/techo/platformio.ini +++ b/variants/techo/platformio.ini @@ -68,6 +68,7 @@ build_flags = -D BLE_DEBUG_LOGGING=1 -D DISPLAY_CLASS=GxEPDDisplay -D OFFLINE_QUEUE_SIZE=256 + -D UI_RECENT_LIST_SIZE=9 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 build_src_filter = ${LilyGo_Techo.build_src_filter}