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

Periodically switching into config mode on nRF51822 Beacon Kit

Hi,

I have implemented some code to periodically switching back and forth between the normal and the config mode. I can see that the handler function is being called, but the beacon does not switch into the config mode. The following is what I implemented:

beacon_mode_t beacon_mode = beacon_mode_normal;

static void config_mode_timeout_handler(void * p_context) {

	if(beacon_mode == beacon_mode_normal)
	{
		beacon_mode = beacon_mode_config;
	}
	else
	{
		beacon_mode = beacon_mode_normal;
	}
	
	advertising_init(beacon_mode);

}

Apparently calling advertising_init with beacon_config_mode is not enough to do this, but I don't know what other functions I should be calling for this. Thanks a lot in advance!

Parents
  • @Sarah:

    If you have a look at our code in beacon_setup() in main.c you can find that we need to init some parameter such as gap, services, connection parameter, security when we are in config mode.

    For your application, since you are switching back and forth a lot, I would suggest you to do this configuration at the begining regardless which mode you will be running. Good thing is that you can have this configuration when you running in both modes.

    The main difference that effectively tells apart which mode is currently running is when calling advertising_init(). If you have called the configuration init as mentioned above, you should be fine. Note that you should better call sd_ble_gap_adv_stop() and sd_ble_gap_adv_start() again after you have changed the advertising flags and data in the advertising_init() function.

  • Hi Sarah,

    Please make sure you have increased the APP_TIMER_MAX_TIMERS define to match with the number of timer you used.

Reply Children
No Data
Related