Skip to content

Commit

Permalink
Bugfix: process cycling power sensor data correctly.
Browse files Browse the repository at this point in the history
Fixes #1802.
  • Loading branch information
dennisguse committed Dec 31, 2023
1 parent 9b21265 commit 310ac8c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package de.dennisguse.opentracks.sensors;

import android.bluetooth.BluetoothGattCharacteristic;
import android.util.Log;

import java.util.List;
import java.util.UUID;
Expand Down Expand Up @@ -33,7 +32,7 @@ public List<ServiceMeasurementUUID> getServices() {
public void handlePayload(SensorManager.SensorDataChangedObserver observer, ServiceMeasurementUUID serviceMeasurementUUID, String sensorName, String address, BluetoothGattCharacteristic characteristic) {
AtmosphericPressure value = parseEnvironmentalSensing(characteristic);
if (value == null) return;
Log.i("ZXCV", "VALUE: " + value);

observer.onChange(new Raw<>(value));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
import androidx.annotation.NonNull;

import de.dennisguse.opentracks.data.models.Power;
import de.dennisguse.opentracks.sensors.BluetoothHandlerManagerCyclingPower;

public class AggregatorCyclingPower extends Aggregator<Power, Power> {
public class AggregatorCyclingPower extends Aggregator<BluetoothHandlerManagerCyclingPower.Data, Power> {

public AggregatorCyclingPower(String name, String address) {
super(name, address);
}

@Override
public void computeValue(Raw<Power> current) {
this.value = current.value();
public void computeValue(Raw<BluetoothHandlerManagerCyclingPower.Data> current) {
this.value = current.value().power();
}

@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import de.dennisguse.opentracks.data.models.AtmosphericPressure;
import de.dennisguse.opentracks.data.models.Cadence;
import de.dennisguse.opentracks.data.models.HeartRate;
import de.dennisguse.opentracks.data.models.Power;
import de.dennisguse.opentracks.data.models.Speed;
import de.dennisguse.opentracks.data.models.TrackPoint;
import de.dennisguse.opentracks.sensors.BluetoothHandlerCyclingCadence;
Expand Down Expand Up @@ -116,7 +115,7 @@ public void update(@NonNull Raw<?> data) {
return;
}
if (value instanceof BluetoothHandlerManagerCyclingPower.Data) {
this.cyclingPower.add((Raw<Power>) data);
this.cyclingPower.add((Raw<BluetoothHandlerManagerCyclingPower.Data>) data);
return;
}
if (value instanceof AtmosphericPressure) {
Expand Down

0 comments on commit 310ac8c

Please sign in to comment.