Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

You are here: Forum Home → ANT+ Forums → ANT+ Bike Power → Thread

   

Standard Power-Only Main Data Page (0x10)

Avatar
RankRankRankRank

Total Posts: 123

Joined 2013-10-07

PM

Hi,

I would like to detect when the user stopped pedaling (Cadence=0, Power=0)
I don't have this sensor so I cannot really test.

Will "pstPage16Data.ucPOEventCount " be increased when the user stopped using the sensor?
For the power value, I check that with the "Accumulated Power" value and see if it didn't increase for too long.
But for the cadence, since it's Instantaneous, is there a way to detect it ?

Here is my current code on page 0x10

/// Check if sensor power stopped using
            
if (pstPage16Data.usPOAccumulatedPower == usPOAccumulatedPowerPrev{
                dataPower_BPS_PAGE_16_NotChanged
++;
                if (
dataPower_BPS_PAGE_16_NotChanged BPSRX_MAX_REPEATS{
                    emit powerChanged
(0);
                    
///todo: emit right pedal power 0, left power 0
                
}
                
else {
                    dataPower_BPS_PAGE_16_NotChanged 
0;
                    
emit powerChanged(stCalculatedStdPowerData.ulAvgStandardPower);
                
}
            }
            
/// How to check for cadence? 



Also a more general question, is there an example available to display a blank value when the sensor is no longer paired ( after too many Rx Fail when it goes to search again, I would like to show something else than the last good value so the user know the sensor is no longer paired)

Thanks, hopefully my last question! smile
     

Signature

——————————————————
Free Indoor Cycling Software - https://maximumtrainer.com

RankRankRankRank

Total Posts: 156

Joined 2013-01-07

PM

Hi,

The event count will keep updating at a regular interval as long as the sensor is transmitting data. Most sensors usually time out after a period of inactivity, so you will probably get a few zero instantaneous power values with different event counts before the sensor turns off.

I would suggest using the accumulated power (not increasing) or instantaneous power (= 0) fields to determine if the user has stopped pedalling because the cadence field is optional and may not be implemented by all sensors.

Try connecting your application to the Bike Power sensor simulators on SimulANT+ if you do not have access to any power sensors.

In regards to your last question. You can use the EVENT_RX_SEARCH_TIMEOUT event ID to indicate when the sensor is no longer connected. Using the ANT_NET_Libraries:

try
            
{
                
switch ((ANT_ReferenceLibrary.ANTMessageID)response.responseID)
                
{
                    
case ANT_ReferenceLibrary.ANTMessageID.RESPONSE_EVENT_0x40:
                    
{
                        
switch (response.getChannelEventCode())

                        
// Cases for other channel events here.......

                       
case ANT_ReferenceLibrary.ANTEventID.EVENT_RX_SEARCH_TIMEOUT_0x01:
                            
{
                                
// Display blank values 
                                
Console.WriteLine("Sensor no longer paired");
                                break;
                            
}
                      }
                 }
             }