Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/devices/sportsplusrower/sportsplusrower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,20 @@ void sportsplusrower::characteristicChanged(const QLowEnergyCharacteristic &char
double kcal = 0;
bool cadence_eval = false;

m_watt = ((newValue.at(10) >> 4) * 10) + (newValue.at(10) & 0x0F);
emit debug(QStringLiteral("Current watt: ") + QString::number(m_watt.value()));

if(newValue.at(1) == 0x10) {
Cadence = ((newValue.at(3) >> 4) * 10) + (newValue.at(3) & 0x0F);
Speed = 0.37497622 * ((double)Cadence.value());
emit debug(QStringLiteral("Current speed: ") + QString::number(Speed.value()));
}

if (Speed.value() > 0) {
double paceSeconds = 1800.0 / Speed.value();
m_watt = rower::calculateWattsFromPace(paceSeconds);
} else {
m_watt = 0;
}
emit debug(QStringLiteral("Current watt: ") + QString::number(m_watt.value()));

if (!firstCharChanged) {
double elapsedMs = lastTimeCharChanged.msecsTo(now);
Distance += ((Speed.value() / 3600.0) / (1000.0 / elapsedMs));
Expand Down Expand Up @@ -186,7 +191,7 @@ void sportsplusrower::characteristicChanged(const QLowEnergyCharacteristic &char
}

Resistance = requestResistance;
KCal = kcal;
KCal += kcal;
if (settings.value(QZSettings::cadence_sensor_name, QZSettings::default_cadence_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled"))) {
Expand Down
Loading