Added BTHome packet id for deduplication

This commit is contained in:
Arne Seime 2024-06-25 19:00:34 +02:00
parent 5f671b0170
commit 1d9582c26a
2 changed files with 6 additions and 1 deletions

View file

@ -39,7 +39,7 @@ config PRST_BLE_ENCODING_SERVICE_DATA_LEN
Size of the service data buffer.
default 20 if PRST_BLE_ENCODING_BPARASITE_V2
default 18 if PRST_BLE_ENCODING_BTHOME_V1
default 19 if PRST_BLE_ENCODING_BTHOME_V2
default 21 if PRST_BLE_ENCODING_BTHOME_V2
config PRST_BLE_HAS_USER_DEFINED_RANDOM_STATIC_ADDR

View file

@ -132,6 +132,11 @@ int prst_ble_encode_service_data(const prst_sensors_t* sensors,
uint8_t batt_percentage_val = 100 * sensors->batt.percentage + 0.5f;
out[18] = batt_percentage_val;
// Misc packet-id
static uint8_t run_counter;
out[19] = 0x00;
out[20] = run_counter++ & 0xFF;
#endif // Encoding protocols
LOG_HEXDUMP_DBG(out, out_len, "Encoded BLE adv: ");