From 357e31270aa97cf9cae6cf8da335666af1fcaec6 Mon Sep 17 00:00:00 2001
From: Gabe Rosenhouse <gabe@missionst.com>
Date: Wed, 19 Feb 2014 00:51:43 -0800
Subject: [PATCH] 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 f98d530dea..444d698287 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();
--
GitLab