Browse Source

BLTOUCH tweaks, new v3.1 command (#14015)

FanDjango 6 years ago
parent
commit
85fb33a060

+ 2
- 5
Marlin/src/feature/bltouch.cpp View File

@@ -146,19 +146,16 @@ bool BLTouch::status_proc() {
146 146
   /**
147 147
    * Return a TRUE for "YES, it is DEPLOYED"
148 148
    * This function will ensure switch state is reset after execution
149
-   * This may change pin position in some scenarios, specifically
150
-   * if the pin has been triggered but not yet stowed.
151 149
    */
152 150
 
153 151
   if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("BLTouch STATUS requested");
154 152
 
155
-  _set_SW_mode();
153
+  _set_SW_mode();              // Incidentally, _set_SW_mode() will also RESET any active alarm
156 154
   const bool tr = triggered(); // If triggered in SW mode, the pin is up, it is STOWED
157 155
 
158 156
   if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("BLTouch is ", (int)tr);
159 157
 
160
-  _reset();                         // turn off the SW Mode
161
-  if (tr) _stow(); else _deploy();  // and reset any triggered signal, restore state
158
+  if (tr) _stow(); else _deploy();  // Turn off SW mode, reset any trigger, honor pin state
162 159
   return !tr;
163 160
 }
164 161
 

+ 7
- 0
Marlin/src/feature/bltouch.h View File

@@ -30,6 +30,7 @@ typedef unsigned char BLTCommand;
30 30
 #define BLTOUCH_SW_MODE         60
31 31
 #define BLTOUCH_STOW            90
32 32
 #define BLTOUCH_SELFTEST       120
33
+#define BLTOUCH_MODE_STORE     130
33 34
 #define BLTOUCH_5V_MODE        140
34 35
 #define BLTOUCH_OD_MODE        150
35 36
 #define BLTOUCH_RESET          160
@@ -51,6 +52,9 @@ typedef unsigned char BLTCommand;
51 52
 #ifndef BLTOUCH_SETOD_DELAY
52 53
   #define BLTOUCH_SETOD_DELAY   BLTOUCH_DELAY
53 54
 #endif
55
+#ifndef BLTOUCH_MODE_STORE_DELAY
56
+  #define BLTOUCH_MODE_STORE_DELAY   BLTOUCH_DELAY
57
+#endif
54 58
 #ifndef BLTOUCH_DEPLOY_DELAY
55 59
   #define BLTOUCH_DEPLOY_DELAY   750
56 60
 #endif
@@ -77,8 +81,11 @@ public:
77 81
   FORCE_INLINE static void _selftest()           { command(BLTOUCH_SELFTEST, BLTOUCH_DELAY); }
78 82
 
79 83
   FORCE_INLINE static void _set_SW_mode()        { command(BLTOUCH_SW_MODE, BLTOUCH_DELAY); }
84
+  FORCE_INLINE static void _reset_SW_mode()      { if (triggered()) _stow(); else _deploy(); }
85
+
80 86
   FORCE_INLINE static void _set_5V_mode()        { command(BLTOUCH_5V_MODE, BLTOUCH_SET5V_DELAY); }
81 87
   FORCE_INLINE static void _set_OD_mode()        { command(BLTOUCH_OD_MODE, BLTOUCH_SETOD_DELAY); }
88
+  FORCE_INLINE static void _mode_store()         { command(BLTOUCH_MODE_STORE, BLTOUCH_MODE_STORE_DELAY); }
82 89
 
83 90
   FORCE_INLINE static void _deploy()             { command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); }
84 91
   FORCE_INLINE static void _stow()               { command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); }

+ 3
- 4
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -237,10 +237,6 @@ void GcodeSuite::G28(const bool always_home_all) {
237 237
     workspace_plane = PLANE_XY;
238 238
   #endif
239 239
 
240
-  #if ENABLED(BLTOUCH)
241
-    bltouch.init();
242
-  #endif
243
-
244 240
   // Always home with tool 0 active
245 241
   #if HOTENDS > 1
246 242
     #if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)
@@ -353,6 +349,9 @@ void GcodeSuite::G28(const bool always_home_all) {
353 349
     // Home Z last if homing towards the bed
354 350
     #if Z_HOME_DIR < 0
355 351
       if (doZ) {
352
+        #if ENABLED(BLTOUCH)
353
+          bltouch.init();
354
+        #endif
356 355
         #if ENABLED(Z_SAFE_HOMING)
357 356
           home_z_safely();
358 357
         #else

+ 17
- 5
Marlin/src/gcode/calibrate/G34_M422.cpp View File

@@ -74,7 +74,7 @@ void GcodeSuite::G34() {
74 74
   do { // break out on error
75 75
 
76 76
     if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) {
77
-      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> XY homing required.");
77
+      SERIAL_ECHOLNPGM("Home XY first");
78 78
       break;
79 79
     }
80 80
 
@@ -142,6 +142,14 @@ void GcodeSuite::G34() {
142 142
       float z_measured_min = 100000.0f;
143 143
       // For each iteration go through all probe positions (one per Z-Stepper)
144 144
       for (uint8_t zstepper = 0; zstepper < Z_STEPPER_COUNT; ++zstepper) {
145
+
146
+        #if BOTH(BLTOUCH, BLTOUCH_HS_MODE)
147
+          // In BLTOUCH HS mode, the probe travels in a deployed state.
148
+          // Users of G34 might have a badly misaligned bed, so raise Z by the
149
+          // length of the deployed pin (BLTOUCH stroke < 7mm)
150
+          do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES + 7);
151
+        #endif
152
+
145 153
         // Probe a Z height for each stepper
146 154
         z_measured[zstepper] = probe_pt(z_auto_align_xpos[zstepper], z_auto_align_ypos[zstepper], PROBE_PT_RAISE, false);
147 155
 
@@ -229,15 +237,19 @@ void GcodeSuite::G34() {
229 237
       ));
230 238
     #endif
231 239
 
232
-    #if HAS_LEVELING
233
-      #if ENABLED(RESTORE_LEVELING_AFTER_G34)
234
-        set_bed_leveling_enabled(leveling_was_active);
235
-      #endif
240
+    #if HAS_LEVELING && ENABLED(RESTORE_LEVELING_AFTER_G34)
241
+      set_bed_leveling_enabled(leveling_was_active);
236 242
     #endif
237 243
 
238 244
     // After this operation the z position needs correction
239 245
     set_axis_is_not_at_home(Z_AXIS);
240 246
 
247
+    #if BOTH(BLTOUCH, BLTOUCH_HS_MODE)
248
+      // In BLTOUCH HS mode, the pin is still deployed at this point.
249
+      // The upcoming G28 means travel, so it is better to stow the pin.
250
+      bltouch._stow();
251
+    #endif
252
+
241 253
     gcode.G28(false);
242 254
 
243 255
   } while(0);

+ 139
- 112
Marlin/src/gcode/config/M43.cpp View File

@@ -34,6 +34,10 @@
34 34
   #include "../../module/servo.h"
35 35
 #endif
36 36
 
37
+#if ENABLED(BLTOUCH)
38
+  #include "../../feature/bltouch.h"
39
+#endif
40
+
37 41
 #if ENABLED(HOST_PROMPT_SUPPORT)
38 42
   #include "../../feature/host_actions.h"
39 43
 #endif
@@ -91,122 +95,152 @@ inline void toggle_pins() {
91 95
 } // toggle_pins
92 96
 
93 97
 inline void servo_probe_test() {
98
+
94 99
   #if !(NUM_SERVOS > 0 && HAS_SERVO_0)
95 100
 
96
-    SERIAL_ERROR_MSG("SERVO not setup");
101
+    SERIAL_ERROR_MSG("SERVO not set up.");
97 102
 
98 103
   #elif !HAS_Z_SERVO_PROBE
99 104
 
100
-    SERIAL_ERROR_MSG("Z_PROBE_SERVO_NR not setup");
105
+    SERIAL_ERROR_MSG("Z_PROBE_SERVO_NR not set up.");
101 106
 
102 107
   #else // HAS_Z_SERVO_PROBE
103 108
 
104 109
     const uint8_t probe_index = parser.byteval('P', Z_PROBE_SERVO_NR);
105 110
 
106
-    SERIAL_ECHOLNPGM("Servo probe test");
107
-    SERIAL_ECHOLNPAIR(".  using index:  ", probe_index);
108
-    SERIAL_ECHOLNPAIR(".  deploy angle: ", servo_angles[probe_index][0]);
109
-    SERIAL_ECHOLNPAIR(".  stow angle:   ", servo_angles[probe_index][1]);
111
+    SERIAL_ECHOLNPAIR("Servo probe test\n"
112
+                      ". using index:  ", int(probe_index),
113
+                      ", deploy angle: ", servo_angles[probe_index][0],
114
+                      ", stow angle:   ", servo_angles[probe_index][1]
115
+    );
110 116
 
111
-    bool probe_inverting;
117
+    bool deploy_state, stow_state;
112 118
 
113 119
     #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
114 120
 
115 121
       #define PROBE_TEST_PIN Z_MIN_PIN
122
+      constexpr bool probe_inverting = Z_MIN_ENDSTOP_INVERTING;
116 123
 
117
-      SERIAL_ECHOLNPAIR(". probe uses Z_MIN pin: ", PROBE_TEST_PIN);
118
-      SERIAL_ECHOLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)");
124
+      SERIAL_ECHOLNPAIR(". Probe Z_MIN_PIN: ", int(PROBE_TEST_PIN));
119 125
       SERIAL_ECHOPGM(". Z_MIN_ENDSTOP_INVERTING: ");
120 126
 
121
-      #if Z_MIN_ENDSTOP_INVERTING
122
-        SERIAL_ECHOLNPGM("true");
123
-      #else
124
-        SERIAL_ECHOLNPGM("false");
125
-      #endif
126
-
127
-      probe_inverting = Z_MIN_ENDSTOP_INVERTING;
128
-
129
-    #elif USES_Z_MIN_PROBE_ENDSTOP
127
+    #else
130 128
 
131 129
       #define PROBE_TEST_PIN Z_MIN_PROBE_PIN
132
-      SERIAL_ECHOLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN);
133
-      SERIAL_ECHOLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)");
134
-      SERIAL_ECHOPGM(". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
135
-
136
-      #if Z_MIN_PROBE_ENDSTOP_INVERTING
137
-        SERIAL_ECHOLNPGM("true");
138
-      #else
139
-        SERIAL_ECHOLNPGM("false");
140
-      #endif
130
+      constexpr bool probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING;
141 131
 
142
-      probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING;
132
+      SERIAL_ECHOLNPAIR(". Probe Z_MIN_PROBE_PIN: ", int(PROBE_TEST_PIN));
133
+      SERIAL_ECHOPGM(   ". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
143 134
 
144 135
     #endif
145 136
 
146
-    SERIAL_ECHOLNPGM(". deploy & stow 4 times");
137
+    serialprint_truefalse(probe_inverting);
138
+    SERIAL_EOL();
139
+
147 140
     SET_INPUT_PULLUP(PROBE_TEST_PIN);
148
-    uint8_t i = 0;
149
-    bool deploy_state, stow_state;
150
-    do {
151
-      MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
152
-      safe_delay(500);
153
-      deploy_state = READ(PROBE_TEST_PIN);
154
-      MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow
155
-      safe_delay(500);
156
-      stow_state = READ(PROBE_TEST_PIN);
157
-    } while (++i < 4);
158
-    if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING - INVERTING setting probably backwards");
159
-
160
-    if (deploy_state != stow_state) {
161
-      SERIAL_ECHOLNPGM("BLTouch clone detected");
162
-      if (deploy_state) {
163
-        SERIAL_ECHOLNPGM(".  DEPLOYED state: HIGH (logic 1)");
164
-        SERIAL_ECHOLNPGM(".  STOWED (triggered) state: LOW (logic 0)");
165
-      }
166
-      else {
167
-        SERIAL_ECHOLNPGM(".  DEPLOYED state: LOW (logic 0)");
168
-        SERIAL_ECHOLNPGM(".  STOWED (triggered) state: HIGH (logic 1)");
141
+
142
+    // First, check for a probe that recognizes an advanced BLTouch sequence.
143
+    // In addition to STOW and DEPLOY, it uses SW MODE (and RESET in the beginning)
144
+    // to see if this is one of the following: BLTOUCH Classic 1.2, 1.3,  or 
145
+    // BLTouch Smart 1.0, 2.0, 2.2, 3.0, 3.1. But only if the user has actually
146
+    // configured a BLTouch as being present. If the user has not configured this,
147
+    // the BLTouch will be detected in the last phase of these tests (see further on).
148
+    bool blt = false;
149
+    // This code will try to detect a BLTouch probe or clone
150
+    #if ENABLED(BLTOUCH)
151
+      SERIAL_ECHOLNPGM(". Check for BLTOUCH");
152
+      bltouch._reset();
153
+      bltouch._stow();
154
+      if (probe_inverting == READ(PROBE_TEST_PIN)) {
155
+        bltouch._set_SW_mode();
156
+        if (probe_inverting != READ(PROBE_TEST_PIN)) {
157
+          bltouch._deploy();
158
+          if (probe_inverting == READ(PROBE_TEST_PIN)) {
159
+            bltouch._stow();
160
+            SERIAL_ECHOLNPGM("= BLTouch Classic 1.2, 1.3, Smart 1.0, 2.0, 2.2, 3.0, 3.1 detected.");
161
+            // Check for a 3.1 by letting the user trigger it, later
162
+            blt = true;
163
+        }
169 164
       }
170
-      #if ENABLED(BLTOUCH)
171
-        SERIAL_ECHOLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true.");
172
-      #endif
173 165
     }
174
-    else {                                           // measure active signal length
175
-      MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
176
-      safe_delay(500);
177
-      SERIAL_ECHOLNPGM("please trigger probe");
178
-      uint16_t probe_counter = 0;
179
-
180
-      // Allow 30 seconds max for operator to trigger probe
181
-      for (uint16_t j = 0; j < 500 * 30 && probe_counter == 0 ; j++) {
182
-
183
-        safe_delay(2);
184
-
185
-        if (0 == j % (500 * 1)) gcode.reset_stepper_timeout(); // Keep steppers powered
186
-
187
-        if (deploy_state != READ(PROBE_TEST_PIN)) { // probe triggered
188
-
189
-          for (probe_counter = 1; probe_counter < 50 && deploy_state != READ(PROBE_TEST_PIN); ++probe_counter)
190
-            safe_delay(2);
191
-
192
-          if (probe_counter == 50)
193
-            SERIAL_ECHOLNPGM("Z Servo Probe detected"); // >= 100mS active time
194
-          else if (probe_counter >= 2)
195
-            SERIAL_ECHOLNPAIR("BLTouch compatible probe detected - pulse width (+/- 4mS): ", probe_counter * 2); // allow 4 - 100mS pulse
196
-          else
197
-            SERIAL_ECHOLNPGM("noise detected - please re-run test"); // less than 2mS pulse
198
-
199
-          MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow
166
+    #endif
200 167
 
201
-        }  // pulse detected
168
+    // The following code is common to all kinds of servo probes.
169
+    // Since it could be a real servo or a BLTouch (any kind) or a clone,
170
+    // use only "common" functions - i.e. SERVO_MOVE. No bltouch.xxxx stuff.
171
+
172
+    // If it is already recognised as a being a BLTouch, no need for this test
173
+    if (!blt) {
174
+      // DEPLOY and STOW 4 times and see if the signal follows
175
+      // Then it is a mechanical switch
176
+      uint8_t i = 0;
177
+      SERIAL_ECHOLNPGM(". Deploy & stow 4 times");
178
+      do {
179
+        MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
180
+        safe_delay(500);
181
+        deploy_state = READ(PROBE_TEST_PIN);
182
+        MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow
183
+        safe_delay(500);
184
+        stow_state = READ(PROBE_TEST_PIN);
185
+      } while (++i < 4);
186
+
187
+      if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING: INVERTING setting probably backwards.");
188
+
189
+      if (deploy_state != stow_state) {
190
+        SERIAL_ECHOLNPGM("= Mechanical Switch detected");
191
+        if (deploy_state) {
192
+          SERIAL_ECHOLNPAIR("  DEPLOYED state: HIGH (logic 1)",
193
+                            "  STOWED (triggered) state: LOW (logic 0)");
194
+        }
195
+        else {
196
+          SERIAL_ECHOLNPAIR("  DEPLOYED state: LOW (logic 0)",
197
+                            "  STOWED (triggered) state: HIGH (logic 1)");
198
+        }
199
+        #if ENABLED(BLTOUCH)
200
+          SERIAL_ECHOLNPGM("FAIL: BLTOUCH enabled - Set up this device as a Servo Probe with INVERTING set to 'true'.");
201
+        #endif
202
+        return;
203
+      }
204
+    }
202 205
 
203
-      } // for loop waiting for trigger
206
+    // Ask the user for a trigger event and measure the pulse width.
207
+    MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
208
+    safe_delay(500);
209
+    SERIAL_ECHOLNPGM("** Please trigger probe within 30 sec **");
210
+    uint16_t probe_counter = 0;
211
+
212
+    // Wait 30 seconds for user to trigger probe
213
+    for (uint16_t j = 0; j < 500 * 30 && probe_counter == 0 ; j++) {
214
+      safe_delay(2);
215
+
216
+      if (0 == j % (500 * 1)) gcode.reset_stepper_timeout();    // Keep steppers powered
217
+
218
+      if (deploy_state != READ(PROBE_TEST_PIN)) {               // probe triggered
219
+        for (probe_counter = 0; probe_counter < 15 && deploy_state != READ(PROBE_TEST_PIN); ++probe_counter) safe_delay(2);
220
+
221
+        if (probe_counter = 15)
222
+          SERIAL_ECHOLNPGM(". Pulse width: 30ms or more");
223
+        else 
224
+          SERIAL_ECHOLNPAIR(". Pulse width (+/- 4ms): ", probe_counter * 2);
225
+          
226
+        if (probe_counter >= 4) {
227
+          if (probe_counter == 15) {
228
+            if (blt) SERIAL_ECHOPGM("= BLTouch V3.1");
229
+            else     SERIAL_ECHOPGM("= Z Servo Probe");
230
+          }
231
+          else SERIAL_ECHOPGM("= BLTouch pre V3.1 or compatible probe");
232
+          SERIAL_ECHOLNPGM(" detected.");
233
+        }
234
+        else SERIAL_ECHOLNPGM("FAIL: Noise detected - please re-run test");
204 235
 
205
-      if (probe_counter == 0) SERIAL_ECHOLNPGM("trigger not detected");
236
+        MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow
237
+        return;
238
+      }
239
+    }
206 240
 
207
-    } // measure active signal length
241
+    if (!probe_counter) SERIAL_ECHOLNPGM("FAIL: Trigger not detected");
208 242
 
209
-  #endif
243
+  #endif // HAS_Z_SERVO_PROBE
210 244
 
211 245
 } // servo_probe_test
212 246
 
@@ -239,12 +273,10 @@ inline void servo_probe_test() {
239 273
  */
240 274
 void GcodeSuite::M43() {
241 275
 
242
-  if (parser.seen('T')) {   // must be first or else its "S" and "E" parameters will execute endstop or servo test
243
-    toggle_pins();
244
-    return;
245
-  }
276
+  // 'T' must be first. It uses 'S' and 'E' differently.
277
+  if (parser.seen('T')) return toggle_pins();
246 278
 
247
-  // Enable or disable endstop monitoring
279
+  // 'E' Enable or disable endstop monitoring and return
248 280
   if (parser.seen('E')) {
249 281
     endstops.monitor_flag = parser.value_bool();
250 282
     SERIAL_ECHOPGM("endstop monitor ");
@@ -253,25 +285,23 @@ void GcodeSuite::M43() {
253 285
     return;
254 286
   }
255 287
 
256
-  if (parser.seen('S')) {
257
-    servo_probe_test();
258
-    return;
259
-  }
288
+  // 'S' Run servo probe test and return
289
+  if (parser.seen('S')) return servo_probe_test();
260 290
 
261
-  // Get the range of pins to test or watch
291
+  // 'P' Get the range of pins to test or watch
262 292
   uint8_t first_pin = PARSED_PIN_INDEX('P', 0),
263 293
           last_pin = parser.seenval('P') ? first_pin : NUMBER_PINS_TOTAL - 1;
264 294
 
265 295
   if (first_pin > last_pin) return;
266 296
 
297
+  // 'I' to ignore protected pins
267 298
   const bool ignore_protection = parser.boolval('I');
268 299
 
269
-  // Watch until click, M108, or reset
300
+  // 'W' Watch until click, M108, or reset
270 301
   if (parser.boolval('W')) {
271 302
     SERIAL_ECHOLNPGM("Watching pins");
272
-
273 303
     #ifdef ARDUINO_ARCH_SAM
274
-      NOLESS(first_pin, 2);  // don't hijack the UART pins
304
+      NOLESS(first_pin, 2); // Don't hijack the UART pins
275 305
     #endif
276 306
     uint8_t pin_state[last_pin - first_pin + 1];
277 307
     for (uint8_t i = first_pin; i <= last_pin; i++) {
@@ -280,11 +310,11 @@ void GcodeSuite::M43() {
280 310
       if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue;
281 311
       pinMode(pin, INPUT_PULLUP);
282 312
       delay(1);
283
-      /*
313
+        /*
284 314
         if (IS_ANALOG(pin))
285 315
           pin_state[pin - first_pin] = analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)); // int16_t pin_state[...]
286 316
         else
287
-      //*/
317
+        //*/
288 318
           pin_state[i - first_pin] = extDigitalRead(pin);
289 319
     }
290 320
 
@@ -303,9 +333,9 @@ void GcodeSuite::M43() {
303 333
         if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue;
304 334
         const byte val =
305 335
           /*
306
-            IS_ANALOG(pin)
307
-              ? analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)) : // int16_t val
308
-              :
336
+          IS_ANALOG(pin)
337
+            ? analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)) : // int16_t val
338
+            :
309 339
           //*/
310 340
             extDigitalRead(pin);
311 341
         if (val != pin_state[i - first_pin]) {
@@ -315,21 +345,18 @@ void GcodeSuite::M43() {
315 345
       }
316 346
 
317 347
       #if HAS_RESUME_CONTINUE
318
-        if (!wait_for_user) {
319
-          KEEPALIVE_STATE(IN_HANDLER);
320
-          break;
321
-        }
348
+        if (!wait_for_user) { KEEPALIVE_STATE(IN_HANDLER); break; }
322 349
       #endif
323 350
 
324 351
       safe_delay(200);
325 352
     }
326
-    return;
327 353
   }
328
-
329
-  // Report current state of selected pin(s)
330
-  for (uint8_t i = first_pin; i <= last_pin; i++) {
331
-    pin_t pin = GET_PIN_MAP_PIN(i);
332
-    if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true);
354
+  else {
355
+    // Report current state of selected pin(s)
356
+    for (uint8_t i = first_pin; i <= last_pin; i++) {
357
+      pin_t pin = GET_PIN_MAP_PIN(i);
358
+      if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true);
359
+    }
333 360
   }
334 361
 }
335 362
 

+ 3
- 0
Marlin/src/lcd/language/language_en.h View File

@@ -918,6 +918,9 @@
918 918
 #ifndef MSG_BLTOUCH_OD_MODE
919 919
   #define MSG_BLTOUCH_OD_MODE                 _UxGT("BLTouch OD Mode")
920 920
 #endif
921
+#ifndef MSG_BLTOUCH_MODE_STORE
922
+  #define MSG_BLTOUCH_MODE_STORE              _UxGT("BLTouch Mode Store")
923
+#endif
921 924
 #ifndef MSG_BLTOUCH_STOW
922 925
   #define MSG_BLTOUCH_STOW                    _UxGT("Stow BLTouch")
923 926
 #endif

+ 1
- 0
Marlin/src/lcd/menu/menu_configuration.cpp View File

@@ -181,6 +181,7 @@ static void lcd_factory_settings() {
181 181
     MENU_ITEM(function, MSG_BLTOUCH_SW_MODE, bltouch._set_SW_mode);
182 182
     MENU_ITEM(function, MSG_BLTOUCH_5V_MODE, bltouch._set_5V_mode);
183 183
     MENU_ITEM(function, MSG_BLTOUCH_OD_MODE, bltouch._set_OD_mode);
184
+    MENU_ITEM(function, MSG_BLTOUCH_MODE_STORE, bltouch._mode_store);
184 185
     END_MENU();
185 186
   }
186 187
 

+ 1
- 2
Marlin/src/module/endstops.cpp View File

@@ -465,8 +465,7 @@ void _O2 Endstops::M119() {
465 465
     #endif
466 466
   #endif
467 467
   #if ENABLED(BLTOUCH)
468
-    bltouch._reset();
469
-    if (enabled_globally) bltouch._stow();
468
+    bltouch._reset_SW_mode();
470 469
   #endif
471 470
 } // Endstops::M119
472 471
 

+ 6
- 10
Marlin/src/module/motion.cpp View File

@@ -1422,8 +1422,7 @@ void homeaxis(const AxisEnum axis) {
1422 1422
   if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 1 Fast:");
1423 1423
 
1424 1424
   #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
1425
-    // BLTOUCH needs to be deployed every time
1426
-    if (axis == Z_AXIS && bltouch.deploy()) return;
1425
+    if (axis == Z_AXIS && bltouch.deploy()) return; // The initial DEPLOY
1427 1426
   #endif
1428 1427
 
1429 1428
   do_homing_move(axis, 1.5f * max_length(
@@ -1435,9 +1434,8 @@ void homeaxis(const AxisEnum axis) {
1435 1434
     ) * axis_home_dir
1436 1435
   );
1437 1436
 
1438
-  #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
1439
-    // BLTOUCH needs to be stowed after trigger to rearm itself
1440
-    if (axis == Z_AXIS) bltouch.stow();
1437
+  #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
1438
+    if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE)
1441 1439
   #endif
1442 1440
 
1443 1441
   // When homing Z with probe respect probe clearance
@@ -1461,16 +1459,14 @@ void homeaxis(const AxisEnum axis) {
1461 1459
     // Slow move towards endstop until triggered
1462 1460
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 2 Slow:");
1463 1461
 
1464
-    #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
1465
-      // BLTOUCH needs to be deployed every time
1466
-      if (axis == Z_AXIS && bltouch.deploy()) return;
1462
+    #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
1463
+      if (axis == Z_AXIS && bltouch.deploy()) return; // Intermediate DEPLOY (in LOW SPEED MODE)
1467 1464
     #endif
1468 1465
 
1469 1466
     do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis));
1470 1467
 
1471 1468
     #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
1472
-      // BLTOUCH needs to be stowed after trigger to rearm itself
1473
-      if (axis == Z_AXIS) bltouch.stow();
1469
+      if (axis == Z_AXIS) bltouch.stow(); // The final STOW
1474 1470
     #endif
1475 1471
   }
1476 1472
 

+ 13
- 9
Marlin/src/module/probe.cpp View File

@@ -356,9 +356,15 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
356 356
 
357 357
     dock_sled(!deploy);
358 358
 
359
-  #elif HAS_Z_SERVO_PROBE && DISABLED(BLTOUCH)
360
-
361
-    MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]);
359
+  #elif HAS_Z_SERVO_PROBE
360
+
361
+    #if DISABLED(BLTOUCH)
362
+      MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]);
363
+    #elif ENABLED(BLTOUCH_HS_MODE)
364
+      // In HIGH SPEED MODE, use the normal retractable probe logic in this code
365
+      // i.e. no intermediate STOWs and DEPLOYs in between individual probe actions
366
+      if (deploy) bltouch.deploy(); else bltouch.stow();
367
+    #endif
362 368
 
363 369
   #elif ENABLED(Z_PROBE_ALLEN_KEY)
364 370
 
@@ -492,9 +498,8 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
492 498
     }
493 499
   #endif
494 500
 
495
-  // Deploy BLTouch at the start of any probe
496
-  #if ENABLED(BLTOUCH)
497
-    if (bltouch.deploy()) return true;
501
+  #if ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
502
+    if (bltouch.deploy()) return true; // DEPLOY in LOW SPEED MODE on every probe action
498 503
   #endif
499 504
 
500 505
   // Disable stealthChop if used. Enable diag1 pin on driver.
@@ -544,9 +549,8 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
544 549
     tmc_disable_stallguard(stepperZ, stealth_states.z);
545 550
   #endif
546 551
 
547
-  // Retract BLTouch immediately after a probe if it was triggered
548
-  #if ENABLED(BLTOUCH)
549
-    if (probe_triggered && bltouch.stow()) return true;
552
+  #if ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
553
+    if (probe_triggered && bltouch.stow()) return true; // STOW in LOW SPEED MODE on trigger on every probe action
550 554
   #endif
551 555
 
552 556
   // Clear endstop flags

+ 1
- 1
config/examples/Anet/E16/_Statusscreen.h View File

@@ -63,7 +63,7 @@ const unsigned char status_logo_bmp[] PROGMEM = {
63 63
   B11110000,B00000000,B00001111,
64 64
   B11111100,B00000000,B00111111,
65 65
   B11111110,B01101100,B01111111,
66
-  B11111111,B11111111,B11111111 
66
+  B11111111,B11111111,B11111111
67 67
 };
68 68
 
69 69
 //

Loading…
Cancel
Save