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

@@ -141,10 +141,19 @@ void onFromRadioAuthorize(uint16_t conn_hdl, BLECharacteristic *chr, ble_gatts_e
}
authorizeRead(conn_hdl);
}
// Last ToRadio value received from the phone
static uint8_t lastToRadio[MAX_TO_FROM_RADIO_SIZE];
void onToRadioWrite(uint16_t conn_hdl, BLECharacteristic *chr, uint8_t *data, uint16_t len)
{
LOG_INFO("toRadioWriteCb data %p, len %u\n", data, len);
bluetoothPhoneAPI->handleToRadio(data, len);
if (memcmp(lastToRadio, data, len) != 0) {
LOG_DEBUG("New ToRadio packet\n");
memcpy(lastToRadio, data, len);
bluetoothPhoneAPI->handleToRadio(data, len);
} else {
LOG_DEBUG("Dropping duplicate ToRadio packet we just saw\n");
}
}
void setupMeshService(void)