Skip to content

Commit

Permalink
Bugfix: on idle detection reset movement-based sensor data.
Browse files Browse the repository at this point in the history
Fixes #1995.
  • Loading branch information
dennisguse committed Dec 17, 2024
1 parent 4966ba8 commit fd9646b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public Output getValue() {
/**
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,5 @@ protected AltitudeGainLoss getNoneValue() {
return new AltitudeGainLoss(0f, 0f);
}

@Override
public void reset() {
value = getNoneValue();
}

public record Data(Altitude gain, Altitude loss) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ protected void computeValue(Raw<Position> current) {
value = current.value();
}

@Override
public void reset() {
value = null;
}

@NonNull
@Override
protected Position getNoneValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ protected void computeValue(Raw<HeartRate> current) {
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() {
Expand Down

0 comments on commit fd9646b

Please sign in to comment.