Commit Graph

43 Commits

Author SHA1 Message Date
Kevin O'Connor c590bf7643 probe: Rename probe_prepare/finalize to probe_prepare/finish
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>
2020-04-25 12:01:52 -04:00
Kevin O'Connor a028aeaf78 Revert "bltouch: No need to pause the toolhead for PWM off commands"
This reverts commit 5c8d15bbee.

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>
2020-04-04 18:51:53 -04:00
Kevin O'Connor 5c8d15bbee bltouch: No need to pause the toolhead for PWM off commands
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-02 08:25:22 -04:00
Kevin O'Connor 9f2a025762 bltouch: Don't assume reset will do a pin_up in test_sensor()
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>
2020-04-02 08:25:22 -04:00
Kevin O'Connor 2b916e79c7 bltouch: Call sync_print_time() on multi_probe_end()
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>
2020-04-02 08:25:22 -04:00
Kevin O'Connor 5e207d2baa bltouch: Apply reset command for a full second on a raise_probe() failure
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>
2020-04-02 08:25:22 -04:00
Kevin O'Connor 3646cc0140 bltouch: Separate out pin_up_not_triggered case in raise_probe()
Simplify raise_probe() by separating out the pin_up_not_triggered
case.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-02 08:25:22 -04:00
Kevin O'Connor 87bfa06b9e bltouch: Don't raise an error in verify_state()
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>
2020-04-02 08:25:22 -04:00
FanDjango 16ecf15a91
bltouch: BTLOUCH V3.0/V3.1 Enable 5V/OD mode set commands (#2540)
Signed-off-by: Mike Stiemke <fandjango@gmx.de>
2020-02-23 22:32:07 -05:00
Kevin O'Connor 804f95ebe4 homing: Don't raise a TimeoutError from home_wait()
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>
2020-02-19 12:20:00 -05:00
Kevin O'Connor fbbbbc85cf homing: Replace notify callback with a completion
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>
2020-02-19 11:45:44 -05:00
FanDjango 086c131bbf bltouch: Add support for stow_on_each_sample
Signed-off-by: Mike Stiemke <fandjango@gmx.de>
2020-02-15 17:58:56 -05:00
Kevin O'Connor 1dd952ac65 probe: Add multi_probe_begin() / multi_probe_end() callbacks
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>
2020-02-15 17:52:44 -05:00
Kevin O'Connor feb15eaf2e homing: Merge home_prepare()/home_finalize() into move_begin/move_end events
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>
2020-02-15 17:52:44 -05:00
Kevin O'Connor 8ed0f7c5c3 kinematics: Remove support for identifying Z steppers
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>
2020-01-23 20:47:01 -05:00
Kevin O'Connor 2843c85019 toolhead: Rename _full_flush() to flush_step_generation() and use globally
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>
2019-11-21 13:17:45 -05:00
Kevin O'Connor 18b0749163 bltouch: No need to call get/set_commanded_position()
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>
2019-11-13 19:35:26 -05:00
Kevin O'Connor a4995c61c9 stepper: Remove add_to_endstop() method
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>
2019-11-12 17:32:18 -05:00
Kevin O'Connor 63311b2348 bltouch: Improve handling of low pin_move_time configuration
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-14 15:16:26 -04:00
Kevin O'Connor 43064d197d homing: Implement homing via new toolhead "drip" movement
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>
2019-07-10 10:43:20 -04:00
Kevin O'Connor b2c778b931 mcu: Integrate query_endstop_wait() into query_endstop()
There is no need to have two separate calls to query an endstop.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Kevin O'Connor 1fd490ddf9 probe: No need to re-raise an EndstopError
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor 7702cc2972 bltouch: Update command timing
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>
2019-05-26 11:09:32 -04:00
Kevin O'Connor 1731fbbca4 gcode: Change respond_info() to log by default
It makes sense to log most respond_info() content, so do that by
default.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-04 13:04:18 -05:00
Kevin O'Connor 4c48c1e8e4 bltouch: Issue just a pin_up command on a normal raise probe attempt
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>
2019-02-04 18:03:07 -05:00
Kevin O'Connor 345a5f4e1f bltouch: Increase default pin_move_time from 200ms to 675ms
Use the same pin move time that Marlin uses.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-04 18:02:53 -05:00
Kevin O'Connor 3b6ddb08a1 bltouch: Don't error on startup if the bltouch is in an error state
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>
2019-01-31 09:43:35 -05:00
Kevin O'Connor a5d3d161d3 bltouch: Retry reset/pin_up if the raise probe attempt fails
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>
2019-01-31 09:43:29 -05:00
Kevin O'Connor 5a6a429bc0 bltouch: Take into account clock skew when calculating command duration
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>
2019-01-21 09:56:08 -05:00
Kevin O'Connor 8a97bc592b bltouch: Add a pin_up_touch_mode_reports_triggered config option
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>
2019-01-21 09:52:11 -05:00
Kevin O'Connor 56141c21d7 bltouch: Raise probe on startup
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>
2019-01-21 09:52:11 -05:00
Kevin O'Connor e36122797b bltouch: Attempt to verify that the probe raises after each probe attempt
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>
2019-01-21 09:52:11 -05:00
Kevin O'Connor 99f96f2832 bltouch: Use pin_down mode for probing
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>
2019-01-21 09:52:11 -05:00
Kevin O'Connor 04f5baa182 bltouch: Simplify time keeping of scheduled events
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>
2019-01-21 09:52:11 -05:00
Kevin O'Connor 26e818d900 bltouch: Verify probe always deploys during a homing operation
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>
2019-01-21 09:52:11 -05:00
Kevin O'Connor d0f09727a9 bltouch: Issue both a "reset" and a "pin_up" after a successful probe
Not all BLTouch clones raise the pin on a "reset" request, so
explicitly send a "pin_up" command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-16 11:06:46 -05:00
Kevin O'Connor ccc25a03d5 bltouch: Add a config option to disable the bltouch sensor test
It appears some bltouch "clones" do not report the probe as triggered
when put in "touch mode" while the pin is raised.  Add a config option
to allow users to disable the test.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-16 11:06:41 -05:00
Kevin O'Connor ce064e6e2d bltouch: Always make sure to check the endstop at least every 1ms
Some of the bltouch implementations may only respond to a probe event
with a 5ms pulse.  Make sure to check the signal pin at least every
millisecond to ensure no signal is lost.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-16 11:06:27 -05:00
Kevin O'Connor 76b57ba05a bltouch: Fix typo in pin_move_time parsing
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-04 11:43:04 -05:00
Kevin O'Connor 44aa5def73 bltouch: Allow the pin_move_time to be configured
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-04 10:34:54 -05:00
Kevin O'Connor e0b2d7c51d bltouch: Add a BLTOUCH_DEBUG command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-03 22:52:32 -05:00
Kevin O'Connor aac92ffb91 bltouch: Fix bug - must restore stepper position after homing
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-01 22:09:06 -05:00
Kevin O'Connor 824e55d75a bltouch: Add initial support for a bltouch "extras" module
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-30 11:34:20 -05:00