Browse Source

Fix and extend BLTouch support

Scott Lahteine 8 years ago
parent
commit
13523cbf29
5 changed files with 31 additions and 18 deletions
  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 View File

318
 
318
 
319
   /**
319
   /**
320
    * The BLTouch Probe emulates a servo probe
320
    * The BLTouch Probe emulates a servo probe
321
+   * and uses "special" angles for its state.
321
    */
322
    */
322
   #if ENABLED(BLTOUCH)
323
   #if ENABLED(BLTOUCH)
323
     #ifndef Z_ENDSTOP_SERVO_NR
324
     #ifndef Z_ENDSTOP_SERVO_NR
326
     #ifndef NUM_SERVOS
327
     #ifndef NUM_SERVOS
327
       #define NUM_SERVOS (Z_ENDSTOP_SERVO_NR + 1)
328
       #define NUM_SERVOS (Z_ENDSTOP_SERVO_NR + 1)
328
     #endif
329
     #endif
329
-    #undef Z_SERVO_ANGLES
330
-    #define Z_SERVO_ANGLES {10,90} // For BLTouch 10=deploy, 90=retract
331
     #undef DEACTIVATE_SERVOS_AFTER_MOVE
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
     #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
340
     #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
333
       #undef Z_MIN_ENDSTOP_INVERTING
341
       #undef Z_MIN_ENDSTOP_INVERTING
334
       #define Z_MIN_ENDSTOP_INVERTING false
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
     #endif
346
     #endif
336
   #endif
347
   #endif
337
 
348
 

+ 1
- 1
Marlin/Marlin_main.cpp View File

1883
 
1883
 
1884
     // Check BLTOUCH probe status for an error
1884
     // Check BLTOUCH probe status for an error
1885
     #if ENABLED(BLTOUCH)
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
     #endif
1887
     #endif
1888
 
1888
 
1889
     #if ENABLED(Z_PROBE_SLED)
1889
     #if ENABLED(Z_PROBE_SLED)

+ 0
- 9
Marlin/enum.h View File

124
   };
124
   };
125
 #endif
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
 #if ENABLED(FILAMENT_CHANGE_FEATURE)
127
 #if ENABLED(FILAMENT_CHANGE_FEATURE)
137
   enum FilamentChangeMenuResponse {
128
   enum FilamentChangeMenuResponse {
138
     FILAMENT_CHANGE_RESPONSE_WAIT_FOR,
129
     FILAMENT_CHANGE_RESPONSE_WAIT_FOR,

+ 5
- 2
Marlin/language_en.h View File

366
 #ifndef MSG_ZPROBE_OUT
366
 #ifndef MSG_ZPROBE_OUT
367
   #define MSG_ZPROBE_OUT                      "Z probe out. bed"
367
   #define MSG_ZPROBE_OUT                      "Z probe out. bed"
368
 #endif
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
 #endif
374
 #endif
372
 #ifndef MSG_HOME
375
 #ifndef MSG_HOME
373
   #define MSG_HOME                            "Home"  // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST
376
   #define MSG_HOME                            "Home"  // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST

+ 12
- 4
Marlin/ultralcd.cpp View File

31
 #include "utility.h"
31
 #include "utility.h"
32
 
32
 
33
 #if ENABLED(BLTOUCH)
33
 #if ENABLED(BLTOUCH)
34
-  #include "servo.h"
35
-  extern Servo servo[NUM_SERVOS];
34
+  #include "endstops.h"
36
 #endif
35
 #endif
37
 
36
 
38
 #if ENABLED(PRINTCOUNTER)
37
 #if ENABLED(PRINTCOUNTER)
593
     MENU_ITEM(back, MSG_WATCH);
592
     MENU_ITEM(back, MSG_WATCH);
594
 
593
 
595
     #if ENABLED(BLTOUCH)
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
     #endif
597
     #endif
599
 
598
 
600
     if (planner.movesplanned() || IS_SD_PRINTING) {
599
     if (planner.movesplanned() || IS_SD_PRINTING) {
1251
     MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
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
     // Switch power on/off
1262
     // Switch power on/off
1255
     //
1263
     //
1256
     #if HAS_POWER_SWITCH
1264
     #if HAS_POWER_SWITCH

Loading…
Cancel
Save