Skip to content

Commit fe8a03e

Browse files
committed
fixed idle time added to ride time on ride start
1 parent e4b600e commit fe8a03e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main/Tasks/core/calcRideParamsOnISR.task.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ void vCalcRideParamsOnISRTask(void *data) {
6262
// TODO block rideParams while calculating?
6363
if (!rideParams.moving) {
6464
esp_event_post_to(obc_events_loop, OBC_EVENTS, RIDE_START_EVENT, NULL, 0, portMAX_DELAY);
65+
} else {
66+
// ignore the first tick after ride start, since it is idle time
67+
rideParams.totalRideTimeMs += msBetweenRotationTicks;
6568
}
6669

6770
currentSpeed = ((float)CIRCUMFERENCE / 1000000) / ((float)msBetweenRotationTicks / 3600000); // km/h
6871
rideParams.moving = true;
6972
rideParams.rotations++;
7073
rideParams.speed = currentSpeed;
71-
rideParams.totalRideTimeMs += msBetweenRotationTicks;
7274
rideParams.distance += (float)CIRCUMFERENCE / 1000000;
7375
rideParams.totalDistance += (float)CIRCUMFERENCE / 1000000;
7476
rideParams.avgSpeed = rideParams.distance / ((float)rideParams.totalRideTimeMs / 3600000);

0 commit comments

Comments
 (0)