forked from upstream-mirrors/OpenTracks
Add an optional filter for invalid (0 bpm) heart rate readings
This commit is contained in:
@@ -12,7 +12,9 @@ public class AggregatorHeartRate extends Aggregator<HeartRate, HeartRate> {
|
||||
|
||||
@Override
|
||||
protected void computeValue(Raw<HeartRate> current) {
|
||||
this.aggregatedValue = current.value();
|
||||
if (current.value().isValid()) {
|
||||
this.aggregatedValue = current.value();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,7 +64,8 @@ public class SensorDataSet {
|
||||
|
||||
public Pair<HeartRate, String> getHeartRate() {
|
||||
if (heartRate != null) {
|
||||
return heartRate.getAggregatedValueWithSensorName(trackPointCreator.createNow());
|
||||
Pair<HeartRate, String> value = heartRate.getAggregatedValueWithSensorName(trackPointCreator.createNow());
|
||||
if (value.first.isValid()) return value;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user