forked from upstream-mirrors/OpenTracks
Workaround: Wahoo Tickr X repords cadence in SPM instead of RPM.
Fixes #1164.
This commit is contained in:
@@ -107,7 +107,6 @@ public abstract class BluetoothConnectionManager<DataType> {
|
|||||||
@Override
|
@Override
|
||||||
public void onCharacteristicChanged(BluetoothGatt gatt, @NonNull BluetoothGattCharacteristic characteristic) {
|
public void onCharacteristicChanged(BluetoothGatt gatt, @NonNull BluetoothGattCharacteristic characteristic) {
|
||||||
Log.d(TAG, "Received data from " + gatt.getDevice().getAddress());
|
Log.d(TAG, "Received data from " + gatt.getDevice().getAddress());
|
||||||
|
|
||||||
SensorData<DataType> sensorData = parsePayload(gatt.getDevice().getName(), gatt.getDevice().getAddress(), characteristic);
|
SensorData<DataType> sensorData = parsePayload(gatt.getDevice().getName(), gatt.getDevice().getAddress(), characteristic);
|
||||||
if (sensorData != null) {
|
if (sensorData != null) {
|
||||||
Log.d(TAG, "Decoded data from " + gatt.getDevice().getAddress() + ": " + sensorData);
|
Log.d(TAG, "Decoded data from " + gatt.getDevice().getAddress() + ": " + sensorData);
|
||||||
|
|||||||
@@ -165,6 +165,11 @@ public class BluetoothUtils {
|
|||||||
index = 3;
|
index = 3;
|
||||||
if (valueLength - index >= 1) {
|
if (valueLength - index >= 1) {
|
||||||
cadence = Cadence.of(characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, index));
|
cadence = Cadence.of(characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, index));
|
||||||
|
|
||||||
|
// Hacky workaround as the Wahoo Tickr X provides cadence in SPM (steps per minute) in violation to the standard.
|
||||||
|
if (sensorName != null && sensorName.startsWith("TICKR X")) {
|
||||||
|
cadence = Cadence.of(cadence.getRPM() / 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
index = 4;
|
index = 4;
|
||||||
|
|||||||
Reference in New Issue
Block a user