Bugfix: on idle detection reset movement-based sensor data.

Fixes #1995.
This commit is contained in:
Dennis Guse
2024-12-14 12:21:50 +01:00
parent 4966ba8868
commit fd9646bb1f
4 changed files with 8 additions and 11 deletions
@@ -55,7 +55,9 @@ public abstract class Aggregator<Input, Output> {
/**
* Reset long term aggregated values (more than derived from previous SensorData). e.g. overall distance.
*/
public void reset() {}
public void reset() {
value = getNoneValue();
}
/**
* Is the data recent considering the current time.
@@ -37,10 +37,5 @@ public class AggregatorBarometer extends Aggregator<AtmosphericPressure, Altitud
return new AltitudeGainLoss(0f, 0f);
}
@Override
public void reset() {
value = getNoneValue();
}
public record Data(Altitude gain, Altitude loss) {}
}
@@ -16,11 +16,6 @@ public class AggregatorGPS extends Aggregator<Position, Position> {
value = current.value();
}
@Override
public void reset() {
value = null;
}
@NonNull
@Override
protected Position getNoneValue() {
@@ -15,6 +15,11 @@ public class AggregatorHeartRate extends Aggregator<HeartRate, HeartRate> {
this.value = current.value();
}
@Override
public void reset() {
// We don't need to reset the heart rate as this value is valid for a certain amount of time: and it is not an aggregate.
}
@NonNull
@Override
protected HeartRate getNoneValue() {