Ignore seen phoneapi packets (#4888)

* Ignore PhoneAPI packet if it's been seen

* ignoramus

* Also keep track of the last 20 packet IDs

* Fill

* Make this match the nimble one

* Add the log too

* Ignore zero ID packets

* Remove message entirely

* TRunkt
This commit is contained in:
Ben Meadors
2024-09-27 20:09:53 -05:00
committed by GitHub
parent 0e0811eccd
commit 8efc15f4d9
6 changed files with 52 additions and 6 deletions

View File

@@ -52,6 +52,7 @@ class PhoneAPI
// Hashmap of timestamps for last time we received a packet on the API per portnum
std::unordered_map<meshtastic_PortNum, uint32_t> lastPortNumToRadio;
uint32_t recentToRadioPacketIds[20]; // Last 20 ToRadio MeshPacket IDs we have seen
/**
* Each packet sent to the phone has an incrementing count
@@ -159,6 +160,8 @@ class PhoneAPI
/// begin a new connection
void handleStartConfig();
bool wasSeenRecently(uint32_t packetId);
/**
* Handle a packet that the phone wants us to send. We can write to it but can not keep a reference to it
* @return true true if a packet was queued for sending