From ee38d4561ae8183ac378a975beca231fc026eca7 Mon Sep 17 00:00:00 2001 From: Marvin Rohrbach Date: Thu, 12 Jan 2023 08:12:18 +0000 Subject: [PATCH] Fix: Counter was missing --- code/nrf-connect/samples/ble/src/encoding.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/nrf-connect/samples/ble/src/encoding.c b/code/nrf-connect/samples/ble/src/encoding.c index 93b24d1..d252984 100644 --- a/code/nrf-connect/samples/ble/src/encoding.c +++ b/code/nrf-connect/samples/ble/src/encoding.c @@ -24,7 +24,10 @@ int prst_ble_encode_service_data(const prst_sensors_t* sensors, #endif // 4 bits for a small wrap-around counter for deduplicating messages on the // receiver. - // out[3] = sensors->run_counter & 0x0f; + + static uint8_t run_counter; + + out[3] = run_counter++ & 0x0f; out[4] = sensors->batt.adc_read.millivolts >> 8; out[5] = sensors->batt.adc_read.millivolts & 0xff; int16_t temp_centicelsius = 100 * sensors->shtc3.temp_c;