Merge pull request #5729 from Bob-the-Kuhn/guaranteed-BLTouch-detection

guaranteed BLTouch detection
This commit is contained in:
Scott Lahteine
2017-02-12 01:13:35 -06:00
committed by GitHub
4 changed files with 106 additions and 26 deletions

View File

@ -388,7 +388,7 @@ int feedrate_percentage = 100, saved_feedrate_percentage,
flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100);
bool axis_relative_modes[] = AXIS_RELATIVE_MODES,
volumetric_enabled =
volumetric_enabled =
#if ENABLED(VOLUMETRIC_DEFAULT_ON)
true
#else
@ -1987,8 +1987,13 @@ static void clean_up_after_endstop_or_probe_move() {
#define STOW_PROBE() set_probe_deployed(false)
#if ENABLED(BLTOUCH)
void bltouch_command(int angle) {
servo[Z_ENDSTOP_SERVO_NR].move(angle); // Give the BL-Touch the command and wait
safe_delay(375);
}
FORCE_INLINE void set_bltouch_deployed(const bool &deploy) {
servo[Z_ENDSTOP_SERVO_NR].move(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("set_bltouch_deployed(", deploy);
@ -2016,7 +2021,15 @@ static void clean_up_after_endstop_or_probe_move() {
// When deploying make sure BLTOUCH is not already triggered
#if ENABLED(BLTOUCH)
if (deploy && TEST_BLTOUCH()) { stop(); return true; }
if (deploy && TEST_BLTOUCH()) { // If BL-Touch says it's triggered
bltouch_command(BLTOUCH_RESET); // try to reset it.
set_bltouch_deployed(true); // Also needs to deploy and stow to
set_bltouch_deployed(false); // clear the triggered condition.
if (TEST_BLTOUCH()) { // If it still claims to be triggered...
stop(); // punt!
return true;
}
}
#elif ENABLED(Z_PROBE_SLED)
if (axis_unhomed_error(true, false, false)) { stop(); return true; }
#elif ENABLED(Z_PROBE_ALLEN_KEY)
@ -3902,7 +3915,7 @@ inline void gcode_G28() {
* R Set the Right limit of the probing grid
*
* Parameters with BILINEAR only:
*
*
* Z Supply an additional Z probe offset
*
* Global Parameters:
@ -10435,6 +10448,12 @@ void setup() {
mixing_virtual_tool_mix[t][i] = mixing_factor[i];
#endif
#if ENABLED(BLTOUCH)
bltouch_command(BLTOUCH_RESET); // Just in case the BLTouch is in the error state, try to
set_bltouch_deployed(true); // reset it. Also needs to deploy and stow to clear the
set_bltouch_deployed(false); // error condition.
#endif
#if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0
i2c.onReceive(i2c_on_receive);
i2c.onRequest(i2c_on_request);