aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* idle_timeout: Move timeout handling from toolhead.py to new extras moduleKevin O'Connor2018-07-161-26/+9
| | | | | | | | Move the "motor_off_timeout" tracking to a new module in the extras/ directory. This makes it easier to customize the idle timeout behavior. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Replace junction_deviation with square_corner_velocityKevin O'Connor2018-07-161-11/+19
| | | | | | | | The junction_deviation configuration parameter has a number of quirks that make it difficult to configure. Replace it with a "square_corner_velocity" configuration parameter. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Fill cmove in toolhead instead of in each kinematic classKevin O'Connor2018-07-131-1/+12
| | | | | | This simplifies the kinematic classes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Move kinematic modules to new kinematics/ directoryKevin O'Connor2018-07-121-8/+13
| | | | | | | | Move extruder.py, cartesian.py, corexy.py, and delta.py to a new kinematics/ sub-directory. This is intended to make adding new kinematics a little easier. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: No need to pass printer reference to add_printer_objects()Kevin O'Connor2018-07-121-2/+2
| | | | | | The config reference already stores a reference to the printer object. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Disable all extruder motors on a motor_off()Kevin O'Connor2018-06-231-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: No need to pass printer reference to kinematic/stepper constructorsKevin O'Connor2018-06-221-8/+7
| | | | | | The config reference already stores a reference to the printer object. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Add support for the M204 commandKevin O'Connor2018-06-151-0/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Fix SET_PRESSURE_ADVANCE so that it works with multiple extrudersKevin O'Connor2018-05-201-0/+2
| | | | | | | Use the new gcode.register_mux_command() so that SET_PRESSURE_ADVANCE works correctly with multiple extruders. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Add a SET_VELOCITY_LIMIT commandKevin O'Connor2018-04-201-3/+38
| | | | | | | Add a command to adjust the maximum velocity, acceleration, and junction deviation parameters. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Allow max_accel_to_decel to be greater than max_accel in configKevin O'Connor2018-04-201-3/+3
| | | | | | | | | If max_accel_to_decel is greater than max_accel in the config, then just internally limit max_accel_to_decel to max_accel. This makes it easier to completely disable the max_accel_to_decel feature (as it can just be set to a high value in the config). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Limit junction speed of short movesKevin O'Connor2018-04-031-3/+8
| | | | | | | | | | | | | | | | | | | | The existing junction algorithm limits the speed between two moves by determining the maximum speed an arc between those two moves would have if the cetripetal acceleration of that arc did not exceed the printer's maximum acceleration. However, should the slicer send an actual arc to the printer, then the existing junction algorithm would not impose any significant limit on the travel speed of that arc. This would permit the head to travel in a circle at high velocity and with a greater centripetal acceleration than the printer's maximum acceleration. To avoid this, impose a limit on the junction velocity of short moves so that an approximate centripetal acceleration of that move does not exceed the move's acceleration limit. Suggested by Michael Barbour. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* display: Add initial support for LCD screens attached to an MCUKevin O'Connor2018-03-061-2/+14
| | | | | | | | Add support for displaying basic status information on ST7920 and HD44780 based LCDs that are attached directly to a micro-controller. Signed-off-by: Marcio Teixeira <marcio@alephobjects.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Allow any stats producer to determine when stats are neededKevin O'Connor2018-02-051-9/+5
| | | | | | | | Instead of using the toolhead class to determine if stats should be reported, allow every printer object with a stats() callback to determine if stats are needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing_override: Allow moves prior to homing an axisKevin O'Connor2018-01-281-2/+2
| | | | | | | Add support for disabling homing checks via the homing_override mechanism. This may be useful to move an axis prior to homing it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>