I am working on the (old) IoT project with SDK 5.160.1.19 (with modified hardware/FW).
I have a blue LED which blinks when it is advertising, pretty much the original code of the IoT project.
Sometimes the LED will stay turned on when the device goes to sleep. I assume it can happen whenwrbl_env.led_tmr_state = 1
in this moment. After shaking the sensor (motion wakeup) the LED continues to blink as it should.
I have noticed that there are three callback options when going to sleep:
.app_before_sleep = NULL,
.app_validate_sleep = NULL,
.app_going_to_sleep = NULL,
Which of them should I utilized to make sure the regarding GPIO is in the correct state?
Or is there a different way altogether to achieve this result?
问候
Johannes
Device:
Hi gme_johannes,
If I am able to understand what you mean from your post, that you would like to accomplish is to blink the LED while the device is in active mode and since the DA14580 goes into sleep the LED should be switched off? And after the wake-up that LED should be in blinking mode. Could you please clarify it in order to provide you the correct steps?
Thanks, PM_Dialog
Hi PM_Dialog,
want I want to make sure is that the LED, which is blinking in my case (advertisement blinking of the IoT sensor), does not get stuck in the ON state when the device enters sleep mode.
I observe that it sometimes seems to happen (statistically, with a duty factor of 10%, in 10% of the cases...)
问候Johannes
PS: I accidentally set your answer to "Accepted answer"
Hi gme_johannes,
When the timeout occurs without connection, the function user_app_on_adv_undirect_complete() sets the device in a low power mode, where the CPU is in Sleep mode and the accelerometer in low power anymotion detection mode. If a motion is detected, then the CPU wakes up and starts advertising. This function is called after expiration of the advertising timer. So, a possible solution would be to switch off the LED into the user_app_on_adv_undirect_complete() callback function.
Thanks, PM_Dialog