Fix and improve software endstops (#13386)
This commit is contained in:
@ -212,7 +212,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
#endif
|
||||
|
||||
#if HAS_SOFTWARE_ENDSTOPS && ENABLED(PROBE_MANUALLY)
|
||||
ABL_VAR bool enable_soft_endstops = true;
|
||||
ABL_VAR bool saved_soft_endstops_state = true;
|
||||
#endif
|
||||
|
||||
#if ABL_GRID
|
||||
@ -494,7 +494,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
if (seenA && g29_in_progress) {
|
||||
SERIAL_ECHOLNPGM("Manual G29 aborted");
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
soft_endstops_enabled = enable_soft_endstops;
|
||||
soft_endstops_enabled = saved_soft_endstops_state;
|
||||
#endif
|
||||
set_bed_leveling_enabled(abl_should_enable);
|
||||
g29_in_progress = false;
|
||||
@ -519,7 +519,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
if (abl_probe_index == 0) {
|
||||
// For the initial G29 S2 save software endstop state
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
enable_soft_endstops = soft_endstops_enabled;
|
||||
saved_soft_endstops_state = soft_endstops_enabled;
|
||||
#endif
|
||||
// Move close to the bed before the first point
|
||||
do_blocking_move_to_z(0);
|
||||
@ -617,7 +617,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
|
||||
// Re-enable software endstops, if needed
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
soft_endstops_enabled = enable_soft_endstops;
|
||||
soft_endstops_enabled = saved_soft_endstops_state;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -641,7 +641,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
|
||||
// Re-enable software endstops, if needed
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
soft_endstops_enabled = enable_soft_endstops;
|
||||
soft_endstops_enabled = saved_soft_endstops_state;
|
||||
#endif
|
||||
|
||||
if (!dryrun) {
|
||||
|
@ -59,7 +59,7 @@ void GcodeSuite::G29() {
|
||||
|
||||
static int mbl_probe_index = -1;
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
static bool enable_soft_endstops;
|
||||
static bool saved_soft_endstops_state;
|
||||
#endif
|
||||
|
||||
MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
|
||||
@ -99,7 +99,7 @@ void GcodeSuite::G29() {
|
||||
if (mbl_probe_index == 0) {
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
// For the initial G29 S2 save software endstop state
|
||||
enable_soft_endstops = soft_endstops_enabled;
|
||||
saved_soft_endstops_state = soft_endstops_enabled;
|
||||
#endif
|
||||
// Move close to the bed before the first point
|
||||
do_blocking_move_to_z(0);
|
||||
@ -108,7 +108,7 @@ void GcodeSuite::G29() {
|
||||
// Save Z for the previous mesh position
|
||||
mbl.set_zigzag_z(mbl_probe_index - 1, current_position[Z_AXIS]);
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
soft_endstops_enabled = enable_soft_endstops;
|
||||
soft_endstops_enabled = saved_soft_endstops_state;
|
||||
#endif
|
||||
}
|
||||
// If there's another point to sample, move there with optional lift.
|
||||
|
@ -38,13 +38,13 @@ void GcodeSuite::M211() {
|
||||
if (parser.seen('S')) soft_endstops_enabled = parser.value_bool();
|
||||
serialprint_onoff(soft_endstops_enabled);
|
||||
SERIAL_ECHOPGM(MSG_SOFT_MIN);
|
||||
SERIAL_ECHOPAIR( MSG_X, LOGICAL_X_POSITION(soft_endstop_min[X_AXIS]));
|
||||
SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop_min[Y_AXIS]));
|
||||
SERIAL_ECHOPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop_min[Z_AXIS]));
|
||||
SERIAL_ECHOPAIR( MSG_X, LOGICAL_X_POSITION(soft_endstop[X_AXIS].min));
|
||||
SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop[Y_AXIS].min));
|
||||
SERIAL_ECHOPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop[Z_AXIS].min));
|
||||
SERIAL_ECHOPGM(MSG_SOFT_MAX);
|
||||
SERIAL_ECHOPAIR( MSG_X, LOGICAL_X_POSITION(soft_endstop_max[X_AXIS]));
|
||||
SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop_max[Y_AXIS]));
|
||||
SERIAL_ECHOLNPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop_max[Z_AXIS]));
|
||||
SERIAL_ECHOPAIR( MSG_X, LOGICAL_X_POSITION(soft_endstop[X_AXIS].max));
|
||||
SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop[Y_AXIS].max));
|
||||
SERIAL_ECHOLNPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop[Z_AXIS].max));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -127,7 +127,7 @@ void GcodeSuite::M240() {
|
||||
parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : photo_position[Y_AXIS],
|
||||
(parser.seenval('Z') ? parser.value_linear_units() : photo_position[Z_AXIS]) + current_position[Z_AXIS]
|
||||
};
|
||||
clamp_to_software_endstops(raw);
|
||||
apply_motion_limits(raw);
|
||||
do_blocking_move_to(raw, fr_mm_s);
|
||||
|
||||
#ifdef PHOTO_SWITCH_POSITION
|
||||
|
@ -190,7 +190,7 @@ void plan_arc(
|
||||
#endif
|
||||
raw[E_AXIS] += extruder_per_segment;
|
||||
|
||||
clamp_to_software_endstops(raw);
|
||||
apply_motion_limits(raw);
|
||||
|
||||
#if HAS_LEVELING && !PLANNER_LEVELING
|
||||
planner.apply_leveling(raw);
|
||||
|
Reference in New Issue
Block a user