diff --git a/src/ANT.h b/src/ANT.h index d4262e84b..07e282f61 100644 --- a/src/ANT.h +++ b/src/ANT.h @@ -199,6 +199,7 @@ static inline double get_timestamp( void ) { #define ANT_QUARQ_FREQUENCY 61 #define ANT_SPORT_CALIBRATION_MESSAGE 0x01 +#define ANT_SPORT_SRM_CALIBRATIONID 0x10 #define ANT_SPORT_AUTOZERO_OFF 0x00 #define ANT_SPORT_AUTOZERO_ON 0x01 #define ANT_SPORT_CALIBRATION_REQUEST_MANUALZERO 0xAA diff --git a/src/ANTChannel.cpp b/src/ANTChannel.cpp index 691611495..6d49be640 100755 --- a/src/ANTChannel.cpp +++ b/src/ANTChannel.cpp @@ -285,7 +285,53 @@ void ANTChannel::broadcastEvent(unsigned char *ant_message) case CHANNEL_TYPE_FAST_QUARQ_NEW: // what kind of power device is this? - switch(antMessage.power_type) { + switch(antMessage.data_page) { + + case ANT_SPORT_CALIBRATION_MESSAGE: + { + // Always ack calibs unless they are acks too! + if (antMessage.data[6] != 0xAC) { + antMessage.data[6] = 0xAC; + qDebug()<<"sending calibration ack..."; + parent->sendMessage(antMessage); + } + + // each device sends a different type + // of calibration message... + switch (antMessage.calibrationID) { + + case ANT_SPORT_SRM_CALIBRATIONID: + + switch (antMessage.ctfID) { + + case 0x01: // offset + // if we're getting calibration messages then + // we should be coasting, so power and cadence + // will be zero + srm_offset = antMessage.srmOffset; + parent->setWatts(0); + parent->setCadence(0); +qDebug()<<"got new offset!"<= 4) { // 4 messages on an SRM parent->setWatts(0); parent->setCadence(0); diff --git a/src/ANTMessage.cpp b/src/ANTMessage.cpp index 984f19d15..e6b59eb38 100755 --- a/src/ANTMessage.cpp +++ b/src/ANTMessage.cpp @@ -372,6 +372,8 @@ qDebug()<<"request message"; qDebug()<<"broadcast data, channel="<antChannel[message[3]]->channel_type) { @@ -398,11 +400,11 @@ qDebug()<<"broadcast data, channel="<watts = watts; + this->watts = (int)watts; } void RealtimeData::setHr(double hr) { - this->hr = hr; + this->hr = (int)hr; } void RealtimeData::setTime(long time) { @@ -52,7 +52,7 @@ void RealtimeData::setWheelRpm(double wheelRpm) } void RealtimeData::setCadence(double aCadence) { - cadence = aCadence; + cadence = (int)aCadence; } void RealtimeData::setLoad(double load) {