Fix a state machine bug

Fixed a bug where allowMovement() would be called at the start of the first drive, which would force it back to a paused state, causing all kind of weird metrics.
This commit is contained in:
Jaap van Ekris 2023-04-28 20:22:14 +02:00 committed by GitHub
parent e1701f8038
commit 43d7e45aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -299,8 +299,11 @@ function createRower (rowerSettings) {
}
function allowMovement () {
log.debug(`*** ALLOW MOVEMENT command by RowingEngine recieved at time: ${flywheel.spinningTime().toFixed(4)} sec`)
_strokeState = 'WaitingForDrive'
if (_strokeState === 'Stopped') {
// We have to check whether there actually was a stop/pause, in order to prevent weird behaviour from the state machine
log.debug(`*** ALLOW MOVEMENT command by RowingEngine recieved at time: ${flywheel.spinningTime().toFixed(4)} sec`)
_strokeState = 'WaitingForDrive'
}
}
function pauseMoving () {