From 3e927ff204279f21ac183d1e6d6834207e71c3c6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 15 Mar 2017 03:20:41 -0500 Subject: [PATCH 1/5] Replace MBL Z hacking --- Marlin/Conditionals_post.h | 5 + Marlin/Configuration.h | 4 +- Marlin/Marlin_main.cpp | 137 ++++++------------ Marlin/SanityCheck.h | 2 + Marlin/enum.h | 21 +-- .../Cartesio/Configuration.h | 4 +- .../Felix/Configuration.h | 4 +- .../Felix/DUAL/Configuration.h | 4 +- .../Hephestos/Configuration.h | 4 +- .../Hephestos_2/Configuration.h | 4 +- .../K8200/Configuration.h | 4 +- .../K8400/Configuration.h | 4 +- .../K8400/Dual-head/Configuration.h | 4 +- .../RepRapWorld/Megatronics/Configuration.h | 4 +- .../RigidBot/Configuration.h | 4 +- .../SCARA/Configuration.h | 4 +- .../TAZ4/Configuration.h | 4 +- .../WITBOX/Configuration.h | 4 +- .../adafruit/ST7565/Configuration.h | 4 +- .../delta/flsun_kossel_mini/Configuration.h | 4 +- .../delta/generic/Configuration.h | 4 +- .../delta/kossel_mini/Configuration.h | 4 +- .../delta/kossel_pro/Configuration.h | 4 +- .../delta/kossel_xl/Configuration.h | 4 +- .../makibox/Configuration.h | 4 +- .../tvrrug/Round2/Configuration.h | 4 +- Marlin/mesh_bed_leveling.h | 19 +++ Marlin/ultralcd.cpp | 71 ++++----- 28 files changed, 148 insertions(+), 195 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index fbb3ea644c..c024f30ede 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -709,6 +709,11 @@ #ifndef Z_CLEARANCE_BETWEEN_PROBES #define Z_CLEARANCE_BETWEEN_PROBES Z_HOMING_HEIGHT #endif + #if Z_CLEARANCE_BETWEEN_PROBES > Z_HOMING_HEIGHT + #define MANUAL_PROBE_HEIGHT Z_CLEARANCE_BETWEEN_PROBES + #else + #define MANUAL_PROBE_HEIGHT Z_HOMING_HEIGHT + #endif #if IS_KINEMATIC // Check for this in the code instead diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ce773728e2..541c52d088 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -750,9 +750,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index c560a076d0..2bfe4fb1d4 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3450,7 +3450,7 @@ inline void gcode_G28() { stepper.synchronize(); // Disable the leveling matrix before homing - #if PLANNER_LEVELING + #if PLANNER_LEVELING || ENABLED(MESH_BED_LEVELING) set_bed_leveling_enabled(false); #endif @@ -3464,31 +3464,6 @@ inline void gcode_G28() { extruder_duplication_enabled = false; #endif - /** - * For mesh bed leveling deactivate the mesh calculations, will be turned - * on again when homing all axis - */ - #if ENABLED(MESH_BED_LEVELING) - float pre_home_z = MESH_HOME_SEARCH_Z; - if (mbl.active()) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("MBL was active"); - #endif - // Use known Z position if already homed - if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) { - set_bed_leveling_enabled(false); - pre_home_z = current_position[Z_AXIS]; - } - else { - mbl.set_active(false); - current_position[Z_AXIS] = pre_home_z; - } - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("Set Z to pre_home_z", current_position); - #endif - } - #endif - setup_for_endstop_or_probe_move(); #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(true)"); @@ -3620,43 +3595,14 @@ inline void gcode_G28() { // Enable mesh leveling again #if ENABLED(MESH_BED_LEVELING) - if (mbl.has_mesh()) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("MBL has mesh"); - #endif + if (mbl.reactivate()) { + set_bed_leveling_enabled(true); if (home_all_axis || (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && homeZ)) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("MBL Z homing"); - #endif - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z - #if Z_HOME_DIR > 0 - + Z_MAX_POS - #endif - ; - SYNC_PLAN_POSITION_KINEMATIC(); - mbl.set_active(true); #if ENABLED(MESH_G28_REST_ORIGIN) - current_position[Z_AXIS] = 0.0; + current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS); set_destination_to_current(); line_to_destination(homing_feedrate_mm_s[Z_AXIS]); stepper.synchronize(); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position); - #endif - #else - planner.unapply_leveling(current_position); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("MBL adjusted MESH_HOME_SEARCH_Z", current_position); - #endif - #endif - } - else if ((axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) && (homeX || homeY)) { - current_position[Z_AXIS] = pre_home_z; - SYNC_PLAN_POSITION_KINEMATIC(); - mbl.set_active(true); - planner.unapply_leveling(current_position); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Home X or Y", current_position); #endif } } @@ -3664,16 +3610,16 @@ inline void gcode_G28() { clean_up_after_endstop_or_probe_move(); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G28"); - #endif - // Restore the active tool after homing #if HOTENDS > 1 tool_change(old_tool_index, 0, true); #endif report_current_position(); + + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G28"); + #endif } #if HAS_PROBING_PROCEDURE @@ -3690,25 +3636,21 @@ inline void gcode_G28() { inline void _mbl_goto_xy(const float &x, const float &y) { const float old_feedrate_mm_s = feedrate_mm_s; - feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS]; - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z - #if Z_CLEARANCE_BETWEEN_PROBES > Z_HOMING_HEIGHT - + Z_CLEARANCE_BETWEEN_PROBES - #elif Z_HOMING_HEIGHT > 0 - + Z_HOMING_HEIGHT - #endif - ; - line_to_current_position(); + #if MANUAL_PROBE_HEIGHT > 0 + feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS]; + current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT; + line_to_current_position(); + #endif feedrate_mm_s = MMM_TO_MMS(XY_PROBE_SPEED); current_position[X_AXIS] = LOGICAL_X_POSITION(x); current_position[Y_AXIS] = LOGICAL_Y_POSITION(y); line_to_current_position(); - #if Z_CLEARANCE_BETWEEN_PROBES > 0 || Z_HOMING_HEIGHT > 0 + #if MANUAL_PROBE_HEIGHT > 0 feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS]; - current_position[Z_AXIS] = LOGICAL_Z_POSITION(MESH_HOME_SEARCH_Z); + current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + 0.2; // just slightly over the bed line_to_current_position(); #endif @@ -3721,7 +3663,6 @@ inline void gcode_G28() { void mbl_mesh_report() { SERIAL_PROTOCOLLNPGM("Num X,Y: " STRINGIFY(MESH_NUM_X_POINTS) "," STRINGIFY(MESH_NUM_Y_POINTS)); - SERIAL_PROTOCOLLNPGM("Z search height: " STRINGIFY(MESH_HOME_SEARCH_Z)); SERIAL_PROTOCOLPGM("Z offset: "); SERIAL_PROTOCOL_F(mbl.z_offset, 5); SERIAL_PROTOCOLLNPGM("\nMeasured points:"); for (uint8_t py = 0; py < MESH_NUM_Y_POINTS; py++) { @@ -3757,6 +3698,10 @@ inline void gcode_G28() { inline void gcode_G29() { static int probe_index = -1; + #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) + static bool enable_soft_endstops; + #endif + const MeshLevelingState state = code_seen('S') ? (MeshLevelingState)code_value_byte() : MeshReport; if (state < 0 || state > 5) { SERIAL_PROTOCOLLNPGM("S out of range (0-5)."); @@ -3788,33 +3733,34 @@ inline void gcode_G28() { } // For each G29 S2... if (probe_index == 0) { - // For the initial G29 S2 make Z a positive value (e.g., 4.0) - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z - #if Z_HOME_DIR > 0 - + Z_MAX_POS - #endif - ; - SYNC_PLAN_POSITION_KINEMATIC(); + #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) + // For the initial G29 S2 save software endstop state + enable_soft_endstops = soft_endstops_enabled; + #endif } else { // For G29 S2 after adjusting Z. mbl.set_zigzag_z(probe_index - 1, current_position[Z_AXIS]); + #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) + soft_endstops_enabled = enable_soft_endstops; + #endif } // If there's another point to sample, move there with optional lift. if (probe_index < (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) { mbl.zigzag(probe_index, px, py); _mbl_goto_xy(mbl.get_probe_x(px), mbl.get_probe_y(py)); + + #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) + // Disable software endstops to allow manual adjustment + // If G29 is not completed, they will not be re-enabled + soft_endstops_enabled = false; + #endif + probe_index++; } else { // One last "return to the bed" (as originally coded) at completion - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z - #if Z_CLEARANCE_BETWEEN_PROBES > Z_HOMING_HEIGHT - + Z_CLEARANCE_BETWEEN_PROBES - #elif Z_HOMING_HEIGHT > 0 - + Z_HOMING_HEIGHT - #endif - ; + current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT; line_to_current_position(); stepper.synchronize(); @@ -3822,7 +3768,12 @@ inline void gcode_G28() { SERIAL_PROTOCOLLNPGM("Mesh probing done."); probe_index = -1; mbl.set_has_mesh(true); + mbl.set_reactivate(true); enqueue_and_echo_commands_P(PSTR("G28")); + #if HAS_BUZZER + lcd_buzz(200, 659); + lcd_buzz(200, 698); + #endif } break; @@ -3871,14 +3822,8 @@ inline void gcode_G28() { break; case MeshReset: - if (mbl.active()) { - current_position[Z_AXIS] -= MESH_HOME_SEARCH_Z; - planner.apply_leveling(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]); - mbl.reset(); - SYNC_PLAN_POSITION_KINEMATIC(); - } - else - mbl.reset(); + reset_bed_level(); + break; } // switch(state) diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index b39e837e57..f144bf909c 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -130,6 +130,8 @@ #error "Z_RAISE_PROBE_DEPLOY_STOW and Z_RAISE_BETWEEN_PROBINGS are now Z_CLEARANCE_DEPLOY_PROBE and Z_CLEARANCE_BETWEEN_PROBES. Please update your configuration." #elif defined(Z_PROBE_DEPLOY_HEIGHT) || defined(Z_PROBE_TRAVEL_HEIGHT) #error "Z_PROBE_DEPLOY_HEIGHT and Z_PROBE_TRAVEL_HEIGHT are now Z_CLEARANCE_DEPLOY_PROBE and Z_CLEARANCE_BETWEEN_PROBES. Please update your configuration." +#elif defined(MESH_HOME_SEARCH_Z) + #error "MESH_HOME_SEARCH_Z is now MANUAL_PROBE_Z_RANGE. Please update your configuration." #elif !defined(MIN_STEPS_PER_SEGMENT) #error Please replace "const int dropsegments" with "#define MIN_STEPS_PER_SEGMENT" (and increase by 1) in Configuration_adv.h. #elif defined(PREVENT_DANGEROUS_EXTRUDE) diff --git a/Marlin/enum.h b/Marlin/enum.h index 41b40063c8..9175696a5b 100644 --- a/Marlin/enum.h +++ b/Marlin/enum.h @@ -164,20 +164,13 @@ enum TempState { }; #endif -#if ENABLED(MESH_BED_LEVELING) - enum MeshLevelingState { - MeshReport, - MeshStart, - MeshNext, - MeshSet, - MeshSetZOffset, - MeshReset - }; - - enum MBLStatus { - MBL_STATUS_NONE = 0, - MBL_STATUS_HAS_MESH_BIT = 0, - MBL_STATUS_ACTIVE_BIT = 1 +#if ENABLED(PROBE_MANUALLY) + enum ABLState { + ABLReport, + ABLStart, + ABLNext, + ABLSet, + ABLReset }; #endif diff --git a/Marlin/example_configurations/Cartesio/Configuration.h b/Marlin/example_configurations/Cartesio/Configuration.h index eeec79db95..912ecb308a 100644 --- a/Marlin/example_configurations/Cartesio/Configuration.h +++ b/Marlin/example_configurations/Cartesio/Configuration.h @@ -750,9 +750,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 2e2f3ecf2e..875aef30d8 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -733,9 +733,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/Felix/DUAL/Configuration.h b/Marlin/example_configurations/Felix/DUAL/Configuration.h index 9bf834d679..7f82de7288 100644 --- a/Marlin/example_configurations/Felix/DUAL/Configuration.h +++ b/Marlin/example_configurations/Felix/DUAL/Configuration.h @@ -733,9 +733,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 6dad4643b3..52c968b4f4 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -742,9 +742,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index 2c3e399fff..0e009beccd 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -744,9 +744,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index df8e92ad6c..dcc2f3a4e8 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -779,9 +779,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/K8400/Configuration.h b/Marlin/example_configurations/K8400/Configuration.h index dbc06c08c1..83f3074aaf 100644 --- a/Marlin/example_configurations/K8400/Configuration.h +++ b/Marlin/example_configurations/K8400/Configuration.h @@ -750,9 +750,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/K8400/Dual-head/Configuration.h b/Marlin/example_configurations/K8400/Dual-head/Configuration.h index fc4f6b7aef..3b1dd25e97 100644 --- a/Marlin/example_configurations/K8400/Dual-head/Configuration.h +++ b/Marlin/example_configurations/K8400/Dual-head/Configuration.h @@ -750,9 +750,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 5088a96c54..c2daa8b793 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -750,9 +750,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index 1242383b65..760ddce5d7 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -749,9 +749,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 7811a2c3aa..e10f0fa396 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -765,9 +765,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/TAZ4/Configuration.h b/Marlin/example_configurations/TAZ4/Configuration.h index 23a734b1c1..0bac6f9810 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -771,9 +771,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 4632893655..7ec8578509 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -742,9 +742,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index 6d3625871b..96f997c3f5 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -750,9 +750,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h b/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h index e6e36ea10a..64e09796a6 100644 --- a/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h @@ -853,9 +853,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 98b17324c3..271b42a649 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -836,9 +836,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index bce910de7e..dde95b82ff 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -839,9 +839,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 437b9bcfe2..58b4fade3d 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -838,9 +838,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index c8a28c42dd..37fb2718a8 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -842,9 +842,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index bc95a78c49..2d2f09f0a0 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -753,9 +753,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index e5c43a8328..4e3b10daf8 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -746,9 +746,9 @@ #define MESH_INSET 10 // Mesh inset margin on print area #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 - #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. + #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0] + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS //#define MANUAL_BED_LEVELING // Add display menu option for bed leveling. diff --git a/Marlin/mesh_bed_leveling.h b/Marlin/mesh_bed_leveling.h index 217cd60340..2f5758818d 100644 --- a/Marlin/mesh_bed_leveling.h +++ b/Marlin/mesh_bed_leveling.h @@ -23,6 +23,23 @@ #include "Marlin.h" #if ENABLED(MESH_BED_LEVELING) + + enum MeshLevelingState { + MeshReport, + MeshStart, + MeshNext, + MeshSet, + MeshSetZOffset, + MeshReset + }; + + enum MBLStatus { + MBL_STATUS_NONE = 0, + MBL_STATUS_HAS_MESH_BIT = 0, + MBL_STATUS_ACTIVE_BIT = 1, + MBL_STATUS_REACTIVATE_BIT = 2 + }; + #define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X))/(MESH_NUM_X_POINTS - 1)) #define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y))/(MESH_NUM_Y_POINTS - 1)) @@ -44,6 +61,8 @@ void set_active(const bool onOff) { onOff ? SBI(status, MBL_STATUS_ACTIVE_BIT) : CBI(status, MBL_STATUS_ACTIVE_BIT); } bool has_mesh() const { return TEST(status, MBL_STATUS_HAS_MESH_BIT); } void set_has_mesh(const bool onOff) { onOff ? SBI(status, MBL_STATUS_HAS_MESH_BIT) : CBI(status, MBL_STATUS_HAS_MESH_BIT); } + bool reactivate() { bool b = TEST(status, MBL_STATUS_REACTIVATE_BIT); CBI(status, MBL_STATUS_REACTIVATE_BIT); return b; } + void set_reactivate(const bool onOff) { onOff ? SBI(status, MBL_STATUS_REACTIVATE_BIT) : CBI(status, MBL_STATUS_REACTIVATE_BIT); } inline void zigzag(const int8_t index, int8_t &px, int8_t &py) const { px = index % (MESH_NUM_X_POINTS); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index f788addde3..f657e14e07 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1223,18 +1223,17 @@ void kill_screen(const char* lcd_msg) { static uint8_t _lcd_level_bed_position; // Utility to go to the next mesh point - // A raise is added between points if Z_HOMING_HEIGHT is in use - // Note: During Manual Bed Leveling the homed Z position is MESH_HOME_SEARCH_Z - // Z position will be restored with the final action, a G28 - inline void _mbl_goto_xy(float x, float y) { + inline void _manual_probe_xy(float x, float y) { if (no_reentrance) return; - current_position[Z_AXIS] = LOGICAL_Z_POSITION(MESH_HOME_SEARCH_Z + Z_HOMING_HEIGHT); - line_to_current(Z_AXIS); + #if MANUAL_PROBE_HEIGHT > 0 + current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT; + line_to_current(Z_AXIS); + #endif current_position[X_AXIS] = LOGICAL_X_POSITION(x); current_position[Y_AXIS] = LOGICAL_Y_POSITION(y); planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder); - #if Z_HOMING_HEIGHT > 0 - current_position[Z_AXIS] = LOGICAL_Z_POSITION(MESH_HOME_SEARCH_Z); + #if MANUAL_PROBE_HEIGHT > 0 + current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + 0.2; line_to_current(Z_AXIS); #endif lcd_synchronize(); @@ -1259,48 +1258,44 @@ void kill_screen(const char* lcd_msg) { if (encoderPosition) { refresh_cmd_timeout(); current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP); - NOLESS(current_position[Z_AXIS], 0); - NOMORE(current_position[Z_AXIS], MESH_HOME_SEARCH_Z * 2); + NOLESS(current_position[Z_AXIS], -(MANUAL_PROBE_Z_RANGE) * 0.5); + NOMORE(current_position[Z_AXIS], (MANUAL_PROBE_Z_RANGE) * 0.5); line_to_current(Z_AXIS); lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; encoderPosition = 0; } - static bool debounce_click = false; if (lcd_clicked) { - if (!debounce_click) { - debounce_click = true; // ignore multiple "clicks" in a row - mbl.set_zigzag_z(_lcd_level_bed_position++, current_position[Z_AXIS]); - if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) { - lcd_goto_screen(_lcd_level_bed_done); + mbl.set_zigzag_z(_lcd_level_bed_position++, current_position[Z_AXIS]); + if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) { + lcd_goto_screen(_lcd_level_bed_done); - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z + Z_HOMING_HEIGHT; + #if MANUAL_PROBE_HEIGHT > 0 + current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT; line_to_current(Z_AXIS); lcd_synchronize(); + #endif - mbl.set_has_mesh(true); - enqueue_and_echo_commands_P(PSTR("G28")); - lcd_return_to_status(); - //LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE); - #if HAS_BUZZER - lcd_buzz(200, 659); - lcd_buzz(200, 698); - #endif - } - else { - lcd_goto_screen(_lcd_level_goto_next_point); - } + mbl.set_has_mesh(true); + mbl.set_reactivate(true); + enqueue_and_echo_commands_P(PSTR("G28")); + lcd_return_to_status(); + //LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE); + #if HAS_BUZZER + lcd_buzz(200, 659); + lcd_buzz(200, 698); + #endif + } + else { + lcd_goto_screen(_lcd_level_goto_next_point); } - } - else { - debounce_click = false; } KeepDrawing: // Update on first display, then only on updates to Z position // Show message above on clicks instead if (lcdDrawUpdate) { - float v = current_position[Z_AXIS] - MESH_HOME_SEARCH_Z; + const float v = current_position[Z_AXIS]; lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001 : 0.0001), '+')); } @@ -1326,10 +1321,10 @@ KeepDrawing: // Set the menu to display ahead of blocking call lcd_goto_screen(_lcd_level_bed_moving); - // _mbl_goto_xy runs the menu loop until the move is done + // _manual_probe_xy runs the menu loop until the move is done int8_t px, py; mbl.zigzag(_lcd_level_bed_position, px, py); - _mbl_goto_xy(mbl.get_probe_x(px), mbl.get_probe_y(py)); + _manual_probe_xy(mbl.get_probe_x(px), mbl.get_probe_y(py)); // After the blocking function returns, change menus lcd_goto_screen(_lcd_level_bed_get_z); @@ -1343,12 +1338,6 @@ KeepDrawing: if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING)); if (lcd_clicked) { _lcd_level_bed_position = 0; - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z - #if Z_HOME_DIR > 0 - + Z_MAX_POS - #endif - ; - planner.set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); lcd_goto_screen(_lcd_level_goto_next_point); } } From e4649c90441c81918a5cae73f5d29f286b459f05 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 Mar 2017 17:20:24 -0500 Subject: [PATCH 2/5] Add HAS_SOFTWARE_ENDSTOPS macro --- Marlin/Conditionals_LCD.h | 2 ++ Marlin/Marlin.h | 2 +- Marlin/Marlin_main.cpp | 16 +++++++--------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/Conditionals_LCD.h b/Marlin/Conditionals_LCD.h index 49b59784ac..0949dcee99 100644 --- a/Marlin/Conditionals_LCD.h +++ b/Marlin/Conditionals_LCD.h @@ -369,4 +369,6 @@ #undef Z_MIN_PROBE_ENDSTOP #endif + #define HAS_SOFTWARE_ENDSTOPS (ENABLED(min_software_endstops) || ENABLED(max_software_endstops)) + #endif //CONDITIONALS_LCD_H diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 4947341f5c..1ce190b458 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -304,7 +304,7 @@ extern float current_position[NUM_AXIS]; extern float soft_endstop_min[XYZ]; extern float soft_endstop_max[XYZ]; -#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) +#if HAS_SOFTWARE_ENDSTOPS extern bool soft_endstops_enabled; void clamp_to_software_endstops(float target[XYZ]); #else diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 2bfe4fb1d4..edf4e945f9 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -414,7 +414,7 @@ float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DI #endif // Software Endstops are based on the configured limits. -#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) +#if HAS_SOFTWARE_ENDSTOPS bool soft_endstops_enabled = true; #endif float soft_endstop_min[XYZ] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS }, @@ -3698,7 +3698,7 @@ inline void gcode_G28() { inline void gcode_G29() { static int probe_index = -1; - #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) + #if HAS_SOFTWARE_ENDSTOPS static bool enable_soft_endstops; #endif @@ -3733,7 +3733,7 @@ inline void gcode_G28() { } // For each G29 S2... if (probe_index == 0) { - #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) + #if HAS_SOFTWARE_ENDSTOPS // For the initial G29 S2 save software endstop state enable_soft_endstops = soft_endstops_enabled; #endif @@ -3741,7 +3741,7 @@ inline void gcode_G28() { else { // For G29 S2 after adjusting Z. mbl.set_zigzag_z(probe_index - 1, current_position[Z_AXIS]); - #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) + #if HAS_SOFTWARE_ENDSTOPS soft_endstops_enabled = enable_soft_endstops; #endif } @@ -3750,7 +3750,7 @@ inline void gcode_G28() { mbl.zigzag(probe_index, px, py); _mbl_goto_xy(mbl.get_probe_x(px), mbl.get_probe_y(py)); - #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) + #if HAS_SOFTWARE_ENDSTOPS // Disable software endstops to allow manual adjustment // If G29 is not completed, they will not be re-enabled soft_endstops_enabled = false; @@ -6372,10 +6372,8 @@ inline void gcode_M205() { */ inline void gcode_M211() { SERIAL_ECHO_START; - #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) + #if HAS_SOFTWARE_ENDSTOPS if (code_seen('S')) soft_endstops_enabled = code_value_bool(); - #endif - #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) SERIAL_ECHOPGM(MSG_SOFT_ENDSTOPS); serialprintPGM(soft_endstops_enabled ? PSTR(MSG_ON) : PSTR(MSG_OFF)); #else @@ -8978,7 +8976,7 @@ void ok_to_send() { SERIAL_EOL; } -#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) +#if HAS_SOFTWARE_ENDSTOPS /** * Constrain the given coordinates to the software endstops. From d01b91508568ecd6b69e4d09e9b91a21dfa5cdd5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 Mar 2017 17:28:44 -0500 Subject: [PATCH 3/5] Implement soft_endstops_enabled for clamping --- Marlin/Marlin_main.cpp | 1 + Marlin/ultralcd.cpp | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index edf4e945f9..f4925d36ff 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -8982,6 +8982,7 @@ void ok_to_send() { * Constrain the given coordinates to the software endstops. */ void clamp_to_software_endstops(float target[XYZ]) { + if (!soft_endstops_enabled) return; #if ENABLED(min_software_endstops) NOLESS(target[X_AXIS], soft_endstop_min[X_AXIS]); NOLESS(target[Y_AXIS], soft_endstop_min[Y_AXIS]); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index f657e14e07..1d95315437 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1596,9 +1596,20 @@ KeepDrawing: if (encoderPosition) { refresh_cmd_timeout(); - // Limit to software endstops, if enabled - float min = (soft_endstops_enabled && min_software_endstops) ? soft_endstop_min[axis] : current_position[axis] - 1000, - max = (soft_endstops_enabled && max_software_endstops) ? soft_endstop_max[axis] : current_position[axis] + 1000; + float min = current_position[axis] - 1000, + max = current_position[axis] + 1000; + + #if HAS_SOFTWARE_ENDSTOPS + // Limit to software endstops, if enabled + if (soft_endstops_enabled) { + #if ENABLED(min_software_endstops) + min = soft_endstop_min[axis]; + #endif + #if ENABLED(max_software_endstops) + max = soft_endstop_max[axis]; + #endif + } + #endif // Get the new position current_position[axis] += float((int32_t)encoderPosition) * move_menu_scale; From 0e410c9dfd98e6857fc8f3ab8a5356bcf55480a9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 Mar 2017 20:03:57 -0500 Subject: [PATCH 4/5] Software endstop options as simple switches --- Marlin/Conditionals_LCD.h | 2 +- Marlin/Configuration.h | 13 +++++++------ Marlin/Marlin_main.cpp | 8 ++++---- Marlin/SanityCheck.h | 2 ++ .../example_configurations/Cartesio/Configuration.h | 13 +++++++------ Marlin/example_configurations/Felix/Configuration.h | 11 ++++++----- .../Felix/DUAL/Configuration.h | 13 +++++++------ .../Hephestos/Configuration.h | 13 +++++++------ .../Hephestos_2/Configuration.h | 13 +++++++------ Marlin/example_configurations/K8200/Configuration.h | 13 +++++++------ Marlin/example_configurations/K8400/Configuration.h | 13 +++++++------ .../K8400/Dual-head/Configuration.h | 13 +++++++------ .../RepRapWorld/Megatronics/Configuration.h | 13 +++++++------ .../example_configurations/RigidBot/Configuration.h | 13 +++++++------ Marlin/example_configurations/SCARA/Configuration.h | 13 +++++++------ Marlin/example_configurations/TAZ4/Configuration.h | 13 +++++++------ .../example_configurations/WITBOX/Configuration.h | 13 +++++++------ .../adafruit/ST7565/Configuration.h | 13 +++++++------ .../delta/flsun_kossel_mini/Configuration.h | 13 +++++++------ .../delta/generic/Configuration.h | 13 +++++++------ .../delta/kossel_mini/Configuration.h | 13 +++++++------ .../delta/kossel_pro/Configuration.h | 13 +++++++------ .../delta/kossel_xl/Configuration.h | 13 +++++++------ .../example_configurations/makibox/Configuration.h | 13 +++++++------ .../tvrrug/Round2/Configuration.h | 13 +++++++------ Marlin/ultralcd.cpp | 4 ++-- 26 files changed, 162 insertions(+), 138 deletions(-) diff --git a/Marlin/Conditionals_LCD.h b/Marlin/Conditionals_LCD.h index 0949dcee99..318a7834f2 100644 --- a/Marlin/Conditionals_LCD.h +++ b/Marlin/Conditionals_LCD.h @@ -369,6 +369,6 @@ #undef Z_MIN_PROBE_ENDSTOP #endif - #define HAS_SOFTWARE_ENDSTOPS (ENABLED(min_software_endstops) || ENABLED(max_software_endstops)) + #define HAS_SOFTWARE_ENDSTOPS (ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS)) #endif //CONDITIONALS_LCD_H diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 541c52d088..11c05018d3 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -705,16 +705,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -725,6 +721,11 @@ #define Y_MAX_POS 200 #define Z_MAX_POS 200 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f4925d36ff..8a99326d95 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -7889,7 +7889,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n && (delayed_move_time || current_position[X_AXIS] != xhome) ) { float raised_z = current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT; - #if ENABLED(max_software_endstops) + #if ENABLED(MAX_SOFTWARE_ENDSTOPS) NOMORE(raised_z, soft_endstop_max[Z_AXIS]); #endif #if ENABLED(DEBUG_LEVELING_FEATURE) @@ -7940,7 +7940,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n // record raised toolhead position for use by unpark COPY(raised_parked_position, current_position); raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT; - #if ENABLED(max_software_endstops) + #if ENABLED(MAX_SOFTWARE_ENDSTOPS) NOMORE(raised_parked_position[Z_AXIS], soft_endstop_max[Z_AXIS]); #endif active_extruder_parked = true; @@ -8983,12 +8983,12 @@ void ok_to_send() { */ void clamp_to_software_endstops(float target[XYZ]) { if (!soft_endstops_enabled) return; - #if ENABLED(min_software_endstops) + #if ENABLED(MIN_SOFTWARE_ENDSTOPS) NOLESS(target[X_AXIS], soft_endstop_min[X_AXIS]); NOLESS(target[Y_AXIS], soft_endstop_min[Y_AXIS]); NOLESS(target[Z_AXIS], soft_endstop_min[Z_AXIS]); #endif - #if ENABLED(max_software_endstops) + #if ENABLED(MAX_SOFTWARE_ENDSTOPS) NOMORE(target[X_AXIS], soft_endstop_max[X_AXIS]); NOMORE(target[Y_AXIS], soft_endstop_max[Y_AXIS]); NOMORE(target[Z_AXIS], soft_endstop_max[Z_AXIS]); diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index f144bf909c..711e32b102 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -158,6 +158,8 @@ #error "LCD_PIN_RESET is now LCD_RESET_PIN. Please update your pins definitions." #elif defined(EXTRUDER_0_AUTO_FAN_PIN) || defined(EXTRUDER_1_AUTO_FAN_PIN) || defined(EXTRUDER_2_AUTO_FAN_PIN) || defined(EXTRUDER_3_AUTO_FAN_PIN) #error "EXTRUDER_[0123]_AUTO_FAN_PIN is now E[0123]_AUTO_FAN_PIN. Please update your Configuration_adv.h." +#elif defined(min_software_endstops) || defined(max_software_endstops) + #error "(min|max)_software_endstops are now (MIN|MAX)_SOFTWARE_ENDSTOPS. Please update your configuration." #endif /** diff --git a/Marlin/example_configurations/Cartesio/Configuration.h b/Marlin/example_configurations/Cartesio/Configuration.h index 912ecb308a..7c9e1f216c 100644 --- a/Marlin/example_configurations/Cartesio/Configuration.h +++ b/Marlin/example_configurations/Cartesio/Configuration.h @@ -705,16 +705,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -725,6 +721,11 @@ #define Y_MAX_POS 270 #define Z_MAX_POS 400 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 875aef30d8..5776379192 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -688,16 +688,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN +// Direction of endstops when homing; 1=MAX, -1=MIN // :[-1, 1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -708,6 +704,11 @@ #define Y_MAX_POS 205 #define Z_MAX_POS 235 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/Felix/DUAL/Configuration.h b/Marlin/example_configurations/Felix/DUAL/Configuration.h index 7f82de7288..c4858da729 100644 --- a/Marlin/example_configurations/Felix/DUAL/Configuration.h +++ b/Marlin/example_configurations/Felix/DUAL/Configuration.h @@ -688,16 +688,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -708,6 +704,11 @@ #define Y_MAX_POS 205 #define Z_MAX_POS 235 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 52c968b4f4..6c3a4cdd1d 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -697,16 +697,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -717,6 +713,11 @@ #define Y_MAX_POS 210 #define Z_MAX_POS 180 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index 0e009beccd..2d805a3e7c 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -699,16 +699,12 @@ #define Z_HOMING_HEIGHT 5 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -719,6 +715,11 @@ #define Y_MAX_POS 297 #define Z_MAX_POS 210 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index dcc2f3a4e8..e160c2d67f 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -734,16 +734,12 @@ #define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -754,6 +750,11 @@ #define Y_MAX_POS 200 #define Z_MAX_POS 200 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/K8400/Configuration.h b/Marlin/example_configurations/K8400/Configuration.h index 83f3074aaf..28738bd7a0 100644 --- a/Marlin/example_configurations/K8400/Configuration.h +++ b/Marlin/example_configurations/K8400/Configuration.h @@ -705,16 +705,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -725,6 +721,11 @@ #define Y_MAX_POS 200 #define Z_MAX_POS 190 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/K8400/Dual-head/Configuration.h b/Marlin/example_configurations/K8400/Dual-head/Configuration.h index 3b1dd25e97..a70f637fc5 100644 --- a/Marlin/example_configurations/K8400/Dual-head/Configuration.h +++ b/Marlin/example_configurations/K8400/Dual-head/Configuration.h @@ -705,16 +705,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -725,6 +721,11 @@ #define Y_MAX_POS 200 #define Z_MAX_POS 190 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index c2daa8b793..f3fe5a604a 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -705,16 +705,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -725,6 +721,11 @@ #define Y_MAX_POS 200 #define Z_MAX_POS 200 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index 760ddce5d7..ac65922db4 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -704,16 +704,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -724,6 +720,11 @@ #define Y_MAX_POS 248 // RigidBot regular is 248mm, RigitBot Big is 304mm #define Z_MAX_POS 254 // RigidBot regular and Big are 254mm +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index e10f0fa396..73efa36ef0 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -720,16 +720,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR 1 #define Y_HOME_DIR 1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -740,6 +736,11 @@ #define Y_MAX_POS 200 #define Z_MAX_POS 225 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/TAZ4/Configuration.h b/Marlin/example_configurations/TAZ4/Configuration.h index 0bac6f9810..613c15bc23 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -726,16 +726,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -746,6 +742,11 @@ #define Y_MAX_POS 275 #define Z_MAX_POS 250 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 7ec8578509..2c57ac958a 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -697,16 +697,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR 1 #define Y_HOME_DIR 1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -717,6 +713,11 @@ #define Y_MAX_POS 210 #define Z_MAX_POS 200 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index 96f997c3f5..736996fcd7 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -705,16 +705,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -725,6 +721,11 @@ #define Y_MAX_POS 200 #define Z_MAX_POS 200 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h b/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h index 64e09796a6..c0e2356101 100644 --- a/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h @@ -807,16 +807,12 @@ #define Z_HOMING_HEIGHT 15 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR 1 // deltas always home to max #define Y_HOME_DIR 1 #define Z_HOME_DIR 1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -827,6 +823,11 @@ #define Y_MAX_POS DELTA_PRINTABLE_RADIUS #define Z_MAX_POS MANUAL_Z_HOME_POS +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 271b42a649..3ad12adb2d 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -791,16 +791,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR 1 // deltas always home to max #define Y_HOME_DIR 1 #define Z_HOME_DIR 1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -811,6 +807,11 @@ #define Y_MAX_POS DELTA_PRINTABLE_RADIUS #define Z_MAX_POS MANUAL_Z_HOME_POS +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index dde95b82ff..c7df7807ec 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -794,16 +794,12 @@ //#define Z_HOMING_HEIGHT 15 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR 1 // deltas always home to max #define Y_HOME_DIR 1 #define Z_HOME_DIR 1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -814,6 +810,11 @@ #define Y_MAX_POS DELTA_PRINTABLE_RADIUS #define Z_MAX_POS MANUAL_Z_HOME_POS +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 58b4fade3d..f45bc4867b 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -793,16 +793,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR 1 // deltas always home to max #define Y_HOME_DIR 1 #define Z_HOME_DIR 1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -813,6 +809,11 @@ #define Y_MAX_POS DELTA_PRINTABLE_RADIUS #define Z_MAX_POS MANUAL_Z_HOME_POS +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index 37fb2718a8..d684b9dc7c 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -797,16 +797,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR 1 // deltas always home to max #define Y_HOME_DIR 1 #define Z_HOME_DIR 1 -#define min_software_endstops false // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -817,6 +813,11 @@ #define Y_MAX_POS DELTA_PRINTABLE_RADIUS #define Z_MAX_POS MANUAL_Z_HOME_POS +// If enabled, axes won't move below MIN_POS in response to movement commands. +//#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 2d2f09f0a0..9cbfde94b0 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -708,16 +708,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -728,6 +724,11 @@ #define Y_MAX_POS 150 #define Z_MAX_POS 86 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 4e3b10daf8..1f984aa89c 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -701,16 +701,12 @@ //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. -// ENDSTOP SETTINGS: -// Sets direction of endstops when homing; 1=MAX, -1=MIN -// :[-1, 1] +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 -#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. - // @section machine // Travel limits after homing (units are in mm) @@ -721,6 +717,11 @@ #define Y_MAX_POS 205 #define Z_MAX_POS 120 +// If enabled, axes won't move below MIN_POS in response to movement commands. +#define MIN_SOFTWARE_ENDSTOPS +// If enabled, axes won't move above MAX_POS in response to movement commands. +#define MAX_SOFTWARE_ENDSTOPS + /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 1d95315437..505c0fef0e 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1602,10 +1602,10 @@ KeepDrawing: #if HAS_SOFTWARE_ENDSTOPS // Limit to software endstops, if enabled if (soft_endstops_enabled) { - #if ENABLED(min_software_endstops) + #if ENABLED(MIN_SOFTWARE_ENDSTOPS) min = soft_endstop_min[axis]; #endif - #if ENABLED(max_software_endstops) + #if ENABLED(MAX_SOFTWARE_ENDSTOPS) max = soft_endstop_max[axis]; #endif } From 11f1fdfab4b6c85e9c7143503bf031242810782b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 Mar 2017 20:29:31 -0500 Subject: [PATCH 5/5] _lcd_level_bed_position => manual_probe_index --- Marlin/ultralcd.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 505c0fef0e..2ba5419c5c 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1220,7 +1220,7 @@ void kill_screen(const char* lcd_msg) { * */ - static uint8_t _lcd_level_bed_position; + static uint8_t manual_probe_index; // Utility to go to the next mesh point inline void _manual_probe_xy(float x, float y) { @@ -1266,8 +1266,8 @@ void kill_screen(const char* lcd_msg) { } if (lcd_clicked) { - mbl.set_zigzag_z(_lcd_level_bed_position++, current_position[Z_AXIS]); - if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) { + mbl.set_zigzag_z(manual_probe_index++, current_position[Z_AXIS]); + if (manual_probe_index == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) { lcd_goto_screen(_lcd_level_bed_done); #if MANUAL_PROBE_HEIGHT > 0 @@ -1307,7 +1307,7 @@ KeepDrawing: void _lcd_level_bed_moving() { if (lcdDrawUpdate) { char msg[10]; - sprintf_P(msg, PSTR("%i / %u"), (int)(_lcd_level_bed_position + 1), (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)); + sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)); lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg); } @@ -1323,7 +1323,7 @@ KeepDrawing: // _manual_probe_xy runs the menu loop until the move is done int8_t px, py; - mbl.zigzag(_lcd_level_bed_position, px, py); + mbl.zigzag(manual_probe_index, px, py); _manual_probe_xy(mbl.get_probe_x(px), mbl.get_probe_y(py)); // After the blocking function returns, change menus @@ -1337,7 +1337,7 @@ KeepDrawing: void _lcd_level_bed_homing_done() { if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING)); if (lcd_clicked) { - _lcd_level_bed_position = 0; + manual_probe_index = 0; lcd_goto_screen(_lcd_level_goto_next_point); } }