Some stepper motor drivers do not respond well to rapid "step +
direction change + step" events. In particular, it is believed this
can cause "over current" events on the tmc2208 drivers when they are
in "stealthchop" mode. Detect these events and remove them from the
generated step times.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the stepper changes direction then the average velocity since the
last step pulse isn't a good indicator of the next step pulse.
Instead, reset the bounds checking to use a low starting guess.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The queue_append system predates the iterative solver - it was useful
when many different kinematic functions directly added steps to the
step compression queues. With the iterative solver being the only
source of step generation, it is simpler to directly add steps from
the iterative solver code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use new mcu.lookup_query_command() for all commands that query
information from the micro-controller.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert standard queries to use the acknowledgments of the sent
command to determine if the response was received or not. This also
controls command retransmissions (should the response have been lost).
The tmc_uart.py will continue to use the old mechanism as the tmcuart
responses are not sent synchronously with the query command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add ability for the host code to get a notification when the ack for a
command sent to the micro-controller is received. This is in
preparation for improved detection of message loss between mcu and
host.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's not valid to set the TPWMTHRS in a "klippy:connect" event handler
because the TMCVirtualPinHelper and TMCCommandHelper classes were
expecting that field to be set during the config reading phase.
Revert "tmc: Fix typo preventing stealthchop threshold from being set"
This reverts commit 7d76067ff9.
Revert "tmc: Query the stepper step_distance from the stepper object"
This reverts commit 67b2852249.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change home_wait() to return if the homing operation completed
succesfully or not. This simplifies the callers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update the endstop code to return its trigger completion object during
home_start(). Update the toolhead class to take a completion object
(instead of creating its own). This reduces the number of
intermediate callbacks needed during a homing operation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It's simpler to query the "printing" status from the idle_timeout
module on an event than it is to track changes to the printing status.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce min_event_systime and rework the previous start_time,
last_event_time, and event_running flags into this one state tracking
variable.
This also makes a minor change to the behavior of the event_delay - it
is now calculated from the time the command completes execution
(instead of from when the event is first detected). This may make a
difference if there is a long running g-code command occurring during
the detection event.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rather than inherit from the BaseSensor, filament sensor implementatons
may instantiate the RunoutHelper and update the filament state via its
note_filament_present method.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add support for notifying the low-level probing handlers that a
multiple probe sequence is occurring. This is in preparation for the
bltouch code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Collapse the "homing:move_begin", "homing:move_end", home_prepare(),
and home_finalize() into two new events: "homing:homing_move_begin"
and "homing:homing_move_end". This simplifies the homing code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When overriding a g-code command, allow the caller to obtain the
previous command handler. Use this feature in homing_override and
safe_z_home.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't obtain the step_distance from the config, instead obtain
step_distance from the instantiated stepper object.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't obtain the step_distance from the config, instead obtain
step_distance from the instantiated stepper object.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
In the rare case where the step generation code finds an interval of
zero, it was possible for an integer division of a negative number to
cause an incorrect result. Fix that by using the idiv_up() and
idiv_down() helpers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There have been several reports that increasing the delay from 37us to
40us eliminates screen corruption on some clone hd44780 displays.
Increase the timeout value so that the standard code works on these
displays.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The caller can now determine which steppers are connected to cartesian
Z movement via the new stepper.is_active_axis() method. It is
therefore no longer necessary for the kinematic code to identify these
steppers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move interpolation checks to _init_mesh_params() so they can be done whle the config is being parsed. Do not allow a probe_count higher than 6 for lagrange interpolation, as this typically leads to oscillation.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Don't force probing when BED_MESH_MAP is executed, output the existing mesh. If the user wants to probe each time before a map they can do so with a gcode_macro.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Renamed some variables in set_mesh() previous called "mesh_min" and "mesh_max" to alleviate confusion with the config options.
Renamed several attributes for clarity. The "calibrate" attribute is now bmc, "probe_params" is now "mesh_params", "probed_z_table" is now "probed_matrix", "mesh_z_table" is now "mesh_matrix".
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Points are now logged after the printer is ready. The formatting is improved, printing out the point index, and its corresponding automatic and manual points.
BED_MESH_OUTPUT now includes a PGP parameter, if PGP=1 the generated points are printed to the terminal.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rename min_point, max_point, and bed_radius to mesh_min, mesh_max, and mesh_radius respectively. Add "mesh_origin" option, that allows round beds to specificy the center of the mesh.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Fix typo that resulted in _get_extended_params() being called for all
commands. Allow "extended" g-code commands to contain numbers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some kinematics do not result in a constant step rate during homing
operations. Calculate the endstop checking rate using the total
distance traveled on the axis divided by the axis step distance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The STEPPER_BUZZ command needs to know if the axis is using radians
instead of millimeters so that it can move a more appropriate
distance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a mechanism for obtaining the print_time via a callback instead of
by flushing the look-ahead queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The print_time parameter of heater.set_temp() is not currently used
and it isn't necessary to flush the look-ahead queue just get the
print_time. Remove the parameter from heater.set_temp() to avoid
flushing the look-ahead queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a null move is added as the first move on the trapezoid motion
queue then it could have a very large move->move_t value. This could
cause numerical stability issues with some advanced kinematic
formulas. Place a limit on the move_t value to avoid this.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This reverts commit 1b92af6078.
The standard "uc1701" lcd_type can now be used in place of the custom
"st7567" lcd_type.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the queuelogger was holding the lock when the process is forked
then any attempt to log from the background process would result in a
deadlock. Attempt a workaround by disabling the queuelogger at the
start of the background process.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Provide a list of available heater and sensor names to
gcode macro templates through the printer.heater.available_heaters
and printer.heater.available_sensors variables
Signed-off-by: Simon Kühling <mail@simonkuehling.de>
The builtin Tn command is not sufficiently flexible to control some
multi-extruder printers. Remove the command and encourage users to
define individual gcode_macros for each Tn instance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The M206 command isn't particularly standardized and isn't issued by
default from 3rd party software in their standard configurations.
Encourage users to use the more powerful SET_GCODE_OFFSET command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>