This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

bugfix request: first Eddystone (e)TLM shows vbatt=0 (not supported)

the first (initialized) Eddystone (e)TLM frame have vbatt unset. I am using SDK 15.3. I suggest the following changes, it simply busy wait until ADC reading is finished before filling in the advertisement frames:

--- a/components/ble/ble_services/eddystone/nrf_ble_es.c
+++ b/components/ble/ble_services/eddystone/nrf_ble_es.c
@@ -51,6 +51,7 @@
 #include "es_stopwatch.h"
 #include "escs_defs.h"
 #include "nrf_sdh_ble.h"
+#include "nrf_drv_saadc.h"
 
 static uint16_t                       m_conn_handle = BLE_CONN_HANDLE_INVALID;  //!< Connection handle.
 static nrf_ble_escs_t                 m_ble_ecs;                                //!< Struct identifying the Eddystone Config Service.
@@ -441,6 +442,10 @@ void nrf_ble_es_init(nrf_ble_es_evt_handler_t evt_handler)
     ble_escs_init();
     adv_slots_init();
     es_battery_voltage_init();
+    while (nrf_drv_saadc_is_busy())
+    {
+        ; // busy wait until ADC reading is finished
+    }
     adv_init();
     es_adv_start_non_connctable_adv();
 }

Related