Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

You are here: Forum Home → ANT+ Forums → ANT+ Heart Rate Monitor → Thread

   

Page 0 - Implementation Guidelines

Avatar
RankRankRankRank

Total Posts: 123

Joined 2013-10-07

PM

Hi,

In the document ANT_Device_profile, page 20 section 6 - Implementation Guidelines – Computed Heart Rate
It talks about implementing a system that shows a blank value when the user may have removed the monitor, or the user may not be wearing the heart rate monitor correctly.

Is there a standard period of time (accepted by ANT+) to use?. Right now i'm displaying a blank field on the Heart Rate value when I receive the same message 10 times in a row (2.5sec)
Thanks in advance,


Here is my current code :
/// DATA PRESENT ON ALL PAGES  (BYTES 4-5-6-7)
    
stPage0Data.usBeatTime = (USHORT)stMessage.aucData[ucDataOffset+4];                  // Measurement time
    
stPage0Data.usBeatTime |= (USHORT)stMessage.aucData[ucDataOffset+5] << 8;
    
stPage0Data.ucBeatCount = (UCHAR)stMessage.aucData[ucDataOffset+6];                  // Measurement count
    
stPage0Data.ucComputedHeartRate = (USHORT)stMessage.aucData[ucDataOffset+7];         // Computed heart rate


    
qDebug() << "Time:" << stPage0Data.usBeatTime;
    
qDebug() << "CountHR:" << hex <<  stPage0Data.ucBeatCount;
    
qDebug() << "InstantHR:" << stPage0Data.ucComputedHeartRate;


    
/// Check if the message is the same in a row for 10 messages, if so, user has removed the strap or incorrect strap placement on user.
    
if ( (stPage0Data.usBeatTime == previousHeartBeatTime) && stPage0Data.ucBeatCount  == previousHeartBeatCount{

        dataNotChanged
++;
        if (
dataNotChanged 10{
            
/// EMIT HR
            
emit HeartRateChanged(0);  /// TODO: Show "---" on interface instead of 0
        
}
    }
    
else {
        dataNotChanged 
0;
         
/// EMIT HR
        
emit HeartRateChanged(stPage0Data.ucComputedHeartRate);
    
}

    
/// Move current data to the past
    
previousHeartBeatCount stPage0Data.ucBeatCount;
    
previousHeartBeatTime stPage0Data.usBeatTime

     

Signature

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

Avatar
RankRankRankRank

Total Posts: 123

Joined 2013-10-07

PM

I guess 2.5sec is okay for now, i'll test and put it up a bit if it's not working as expected.
assuming a low heart rate of 30 it would take 2sec to increase the heart beat count

[Edit: Nevermind I guess my reasoning was false, the time event will still increase even if you have a low beat count
Now i'm using this and seems to work fine :


/// Check if sensor cadence stopped using
    
if (currentPage0.usLastCadence1024 == pastPage0.usLastCadence1024 && currentPage0.usCumCadenceRevCount  == pastPage0.usCumCadenceRevCount{
        dataNotChanged
++;
        if (
dataNotChanged MAX_MSG_REPEAT_CADENCE{
            emit cadenceChanged
(0);
        
}
    }
    
else {
        dataNotChanged 
0;
        
/// Compute new cadence
        
computeCadence();
    
     

Signature

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