From 77689870ad76ce0668de0060814629ba40a965c9 Mon Sep 17 00:00:00 2001 From: pelgraine <140762863+pelgraine@users.noreply.github.com> Date: Sat, 23 May 2026 07:08:46 +1000 Subject: [PATCH] T5S3 ui fixes, including bigger minesweeper grid square. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contact list display bug fix for all devices: MyMesh.h — added onAdvertRecv override declaration (line 214), alongside the other contact-related overrides. MyMesh.cpp — added the implementation (lines 374-387). It calls BaseChatMesh::onAdvertRecv() first to let all normal processing happen (auto-add, replay guard, path caching, etc.), then unconditionally looks up the contact by pubkey and bumps lastmod to local RTC time. This way, even when the base class's replay guard early-returns (because timestamp <= last_advert_timestamp), the contact still bubbles up in the recency-sorted contacts list since we're actively hearing it. --- examples/companion_radio/MyMesh.cpp | 15 +++++++++ examples/companion_radio/MyMesh.h | 1 + .../ui-new/Channelpickerscreen.h | 6 +++- .../ui-new/MinesweeperScreen.h | 32 ++++++++++--------- .../companion_radio/ui-new/Settingsscreen.h | 4 +-- 5 files changed, 40 insertions(+), 18 deletions(-) diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp index 18cc880c..8634995f 100644 --- a/examples/companion_radio/MyMesh.cpp +++ b/examples/companion_radio/MyMesh.cpp @@ -371,6 +371,21 @@ void MyMesh::onContactsFull() { } } +void MyMesh::onAdvertRecv(mesh::Packet* packet, const mesh::Identity& id, uint32_t timestamp, const uint8_t* app_data, size_t app_data_len) { + // Let the base class handle normal advert processing (auto-add, replay guard, etc.) + BaseChatMesh::onAdvertRecv(packet, id, timestamp, app_data, app_data_len); + + // Unconditionally bump lastmod to local RTC time. + // The base class replay guard early-returns without updating lastmod when + // timestamp <= last_advert_timestamp, causing nodes with stuck or behind + // clocks to sink to the bottom of the recency-sorted contacts list even + // though we are actively hearing their adverts. + ContactInfo* c = lookupContactByPubKey(id.pub_key, PUB_KEY_SIZE); + if (c) { + c->lastmod = getRTCClock()->getCurrentTime(); + } +} + void MyMesh::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) { _forceNextImport = false; // clear force-add flag (set by forceImportContact) if (_serial->isConnected()) { diff --git a/examples/companion_radio/MyMesh.h b/examples/companion_radio/MyMesh.h index 6ab17647..8664a7a3 100644 --- a/examples/companion_radio/MyMesh.h +++ b/examples/companion_radio/MyMesh.h @@ -211,6 +211,7 @@ protected: bool shouldOverwriteWhenFull() const override; void onContactsFull() override; void onContactOverwrite(const uint8_t* pub_key) override; + void onAdvertRecv(mesh::Packet* packet, const mesh::Identity& id, uint32_t timestamp, const uint8_t* app_data, size_t app_data_len) override; bool onContactPathRecv(ContactInfo& from, uint8_t* in_path, uint8_t in_path_len, uint8_t* out_path, uint8_t out_path_len, uint8_t extra_type, uint8_t* extra, uint8_t extra_len) override; void onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) override; void onContactPathUpdated(const ContactInfo &contact) override; diff --git a/examples/companion_radio/ui-new/Channelpickerscreen.h b/examples/companion_radio/ui-new/Channelpickerscreen.h index e7f7c9f8..122daf44 100644 --- a/examples/companion_radio/ui-new/Channelpickerscreen.h +++ b/examples/companion_radio/ui-new/Channelpickerscreen.h @@ -376,7 +376,11 @@ public: // Key hints display.setColor(DisplayDriver::YELLOW); + #if defined(LilyGo_T5S3_EPaper_Pro) + const char* hints = "Tap:Yes Boot:Cancel"; + #else const char* hints = "Enter:Yes Q:Cancel"; + #endif display.setCursor(boxX + 4, boxY + 29); display.print(hints); } @@ -396,7 +400,7 @@ public: display.print(rt); } else { display.print("Tap:Open"); - const char* rt = "Hold:Del Boot:Back"; + const char* rt = "Long Press:Del Hist Boot:Back"; display.setCursor(display.width() - display.getTextWidth(rt) - 2, footerY); display.print(rt); } diff --git a/examples/companion_radio/ui-new/MinesweeperScreen.h b/examples/companion_radio/ui-new/MinesweeperScreen.h index 71396368..56c89cd6 100644 --- a/examples/companion_radio/ui-new/MinesweeperScreen.h +++ b/examples/companion_radio/ui-new/MinesweeperScreen.h @@ -3,12 +3,13 @@ // ============================================================================= // MinesweeperScreen -- Classic Minesweeper for Meck e-ink devices // -// 9x9 grid, 10 mines (classic Beginner difficulty). +// 9x9 grid, 10 mines (classic Beginner difficulty) on T-Deck Pro. +// 14x14 grid, 25 mines on T5S3 (fills the larger virtual display). // First reveal is always safe -- mines are placed after the first click. // Fully turn-based: no tick timer, renders only on input. Perfect for e-ink. // // T-Deck Pro: 14x14 pixel cells (126x126 grid area on 240x320 display) -// T5S3: 8x8 pixel cells (72x72 grid area on 128x128 virtual display) +// T5S3: 14x14 grid at 8x8 pixel cells (112x112 on 128x128 virtual display) // ============================================================================= #include @@ -17,22 +18,23 @@ // Forward declarations class UITask; -// -- Grid parameters -- -#define MINE_GRID_W 9 -#define MINE_GRID_H 9 -#define MINE_COUNT 10 -#define MINE_TOTAL (MINE_GRID_W * MINE_GRID_H) - -// -- Cell sizes per platform -- +// -- Grid and cell parameters per platform -- #if defined(LilyGo_T5S3_EPaper_Pro) - #define MINE_CELL 8 - #define MINE_HDR 14 - #define MINE_FTR 10 + #define MINE_GRID_W 14 + #define MINE_GRID_H 14 + #define MINE_COUNT 25 + #define MINE_CELL 8 + #define MINE_HDR 14 + #define MINE_FTR 10 #else - #define MINE_CELL 14 - #define MINE_HDR 14 - #define MINE_FTR 14 + #define MINE_GRID_W 9 + #define MINE_GRID_H 9 + #define MINE_COUNT 10 + #define MINE_CELL 14 + #define MINE_HDR 14 + #define MINE_FTR 14 #endif +#define MINE_TOTAL (MINE_GRID_W * MINE_GRID_H) #define MINE_VALUE 9 // Content value indicating a mine diff --git a/examples/companion_radio/ui-new/Settingsscreen.h b/examples/companion_radio/ui-new/Settingsscreen.h index 16b08152..89419d98 100644 --- a/examples/companion_radio/ui-new/Settingsscreen.h +++ b/examples/companion_radio/ui-new/Settingsscreen.h @@ -2111,9 +2111,9 @@ public: char hintBuf[40]; #if defined(LilyGo_T5S3_EPaper_Pro) if (chIdx > 0) { - snprintf(hintBuf, sizeof(hintBuf), "Notif:%s Ent:Region Hold:Del", nTag); + snprintf(hintBuf, sizeof(hintBuf), "Hold:Del"); } else { - snprintf(hintBuf, sizeof(hintBuf), "Notif:%s Ent:Region", nTag); + hintBuf[0] = '\0'; // No actionable hints for channel 0 on T5S3 } #elif defined(MECK_AUDIO_VARIANT) || defined(HAS_4G_MODEM) if (chIdx > 0) {