mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
fix(nav): ping result never appeared after Send
startPingForKey() set the "RTT: ..." line but didn't rebuild the ping menu, and updatePingMenuState only rebuilt on a string-count change it computed after the mutation — so the menu stayed at a lone "Send" row and nothing visibly happened after pressing Send, whether or not a reply came. - Rebuild the menu right after starting the ping so "RTT: ..." shows at once; on send failure show "RTT: send fail" instead of a blank. - Sync the menu against its actual row count (_ping_menu._count) as result lines populate, so RTT/SNR rows appear when the reply lands. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -218,8 +218,9 @@ class NearbyScreen : public UIScreen {
|
||||
_pinging = true;
|
||||
_ping_started_ms = millis();
|
||||
} else {
|
||||
_ping_time_str[0] = '\0';
|
||||
snprintf(_ping_time_str, sizeof(_ping_time_str), "RTT: send fail");
|
||||
}
|
||||
if (_ping_menu.active) rebuildPingMenu(); // surface "RTT: ..." immediately
|
||||
}
|
||||
|
||||
void updatePingMenuState() {
|
||||
@@ -228,7 +229,6 @@ class NearbyScreen : public UIScreen {
|
||||
int16_t snr_out = 0, snr_back = 0;
|
||||
uint32_t rtt = 0;
|
||||
_task->getPingResult(snr_out, snr_back, rtt);
|
||||
int before = pingRowCount();
|
||||
|
||||
if (_pinging && (snr_out != 0 || snr_back != 0 || rtt != 0)) {
|
||||
if (rtt > 0 && rtt < 10000) {
|
||||
@@ -250,9 +250,9 @@ class NearbyScreen : public UIScreen {
|
||||
_pinging = false;
|
||||
if (_task) _task->clearPing();
|
||||
}
|
||||
// Grow the menu in place as result lines populate, so they never show as
|
||||
// blank rows beforehand.
|
||||
if (pingRowCount() != before) rebuildPingMenu();
|
||||
// Keep the menu in sync with the populated result lines (grows as the
|
||||
// reply arrives; never shows blank rows).
|
||||
if (pingRowCount() != _ping_menu._count) rebuildPingMenu();
|
||||
}
|
||||
|
||||
bool handlePingMenuInput(char c, const uint8_t* pub_key, bool allow_enter_to_open = false) {
|
||||
|
||||
Reference in New Issue
Block a user