Add an optional filter for invalid (0 bpm) heart rate readings

This commit is contained in:
frazou
2025-11-16 22:04:02 +01:00
parent c259f9b8bd
commit a3407ccbea
4 changed files with 11 additions and 3 deletions
@@ -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;