Fix and extend BLTouch support

master
Scott Lahteine 8 years ago
parent 5cbed13f41
commit 13523cbf29

@ -318,6 +318,7 @@
/** /**
* The BLTouch Probe emulates a servo probe * The BLTouch Probe emulates a servo probe
* and uses "special" angles for its state.
*/ */
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
#ifndef Z_ENDSTOP_SERVO_NR #ifndef Z_ENDSTOP_SERVO_NR
@ -326,12 +327,22 @@
#ifndef NUM_SERVOS #ifndef NUM_SERVOS
#define NUM_SERVOS (Z_ENDSTOP_SERVO_NR + 1) #define NUM_SERVOS (Z_ENDSTOP_SERVO_NR + 1)
#endif #endif
#undef Z_SERVO_ANGLES
#define Z_SERVO_ANGLES {10,90} // For BLTouch 10=deploy, 90=retract
#undef DEACTIVATE_SERVOS_AFTER_MOVE #undef DEACTIVATE_SERVOS_AFTER_MOVE
#undef Z_SERVO_ANGLES
#define Z_SERVO_ANGLES { BLTOUCH_DEPLOY, BLTOUCH_STOW }
#define BLTOUCH_DEPLOY 10
#define BLTOUCH_STOW 90
#define BLTOUCH_SELFTEST 120
#define BLTOUCH_RELEASE 160
#define _TEST_BLTOUCH(P) (READ(P##_PIN) != P##_ENDSTOP_INVERTING)
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#undef Z_MIN_ENDSTOP_INVERTING #undef Z_MIN_ENDSTOP_INVERTING
#define Z_MIN_ENDSTOP_INVERTING false #define Z_MIN_ENDSTOP_INVERTING false
#define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN)
#else
#define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN_PROBE)
#endif #endif
#endif #endif

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

@ -124,15 +124,6 @@ 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,

@ -366,8 +366,11 @@
#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 #ifndef MSG_BLTOUCH_RESET
#define MSG_RESET_BLTOUCH "Reset BLTouch" #define MSG_BLTOUCH_SELFTEST "BLTouch Self-Test"
#endif
#ifndef MSG_BLTOUCH_RESET
#define MSG_BLTOUCH_RESET "Reset BLTouch"
#endif #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

@ -31,8 +31,7 @@
#include "utility.h" #include "utility.h"
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
#include "servo.h" #include "endstops.h"
extern Servo servo[NUM_SERVOS];
#endif #endif
#if ENABLED(PRINTCOUNTER) #if ENABLED(PRINTCOUNTER)
@ -593,8 +592,8 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM(back, MSG_WATCH); MENU_ITEM(back, MSG_WATCH);
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
if (servo[Z_ENDSTOP_SERVO_NR].read() == BLTouchState_Error) if (!endstops.z_probe_enabled && TEST_BLTOUCH())
MENU_ITEM(gcode, MSG_RESET_BLTOUCH, "M280 S90 P" STRINGIFY(Z_ENDSTOP_SERVO_NR)); MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
#endif #endif
if (planner.movesplanned() || IS_SD_PRINTING) { if (planner.movesplanned() || IS_SD_PRINTING) {
@ -1250,6 +1249,15 @@ void kill_screen(const char* lcd_msg) {
// //
MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown); MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
//
// BLTouch Self-Test and Reset
//
#if ENABLED(BLTOUCH)
MENU_ITEM(gcode, MSG_BLTOUCH_TEST, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_SELFTEST)));
if (!endstops.z_probe_enabled && TEST_BLTOUCH())
MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
#endif
// //
// Switch power on/off // Switch power on/off
// //

Loading…
Cancel
Save