Browse Source

Add handling of BLTouch error state

Scott Lahteine 8 years ago
parent
commit
f38a33a5d8
4 changed files with 28 additions and 0 deletions
  1. 5
    0
      Marlin/Marlin_main.cpp
  2. 9
    0
      Marlin/enum.h
  3. 3
    0
      Marlin/language_en.h
  4. 11
    0
      Marlin/ultralcd.cpp

+ 5
- 0
Marlin/Marlin_main.cpp View File

1881
     // Make room for probe
1881
     // Make room for probe
1882
     do_probe_raise(_Z_PROBE_DEPLOY_HEIGHT);
1882
     do_probe_raise(_Z_PROBE_DEPLOY_HEIGHT);
1883
 
1883
 
1884
+    // Check BLTOUCH probe status for an error
1885
+    #if ENABLED(BLTOUCH)
1886
+      if (servo[Z_ENDSTOP_SERVO_NR].read() == BLTouchState_Error) { stop(); return true; }
1887
+    #endif
1888
+
1884
     #if ENABLED(Z_PROBE_SLED)
1889
     #if ENABLED(Z_PROBE_SLED)
1885
       if (axis_unhomed_error(true, false, false)) { stop(); return true; }
1890
       if (axis_unhomed_error(true, false, false)) { stop(); return true; }
1886
     #elif ENABLED(Z_PROBE_ALLEN_KEY)
1891
     #elif ENABLED(Z_PROBE_ALLEN_KEY)

+ 9
- 0
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
+
127
 #if ENABLED(FILAMENT_CHANGE_FEATURE)
136
 #if ENABLED(FILAMENT_CHANGE_FEATURE)
128
   enum FilamentChangeMenuResponse {
137
   enum FilamentChangeMenuResponse {
129
     FILAMENT_CHANGE_RESPONSE_WAIT_FOR,
138
     FILAMENT_CHANGE_RESPONSE_WAIT_FOR,

+ 3
- 0
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"
371
+#endif
369
 #ifndef MSG_HOME
372
 #ifndef MSG_HOME
370
   #define MSG_HOME                            "Home"  // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST
373
   #define MSG_HOME                            "Home"  // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST
371
 #endif
374
 #endif

+ 11
- 0
Marlin/ultralcd.cpp View File

30
 #include "configuration_store.h"
30
 #include "configuration_store.h"
31
 #include "utility.h"
31
 #include "utility.h"
32
 
32
 
33
+#if ENABLED(BLTOUCH)
34
+  #include "servo.h"
35
+  extern Servo servo[NUM_SERVOS];
36
+#endif
37
+
33
 #if ENABLED(PRINTCOUNTER)
38
 #if ENABLED(PRINTCOUNTER)
34
   #include "printcounter.h"
39
   #include "printcounter.h"
35
   #include "duration_t.h"
40
   #include "duration_t.h"
586
   static void lcd_main_menu() {
591
   static void lcd_main_menu() {
587
     START_MENU();
592
     START_MENU();
588
     MENU_ITEM(back, MSG_WATCH);
593
     MENU_ITEM(back, MSG_WATCH);
594
+
595
+    #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));
598
+    #endif
599
+
589
     if (planner.movesplanned() || IS_SD_PRINTING) {
600
     if (planner.movesplanned() || IS_SD_PRINTING) {
590
       MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
601
       MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
591
     }
602
     }

Loading…
Cancel
Save