Fix calibration adjustments to move immediately#52
Conversation
csader
left a comment
There was a problem hiding this comment.
Clean, well-scoped fix. The extraction into tuning.py with validation and tests is solid, and removing the redundant client-side goto_char requests makes sense now that the backend previews immediately.
One question before I merge: can you confirm the g command (m{id}g{position}) is "goto absolute step position"? The old code was sending goto_char (character index) client-side — the new approach sends a step position directly, which is semantically different. Just want to make sure the firmware handles g as an absolute step goto rather than a character index.
Also noting there's no upper-bound validation on step_position (module_id caps at 254, char_index at 63, but step_position only rejects negatives). Not blocking — firmware should reject out-of-range values — but worth considering for consistency.
Looks good to merge once confirmed.
b47c9a6 to
5a347d0
Compare
|
As for the g command - it's referenced here as
I also added upper-bound validation so the step must be within the module’s calibrated revolution range: 0 <= step_position < calibration_steps. |
csader
left a comment
There was a problem hiding this comment.
Clean, focused change. The g command approach is the right call — re-sending the character index could be ignored since firmware still considers that flap active.
Extraction into tuning.py with validation and tests is solid. Ready to merge.
This pull request refactors how fine-tuning adjustments are sent to hardware modules, ensuring that after a correction is applied, the module immediately moves to the new position for user feedback. It introduces a helper function for building adjustment commands, updates the backend to use this helper, removes redundant client-side requests, and adds tests for the new logic. User-facing descriptions have also been updated for clarity.
Backend improvements:
build_tuning_adjust_commandsintuning.pyto generate commands that both save a tuning adjustment and immediately preview it by moving the module.auto_tune_routeinserver/app.pyto use the new helper, ensuring that after an adjustment, the module is moved immediately for feedback. The response now also indicates that the adjustment was previewed.tests/test_tuning.pyto verify thatbuild_tuning_adjust_commandsgenerates the correct commands and properly validates input.Frontend changes:
app.jsthat previously re-sent the same character index after an adjustment, since the backend now handles immediate previewing. [1] [2] [3]User interface updates:
index.htmlto clarify that corrections now move modules immediately, and that negative corrections may require a full forward revolution. [1] [2]