aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* klippy: Support generic printer_state() and stats() callbacksKevin O'Connor2018-01-281-6/+7
| | | | | | | | | | | Instead of hardcoding which objects are called on state transitions, allow any "printer object" to be invoked if it has a printer_state() method. Convert connect, ready, shutdown, and disconnect callbacks to this mechanism. Similarly, allow all printer objects to provide a stats() callback. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Add access methods and avoid peeking into the printer classesKevin O'Connor2018-01-281-3/+3
| | | | | | | | | Add get_reactor(), lookup_object(), lookup_module_objects(), and set_rollover_info() to the main Printer class so that callers do not need to peek into the class' members. Similarly, add get_printer() and get_name() methods to the ConfigWrapper class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Improve tracking of print_stallKevin O'Connor2018-01-121-7/+9
| | | | | | | | | | | | | | The previous code increases print_stall if a move is proactively flushed due to buffer_time_low and a follow up move is ready to send before the existing moves are fully retired. However, this would not track the case where a move is proactively flushed and it takes an extended amount of time to get sufficient moves to refill the queue. Change the code so that print_stall increases anytime a new move is queued after a proactive flush and there are existing moves not yet fully retired. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Allow junction_deviation to be set to zeroKevin O'Connor2017-12-181-1/+1
| | | | | | | Allow lookahead to be effectively disabled by setting junction_deviation to zero. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Directly interact with the kinematic class on query_endstops()Kevin O'Connor2017-12-061-3/+0
| | | | | | Move the query_endstop logic out of toolhead.py and into homing.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Directly interact with the kinematic class when homingKevin O'Connor2017-12-061-6/+2
| | | | | | | Move the homing logic out of toolhead.py and into homing.py. This simplifies the toolhead logic and centralizes the homing code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Simplify exception handlingKevin O'Connor2017-12-061-1/+5
| | | | | | | | Translate caught exceptions into a gcode.error() exception. This way there is one standard place to invoke respond_error(). Also, always reset the last_position on a handled error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Base homing cpu delay on estimated number of steps neededKevin O'Connor2017-11-291-2/+3
| | | | | | | | | Instead of adding 250ms to each homing operation add a time relative to the number of estimated steps that are to be generated. This scales the delay to really large axes without adding a delay for normal users. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>