Add handling of BLTouch error state

This commit is contained in:
Scott Lahteine 2016-09-18 18:02:53 -05:00
parent c4dcfa254e
commit f38a33a5d8
4 changed files with 28 additions and 0 deletions

View File

@ -1881,6 +1881,11 @@ static void clean_up_after_endstop_or_probe_move() {
// Make room for probe // Make room for probe
do_probe_raise(_Z_PROBE_DEPLOY_HEIGHT); do_probe_raise(_Z_PROBE_DEPLOY_HEIGHT);
// Check BLTOUCH probe status for an error
#if ENABLED(BLTOUCH)
if (servo[Z_ENDSTOP_SERVO_NR].read() == BLTouchState_Error) { stop(); return true; }
#endif
#if ENABLED(Z_PROBE_SLED) #if ENABLED(Z_PROBE_SLED)
if (axis_unhomed_error(true, false, false)) { stop(); return true; } if (axis_unhomed_error(true, false, false)) { stop(); return true; }
#elif ENABLED(Z_PROBE_ALLEN_KEY) #elif ENABLED(Z_PROBE_ALLEN_KEY)

View File

@ -124,6 +124,15 @@ enum TempState {
}; };
#endif #endif
#if ENABLED(BLTOUCH)
enum BLTouchState {
BLTouchState_Deploy = 10,
BLTouchState_Stow = 90,
BLTouchState_Selftest = 120,
BLTouchState_Error = 160
};
#endif
#if ENABLED(FILAMENT_CHANGE_FEATURE) #if ENABLED(FILAMENT_CHANGE_FEATURE)
enum FilamentChangeMenuResponse { enum FilamentChangeMenuResponse {
FILAMENT_CHANGE_RESPONSE_WAIT_FOR, FILAMENT_CHANGE_RESPONSE_WAIT_FOR,

View File

@ -366,6 +366,9 @@
#ifndef MSG_ZPROBE_OUT #ifndef MSG_ZPROBE_OUT
#define MSG_ZPROBE_OUT "Z probe out. bed" #define MSG_ZPROBE_OUT "Z probe out. bed"
#endif #endif
#ifndef MSG_RESET_BLTOUCH
#define MSG_RESET_BLTOUCH "Reset BLTouch"
#endif
#ifndef MSG_HOME #ifndef MSG_HOME
#define MSG_HOME "Home" // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_HOME "Home" // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST
#endif #endif

View File

@ -30,6 +30,11 @@
#include "configuration_store.h" #include "configuration_store.h"
#include "utility.h" #include "utility.h"
#if ENABLED(BLTOUCH)
#include "servo.h"
extern Servo servo[NUM_SERVOS];
#endif
#if ENABLED(PRINTCOUNTER) #if ENABLED(PRINTCOUNTER)
#include "printcounter.h" #include "printcounter.h"
#include "duration_t.h" #include "duration_t.h"
@ -586,6 +591,12 @@ void kill_screen(const char* lcd_msg) {
static void lcd_main_menu() { static void lcd_main_menu() {
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_WATCH); MENU_ITEM(back, MSG_WATCH);
#if ENABLED(BLTOUCH)
if (servo[Z_ENDSTOP_SERVO_NR].read() == BLTouchState_Error)
MENU_ITEM(gcode, MSG_RESET_BLTOUCH, "M280 S90 P" STRINGIFY(Z_ENDSTOP_SERVO_NR));
#endif
if (planner.movesplanned() || IS_SD_PRINTING) { if (planner.movesplanned() || IS_SD_PRINTING) {
MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu); MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
} }