Firmware flow
How angular error becomes a motor-speed request
Complete selected stabilisation routine.
Read the current angle, subtract it from the target, scale the error using the step settings and pass that value to the stepper speed function.
The computed value is passed to a speed setter, not to a position-move command. The excerpt does not establish closed-loop stability, tuning or a tested accuracy.
Read the implementation
stabilizeMotor · selected source lines 149–155. Source inspection is not a hardware test.
void stabilizeMotor() {
float currentAngle = getMPUAngle();
float angleError = mpuTargetAngle - currentAngle;
float stepsToMove = angleError * (stepsPerRevolution * microstepSetting / 360.0); // Map angle to steps
stepper.setSpeed(stepsToMove);
stepper.runSpeed();
}Open the exact source-level diagramTechnical notes
Direction control
moveLeft() and moveRight() provide explicit direction-control operations.
Sweep mode
toggleSweep() and sweepMotor() distinguish selecting a sweep mode from executing it. That separation gives a movement pattern its own ongoing state.
IMU feedback
The development work connects IMU orientation feedback with the stepper platform’s movement commands.