mirror of
https://github.com/pelgraine/Meck.git
synced 2026-08-09 02:02:44 +02:00
T5S3 ui fixes, including bigger minesweeper grid square.
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.
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 <helpers/ui/UIScreen.h>
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user