File tree Expand file tree Collapse file tree
src/devices/sportsplusrower Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,15 +136,20 @@ void sportsplusrower::characteristicChanged(const QLowEnergyCharacteristic &char
136136 double kcal = 0 ;
137137 bool cadence_eval = false ;
138138
139- m_watt = ((newValue.at (10 ) >> 4 ) * 10 ) + (newValue.at (10 ) & 0x0F );
140- emit debug (QStringLiteral (" Current watt: " ) + QString::number (m_watt.value ()));
141-
142139 if (newValue.at (1 ) == 0x10 ) {
143140 Cadence = ((newValue.at (3 ) >> 4 ) * 10 ) + (newValue.at (3 ) & 0x0F );
144141 Speed = 0.37497622 * ((double )Cadence.value ());
145142 emit debug (QStringLiteral (" Current speed: " ) + QString::number (Speed.value ()));
146143 }
147144
145+ if (Speed.value () > 0 ) {
146+ double paceSeconds = 1800.0 / Speed.value ();
147+ m_watt = rower::calculateWattsFromPace (paceSeconds);
148+ } else {
149+ m_watt = 0 ;
150+ }
151+ emit debug (QStringLiteral (" Current watt: " ) + QString::number (m_watt.value ()));
152+
148153 if (!firstCharChanged) {
149154 double elapsedMs = lastTimeCharChanged.msecsTo (now);
150155 Distance += ((Speed.value () / 3600.0 ) / (1000.0 / elapsedMs));
@@ -186,7 +191,7 @@ void sportsplusrower::characteristicChanged(const QLowEnergyCharacteristic &char
186191 }
187192
188193 Resistance = requestResistance;
189- KCal = kcal;
194+ KCal + = kcal;
190195 if (settings.value (QZSettings::cadence_sensor_name, QZSettings::default_cadence_sensor_name)
191196 .toString ()
192197 .startsWith (QStringLiteral (" Disabled" ))) {
You can’t perform that action at this time.
0 commit comments