aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* klippy: Rework shutdown handlingKevin O'Connor2017-10-121-6/+4
| | | | | | | | | If an MCU signals a shutdown from the background thread, notify the main thread and handle the shutdown there. Dispatch shutdown handling from the main Printer() class instead of from the Toolhead class. This simplifies the shutdown logic. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cartesian: Fix min_stop_interval calculation errorKevin O'Connor2017-10-121-2/+3
| | | | | | | | It is possible to have an acceleration greater than max_z_accel on XY+Z moves. That needs to be taken into account when calculating the min_stop_interval. This prevents spurious "No next step" MCU errors. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Report the raw MCU position from the M114 commandKevin O'Connor2017-10-031-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Make sure reset_print_time() doesn't go backwards in timeKevin O'Connor2017-09-271-2/+3
| | | | | | | | Update the homing code to pass in the start of the homing operation to toolhead.reset_print_time(). This prevents an error when batch processing gcode files that contain multiple homing operations. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Avoid using '%' syntax when calling logging moduleKevin O'Connor2017-09-271-1/+1
| | | | | | | The logging module can build strings directly from printf syntax - no need to build the string first. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Initial support for multiple micro-controllersKevin O'Connor2017-09-201-6/+11
| | | | | | | | | Add initial support for controlling multiple independent micro-controllers from a single Klippy host instance. Add basic support for synchronizing the clocks of the additional mcus to the main mcu's clock. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* clocksync: Don't export get_last_clock()Kevin O'Connor2017-09-191-0/+1
| | | | | | | Everywhere the data in get_last_clock() is used can be done just as easily with estimated_print_time(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Separate is_active() code from stats() codeKevin O'Connor2017-09-191-6/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Move query_endstop() code from kinematic classes to homing.pyKevin O'Connor2017-09-191-4/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Synchronize print_time to main mcu's timeKevin O'Connor2017-09-191-66/+47
| | | | | | | | Instead of starting the print_time at zero, start it at the estimated time of the main mcu's clock. This simplifies the code and it ensures that print_time never goes backwards. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Use is_fileoutput() externallyKevin O'Connor2017-09-191-1/+1
| | | | | | | Use mcu.is_fileoutput() instead of looking up the "debugoutput" flag in the start args. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Permit look-ahead between Z movesKevin O'Connor2017-09-031-7/+8
| | | | | | | | Extend the look-ahead mechanism to work between moves that contain Z movement. This improves Klipper's handling of g-code produced in "vase mode". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Eliminate set_max_jerk() from kinematic classesKevin O'Connor2017-09-031-14/+17
| | | | | | | | Allow the kinematic classes to query the max velocity, max accel, and max halt velocity from the toolhead class instead of having the toolhead class call into the kinematic classes with those values. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Avoid directly accessing the printer.mcu fieldKevin O'Connor2017-08-261-11/+14
| | | | | | | Lookup the mcu object from the printer objects and store it locally in the toolhead class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Store printer startup parameters in new "start_args" dictionaryKevin O'Connor2017-08-251-0/+2
| | | | | | | | | Store pertinent information from the software startup in a dictionary that the various printer components can access instead of in individual variables in the Printer() class. This makes it easier to add future command-line options. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Add initial support for multi-extrudersKevin O'Connor2017-06-091-7/+16
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Allow each module to define their config sectionsKevin O'Connor2017-06-091-0/+3
| | | | | | | | Create add_printer_objects() functions in the fan, heater, extruder, and toolhead modules. Create the necessary printer component objects from this call instead of placing the code directly in klippy.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Don't log stats when the printer is idleKevin O'Connor2017-04-141-5/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Support minimum/maximum value checks on configuration variablesKevin O'Connor2017-04-111-10/+17
| | | | | | | Verify that numeric parameters are in a sane range when reading the config. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* corexy: Initial corexy kinematic implementationKevin O'Connor2017-04-031-1/+2
| | | | | | Add initial support for corexy kinematics. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Increase the motor_off_time default to 10 minutesKevin O'Connor2017-03-301-1/+1
| | | | | | | Increase the default motor_off_time from 1 minute to 10 minutes. The small value is a common source of confusion. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>