mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 02:32:23 +00:00
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:
@@ -44,6 +44,9 @@ static BluetoothPhoneAPI *bluetoothPhoneAPI;
|
||||
* Subclasses can use this as a hook to provide custom notifications for their transport (i.e. bluetooth notifies)
|
||||
*/
|
||||
|
||||
// Last ToRadio value received from the phone
|
||||
static uint8_t lastToRadio[MAX_TO_FROM_RADIO_SIZE];
|
||||
|
||||
class NimbleBluetoothToRadioCallback : public NimBLECharacteristicCallbacks
|
||||
{
|
||||
virtual void onWrite(NimBLECharacteristic *pCharacteristic)
|
||||
@@ -51,7 +54,13 @@ class NimbleBluetoothToRadioCallback : public NimBLECharacteristicCallbacks
|
||||
LOG_INFO("To Radio onwrite\n");
|
||||
auto val = pCharacteristic->getValue();
|
||||
|
||||
bluetoothPhoneAPI->handleToRadio(val.data(), val.length());
|
||||
if (memcmp(lastToRadio, val.data(), val.length()) != 0) {
|
||||
LOG_DEBUG("New ToRadio packet\n");
|
||||
memcpy(lastToRadio, val.data(), val.length());
|
||||
bluetoothPhoneAPI->handleToRadio(val.data(), val.length());
|
||||
} else {
|
||||
LOG_DEBUG("Dropping duplicate ToRadio packet we just saw\n");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user