aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
Commit message (Collapse)AuthorAgeFilesLines
* toolhead: Flush in chunks from flush_step_generation()Kevin O'Connor2023-01-081-2/+8
| | | | | | | | | If note_kinematic_activity() has a time far in the future it could result in a single flush attempt of that time range. Be sure to break up that range into small chunks using the normal _update_move_time() mechanism. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Rename last_kin_flush_time to force_flush_timeKevin O'Connor2023-01-081-8/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Fix note_kinematic_activity()Kevin O'Connor2023-01-081-1/+1
| | | | | | | | It was possible a note_kinematic_activity() call could increase last_kin_move_time, but _process_moves() could reset it. Fix by making sure _process_moves() only ever increases last_kin_move_time. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Capture current junction_deviation in a Move classDmitry Butyugin2022-10-171-3/+4
| | | | | | | If a maximum acceleration is changed between two consecutive moves, this allows to correctly compute the junction velocity between them. Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* toolhead: Fix toolhead stop on SET_VELOCITY_LIMIT (#5053)Stephen Hurd2021-12-301-1/+0
| | | | | This fixes issue #5050 Signed-off-by: Stephen Hurd <deuce@synchro.net>
* toolhead: change SET_VELOCITY_LIMIT respond (fixed) (#4620)Stefan Dej2021-08-311-10/+19
| | | | | Returns only the current values if no new ones have been passed. Signed-off-by: Stefan Dej <meteyou@gmail.com>
* Revert "toolhead: change SET_VELOCITY_LIMIT respond behavior"Kevin O'Connor2021-08-241-19/+7
| | | | | | This reverts commit 9f75e348b06f494c0aa4181867b92013f72a9278. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: change SET_VELOCITY_LIMIT respond behaviorstefand2021-08-241-7/+19
| | | | | | Returns only the current values if no new ones have been passed. Signed-off-by: Stefan Dej <meteyou@gmail.com>
* trapq: Store toolhead.set_position() updates in trapq historyKevin O'Connor2021-07-291-1/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Rename trapq_free_moves() to trapq_finalize_moves()Kevin O'Connor2021-07-291-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Do not limit SET_VELOCITY_LIMIT to values specified in configKevin O'Connor2021-04-301-8/+4
| | | | | | | Allow a larger velocity, accel, and square_corner_velocity than what is specified in the config file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Do not set min_stop_interval in micro-controllerKevin O'Connor2021-04-301-6/+0
| | | | | | | | The min_stop_interval safety check is fragile and leads to a notable amount of complexity. Avoid these issues by not programming this safety check. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Export the print_stalls value via get_status()Kevin O'Connor2021-04-091-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Make sure input_shaper movement starts after endstop checkingKevin O'Connor2021-03-291-0/+1
| | | | | | | | | | Add a dwell() to the start of drip_move() to ensure that input_shaper movements scheduled in advance of the nominal move time aren't scheduled prior to the homing start. (Otherwise the stepper may move prior to endstop checking, which can corrupt the "no movement" checks.) Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Make homing.py an "extras" moduleKevin O'Connor2021-01-081-2/+2
| | | | | | | Move klippy/homing.py to klippy/extras/homing.py and convert the code to an "extras" modules. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Move definition of CommandError and Coord from homing.py to gcode.pyKevin O'Connor2021-01-081-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kinematics: Calculate axis_minimum/axis_maximum in advanceKevin O'Connor2021-01-081-1/+2
| | | | | | | | Calculate the get_status() axis_minimum and axis_maximum fields in advance so that they don't need to be calculated on each get_status() call. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Fixed reporting of the kinematic limitsDmitry Butyugin2020-10-141-2/+3
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* homing: Prefer printer.command_error() instead of homing.CommandError()Kevin O'Connor2020-09-041-2/+2
| | | | | | | Update callers to use the printer.command_error reference instead of directly using homing.CommandError() when raising or catching errors. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Remove EndstopErrorKevin O'Connor2020-09-041-3/+3
| | | | | | | There's no reason to distinguish between an EndstopError and a CommandError, so just use CommandError. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Add a move.move_error() helperKevin O'Connor2020-09-031-0/+4
| | | | | | | Move the EndstopMoveError() code from homing.py to a new method in the toolhead Move class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_move: Move GCodeMove class from gcode.py to new extras moduleKevin O'Connor2020-08-201-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Move G4 and M400 commands from gcode.py to toolhead.pyKevin O'Connor2020-08-201-1/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Remove unused get_stats() dataKevin O'Connor2020-08-201-10/+2
| | | | | | | The "status" and "printing_time" are now available in the "idle_timeout" module, so no need to report them from toolhead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Add a manual_move() helper functionKevin O'Connor2020-08-201-0/+7
| | | | | | | | Add a helper function for submitting relative movements. This function will also automatically ensure gcode.reset_last_position() is called. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Automatically call reset_last_position() on a toolhead set_position()Kevin O'Connor2020-08-201-0/+1
| | | | | | | | Generate a "toolhead:set_position" event on a call to toolhead.set_position() and use that event to automatically call gcode.reset_last_position(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: report velocity and accel via get_statusArksine2020-08-011-1/+5
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* toolhead: Handle flush_step_generation() call after dwell()Kevin O'Connor2020-06-011-0/+1
| | | | | | | | | If self.kin_flush_delay changes after a G4 dwell command (or other non-kinematic time update) then it could lead to "internal step compression" errors. Make sure to handle this case in flush_step_generation(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rename try_load_module() to load_object()Kevin O'Connor2020-05-081-4/+3
| | | | | | | | Rename try_load_module() so that it uses consistent naming for "printer objects". Change the function to raise an error by default if the specified module does not exist. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Use new GCodeCommand wrappersKevin O'Connor2020-05-051-23/+19
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Implement a step+dir+step filterKevin O'Connor2020-03-131-3/+4
| | | | | | | | | | 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>
* Revert "itersolve: Implement a step+dir+step filter"Kevin O'Connor2020-03-051-4/+3
| | | | | | | | This reverts commit c9cb462f90a68deb73cacb179f7bbcde2cb9aeed. The step flushing for this commit was not complete. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Implement a step+dir+step filterKevin O'Connor2020-03-041-3/+4
| | | | | | | | | | 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>
* toolhead: Minor comment addition to calc_junction()Kevin O'Connor2020-02-281-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Replace notify callback with a completionKevin O'Connor2020-02-191-4/+2
| | | | | | | | | 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>
* toolhead: Add register_lookahead_callback() methodKevin O'Connor2020-01-031-0/+13
| | | | | | | 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>
* toolhead: Report which axes are homed via get_status()Kevin O'Connor2019-11-241-5/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Report the current extruder from the get_status() methodKevin O'Connor2019-11-241-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* force_move: Make sure to flush step generation queue after each moveKevin O'Connor2019-11-241-0/+2
| | | | | | | Add toolhead.note_kinematic_activity() call and use it to force the step generation to be flushed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Remove support for lookahead() methodKevin O'Connor2019-11-211-16/+4
| | | | | | | Now that the extruder lookahead method is no longer used it can be removed from the toolhead and extruder classes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Support step generation in lead up to and after stepper activityKevin O'Connor2019-11-211-17/+39
| | | | | | | | Add support for kinematic functions that calculate step times based on a range of the motion queue. This requires adding additional pause times when fully flushing the motion queue. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Rename _full_flush() to flush_step_generation() and use globallyKevin O'Connor2019-11-211-6/+7
| | | | | | | Update code that modifies the low-level kinematics handlers to first call toolhead.flush_step_generation(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: No need to transition to Flushed state before entering Drip stateKevin O'Connor2019-11-211-3/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Don't report buffer_time stat during homingKevin O'Connor2019-11-151-0/+2
| | | | | | | The buffer_time info is misleading during a homing operation - just report zero instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Don't call _process_moves() if no moves presentKevin O'Connor2019-11-151-1/+3
| | | | | | | Don't transition to the normal movement state if there aren't any moves actually ready to be processed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Remove explicit active extruder trackingKevin O'Connor2019-11-131-4/+1
| | | | | | | There's no need to have special logic in gcode.py to track the active extruder. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper_enable: Move motor_off() logic to stepper_enable.pyKevin O'Connor2019-11-121-14/+0
| | | | | | | | Directly disable all the stepper motors on a global motor_off() from the StepperEnable() class in stepper_enable.py. This simplifies the toolhead and kinematic classes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Clear any pending pauses when a shutdown occursKevin O'Connor2019-11-071-4/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Rename register_move_handler() to register_step_generator()Kevin O'Connor2019-11-071-5/+5
| | | | | | | Rename the function so it is more clear what the step generation code path is. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Calculate and store axes_r in move classKevin O'Connor2019-11-061-7/+12
| | | | | | | | Calculate the ratio of axis distance to total move distance (axis_d / move_d) and store in a new member variable axes_r. This avoids needing to recalculate the value in other code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>