aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* toolhead: Don't clear sync_print_time on a get_next_move_time() callKevin O'Connor2018-10-151-8/+11
| | | | | | | | Only clear the internal sync_print_time flag if the code performs a regular "lazy" flush of the look-ahead queue. This helps build the look-ahead queue even when running internal scripts. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: M204 must update max_accel_to_decelKevin O'Connor2018-10-011-3/+3
| | | | | | | The max_accel_to_decel variable must not be greater than the max_accel variable. Make sure to check this when M204 changes max_accel. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Update look-ahead flush commentKevin O'Connor2018-09-251-3/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Set commanded_pos[] to move.end_posKevin O'Connor2018-09-111-1/+1
| | | | | | | | Commit 4573932f allowed move.end_pos to differ from the requested end position - the toolhead class should use the updated position when storing its commanded position. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Handle rounding errors with extrude only movesKevin O'Connor2018-09-111-1/+4
| | | | | | | | | It's possible that a g-code transform class may make an extrude only move appear as a kinematic move due to limitations of double precision math. Handle this by checking for an inconsequential move distance instead of checking for a move distance of exactly zero. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* statistics: Move stats handling to new "extras" moduleKevin O'Connor2018-09-021-0/+1
| | | | | | Move the generation of statistics to its own module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rename lookup_module_objects() to lookup_objects()Kevin O'Connor2018-09-021-1/+2
| | | | | | Rename the method and support returning all known objects. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Support M204 with P and T instead of SKevin O'Connor2018-09-021-1/+7
| | | | | | | Recent versions of Slic3r now send M204 with P and T instead of with S, so support that. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Forward original config error if raised in kinematics classKevin O'Connor2018-08-301-0/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>