Fix and improve software endstops (#13386)

This commit is contained in:
Scott Lahteine
2019-03-13 05:48:36 -05:00
committed by GitHub
parent 6214c997c0
commit 87162658c4
13 changed files with 131 additions and 123 deletions

View File

@ -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.