mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 02:06:11 +00:00
fix(NearbyScreen): TIME filter stale sort + right-align distance/age column
- TIME mode: call refresh() every 3 s so newly-heard contacts bubble up to the correct position; previously the list froze at the order captured when the filter was selected. - All filters: right-align the distance/age value within the right column (width - textWidth - 2 px) instead of pinning it to a fixed left edge, so short strings like "5s" or "3m" sit flush with the longer ones. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
2cc68fb987
commit
54ab351b2f
@@ -38,7 +38,9 @@ class NearbyScreen : public UIScreen {
|
|||||||
uint8_t _filter;
|
uint8_t _filter;
|
||||||
|
|
||||||
unsigned long _detail_refresh_ms;
|
unsigned long _detail_refresh_ms;
|
||||||
|
unsigned long _list_refresh_ms = 0;
|
||||||
static const unsigned long DETAIL_REFRESH_MS = 10000UL;
|
static const unsigned long DETAIL_REFRESH_MS = 10000UL;
|
||||||
|
static const unsigned long TIME_LIST_REFRESH_MS = 3000UL;
|
||||||
|
|
||||||
PopupMenu _ctx_menu;
|
PopupMenu _ctx_menu;
|
||||||
PopupMenu _opts; // detail-view Options: Navigate / Ping
|
PopupMenu _opts; // detail-view Options: Navigate / Ping
|
||||||
@@ -605,6 +607,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ── list view ────────────────────────────────────────────────────────────
|
// ── list view ────────────────────────────────────────────────────────────
|
||||||
|
// In TIME mode re-sort periodically so newly-heard contacts bubble up.
|
||||||
|
if (_filter == FILTER_COUNT - 1 &&
|
||||||
|
millis() - _list_refresh_ms >= TIME_LIST_REFRESH_MS) {
|
||||||
|
refresh();
|
||||||
|
_list_refresh_ms = millis();
|
||||||
|
}
|
||||||
|
|
||||||
int item_h = display.lineStep();
|
int item_h = display.lineStep();
|
||||||
int start_y = display.listStart();
|
int start_y = display.listStart();
|
||||||
int dist_col = display.width() - display.getCharWidth() * 7;
|
int dist_col = display.width() - display.getCharWidth() * 7;
|
||||||
@@ -644,7 +653,8 @@ public:
|
|||||||
if (e.dist_km >= 0.0f) geo::fmtDist(right, sizeof(right), e.dist_km, useImperial());
|
if (e.dist_km >= 0.0f) geo::fmtDist(right, sizeof(right), e.dist_km, useImperial());
|
||||||
else strncpy(right, "?GPS", sizeof(right));
|
else strncpy(right, "?GPS", sizeof(right));
|
||||||
}
|
}
|
||||||
display.setCursor(dist_col, y);
|
// Right-align within the right column (2 px margin from edge).
|
||||||
|
display.setCursor(display.width() - display.getTextWidth(right) - 2, y);
|
||||||
display.print(right);
|
display.print(right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user