Use BLTOUCH_HS_MODE for default + editable
This commit is contained in:
@@ -853,14 +853,14 @@
|
||||
//#define BLTOUCH_FORCE_MODE_SET
|
||||
|
||||
/**
|
||||
* Use "HIGH SPEED" mode for probing.
|
||||
* Enable "HIGH SPEED" option for probing.
|
||||
* Danger: Disable if your probe sometimes fails. Only suitable for stable well-adjusted systems.
|
||||
* This feature was designed for Deltabots with very fast Z moves; however, higher speed Cartesians
|
||||
* might be able to use it. If the machine can't raise Z fast enough the BLTouch may go into ALARM.
|
||||
*
|
||||
* This only sets the default state. Changed with 'M401 S' or UI, saved with M500.
|
||||
* Set the default state here, change with 'M401 S' or UI, use M500 to save, M502 to reset.
|
||||
*/
|
||||
//#define BLTOUCH_HS_MODE
|
||||
//#define BLTOUCH_HS_MODE true
|
||||
|
||||
// Safety: Enable voltage mode settings in the LCD menu.
|
||||
//#define BLTOUCH_LCD_VOLTAGE_MENU
|
||||
|
||||
@@ -28,8 +28,12 @@
|
||||
|
||||
BLTouch bltouch;
|
||||
|
||||
bool BLTouch::od_5v_mode, // Initialized by settings.load, 0 = Open Drain; 1 = 5V Drain
|
||||
BLTouch::high_speed_mode; // Initialized by settings.load, 0 = Low Speed; 1 = High Speed
|
||||
bool BLTouch::od_5v_mode; // Initialized by settings.load, 0 = Open Drain; 1 = 5V Drain
|
||||
#ifdef BLTOUCH_HS_MODE
|
||||
bool BLTouch::high_speed_mode; // Initialized by settings.load, 0 = Low Speed; 1 = High Speed
|
||||
#else
|
||||
constexpr bool BLTouch::high_speed_mode;
|
||||
#endif
|
||||
|
||||
#include "../module/servo.h"
|
||||
#include "../module/probe.h"
|
||||
|
||||
@@ -68,10 +68,15 @@ class BLTouch {
|
||||
public:
|
||||
|
||||
static void init(const bool set_voltage=false);
|
||||
static bool od_5v_mode, // Initialized by settings.load, 0 = Open Drain; 1 = 5V Drain
|
||||
high_speed_mode; // Initialized by settings.load, 0 = Low Speed; 1 = High Speed
|
||||
static bool od_5v_mode; // Initialized by settings.load, 0 = Open Drain; 1 = 5V Drain
|
||||
|
||||
const float z_extra_clearance() { return high_speed_mode ? 7 : 0; }
|
||||
#ifdef BLTOUCH_HS_MODE
|
||||
static bool high_speed_mode; // Initialized by settings.load, 0 = Low Speed; 1 = High Speed
|
||||
#else
|
||||
static constexpr bool high_speed_mode = false;
|
||||
#endif
|
||||
|
||||
static inline float z_extra_clearance() { return high_speed_mode ? 7 : 0; }
|
||||
|
||||
// DEPLOY and STOW are wrapped for error handling - these are used by homing and by probing
|
||||
static bool deploy() { return deploy_proc(); }
|
||||
|
||||
@@ -27,22 +27,20 @@
|
||||
#include "../gcode.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/probe.h"
|
||||
#if ENABLED(BLTOUCH)
|
||||
|
||||
#ifdef BLTOUCH_HS_MODE
|
||||
#include "../../feature/bltouch.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M401: Deploy and activate the Z probe
|
||||
*
|
||||
* With BLTOUCH:
|
||||
* With BLTOUCH_HS_MODE:
|
||||
* S<bool> Set High Speed (HS) Mode and exit without deploy
|
||||
*/
|
||||
void GcodeSuite::M401() {
|
||||
#if ENABLED(BLTOUCH)
|
||||
if (parser.seen('S')) {
|
||||
bltouch.high_speed_mode = parser.value_bool();
|
||||
return;
|
||||
}
|
||||
#ifdef BLTOUCH_HS_MODE
|
||||
if (parser.seen('S')) { bltouch.high_speed_mode = parser.value_bool(); return; }
|
||||
#endif
|
||||
probe.deploy();
|
||||
TERN_(PROBE_TARE, probe.tare());
|
||||
|
||||
@@ -238,7 +238,9 @@ void menu_advanced_settings();
|
||||
ACTION_ITEM(MSG_BLTOUCH_DEPLOY, bltouch._deploy);
|
||||
ACTION_ITEM(MSG_BLTOUCH_STOW, bltouch._stow);
|
||||
ACTION_ITEM(MSG_BLTOUCH_SW_MODE, bltouch._set_SW_mode);
|
||||
EDIT_ITEM(bool, MSG_BLTOUCH_SPEED_MODE, &bltouch.high_speed_mode);
|
||||
#ifdef BLTOUCH_HS_MODE
|
||||
EDIT_ITEM(bool, MSG_BLTOUCH_SPEED_MODE, &bltouch.high_speed_mode);
|
||||
#endif
|
||||
#if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU)
|
||||
CONFIRM_ITEM(MSG_BLTOUCH_5V_MODE, MSG_BLTOUCH_5V_MODE, MSG_BUTTON_CANCEL, bltouch._set_5V_mode, nullptr, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE));
|
||||
CONFIRM_ITEM(MSG_BLTOUCH_OD_MODE, MSG_BLTOUCH_OD_MODE, MSG_BUTTON_CANCEL, bltouch._set_OD_mode, nullptr, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE));
|
||||
|
||||
@@ -530,10 +530,12 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
|
||||
if (probe.test_sensitivity.z) tmc_disable_stallguard(stepperZ, stealth_states.z);
|
||||
set_homing_current(false);
|
||||
#endif
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
if (!bltouch.high_speed_mode && probe_triggered && bltouch.stow())
|
||||
if (probe_triggered && !bltouch.high_speed_mode && bltouch.stow())
|
||||
return true; // Stow in LOW SPEED MODE on every trigger
|
||||
#endif
|
||||
|
||||
// Clear endstop flags
|
||||
endstops.hit_on_purpose();
|
||||
|
||||
@@ -762,9 +764,7 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
|
||||
DEBUG_POS("", current_position);
|
||||
}
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
if (bltouch.triggered() && bltouch.high_speed_mode) bltouch._reset();
|
||||
#endif
|
||||
TERN_(BLTOUCH, if (bltouch.high_speed_mode && bltouch.triggered()) bltouch._reset());
|
||||
|
||||
// On delta keep Z below clip height or do_blocking_move_to will abort
|
||||
xyz_pos_t npos = { rx, ry, TERN(DELTA, _MIN(delta_clip_start_height, current_position.z), current_position.z) };
|
||||
|
||||
@@ -277,7 +277,9 @@ typedef struct SettingsDataStruct {
|
||||
// BLTOUCH
|
||||
//
|
||||
bool bltouch_od_5v_mode;
|
||||
bool bltouch_high_speed_mode; // M401 S
|
||||
#ifdef BLTOUCH_HS_MODE
|
||||
bool bltouch_high_speed_mode; // M401 S
|
||||
#endif
|
||||
|
||||
//
|
||||
// Kinematic Settings
|
||||
@@ -863,9 +865,11 @@ void MarlinSettings::postprocess() {
|
||||
const bool bltouch_od_5v_mode = TERN0(BLTOUCH, bltouch.od_5v_mode);
|
||||
EEPROM_WRITE(bltouch_od_5v_mode);
|
||||
|
||||
_FIELD_TEST(bltouch_high_speed_mode);
|
||||
const bool bltouch_high_speed_mode = TERN0(BLTOUCH, bltouch.high_speed_mode);
|
||||
EEPROM_WRITE(bltouch_high_speed_mode);
|
||||
#ifdef BLTOUCH_HS_MODE
|
||||
_FIELD_TEST(bltouch_high_speed_mode);
|
||||
const bool bltouch_high_speed_mode = TERN0(BLTOUCH, bltouch.high_speed_mode);
|
||||
EEPROM_WRITE(bltouch_high_speed_mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1738,13 +1742,15 @@ void MarlinSettings::postprocess() {
|
||||
#endif
|
||||
EEPROM_READ(bltouch_od_5v_mode);
|
||||
|
||||
_FIELD_TEST(bltouch_high_speed_mode);
|
||||
#if ENABLED(BLTOUCH)
|
||||
const bool &bltouch_high_speed_mode = bltouch.high_speed_mode;
|
||||
#else
|
||||
bool bltouch_high_speed_mode;
|
||||
#ifdef BLTOUCH_HS_MODE
|
||||
_FIELD_TEST(bltouch_high_speed_mode);
|
||||
#if ENABLED(BLTOUCH)
|
||||
const bool &bltouch_high_speed_mode = bltouch.high_speed_mode;
|
||||
#else
|
||||
bool bltouch_high_speed_mode;
|
||||
#endif
|
||||
EEPROM_READ(bltouch_high_speed_mode);
|
||||
#endif
|
||||
EEPROM_READ(bltouch_high_speed_mode);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2744,7 +2750,9 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
// BLTouch
|
||||
//
|
||||
TERN_(BLTOUCH, bltouch.high_speed_mode = ENABLED(BLTOUCH_HS_MODE));
|
||||
#ifdef BLTOUCH_HS_MODE
|
||||
bltouch.high_speed_mode = ENABLED(BLTOUCH_HS_MODE);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Kinematic settings
|
||||
|
||||
Reference in New Issue
Block a user