Repository navigation
fix: AZ ALT drivers staying energized on 0 length moves - #311
Merged
Merged
Conversation
ClutchplateDude
approved these changes
Oct 13, 2026
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.
Problem
When "Move AZ/ALT to home" is used in OATControl (
:MAAH#) while both AZ and ALT are already at home, the AZ/ALT drivers are enabled but never disabled again. They stay powered at full hold current until the next real AZ/ALT move, and the motors overheat.The same happens with any other zero-length AZ/ALT move, e.g.
:MAZ0#/:MAL0#.Cause
moveAZALTToHome(),moveBy()andmoveStepperBy()callenableAzMotor()/enableAltMotor()(EN LOW) and then queue the move. The drivers are only disabled again inMount::loop(), when_azAltWasRunningis set and neither stepper is running anymore._azAltWasRunningis only set once a stepper is actually seen running. For a zero-step move that never happens, sodisableAzAltMotors()is never called.Fix
enableAzMotor()/enableAltMotor()now set_azAltWasRunning = true. On its next pass,Mount::loop()disables the drivers (still respectingAZ_ALWAYS_ON/ALT_ALWAYS_ON) and stores the AZ/ALT positions to EEPROM, whether or not the move had any steps.All callers enable the driver and queue the move in the same call, with no
loop()in between, so a real move can't be disabled before it starts. The only side effect is one EEPROM position write per zero-length move.Tested on hardware.
🤖 Generated with Claude Code