fix: wire NearbyScreen ping through expected_ack_table so RTT is measurable

Direct sendMessage() calls bypass the BT serial handler that populates
expected_ack_table; add registerExpectedAck() to MyMesh and call it from
NearbyScreen so isAckPending() can actually track the outstanding ping.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-14 15:57:00 +02:00
parent 11cb0ae25e
commit d59687647f
2 changed files with 9 additions and 0 deletions

View File

@@ -176,6 +176,14 @@ public:
return false;
}
void registerExpectedAck(uint32_t expected_ack) {
if (!expected_ack) return;
expected_ack_table[next_ack_idx].msg_sent = millis();
expected_ack_table[next_ack_idx].ack = expected_ack;
expected_ack_table[next_ack_idx].contact = nullptr;
next_ack_idx = (next_ack_idx + 1) % EXPECTED_ACK_TABLE_SIZE;
}
#if ENV_INCLUDE_GPS == 1
void applyGpsPrefs() {
sensors.setSettingValue("gps", _prefs.gps_enabled ? "1" : "0");

View File

@@ -298,6 +298,7 @@ public:
uint32_t expected_ack, est_timeout;
int res = the_mesh.sendMessage(ci, rtc_clock.getCurrentTime(), 0, "", expected_ack, est_timeout);
if (res != MSG_SEND_FAILED && expected_ack != 0) {
the_mesh.registerExpectedAck(expected_ack);
_ping_expected_ack = expected_ack;
_ping_start_ms = millis();
_ping_ack_seen = false;