Nearby Nodes: Add Ping

This commit is contained in:
vanous
2026-05-30 16:32:46 +02:00
parent cb37d23eb0
commit 8c3622b879
7 changed files with 482 additions and 107 deletions
+19
View File
@@ -80,6 +80,14 @@ class UITask : public AbstractUITask {
TrailStore _trail;
uint32_t _next_trail_sample_ms = 0;
// Ping state
bool _ping_active = false;
uint32_t _ping_tag = 0;
unsigned long _ping_sent_ms = 0;
int16_t _ping_snr_out_x4 = 0;
int16_t _ping_snr_back_x4 = 0;
uint32_t _ping_rtt_ms = 0;
void userLedHandler();
// Button action handlers
@@ -149,6 +157,17 @@ public:
bool hasDisplay() const { return _display != NULL; }
DisplayDriver* getDisplay() const { return _display; }
// Ping helpers
bool startPing(const uint8_t* pub_key);
bool isPingActive() const { return _ping_active; }
void getPingResult(int16_t& snr_out_x4, int16_t& snr_back_x4, uint32_t& rtt_ms) const {
snr_out_x4 = _ping_snr_out_x4;
snr_back_x4 = _ping_snr_back_x4;
rtt_ms = _ping_rtt_ms;
}
void clearPing();
void handlePingResult(uint32_t tag, int16_t snr_out_x4, int16_t snr_back_x4, uint32_t rtt_ms);
// Favourites dial helpers. Slot index 0..FAVOURITES_COUNT-1.
int findFavouriteSlot(const uint8_t* pub_key) const {
if (!_node_prefs || !pub_key) return -1;