EVENT_CHANNEL_CLOSED ?

Dear Members,

How can I scan continously if I loss the sensor,

I have made at this function :

static void ant_evt_handler(ant_evt_t * p_ant_evt, void * p_context)

case EVENT_CHANNEL_CLOSED:
									  NRF_LOG_INFO("EVENT_CHANNEL_CLOSED...\r\n");
								    NRF_LOG_INFO("BSP_INDICATE_SCANNING...\r\n");//31Mar22 Rixtronix LAB
                    
								     err_code = bsp_indication_set(BSP_INDICATE_SCANNING);
					
								    nrf_pwr_mgmt_feed(); //Function for indicating activity.
								    
								
                    break;

but it's not scanning when it loss the sensor ,

Any clues ?

Kind regards,

Rixtronix

  • The intention is that when the ANT search timeout you start again if you want to, in other words it's event driven what the application does based on the events that occurs. It's the same for instance in BLE, if the advertisment or scanning timeout, the application can start again or go to sleep. You can do what you ask about also, but then you can get error codes for instance because it's already in the progress of searching when you call search from the timer.

    Kenneth

  • Hi Kenneth,

    Thanks for the reply,

    but I can not put "extra time out" when the "EVENT_CLOSED" runs?

    Regards,

    RIxtronix

  • Sorry to ask, but what you asking about? You totally free to call this api whenever you like with the parameters supported, you can call it as frequently as you like (though it sounds strange to call it if it's already running). What extra time are you asking about?

    Best regards,
    Kenneth

  • Hi Kenneth,

    Thanks for the reply,

    I made like this :

    on main ()
    	create_timers_ANT_HRM();//create timer for ANT Sensor Timeout Extension 11 May 22 Rixtronix LAB
    	/*****************ANT SENSOR TIMER*************11May22*************BEGIN***********/
    	   app_timer_start(m_repeated_timer_ANT_timeout, APP_TIMER_TICKS(60000), NULL);  // timeout extenstion ANT SENSOR 11 May 22 Rixtronix LAB
    	/**************************END*****************/
    	//Timer configuration
    	static void create_timers_ANT_HRM()
    {
        ret_code_t err_code;
    	
        // Create timers ANT HRM
        err_code = app_timer_create(&m_repeated_timer_ANT_timeout,
                                    APP_TIMER_MODE_REPEATED,
                                    repeated_timer_handler_ANT_HRM);
        APP_ERROR_CHECK(err_code);
    }
    //timer handler
    static void repeated_timer_handler_ANT_HRM(void * p_context)
    {
    	ret_code_t err_code;
    	 
    	 //Process ANT_HRM every x seconds  here 24 Dec 21 Rixtronix LAB
    	 //ANT_HRM_flag_timer =0;
    	 //GPS_flag_timer =0;
    	//Start GPS again singleshot
    	//app_timer_start(m_repeated_timer_GPS_Start, APP_TIMER_TICKS(10), NULL);  // 29 Dec 21 Rixtronix LAB
    	
    	/********Rixtronix LAB timer event for increasing timeout ANT Sensor 11May22*********/
    	/******E:\nRF5_SDK_17.0.2_d674dde\components\softdevice\SoftDevice\headers\include\ant_interface.h LINE 457*******/
     err_code = sd_ant_channel_search_timeout_set(HRM_CHANNEL_NUM, 88);
        APP_ERROR_CHECK(err_code);
    	/******E:\nRF5_SDK_17.0.2_d674dde\components\softdevice\SoftDevice\headers\include\ant_interface.h LINE 457*******/	
     err_code = sd_ant_channel_search_timeout_set(BSC_CHANNEL_NUM, 88);
        APP_ERROR_CHECK(err_code);	
    	
    	/******E:\nRF5_SDK_17.0.2_d674dde\components\softdevice\SoftDevice\headers\include\ant_interface.h LINE 457*******/
    	  err_code = sd_ant_channel_search_timeout_set(BPWR_CHANNEL_NUM, 88);
        APP_ERROR_CHECK(err_code);
    	
    }
    

    I want to extend the timeout, so the receiver always waits

    Regards,

    Rixtronix

  • I believe waiting for the closed event and open channel again is the fastest. In any case I recommend to check out some of the application notes that describe different types of search and scanning in ANT if you haven't already:

    https://www.thisisant.com/resources/an14-continuous-scanning-mode/ 
    https://www.thisisant.com/resources/an11-ant-channel-search-and-background-scanning-channel/ 

    Kenneth

Related