Parcourir la source

Fix and extend BLTouch support

Scott Lahteine il y a 8 ans
Parent
révision
13523cbf29
5 fichiers modifiés avec 31 ajouts et 18 suppressions
  1. 13
    2
      Marlin/Conditionals_LCD.h
  2. 1
    1
      Marlin/Marlin_main.cpp
  3. 0
    9
      Marlin/enum.h
  4. 5
    2
      Marlin/language_en.h
  5. 12
    4
      Marlin/ultralcd.cpp

+ 13
- 2
Marlin/Conditionals_LCD.h Voir le fichier

@@ -318,6 +318,7 @@
318 318
 
319 319
   /**
320 320
    * The BLTouch Probe emulates a servo probe
321
+   * and uses "special" angles for its state.
321 322
    */
322 323
   #if ENABLED(BLTOUCH)
323 324
     #ifndef Z_ENDSTOP_SERVO_NR
@@ -326,12 +327,22 @@
326 327
     #ifndef NUM_SERVOS
327 328
       #define NUM_SERVOS (Z_ENDSTOP_SERVO_NR + 1)
328 329
     #endif
329
-    #undef Z_SERVO_ANGLES
330
-    #define Z_SERVO_ANGLES {10,90} // For BLTouch 10=deploy, 90=retract
331 330
     #undef DEACTIVATE_SERVOS_AFTER_MOVE
331
+    #undef Z_SERVO_ANGLES
332
+    #define Z_SERVO_ANGLES { BLTOUCH_DEPLOY, BLTOUCH_STOW }
333
+
334
+    #define BLTOUCH_DEPLOY    10
335
+    #define BLTOUCH_STOW   90
336
+    #define BLTOUCH_SELFTEST 120
337
+    #define BLTOUCH_RELEASE  160
338
+    #define _TEST_BLTOUCH(P) (READ(P##_PIN) != P##_ENDSTOP_INVERTING)
339
+
332 340
     #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
333 341
       #undef Z_MIN_ENDSTOP_INVERTING
334 342
       #define Z_MIN_ENDSTOP_INVERTING false
343
+      #define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN)
344
+    #else
345
+      #define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN_PROBE)
335 346
     #endif
336 347
   #endif
337 348
 

+ 1
- 1
Marlin/Marlin_main.cpp Voir le fichier

@@ -1883,7 +1883,7 @@ static void clean_up_after_endstop_or_probe_move() {
1883 1883
 
1884 1884
     // Check BLTOUCH probe status for an error
1885 1885
     #if ENABLED(BLTOUCH)
1886
-      if (servo[Z_ENDSTOP_SERVO_NR].read() == BLTouchState_Error) { stop(); return true; }
1886
+      if (TEST_BLTOUCH()) { stop(); return true; }
1887 1887
     #endif
1888 1888
 
1889 1889
     #if ENABLED(Z_PROBE_SLED)

+ 0
- 9
Marlin/enum.h Voir le fichier

@@ -124,15 +124,6 @@ enum TempState {
124 124
   };
125 125
 #endif
126 126
 
127
-#if ENABLED(BLTOUCH)
128
-  enum BLTouchState {
129
-    BLTouchState_Deploy   = 10,
130
-    BLTouchState_Stow     = 90,
131
-    BLTouchState_Selftest = 120,
132
-    BLTouchState_Error    = 160
133
-  };
134
-#endif
135
-
136 127
 #if ENABLED(FILAMENT_CHANGE_FEATURE)
137 128
   enum FilamentChangeMenuResponse {
138 129
     FILAMENT_CHANGE_RESPONSE_WAIT_FOR,

+ 5
- 2
Marlin/language_en.h Voir le fichier

@@ -366,8 +366,11 @@
366 366
 #ifndef MSG_ZPROBE_OUT
367 367
   #define MSG_ZPROBE_OUT                      "Z probe out. bed"
368 368
 #endif
369
-#ifndef MSG_RESET_BLTOUCH
370
-  #define MSG_RESET_BLTOUCH                   "Reset BLTouch"
369
+#ifndef MSG_BLTOUCH_RESET
370
+  #define MSG_BLTOUCH_SELFTEST                "BLTouch Self-Test"
371
+#endif
372
+#ifndef MSG_BLTOUCH_RESET
373
+  #define MSG_BLTOUCH_RESET                   "Reset BLTouch"
371 374
 #endif
372 375
 #ifndef MSG_HOME
373 376
   #define MSG_HOME                            "Home"  // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST

+ 12
- 4
Marlin/ultralcd.cpp Voir le fichier

@@ -31,8 +31,7 @@
31 31
 #include "utility.h"
32 32
 
33 33
 #if ENABLED(BLTOUCH)
34
-  #include "servo.h"
35
-  extern Servo servo[NUM_SERVOS];
34
+  #include "endstops.h"
36 35
 #endif
37 36
 
38 37
 #if ENABLED(PRINTCOUNTER)
@@ -593,8 +592,8 @@ void kill_screen(const char* lcd_msg) {
593 592
     MENU_ITEM(back, MSG_WATCH);
594 593
 
595 594
     #if ENABLED(BLTOUCH)
596
-      if (servo[Z_ENDSTOP_SERVO_NR].read() == BLTouchState_Error)
597
-        MENU_ITEM(gcode, MSG_RESET_BLTOUCH, "M280 S90 P" STRINGIFY(Z_ENDSTOP_SERVO_NR));
595
+      if (!endstops.z_probe_enabled && TEST_BLTOUCH())
596
+        MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
598 597
     #endif
599 598
 
600 599
     if (planner.movesplanned() || IS_SD_PRINTING) {
@@ -1251,6 +1250,15 @@ void kill_screen(const char* lcd_msg) {
1251 1250
     MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
1252 1251
 
1253 1252
     //
1253
+    // BLTouch Self-Test and Reset
1254
+    //
1255
+    #if ENABLED(BLTOUCH)
1256
+      MENU_ITEM(gcode, MSG_BLTOUCH_TEST, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_SELFTEST)));
1257
+      if (!endstops.z_probe_enabled && TEST_BLTOUCH())
1258
+        MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
1259
+    #endif
1260
+
1261
+    //
1254 1262
     // Switch power on/off
1255 1263
     //
1256 1264
     #if HAS_POWER_SWITCH

Chargement…
Annuler
Enregistrer