From 2ccdf4f36d368dd5b5d24aab05dc54c39e8bf458 Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Wed, 19 Feb 2014 00:02:59 -0800 Subject: [PATCH 1/4] Use descriptive constants instead of numeric literals --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f98d530de..47f81a4d4 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1241,7 +1241,7 @@ void process_commands() #else // NOT DELTA - home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))); + home_all_axis = !((code_seen(axis_codes[X_AXIS])) || (code_seen(axis_codes[Y_AXIS])) || (code_seen(axis_codes[Z_AXIS]))); #if Z_HOME_DIR > 0 // If homing away from BED do Z first if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) { From d2d7d186b5aaa208351d0dda35b26b59b6fbebca Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Wed, 19 Feb 2014 00:10:17 -0800 Subject: [PATCH 2/4] Use descriptive constants, more --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 47f81a4d4..a3f0d6048 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2088,7 +2088,7 @@ void process_commands() } else { - bool all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))|| (code_seen(axis_codes[3]))); + bool all_axis = !((code_seen(axis_codes[X_AXIS])) || (code_seen(axis_codes[Y_AXIS])) || (code_seen(axis_codes[Z_AXIS]))|| (code_seen(axis_codes[E_AXIS]))); if(all_axis) { st_synchronize(); From 357e31270aa97cf9cae6cf8da335666af1fcaec6 Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Wed, 19 Feb 2014 00:51:43 -0800 Subject: [PATCH 3/4] Prevent G29 without first homing in X and Y If position is unknown, then G29 can be dangerous. --- Marlin/Marlin_main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f98d530de..444d69828 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1409,6 +1409,15 @@ void process_commands() #error "You must have a Z_MIN endstop in order to enable Auto Bed Leveling feature!!! Z_MIN_PIN must point to a valid hardware pin." #endif + // Prevent user from running a G29 without first homing in X and Y + if (! (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) ) + { + LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN); + SERIAL_ECHO_START; + SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN); + break; // abort G29, since we don't know where we are + } + st_synchronize(); // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly //vector_3 corrected_position = plan_get_position_mm(); From f308a8af91a0f7638a48a5e4f8647d1567992df6 Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Wed, 19 Feb 2014 01:06:24 -0800 Subject: [PATCH 4/4] update comment --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 444d69828..bc8327b8b 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -76,7 +76,7 @@ // G10 - retract filament according to settings of M207 // G11 - retract recover filament according to settings of M208 // G28 - Home all Axis -// G29 - Detailed Z-Probe, probes the bed at 3 points. You must de at the home position for this to work correctly. +// G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you haven't homed yet. // G30 - Single Z Probe, probes bed at current XY location. // G90 - Use Absolute Coordinates // G91 - Use Relative Coordinates