Merge pull request #4839 from thinkyhead/rc_bltouch_servo_nr
Better BLTOUCH support
This commit is contained in:
commit
9a9e9afcf8
|
@ -118,9 +118,13 @@
|
|||
* The BLTouch Probe emulates a servo probe
|
||||
*/
|
||||
#if ENABLED(BLTOUCH)
|
||||
#undef Z_ENDSTOP_SERVO_NR
|
||||
#ifndef Z_ENDSTOP_SERVO_NR
|
||||
#define Z_ENDSTOP_SERVO_NR 0
|
||||
#endif
|
||||
#ifndef NUM_SERVOS
|
||||
#define NUM_SERVOS (Z_ENDSTOP_SERVO_NR + 1)
|
||||
#endif
|
||||
#undef Z_SERVO_ANGLES
|
||||
#define Z_ENDSTOP_SERVO_NR 0
|
||||
#define Z_SERVO_ANGLES {10,90} // For BLTouch 10=deploy, 90=retract
|
||||
#undef DEACTIVATE_SERVOS_AFTER_MOVE
|
||||
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||
|
|
|
@ -528,6 +528,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -1881,6 +1881,11 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||
// Make room for probe
|
||||
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 (axis_unhomed_error(true, false, false)) { stop(); return true; }
|
||||
#elif ENABLED(Z_PROBE_ALLEN_KEY)
|
||||
|
|
|
@ -306,12 +306,8 @@
|
|||
/**
|
||||
* Limited number of servos
|
||||
*/
|
||||
#if defined(NUM_SERVOS) && NUM_SERVOS > 0
|
||||
#if NUM_SERVOS > 4
|
||||
#error "The maximum number of SERVOS in Marlin is 4."
|
||||
#elif HAS_Z_SERVO_ENDSTOP && Z_ENDSTOP_SERVO_NR >= NUM_SERVOS
|
||||
#error "Z_ENDSTOP_SERVO_NR must be smaller than NUM_SERVOS."
|
||||
#endif
|
||||
#if NUM_SERVOS > 4
|
||||
#error "The maximum number of SERVOS in Marlin is 4."
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -367,7 +363,7 @@
|
|||
#ifndef NUM_SERVOS
|
||||
#error "You must set NUM_SERVOS for a Z servo probe (Z_ENDSTOP_SERVO_NR)."
|
||||
#elif Z_ENDSTOP_SERVO_NR >= NUM_SERVOS
|
||||
#error "Z_ENDSTOP_SERVO_NR must be less than NUM_SERVOS."
|
||||
#error "Z_ENDSTOP_SERVO_NR must be smaller than NUM_SERVOS."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -404,7 +400,7 @@
|
|||
#if (ENABLED(FIX_MOUNTED_PROBE) && (ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED))) \
|
||||
|| (ENABLED(Z_PROBE_ALLEN_KEY) && (HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED))) \
|
||||
|| (HAS_Z_SERVO_ENDSTOP && ENABLED(Z_PROBE_SLED))
|
||||
#error "Please define only one type of probe: Z Servo, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or FIX_MOUNTED_PROBE."
|
||||
#error "Please define only one type of probe: Z Servo/BLTOUCH, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or FIX_MOUNTED_PROBE."
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -124,6 +124,15 @@ enum TempState {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
enum BLTouchState {
|
||||
BLTouchState_Deploy = 10,
|
||||
BLTouchState_Stow = 90,
|
||||
BLTouchState_Selftest = 120,
|
||||
BLTouchState_Error = 160
|
||||
};
|
||||
#endif
|
||||
|
||||
#if ENABLED(FILAMENT_CHANGE_FEATURE)
|
||||
enum FilamentChangeMenuResponse {
|
||||
FILAMENT_CHANGE_RESPONSE_WAIT_FOR,
|
||||
|
|
|
@ -511,6 +511,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -494,6 +494,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -492,6 +492,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -503,6 +503,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -505,6 +505,7 @@
|
|||
#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -528,6 +528,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -511,6 +511,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -511,6 +511,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -511,6 +511,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -509,6 +509,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -521,6 +521,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -503,6 +503,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -511,6 +511,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -554,6 +554,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -554,6 +554,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -554,6 +554,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -550,6 +550,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -560,6 +560,7 @@
|
|||
#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -514,6 +514,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -507,6 +507,7 @@
|
|||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
// The BLTouch probe emulates a servo probe.
|
||||
// The default connector is SERVO 0. Set Z_ENDSTOP_SERVO_NR below to override.
|
||||
//#define BLTOUCH
|
||||
|
||||
// Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
|
|
|
@ -366,6 +366,9 @@
|
|||
#ifndef MSG_ZPROBE_OUT
|
||||
#define MSG_ZPROBE_OUT "Z probe out. bed"
|
||||
#endif
|
||||
#ifndef MSG_RESET_BLTOUCH
|
||||
#define MSG_RESET_BLTOUCH "Reset BLTouch"
|
||||
#endif
|
||||
#ifndef MSG_HOME
|
||||
#define MSG_HOME "Home" // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
#include "configuration_store.h"
|
||||
#include "utility.h"
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
#include "servo.h"
|
||||
extern Servo servo[NUM_SERVOS];
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
#include "printcounter.h"
|
||||
#include "duration_t.h"
|
||||
|
@ -586,6 +591,12 @@ void kill_screen(const char* lcd_msg) {
|
|||
static void lcd_main_menu() {
|
||||
START_MENU();
|
||||
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) {
|
||||
MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue