Skip to content

Commit d7c3319

Browse files
authored
proform 550r rowing (#4585)
1 parent bea7d85 commit d7c3319

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/devices/proformrower/proformrower.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,23 @@ void proformrower::characteristicChanged(const QLowEnergyCharacteristic &charact
580580
lastPacket = newValue;
581581

582582
if (newValue.length() == 20 && (uint8_t)newValue.at(0) == 0xff && newValue.at(1) == 0x11) {
583-
Cadence = (uint8_t)(newValue.at(12));
583+
const bool rowerTelemetryFrame = (uint8_t)newValue.at(2) == 0 && (uint8_t)newValue.at(3) == 0 &&
584+
(uint8_t)newValue.at(4) == 0 && (uint8_t)newValue.at(5) == 0 &&
585+
(uint8_t)newValue.at(6) == 0 && (uint8_t)newValue.at(7) == 0 &&
586+
(uint8_t)newValue.at(8) == 0 && (uint8_t)newValue.at(9) == 0;
587+
if (!rowerTelemetryFrame) {
588+
return;
589+
}
590+
const uint8_t cadence = (uint8_t)(newValue.at(12));
591+
uint16_t s = (((uint16_t)((uint8_t)newValue.at(14)) << 8) + (uint16_t)((uint8_t)newValue.at(13)));
592+
if (cadence == 0 && s > 0) {
593+
return;
594+
}
595+
Cadence = cadence;
584596
StrokesCount += (Cadence.value()) *
585597
((double)lastRefreshCharacteristicChanged.msecsTo(now)) / 60000;
586598
emit debug(QStringLiteral("Current Cadence: ") + QString::number(Cadence.value()));
587599
emit debug(QStringLiteral("Strokes Count: ") + QString::number(StrokesCount.value()));
588-
uint16_t s = (((uint16_t)((uint8_t)newValue.at(14)) << 8) + (uint16_t)((uint8_t)newValue.at(13)));
589600
if (s > 0)
590601
Speed = (60.0 / (double)(s)) * 30.0;
591602
else
@@ -595,7 +606,8 @@ void proformrower::characteristicChanged(const QLowEnergyCharacteristic &charact
595606
}
596607

597608
if (newValue.length() != 20 || newValue.at(0) != 0x00 || newValue.at(1) != 0x12 || newValue.at(2) != 0x01 ||
598-
newValue.at(3) != 0x04 || newValue.at(4) != 0x02 || (newValue.at(5) != 0x2e && newValue.at(5) != 0x30) ||
609+
newValue.at(3) != 0x04 || newValue.at(4) != 0x02 ||
610+
(newValue.at(5) != 0x2e && newValue.at(5) != 0x30 && newValue.at(5) != 0x31) ||
599611
(((uint8_t)newValue.at(12)) == 0xFF && ((uint8_t)newValue.at(13)) == 0xFF &&
600612
((uint8_t)newValue.at(14)) == 0xFF && ((uint8_t)newValue.at(15)) == 0xFF &&
601613
((uint8_t)newValue.at(16)) == 0xFF && ((uint8_t)newValue.at(17)) == 0xFF &&

0 commit comments

Comments
 (0)