Fix and extend BLTouch support

This commit is contained in:
Scott Lahteine 2016-09-20 13:56:23 -05:00
parent 5cbed13f41
commit 13523cbf29
5 changed files with 31 additions and 18 deletions

View file

@ -318,6 +318,7 @@
/**
* The BLTouch Probe emulates a servo probe
* and uses "special" angles for its state.
*/
#if ENABLED(BLTOUCH)
#ifndef Z_ENDSTOP_SERVO_NR
@ -326,12 +327,22 @@
#ifndef NUM_SERVOS
#define NUM_SERVOS (Z_ENDSTOP_SERVO_NR + 1)
#endif
#undef Z_SERVO_ANGLES
#define Z_SERVO_ANGLES {10,90} // For BLTouch 10=deploy, 90=retract
#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)
#undef Z_MIN_ENDSTOP_INVERTING
#define Z_MIN_ENDSTOP_INVERTING false
#define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN)
#else
#define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN_PROBE)
#endif
#endif

View file

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

View file

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

View file

@ -366,8 +366,11 @@
#ifndef MSG_ZPROBE_OUT
#define MSG_ZPROBE_OUT "Z probe out. bed"
#endif
#ifndef MSG_RESET_BLTOUCH
#define MSG_RESET_BLTOUCH "Reset BLTouch"
#ifndef MSG_BLTOUCH_RESET
#define MSG_BLTOUCH_SELFTEST "BLTouch Self-Test"
#endif
#ifndef MSG_BLTOUCH_RESET
#define MSG_BLTOUCH_RESET "Reset BLTouch"
#endif
#ifndef MSG_HOME
#define MSG_HOME "Home" // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST

View file

@ -31,8 +31,7 @@
#include "utility.h"
#if ENABLED(BLTOUCH)
#include "servo.h"
extern Servo servo[NUM_SERVOS];
#include "endstops.h"
#endif
#if ENABLED(PRINTCOUNTER)
@ -593,8 +592,8 @@ void kill_screen(const char* lcd_msg) {
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));
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
if (planner.movesplanned() || IS_SD_PRINTING) {
@ -1250,6 +1249,15 @@ void kill_screen(const char* lcd_msg) {
//
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
//