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

void ant_hrm_evt_handler ?

Dear Members,

I saw this code ,

static void ant_hrm_evt_handler(ant_hrm_profile_t * p_profile, ant_hrm_evt_t event)
{
    nrf_pwr_mgmt_feed();

    switch (event)
    {
        case ANT_HRM_PAGE_0_UPDATED:
            /* fall through */
        case ANT_HRM_PAGE_1_UPDATED:
            /* fall through */
        case ANT_HRM_PAGE_2_UPDATED:
            /* fall through */
        case ANT_HRM_PAGE_3_UPDATED:
            /* fall through */
        case ANT_HRM_PAGE_4_UPDATED:
            NRF_LOG_INFO("Page was updated");
            break;

        default:
            break;
    }
}static void ant_hrm_evt_handler(ant_hrm_profile_t * p_profile, ant_hrm_evt_t event)
{
    nrf_pwr_mgmt_feed();

    switch (event)
    {
        case ANT_HRM_PAGE_0_UPDATED:
            /* fall through */
        case ANT_HRM_PAGE_1_UPDATED:
            /* fall through */
        case ANT_HRM_PAGE_2_UPDATED:
            /* fall through */
        case ANT_HRM_PAGE_3_UPDATED:
            /* fall through */
        case ANT_HRM_PAGE_4_UPDATED:
            NRF_LOG_INFO("Page was updated");
            break;

        default:
            break;
    }
}

If there is no input, how can I handle it and display result = 0 and not shutting down CPU ?

How can I display 0 from this code ?

NRF_LOG_INFO("Heart beat count:                 %u", (unsigned int)p_page_data->beat_count);
    NRF_LOG_INFO("Computed heart rate:              %u",
                 (unsigned int) p_page_data->computed_heart_rate);
    NRF_LOG_INFO("Heart beat event time:            %u.%03us\r\n\n",
                 (unsigned int) ANT_HRM_BEAT_TIME_SEC(p_page_data->beat_time),
                 (unsigned int) ANT_HRM_BEAT_TIME_MSEC(p_page_data->beat_time));

If there's no input, the code above never displayed and CPU shut down by itself,

Thanks

  • Hello,

    The ANT channel state indicator module makes the application enter SYSTEM OFF mode (i.e. deep sleep) when it receives the EVENT_CHANNEL_CLOSED event. If you want to avoid this you can remove initialization of this module in addition to removing the source file (ant_state_indicator.c) from your project.

    How can I display 0 from this code ?

     Sorry, but not sure I understand what you mean by this. Can't your app just display '0' if it hasn't received any ANT_HRM_PAGE_X_UPDATED events?

  • Hi Vidar,

    Thanks for the reply,

    What I mean from "How can I display 0 from this code ?"

    If there is no input from sensor, how can I display the value of the sensor = 0, because it doesn't have event yet ? and result is being displayed if there's event.

    Thanks

  • do you mean by commenting out this :

    err_code = ant_state_indicator_init(m_ant_hrm.channel_number, HRM_DISP_CHANNEL_TYPE);
        APP_ERROR_CHECK(err_code);

    at

    static void utils_setup(void)

    How can I change the setting of ant_state_indicator for example turn it off after 1 hour ? thanks

  • The cadence and speed sensor stopped transmitting now, but

    I still got :


    nfo> app: Computed speed value:                         2 kph
                    

    nfo> app: Computed cadence value:                       89 rpms
                  

    nfo> ant_hrm: HRM RX Page Number: 4
                                              

    nfo> ant_hrm_page_0: Computed heart rate Rixtronix:              63
              

    nfo> ant_hrm_page_0: Heart beat count:                 196
                       

    nfo> ant_hrm_page_0: Computed heart rate:              63
                        

    nfo> ant_hrm_page_0: Heart beat event time:            18.724s
         

    it supposed to be 0 on speed and cadence, any ideas ?

    Thanks

  • When it's idle for more than 10 minutes and I give input from the sensor, it stays idle, how can I rectify it ? thanks

        log_init();
        utils_setup();
        softdevice_setup();
        profile_setup();
    	
    	  create_timers();
    	  nrf_pwr_mgmt_feed(); //Function for indicating activity. 
    	  
        
       
    	  NRF_LOG_FLUSH();
    	 
    	   
    	   ssd1306_init_i2c(SSD1306_CONFIG_SCL_PIN, SSD1306_CONFIG_SDA_PIN);
    	   ssd1306_begin(SSD1306_SWITCHCAPVCC, SSD1306_I2C_ADDRESS, false);
    	   ssd1306_clear_display(); 
    		  
            ssd1306_display();
    	      nrf_delay_ms(500);
    	      
            ssd1306_draw_circle(SSD1306_LCDWIDTH / 2, SSD1306_LCDHEIGHT / 2, 30, WHITE);
    	       nrf_delay_ms(5000);
                ssd1306_display();
    	        nrf_delay_ms(1000); 
    		
    					
        for (;;)
        {
    			  nrf_pwr_mgmt_feed(); //Function for indicating activity. 
            
    			  app_timer_start(m_repeated_timer_id, APP_TIMER_TICKS(200), NULL);
    			  
                  nrf_pwr_mgmt_run();
    			  nrf_delay_ms(500);
    
    				
    
        }

Related