Add StopWorkout command with safe treadmill stop sequencing, serialize HID I/O, and improve logging - #4931
Merged
Conversation
cagnulein
changed the base branch from
claude/fervent-newton-a25bb2
to
codex/fix-v1-treadmill-startup-and-stop-behaviors
August 14, 2026 05:34
cagnulein
merged commit Aug 14, 2026
c3e41c3
into
codex/fix-v1-treadmill-startup-and-stop-behaviors
14 of 17 checks passed
cagnulein
deleted the
codex/fix-v1-treadmill-startup-and-stop-behaviors-85pqtd
branch
August 14, 2026 05:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
StopWorkoutcommand to distinguish a connected treadmill stop sequence from a simple pause and to avoid racing with resume/target writes.Description
DeviceCommand.StopWorkoutto the sealedDeviceCommandhierarchy.commandMutexand serialized HID request/response transactions withioMutex, and routedwriteFeaturethroughwriteFeatureSerialized.V1Session(stopWorkoutSafely) that discards pending writes, forcesKPH=0+WORKOUT_MODE=PAUSE, confirms belt halt viahaltBeltConfirmed(reason), writesWORKOUT_MODE=IDLEand optionally confirms it, and kept USB session connected;gracefulEndForDisconnectupdated to callhaltBeltConfirmed("disconnect").pollOncerun underioMutexand addedlogSafetyWritesto log explicit writes forWORKOUT_MODE,KPH,IDLE_MODE_LOCKOUT, andREQUIRE_START_REQUESTED; added additional console-init / transition-to-active handling to avoid starting treadmills implicitly.StopWorkoutas equivalent to pause on V2 devices inV2Session, and updatedFitProDeviceService.stopWorkout()to sendDeviceCommand.StopWorkout.StartFromDevice,PauseFromDevice,StopFromDevice) to public slots inhomeform.hto allow device implementations to invoke them without echoing commands to the physical console.Testing
Codex Task