mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-27 23:38:12 +00:00
fix: ping RTT 0ms, degree symbol, clock page dots overlap
- Ping: add _ping_ack_seen flag; RTT is measured only after ACK entry
was first confirmed present in the table, preventing false 0ms when
isAckPending() returns false before the entry is registered
- NearbyScreen: replace unsupported degree symbol \xb0 with 'd'
in bearing format ("Dist:1.5km 45d")
- Clock page: hide page indicator dots (already hides node name/battery);
eliminates overlap with size-2 clock text drawn at y=0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,7 @@ class NearbyScreen : public UIScreen {
|
||||
uint32_t _ping_expected_ack;
|
||||
unsigned long _ping_start_ms;
|
||||
unsigned long _ping_rtt_ms;
|
||||
bool _ping_ack_seen; // true once ACK entry confirmed in table
|
||||
static const unsigned long PING_TIMEOUT_MS = 30000UL;
|
||||
|
||||
static float haversineKm(int32_t lat1, int32_t lon1, int32_t lat2, int32_t lon2) {
|
||||
@@ -152,7 +153,8 @@ public:
|
||||
_filter = 0;
|
||||
_scanning = false;
|
||||
_ctx_menu.active = false;
|
||||
_ping_state = PING_IDLE;
|
||||
_ping_state = PING_IDLE;
|
||||
_ping_ack_seen = false;
|
||||
refresh();
|
||||
}
|
||||
|
||||
@@ -167,9 +169,12 @@ public:
|
||||
|
||||
// poll ping ack
|
||||
if (_ping_state == PING_WAIT) {
|
||||
if (!the_mesh.isAckPending(_ping_expected_ack)) {
|
||||
bool pending = the_mesh.isAckPending(_ping_expected_ack);
|
||||
if (pending) {
|
||||
_ping_ack_seen = true;
|
||||
} else if (_ping_ack_seen) {
|
||||
_ping_rtt_ms = millis() - _ping_start_ms;
|
||||
_ping_state = PING_OK;
|
||||
_ping_state = PING_OK;
|
||||
} else if (millis() - _ping_start_ms >= PING_TIMEOUT_MS) {
|
||||
_ping_state = PING_TIMEOUT;
|
||||
}
|
||||
@@ -197,7 +202,7 @@ public:
|
||||
if (e.dist_km >= 0.0f) {
|
||||
char dist[12];
|
||||
fmtDist(dist, sizeof(dist), e.dist_km);
|
||||
snprintf(buf, sizeof(buf), "Dist:%s %d\xb0", dist, bearingDeg(_own_lat, _own_lon, e.lat_e6, e.lon_e6));
|
||||
snprintf(buf, sizeof(buf), "Dist:%s %dd", dist, bearingDeg(_own_lat, _own_lon, e.lat_e6, e.lon_e6));
|
||||
display.setCursor(2, 31); display.print(buf);
|
||||
} else {
|
||||
display.setCursor(2, 31); display.print("Dist: no own GPS");
|
||||
@@ -290,8 +295,9 @@ public:
|
||||
int res = the_mesh.sendMessage(ci, rtc_clock.getCurrentTime(), 0, "", expected_ack, est_timeout);
|
||||
if (res != MSG_SEND_FAILED && expected_ack != 0) {
|
||||
_ping_expected_ack = expected_ack;
|
||||
_ping_start_ms = millis();
|
||||
_ping_state = PING_WAIT;
|
||||
_ping_start_ms = millis();
|
||||
_ping_ack_seen = false;
|
||||
_ping_state = PING_WAIT;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1803,8 +1803,8 @@ public:
|
||||
// ensure current page is visible (e.g. after settings change)
|
||||
if (!isPageVisible(_page)) _page = navPage(_page, +1);
|
||||
|
||||
// curr page indicator — only visible pages get a dot
|
||||
{
|
||||
// curr page indicator — hidden on CLOCK page (full screen used for dashboard)
|
||||
if (_page != CLOCK) {
|
||||
int vis_count = 0, curr_vis = 0;
|
||||
for (int i = 0; i < (int)Count; i++) {
|
||||
if (!isPageVisible(i)) continue;
|
||||
|
||||
Reference in New Issue
Block a user