[APP-16401] add microsteps#6031
Conversation
| // (a motor spec, e.g. 200 for a NEMA 17). The effective pulses-per-revolution | ||
| // on the step pin is TicksPerRotation * Microsteps. | ||
| TicksPerRotation int `json:"ticks_per_rotation"` | ||
| // Microsteps is the driver's microstep divisor (1, 2, 4, 8, 16, 32, ...), |
There was a problem hiding this comment.
This comment does not add much.
Seems also that it cannot be odd?
I'd consider updating.
| // Microsteps is the driver's microstep divisor (1, 2, 4, 8, 16, 32, ...), | ||
| Microsteps int `json:"microsteps,omitempty"` | ||
| // MaxRPM is the motor's maximum shaft speed and is the preferred way to cap | ||
| // the step-pin pulse frequency: maxFreq = MaxRPM * TicksPerRotation * Microsteps / 60. |
There was a problem hiding this comment.
maxFreq = MaxRPM * TicksPerRotation * Microsteps / 60
where is maxFreq come from?
There was a problem hiding this comment.
the comment wasn't formatted properly, the max frequency is the frequency if you wanted to drive the stepper motor at the max rpms
| if cfg.Pins.Step == "" { | ||
| return nil, nil, resource.NewConfigValidationFieldRequiredError(path, "step") | ||
| } | ||
| if cfg.Microsteps < 0 { |
There was a problem hiding this comment.
also make sure that it's not odd?
There was a problem hiding this comment.
we can't because 1 is a valid value
| Named: conf.ResourceName().AsNamed(), | ||
| theBoard: b, | ||
| stepsPerRotation: mc.TicksPerRotation, | ||
| stepsPerRotation: mc.TicksPerRotation * microsteps, |
There was a problem hiding this comment.
when microstepping the total counts for a rev is stepPerRev*microsteps
| if mc.StepperDelay > 0 { | ||
| logger.Warnf( | ||
| "motor (%s) has both max_rpm and stepper_delay_usec set; max_rpm wins. "+ | ||
| "stepper_delay_usec is deprecated, drop it from the config.", |
There was a problem hiding this comment.
if stepper delay is deprecated why did you give it a value above?
There was a problem hiding this comment.
because we technically still use it in the code to calculate requested frequency
Adding config field to set the
max_rpmandmicrostepsin a effort to make gpiostepper motor easier to configure.I didn't remove the
stepper_delay_usecfor backward compatibility