File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -213,14 +213,20 @@ void nautilusbike::characteristicChanged(const QLowEnergyCharacteristic &charact
213213
214214double nautilusbike::GetSpeedFromPacket (const QByteArray &packet) {
215215 const double miles = 1.60934 ;
216- QSettings settings;
217- const bool milesUnit = settings.value (QZSettings::miles_unit, QZSettings::default_miles_unit).toBool ();
218216 uint16_t convertedData = 0 ;
219217 double data = 0 ;
220218 convertedData = (packet.at (4 ) << 8 ) | ((uint8_t )packet.at (3 ));
221219 data = (double )convertedData / 100 .0f ;
222- if (milesUnit)
220+ if (B616 ) {
221+ // B616 sends speed in km/h, but in mph when the bike unit is set to miles
222+ QSettings settings;
223+ const bool milesUnit = settings.value (QZSettings::miles_unit, QZSettings::default_miles_unit).toBool ();
224+ if (milesUnit)
225+ data = data * miles;
226+ } else {
227+ // B628 and other models always send speed in mph; convert to km/h
223228 data = data * miles;
229+ }
224230
225231 return data;
226232}
You can’t perform that action at this time.
0 commit comments