aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/homing.py
Commit message (Collapse)AuthorAgeFilesLines
* homing: Don't raise a TimeoutError from home_wait()Kevin O'Connor2020-02-191-5/+3
| | | | | | | Change home_wait() to return if the homing operation completed succesfully or not. This simplifies the callers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Replace notify callback with a completionKevin O'Connor2020-02-191-11/+14
| | | | | | | | | 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>
* homing: Add a "home_rails_begin" event notifierKevin O'Connor2020-02-151-1/+3
| | | | | | Also, rename the "homed_rails" event to "home_rails_end". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Merge home_prepare()/home_finalize() into move_begin/move_end eventsKevin O'Connor2020-02-151-14/+10
| | | | | | | | Collapse the "homing:move_begin", "homing:move_end", home_prepare(), and home_finalize() into two new events: "homing:homing_move_begin" and "homing:homing_move_end". This simplifies the homing code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Ability to set retract speed between homing moves (#2487)FanDjango2020-02-121-1/+1
| | | | | On the retract move between homing moves, use a different speed (typically a faster one). Signed-off-by: Mike Stiemke <fandjango@gmx.de>
* homing_heaters: Turn off heaters during homing/probing (#2486)FanDjango2020-02-121-0/+4
| | | Signed-off-by: Mike Stiemke <fandjango@gmx.de>
* homing: Don't assume homing occurs with a constant step rateKevin O'Connor2020-01-061-3/+12
| | | | | | | | Some kinematics do not result in a constant step rate during homing operations. Calculate the endstop checking rate using the total distance traveled on the axis divided by the axis step distance. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Rename _full_flush() to flush_step_generation() and use globallyKevin O'Connor2019-11-211-1/+4
| | | | | | | 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>
* homing: Use get/set_tag_position() to determine probed positionKevin O'Connor2019-11-131-6/+14
| | | | | | | Don't rely on get_commanded_position() to determine the final probe point. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop_phase: Use set_tag_position() instead of set_commanded_position()Kevin O'Connor2019-11-131-3/+3
| | | | | | | Use the new get/set_tag_position() calls to avoid altering the low-level kinematic position. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Add get/set_tag_position() and convert calc_position()Kevin O'Connor2019-11-131-3/+8
| | | | | | | | | Rename calc_position() to calc_tag_position() and have it calculate the value of the position from the last stepper set_tag_position() call. This enables the calc_tag_position() code to be more flexible as it can be run with arbitrary positions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper_enable: Move motor_off() logic to stepper_enable.pyKevin O'Connor2019-11-121-1/+1
| | | | | | | | 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>
* homing: Remove no longer needed homing time delay codeKevin O'Connor2019-07-101-30/+7
| | | | | | | | Now that homing is implemented via "drip moves", it is no longer necessary to round the homing speed and it is no longer necessary to add a delay for cpu processing time. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Implement homing via new toolhead "drip" movementKevin O'Connor2019-07-101-4/+9
| | | | | | | | | | | 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>
* homing: Catch the more generic CommandError during homingKevin O'Connor2019-06-061-4/+4
| | | | | | | Allow the low-level homing code to raise either a gcode.error or an EndstopError during a fault. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Use the same underlying error object for homing and gcode errorsKevin O'Connor2019-06-061-1/+4
| | | | | | | Introduce a homing.CommandError and use that as the basis for both gcode and EndstopError exceptions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: "gcode_position" and toolhead "position" as get_status() named tupleKevin O'Connor2019-06-041-2/+4
| | | | | | | 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>
* bltouch: Verify probe always deploys during a homing operationKevin O'Connor2019-01-211-1/+5
| | | | | | | | | Verify that there is always some movement during a probing operation. This is normally done by the homing.py code (via its verify_movement check), but that check may not be enabled when z_virtual_endstop is used. So, always enable the check in the bltouch.py code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Always start endstop checking before the nominal move startKevin O'Connor2019-01-101-0/+2
| | | | | | | Make sure the endstop checking is started prior to any movement. This helps ensure the verify_movement check is accurate. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop_phase: Move endstop phase homing code to new "extras" moduleKevin O'Connor2018-10-161-8/+8
| | | | | | | Move the endstop phase tracking code from stepper.py to a new extras/endstop_phase.py module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Pass printer instead of toolhead object to Homing classKevin O'Connor2018-10-161-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Move homing offset adjustment logic to generic homing codeKevin O'Connor2018-10-101-0/+8
| | | | | | | Move the "stepper phase" adjustment logic from the kinematic classes to the generic homing.py code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Implement second home from homing.pyKevin O'Connor2018-10-101-29/+42
| | | | | | | Move the logic for performing the second home from the kinematics classes to the generic homing code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* probe: Verify the toolhead moves at least some distance on a probeKevin O'Connor2018-10-011-16/+18
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* query_endstops: Move QUERY_ENDSTOP command to it own extras/ moduleKevin O'Connor2018-07-161-12/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* delta: Rename get_position() to calc_position()Kevin O'Connor2018-06-221-1/+1
| | | | | | | | Calculating the cartesian position from the stepper positions can be complex and cpu intensive, so rename it to calc_position() to be more descriptive. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Replace PrinterHomingStepper with PrinterRailKevin O'Connor2018-06-221-5/+5
| | | | | | | | Update the code to use the term "rail" when dealing with a motor controlled "axis". A rail has a series of steppers and endstops that control that motor controlled "axis". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Apply speed rounding after calling home_prepare()Kevin O'Connor2018-05-141-4/+9
| | | | | | | | | | The step speed rounding and the cpu delay must be run after running the endstop specific preparation code. Otherwise, a delay in the home_prepare() code could undo those calculations. Specifically, this could lead to errors on a multi-mcu setup when the Z is homed using a virtual_z_offset and there is a delay in the activate_gcode section. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Position returned by M114 should be relative to last G92Kevin O'Connor2018-03-151-4/+0
| | | | | | | | It looks like OctoPrint is expecting the result from M114 to be relative to the last G92 command. Also, introduce GET_POSITION to report the actual location that the printer is at. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: allow to disable homing retractcruwaller2018-03-061-0/+2
| | | | | | Homing retract can be disabled by setting homing_retract_dist to 0. Signed-off-by: Petri Honkala <cruwaller@gmail.com>
* homing_override: Allow moves prior to homing an axisKevin O'Connor2018-01-281-1/+3
| | | | | | | 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>
* probe: Support activate/deactivate scripts on each probeKevin O'Connor2018-01-281-0/+4
| | | | | | | | Allow a set of g-code scripts to be run on each probe invocation. This may be useful for probes that need to be setup before they are useful (eg, with servo actuated probes). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* probe: Initial support for Z-Probe hardwareKevin O'Connor2018-01-281-2/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Handle speed rounding when homing speed greater than max_velocityKevin O'Connor2017-12-201-1/+11
| | | | | | | | | | Commit 002dc0df added rounding to the homing speed, but it did not work if the configured homing speed was less than the printer's maximum velocity. Move the speed rounding from stepper.py to homing.py and make sure the rounded speed is less than the maximum speed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Directly interact with the kinematic class on query_endstops()Kevin O'Connor2017-12-061-5/+7
| | | | | | 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-2/+9
| | | | | | | 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>
* homing: Make sure to clean up homing state even if homing failsKevin O'Connor2017-12-061-27/+35
| | | | | | | | | | | Make sure to always call MCU_endstop.home_wait() if MCU_endstop.home_start() is invoked. Rename MCU_stepper.note_homing_triggered() to note_homing_end() and make sure it is always called if MCU_stepper.note_homing_start() is invoked. With these changes, MCU_endstop.home_finalize() is no longer needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Pass list of endstops (not steppers) to the homing codeKevin O'Connor2017-12-061-24/+23
| | | | | | | The homing code wants the list of endstops to enable during a homing operation - it's confusing to pass the steppers. 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/+8
| | | | | | | | | 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>
* stepper: Add get_endstops() / set_position wrappersKevin O'Connor2017-11-181-18/+24
| | | | | | | Add wrappers around mcu_endstop and mcu_stepper so that the kinematic classes do not need to directly access these low-level classes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop: Eliminate end_stop_set_oversample commandKevin O'Connor2017-10-121-1/+4
| | | | | | | | | | Pass the sample_ticks and sample_count parameters directly in the end_stop_home command instead. This simplifies the code. Also, simplify calculation of next wakeup time in end_stop_oversample_event(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Report the raw MCU position from the M114 commandKevin O'Connor2017-10-031-1/+5
| | | | 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-1/+1
| | | | | | | | 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>
* homing: Move query_endstop() code from kinematic classes to homing.pyKevin O'Connor2017-09-191-7/+18
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Pass print_time directly to MCU callsKevin O'Connor2017-09-191-1/+1
| | | | | | | | | Now that the print_time is always synchronized with the mcu_time, there is no longer a need to track mcu_time as a separate quantity. Eliminate references to mcu_time from the code and pass print_time directly in its place. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Add a small delay before each homing operationKevin O'Connor2017-08-291-1/+5
| | | | | | | | | | | The homing operation can be cpu intensive for the host software. Add a small (250ms) delay before homing so that the host has additional time to process the command before it is due on the mcu. This is intended to work around some reports of "timer too close" errors during Z homing on RPi2 hosts and printers with high precision Z positioning. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Add get_mcu() call to the mcu oid objectsKevin O'Connor2017-08-291-1/+1
| | | | | | | | | Allow external code to obtain the mcu object that controls a pin setup with setup_pin(). Also, don't bother defining print_to_mcu_time() and system_to_mcu_time() on each pin object as they can be obtained via the new get_mcu() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Use newer "except XYZError as e" python syntaxKevin O'Connor2017-06-101-1/+1
| | | | | | Use the newer syntax for python exceptions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rework homing to use greenletsKevin O'Connor2016-12-091-56/+19
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rework endstop query to use greenletsKevin O'Connor2016-12-091-34/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>