Rename step_sqrt/step_factor to step_accel/step_const and have them
directly take the velocity and acceleration in millimeters and
seconds. This simplifies the kinematic classes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Extend the endstop code so that more than one stepper can be halted
during endstop homing. Some kinematic setups (eg, corexy) require an
endstop to support this.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The previous calculation was only valid if the stepper is always
commanded to a position that is an exact multiple of the
step_distance. The safety check was programmed with a value too large
for other commanded positions, which could result in "No next step"
errors. Fix by changing the calculation to use the worst case
scenario.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the mcu objects can be created prior to connecting to the
mcu, it is no longer necessary to separate the init and build_config
phases in the high-level code. Move the mcu objection creation from
the build_config phase to the init phase and eliminate the
build_config phase.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a separate callback for setting the min_stop_interval.
Also, move the setting of the stepper max_error from the stepper
configs to the mcu config and rename it to max_stepper_error.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the default compression error window (max_error) from 50us to
25us - it's common for stepper motor drivers to have 30us for their
"pwm fixed off time" and it would be good for the steps to be
scheduled within that time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the config file so the maximum accel and velocity are specified
in the "printer" section instead of the individual "stepper" sections.
The underlying code limits the velocity and accel of the toolhead
relative to the print object, so it makes sense to configure the
system that was as well.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create the QueryEndstops in the gcode handler instead of in the
kinematic classes. This simplifies the gcode handler as it can
directly register its response callback.
Also, store the stepper name in the stepper class. Also, propagate
the print_time of the query request to the mcu_endstop class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Automatically reset the next step time to zero on a stepper_stop()
call. This makes the host code simpler as it no longer needs to
schedule an explicit reset_step_clock command on the step after a
homing operation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commits f0cefebf and 8f331f08 changed the way the code determined what
steps to take on fractional steps. Unfortunately, it was possible in
some situations for the C code to round differently from the python
code which could result in warnings and lost steps.
Change the code so that all fractional step handling is done in the C
code. Implementing the step rounding logic in one location avoids any
conflicts.
In order to efficiently handle the step rounding in the C code, the C
code has also been extended to directly send the "set_next_step_dir"
command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename get_homed_position() to get_homed_offset() and return the
endstop position delta in steps instead of an absolute position
relative to position_endstop. The conversion to absolute positions
can be dependent on the type of kinematics in use, so is inappropriate
to do in the low level stepper.py code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for enhancing the precision of endstop switches by also
inspecting the phase of the stepper motor when the endstop triggers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow the owner of the stepper object to cacluate the maximum step
jerk velocity. This is used to ensure there is no communication error
between mcu and host.
Disable checking of jerk velocity for extruder stepper motors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
All users of max_step_velocity and max_step_accel end up multiplying
by step_dist anyway, so it's easier to store max_velocity and
max_accel.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>