diff --git a/examples/companion_radio/MyMesh.h b/examples/companion_radio/MyMesh.h index 067406d5..4b1e73c8 100644 --- a/examples/companion_radio/MyMesh.h +++ b/examples/companion_radio/MyMesh.h @@ -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"); diff --git a/examples/companion_radio/ui-new/NearbyScreen.h b/examples/companion_radio/ui-new/NearbyScreen.h index cdbbb416..bf75a3cb 100644 --- a/examples/companion_radio/ui-new/NearbyScreen.h +++ b/examples/companion_radio/ui-new/NearbyScreen.h @@ -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;