Is API 'app_easy_timer' working while used in user_app_on_init

4 posts / 0 new
Last post
hardy.chen
Offline
Last seen:1 year 7 months ago
加入:2015-03-13 04:20
Is API 'app_easy_timer' working while used in user_app_on_init

Hi Dialog,

I faced one weird issue about using API 'app_easy_timer'.

I tried to setup one timer in 'user_app_on_init' which is callback of 'app_on_init' in arch_main_loop_callbacks.
But it was not ever fired at all.
Strange thing is that It was able to fired normally while setting it at callback 'user_advertise_operation'.

Could you comment what the appropriate usage is for API 'app_easy_timer'?

Anything related to following case designed in easy timer module?
--
if (app_check_BLE_active())
ke_timer_set(APP_EASY_TIMER_HND_TO_MSG_ID(timer_id), TASK_APP, delay);
else
{

Device:
MT_dialog
Offline
Last seen:2 days 16 hours ago
Staff
加入:2015-06-08 11:34
Hi hardy.chen,

Hi hardy.chen,

You cant set the timer is that section of the application, the reason is that this function in called before the main loop of the application therefore before the scheduler is called. So when the scheduler is called there is reset pending commands (by the ble stack initialization procedure after the GAPM_DEVICE_READY_IND), because of this reset anything you have set is cancelled.

Thanks MT_dialog

hardy.chen
Offline
Last seen:1 year 7 months ago
加入:2015-03-13 04:20
Hi Dialog,

Hi Dialog,

Thanks!
But could you comment where the anchor point is for the callback, if I want to start the timer right after *initialization* of application or the entry point of application that scheduler has been started?

---
static const struct arch_main_loop_callbacks user_app_main_loop_callbacks = {
.app_on_init = user_app_on_init, //default_app_on_init,
.app_on_ble_powered = NULL,
.app_on_sytem_powered = NULL,
.app_before_sleep = user_app_before_sleep,
.app_validate_sleep = NULL,
.app_going_to_sleep = user_app_going_to_sleep,
.app_resume_from_sleep = user_app_resume_from_sleep,
};

MT_dialog
Offline
Last seen:2 days 16 hours ago
Staff
加入:2015-06-08 11:34
Hi hardy.chen,

Hi hardy.chen,

You can set your timer to get started in the advertising process functiom in a custom user_app_adv_start() function.

Thanks MT_dialog