I'm using the ble_app_sleepmode project as starting point for a simple counter on DA14531, using the MNF proprietary data.
The flow is quite simple:
This is what ble_app_sleepmode already does, except it increments the counter before going into extended sleep. I have tried to change this, such that I call `mnf_data_update` in `app_button_press_cb` or in `app_wakeup_cb`. The counter does change, but it is only broadcasted the next time the device wakes up. In other words, it is always exactly one behind.
I.e. the actual flow becomes:
How do I make sure that the advertising data is updated on the fly, but after waking up from extended sleep, such that mnf is equal to count? I would highly appreciate an example based on the ble_app_sleepmode project, as that is a suitable starting point for my project.
Hi Hat,
Thank you for posting your questions online.
Let me check on this and will back to you soon.
BR,
Jason
Hello Jason,
Any updates?
Hatbassist
Hi Hatbassist,
Sorry for the delay.
I have checked the code, you can take a reference by the following info. I can create a demo when I have time for this. Please try the following APIs first.
1, you can refer to this tutorial to change the ADV data on the fly:13. Dynamic Advertising Data — DA145XX Tutorial SDK Getting started (renesas.com)
2, Set the adv type to DEF_ADV_WITH_TIMEOUT, and set the timeout value to sleep the chip
2, write update MNF APIs to your button-wake-up-callback:
3, change the adv callback to the default one
If this not help I will create a demo to you when I have time. or you can try to fix it.
JH_Renesas
This seems to work.
I had to add a call to the `app_add_ad_struct` function in `update_advertising_data` as well, and change all calls from `user_app_adv_start` to `default_advertise_operation`.
Then it wakes up and broadcasts updated information.
Thanks!