BLTOUCH tweaks, new v3.1 command (#14015)
This commit is contained in:
committed by
Scott Lahteine
parent
62ef54cb81
commit
85fb33a060
@ -146,19 +146,16 @@ bool BLTouch::status_proc() {
|
||||
/**
|
||||
* Return a TRUE for "YES, it is DEPLOYED"
|
||||
* This function will ensure switch state is reset after execution
|
||||
* This may change pin position in some scenarios, specifically
|
||||
* if the pin has been triggered but not yet stowed.
|
||||
*/
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLN("BLTouch STATUS requested");
|
||||
|
||||
_set_SW_mode();
|
||||
_set_SW_mode(); // Incidentally, _set_SW_mode() will also RESET any active alarm
|
||||
const bool tr = triggered(); // If triggered in SW mode, the pin is up, it is STOWED
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("BLTouch is ", (int)tr);
|
||||
|
||||
_reset(); // turn off the SW Mode
|
||||
if (tr) _stow(); else _deploy(); // and reset any triggered signal, restore state
|
||||
if (tr) _stow(); else _deploy(); // Turn off SW mode, reset any trigger, honor pin state
|
||||
return !tr;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ typedef unsigned char BLTCommand;
|
||||
#define BLTOUCH_SW_MODE 60
|
||||
#define BLTOUCH_STOW 90
|
||||
#define BLTOUCH_SELFTEST 120
|
||||
#define BLTOUCH_MODE_STORE 130
|
||||
#define BLTOUCH_5V_MODE 140
|
||||
#define BLTOUCH_OD_MODE 150
|
||||
#define BLTOUCH_RESET 160
|
||||
@ -51,6 +52,9 @@ typedef unsigned char BLTCommand;
|
||||
#ifndef BLTOUCH_SETOD_DELAY
|
||||
#define BLTOUCH_SETOD_DELAY BLTOUCH_DELAY
|
||||
#endif
|
||||
#ifndef BLTOUCH_MODE_STORE_DELAY
|
||||
#define BLTOUCH_MODE_STORE_DELAY BLTOUCH_DELAY
|
||||
#endif
|
||||
#ifndef BLTOUCH_DEPLOY_DELAY
|
||||
#define BLTOUCH_DEPLOY_DELAY 750
|
||||
#endif
|
||||
@ -77,8 +81,11 @@ public:
|
||||
FORCE_INLINE static void _selftest() { command(BLTOUCH_SELFTEST, BLTOUCH_DELAY); }
|
||||
|
||||
FORCE_INLINE static void _set_SW_mode() { command(BLTOUCH_SW_MODE, BLTOUCH_DELAY); }
|
||||
FORCE_INLINE static void _reset_SW_mode() { if (triggered()) _stow(); else _deploy(); }
|
||||
|
||||
FORCE_INLINE static void _set_5V_mode() { command(BLTOUCH_5V_MODE, BLTOUCH_SET5V_DELAY); }
|
||||
FORCE_INLINE static void _set_OD_mode() { command(BLTOUCH_OD_MODE, BLTOUCH_SETOD_DELAY); }
|
||||
FORCE_INLINE static void _mode_store() { command(BLTOUCH_MODE_STORE, BLTOUCH_MODE_STORE_DELAY); }
|
||||
|
||||
FORCE_INLINE static void _deploy() { command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); }
|
||||
FORCE_INLINE static void _stow() { command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); }
|
||||
|
Reference in New Issue
Block a user