Repository navigation
fix(state): sync actuator state when the active config changes - #9
Merged
Merged
Conversation
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.
What and why
Actuator state was only initialised at startup, so loading, uploading, replacing, patching or reloading a config left
actuator_statesout of step with the new config. AddedRuntimeState.sync_actuators(): actuators that stay keep their stored state (the last command sent to hardware), new ones and ones whose type changed get their initial state, and removed ones are dropped. The config routes now share_publish_config(), which syncs, then broadcastsconfig_updateandactuator_statesto clients. Extracted_initial_state()frominitialize_all()so both paths use it.Closes UTATRocketry/Nova-Collected#23
How was this tested?
Added
tests/test_actuator_state_sync.pywith three cases: switching configs adds, removes and keeps actuators; a type change resets state; and syncing from empty matchesinitialize_all.Hardware impact
hardware-risklabel; a lead must approve!, link the matching PRs:It doesn't send any commands. It changes which actuator state the backend holds and shows after a config change, which operators rely on when commanding valves, so I'm treating it as hardware-risk.
Checklist
dev(ormainfor a release/hotfix, or with a reason given above).envfiles or build output committed