aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* toolhead: Simplify set_junction() codeKevin O'Connor2019-11-061-7/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Use separate 'move' entries for accel, cruise, and decel phasesKevin O'Connor2019-11-061-1/+2
| | | | | | | | Only track a single acceleration movement in a 'struct move' instance. Break the classic trapezoid movement (accel, cruise, decel) into three separate movements. This simplifies the calculation logic. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Flush trapezoid velocity queue in batchesKevin O'Connor2019-11-061-73/+70
| | | | | | | | | | | | | Load all items from the look-ahead queue into the trapezoid velocity queue, and then flush that queue by time. This prevents the host cpu from being starved on very long moves (which may require a large number of steps to be generated). It also improves the overall performance. With the batch flushing logic in place, it is no longer necessary to split homing moves up. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Remove move_fill()Kevin O'Connor2019-11-061-7/+3
| | | | | | | Now that all callers use the trapq system to queue moves, it is no longer necessary to individually allocate and fill a 'struct move'. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Remove kinematic move() callKevin O'Connor2019-11-061-1/+0
| | | | | | | Now that all kinematics use the trapq system, there is no need to call into the kinematics on each g-code move. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Initial support for building a queue of trapezoidal velocity movesKevin O'Connor2019-11-061-6/+18
| | | | | | | | Add support for building a list of moves in the trapq.c code. Update the toolhead code so that moves generated from the look-ahead code are added to that list. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tuning_tower: Tool for tuning parameters based on print Z heightKevin O'Connor2019-10-011-0/+1
| | | | | | | This adds a testing tool that can run a command on each Z layer of a print. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Fix velocity jumps in accel_to_decel lookahead processingKevin O'Connor2019-09-261-2/+3
| | | | | | | | | When reducing the maximum speed due to the max_accel_to_decel setting, move velocity limits must still be propagated. Otherwise, the trapezoid move planner may produce moves with velocity jumps. Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Fix homing moves not apply kinematic acceleration limitsKevin O'Connor2019-09-011-2/+7
| | | | | | | During a "drip feed" move, both the move's maximum speed and maximum acceleration may be limited by the kinematics. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: No need to build entire look-ahead queue before homingKevin O'Connor2019-07-181-12/+6
| | | | | | | | It's not necessary to fully build up the look-ahead queue prior to starting a "drip move" homing operation. Instead, allow the look-ahead queue to flush normally. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Delay calculating homing print_time until ready to moveKevin O'Connor2019-07-121-1/+5
| | | | | | | | If the homing move is exceptionally long, it could take a long time for the host to process the look-ahead queue. Delay the print_time calculation until moves are ready to be sent. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Remove no longer needed reset_print_time()Kevin O'Connor2019-07-101-8/+2
| | | | | | | Now that homing is implemented via "drip moves", it is no longer necessary to move the print_time backwards. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Implement homing via new toolhead "drip" movementKevin O'Connor2019-07-101-6/+60
| | | | | | | | | | | Rework the low-level implementation of homing movement. The existing mechanism buffers all homing movement into the micro-controller prior to starting the home. Replace with a system that buffers all movement into the host look-ahead buffer and then "drip feed" those moves to the micro-controllers. Then clear the host look-ahead buffer when all endstops trigger. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Change the code to use more explicit state transitionsKevin O'Connor2019-07-101-27/+37
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Just warn if M204 doesn't contain valid S, P, or TKevin O'Connor2019-06-211-3/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Commands should still pause even when sync_print_timeKevin O'Connor2019-06-091-2/+3
| | | | | | | | If commands are slowly fed to the printer it could cause the number of queued commands to grow without bound. Be sure to pause the incoming command stream even if the lookahead queue is empty. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: "gcode_position" and toolhead "position" as get_status() named tupleKevin O'Connor2019-06-041-0/+1
| | | | | | | Add "gcode_position" named tuple to gcode.get_status(). Add a "position" named tuple to toolhead.get_status(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Change respond_info() to log by defaultKevin O'Connor2019-03-041-1/+1
| | | | | | | It makes sense to log most respond_info() content, so do that by default. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Wrap code to 80 columnsKevin O'Connor2019-02-271-5/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Use an event to handle restart request actionsKevin O'Connor2019-02-251-0/+4
| | | | | | | | Instead of directly turning off motors, heaters, and fans from gcode.py, raise a new event and allow the heater, fan, and toolhead to handle the event as needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* manual_stepper: Add an "extras" module for manually controlling a stepperKevin O'Connor2019-02-121-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* manual_probe: Add a helper script for performing manual Z probingKevin O'Connor2019-02-121-0/+1
| | | | | | Add MANUAL_PROBE and Z_ENDSTOP_CALIBRATE commands. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Convert printer_state("shutdown") to an event handlerKevin O'Connor2019-01-081-7/+5
| | | | | | | Convert all users of the printer_state("shutdown") handler to register a "klippy:shutdown" event handler instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Do not apply main printer accel/velocity to extrude only movesKevin O'Connor2019-01-041-3/+5
| | | | | | | Limit speed and acceleration of extrude only moves to just the max_extrude_only_velocity and max_extrude_only_accel config settings. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Don't report an error if request too high in SET_VELOCITY_LIMITKevin O'Connor2019-01-041-10/+8
| | | | | | | If a requested value is higher than the configured maximum, then just limit the value to the configured maximum instead of raising an error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* idle_timeout: Add printing/ready/idle trackingKevin O'Connor2018-10-281-1/+8
| | | | | | | Internally track the overall printer state. Generate events on state transitions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>