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

BLE CSCS cadence value problem

HI

I am working with BLE CSCS example, and I found some problem during read cadence value. Simulator is changing values and I am observing situation: if cadence value is less than 50rpm occasionally shows 0rpm. I think that it occured when cumulative_crank_revs is not incerement during 1 seceond (BICYCLE_POWER_MEAS_INTERVAL).

Have anyone meet the same problem ?

Parents Reply
  • What do You think about this solution (which works correctly for everyone third party app's):

        // Calculate simulated cadence values.
        p_measurement->is_crank_rev_data_present = true;
        degrees_per_sec = RPM_TO_DEGREES_PER_SEC * RPM;
    
        crank_rev_degrees     += degrees_per_sec;
        cumulative_crank_revs += crank_rev_degrees / DEGREES_PER_REVOLUTION;
        crank_rev_degrees     %= DEGREES_PER_REVOLUTION;
    
        if(cumulative_crank_revs > last_cumulative_crank_revs){
          p_measurement->cumulative_crank_revs = cumulative_crank_revs;
          p_measurement->last_crank_event_time = event_time + (1024 * (degrees_per_sec - crank_rev_degrees) / degrees_per_sec);
          last_cumulative_crank_revs = p_measurement->cumulative_crank_revs;
          last_last_crank_event_time = p_measurement->last_crank_event_time;
        }else{
          p_measurement->cumulative_crank_revs = last_cumulative_crank_revs;
          p_measurement->last_crank_event_time = last_last_crank_event_time;
        }
    
        event_time += event_time_inc;

    Is it correct in terms of Gatt specifications ?

Children
Related