aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/bltouch.py
Commit message (Collapse)AuthorAgeFilesLines
* mcu: Return time of trigger from home_wait()Kevin O'Connor2021-08-171-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Ensure the z_offset is not negativeKevin O'Connor2021-06-221-1/+1
| | | | | | | It would not make sense to have a negative z_offset. Reported by @Yoyolick. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* probe: Call add_stepper() earlier in boot processKevin O'Connor2021-06-091-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Minor indentation changeKevin O'Connor2021-04-021-3/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Raise the probe as soon as the endstop triggersKevin O'Connor2021-04-021-9/+24
| | | | | | | | Start the raise sequence once the endstop notification arrives. This can reduce the response time as it does not require waiting for the homing sequence to fully finalize. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Use hmove.check_no_movement() to verify bltouch deployedKevin O'Connor2021-04-021-10/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Pass the HomingMove class to homing_move_begin/end eventsKevin O'Connor2021-03-291-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Move homing logic from manual_stepper.py to homing.pyKevin O'Connor2021-03-291-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Fix bug causing incorrect position when "stow_on_each_sample=False"Kevin O'Connor2020-10-241-0/+1
| | | | | | | | | It is only valid to call raise_probe() when the toolhead is not moving. Make sure to call sync_print_time() from multi_probe_end() to ensure that. This fixes a bug that could cause the Z axis steppers to lose their position when "stow_on_each_sample=False". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Add an extra 200ms delay to the initialization processKevin O'Connor2020-10-111-0/+2
| | | | | | | | | | On a reset, the mcu.py code may have sent an initialization message to the bltouch, which needs time to complete. Add additional time during the bltouch setup to avoid a race with these two times. This avoids some "timer too close" errors that users of fast host machines were reporting. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Remove EndstopErrorKevin O'Connor2020-09-041-5/+5
| | | | | | | There's no reason to distinguish between an EndstopError and a CommandError, so just use CommandError. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extras: Use "from . import module" for relative importsKevin O'Connor2020-06-151-1/+2
| | | | | | Use alternate import syntax to improve Python3 compatibility. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Add "probe in touch mode" optionKevin O'Connor2020-05-111-0/+4
| | | | Signed-off-by: Mike Stiemke <fandjango@gmx.de>
* bltouch: Simplify handling of command timingKevin O'Connor2020-05-111-28/+23
| | | | | | | | | | | | | | Always disable the PWM after each command sent. Automatically trim the command duration so the PWM disable doesn't increase the total pulse time (when the duration is 200ms or greater). Track the ideal command end time separately from the pwm transmit time and only delay toolhead moves to this ideal time. Update verify_state() to automatically schedule the check using the time of the last sent command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Use new GCodeCommand wrappersKevin O'Connor2020-05-051-8/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* probe: Rename probe_prepare/finalize to probe_prepare/finishKevin O'Connor2020-04-251-1/+1
| | | | | | | | The probe_finalize() name is used for callbacks in both the PrinterProbe and ProbePointsHelper classes. Rename the PrinterProbe callback to avoid confusion. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Revert "bltouch: No need to pause the toolhead for PWM off commands"Kevin O'Connor2020-04-041-6/+4
| | | | | | | | | | This reverts commit 5c8d15bbee9b1c4c82e3a2ecb5c63ce37f4a8dcb. The lower_probe() code was already manually optimizing the timing of the pwm disable, and that conflicted with the optimization in commit 5c8d15bb. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: No need to pause the toolhead for PWM off commandsKevin O'Connor2020-04-021-4/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Don't assume reset will do a pin_up in test_sensor()Kevin O'Connor2020-04-021-9/+16
| | | | | | | | | | | Some clones don't raise the pin on a reset and the ANTClabs BL-Touch sometimes doesn't raise the pin either. Rework the (infrequently called) sensor test code to always issue a pin_up command before the touch command. Also, perform a reset and retry if the sensor test fails. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Call sync_print_time() on multi_probe_end()Kevin O'Connor2020-04-021-0/+1
| | | | | | | Be sure to fully raise the probe prior to starting any future toolhead movements in the multi_probe_end() case. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Apply reset command for a full second on a raise_probe() failureKevin O'Connor2020-04-021-2/+1
| | | | | | | | If an error is found during the pin_up_not_triggered check, then apply the reset command for a full second (instead of just 100ms). This gives the bltouch more time to check its internal state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Separate out pin_up_not_triggered case in raise_probe()Kevin O'Connor2020-04-021-6/+9
| | | | | | | Simplify raise_probe() by separating out the pin_up_not_triggered case. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Don't raise an error in verify_state()Kevin O'Connor2020-04-021-18/+17
| | | | | | | Return the triggered state from verify_state() and update the callers to raise the error (if needed). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: BTLOUCH V3.0/V3.1 Enable 5V/OD mode set commands (#2540)FanDjango2020-02-231-0/+57
| | | Signed-off-by: Mike Stiemke <fandjango@gmx.de>
* homing: Don't raise a TimeoutError from home_wait()Kevin O'Connor2020-02-191-4/+2
| | | | | | | 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-4/+3
| | | | | | | | | 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>
* bltouch: Add support for stow_on_each_sampleFanDjango2020-02-151-8/+23
| | | | Signed-off-by: Mike Stiemke <fandjango@gmx.de>
* probe: Add multi_probe_begin() / multi_probe_end() callbacksKevin O'Connor2020-02-151-0/+4
| | | | | | | | Add support for notifying the low-level probing handlers that a multiple probe sequence is occurring. This is in preparation for the bltouch code. 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-4/+2
| | | | | | | | 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>
* kinematics: Remove support for identifying Z steppersKevin O'Connor2020-01-231-2/+3
| | | | | | | | | The caller can now determine which steppers are connected to cartesian Z movement via the new stepper.is_active_axis() method. It is therefore no longer necessary for the kinematic code to identify these steppers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Rename _full_flush() to flush_step_generation() and use globallyKevin O'Connor2019-11-211-0/+2
| | | | | | | 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>
* bltouch: No need to call get/set_commanded_position()Kevin O'Connor2019-11-131-4/+0
| | | | | | | Now that the homing code does not call set_commanded_position(), it is no longer necessary to save/restore the position in the bltouch code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Remove add_to_endstop() methodKevin O'Connor2019-11-121-1/+1
| | | | | | | Now that the PrinterStepper and MCU_stepper classes have been merged, there is no need for the add_to_endstop() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Improve handling of low pin_move_time configurationKevin O'Connor2019-09-141-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Implement homing via new toolhead "drip" movementKevin O'Connor2019-07-101-3/+4
| | | | | | | | | | | 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>
* mcu: Integrate query_endstop_wait() into query_endstop()Kevin O'Connor2019-07-101-1/+0
| | | | | | There is no need to have two separate calls to query an endstop. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* probe: No need to re-raise an EndstopErrorKevin O'Connor2019-06-061-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Update command timingKevin O'Connor2019-05-261-5/+5
| | | | | | | | | | | | | | | | | Prior to the BLTouch v3, the recommended command times were 700us (pin_down), 1200us (touch_mode), 1500us (pin_up), 1800us (self_test), and 2200us (reset). However, the recommended Marlin timing (via servo "angles") was 647.111, 1162.667, 1472, 1781.333, and 2193.778us. As of the BLTouch v3, the recommended times are now 650, 1165, 1475, 1780, and 2190us. The v3 continues to recommended Marlin timings of 647.111, 1162.667, 1472, 1781.333, and 2193.778us. Update Klipper to use the new BL-Touch v3 recommended timing. The new timings are required for the BL-Touch v3 and they are closer to what the Marlin firmware has historically used. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Change respond_info() to log by defaultKevin O'Connor2019-03-041-4/+1
| | | | | | | It makes sense to log most respond_info() content, so do that by default. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Issue just a pin_up command on a normal raise probe attemptKevin O'Connor2019-02-041-1/+2
| | | | | | | | In the normal case, a regular pin_up command should be sufficient to raise the probe. (Should the regular pin_up fail, the code can issue a "reset" command during the retry.) Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Increase default pin_move_time from 200ms to 675msKevin O'Connor2019-02-041-1/+1
| | | | | | Use the same pin move time that Marlin uses. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Don't error on startup if the bltouch is in an error stateKevin O'Connor2019-01-311-1/+1
| | | | | | | | | Stopping the connect sequence can make it difficult to get the bltouch out of an error state. Allow the connect to proceed, ideally if the bltouch stays in an error state it will be detected during the first probe attempt. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Retry reset/pin_up if the raise probe attempt failsKevin O'Connor2019-01-311-8/+20
| | | | | | | There's no harm in retrying the attempt if it appears to have failed for some reason. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Take into account clock skew when calculating command durationKevin O'Connor2019-01-211-1/+5
| | | | | | | | We want the duration of each command to be an exact multiple of SIGNAL_PERIOD. The durations might not be exact if the bltouch is on a secondary mcu. Account for this in send_cmd(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Add a pin_up_touch_mode_reports_triggered config optionKevin O'Connor2019-01-211-2/+4
| | | | | | | Rework the undocumented test_sensor_pin config option into a pin_up_touch_mode_reports_triggered option and document it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Raise probe on startupKevin O'Connor2019-01-211-6/+16
| | | | | | | Send a pin_up command during startup and try to verify that the probe actually raises. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Attempt to verify that the probe raises after each probe attemptKevin O'Connor2019-01-211-13/+22
| | | | | | | | Query the bltouch state during the pin_up command to try and verify that the probe does actually retract. This may be useful to detect if the bltouch enters into an "error" state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Use pin_down mode for probingKevin O'Connor2019-01-211-3/+7
| | | | | | | | | | | | The BLTouch is more accurate when probing in "pin_down" mode than "touch_mode" (at least on some hardware). Rework the code to use that mode. When probing in pin_down mode, the BLTouch can go into an error state if a pin_up is not sent immediately after a touch signal. Rework the pin_up code to reduce the time it takes to transmit the command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Simplify time keeping of scheduled eventsKevin O'Connor2019-01-211-26/+33
| | | | | | | Introduce a sync_print_time() method and update send_cmd() to track the duration of bltouch commands. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bltouch: Verify probe always deploys during a homing operationKevin O'Connor2019-01-211-0/+7
| | | | | | | | | 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>