From eda5190581972c549079a84ba2afef881a688884 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 2 Mar 2016 19:55:01 -0800 Subject: [PATCH] Check for known position in `M48` --- Marlin/Marlin_main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 8df5c2f08f..d5d5d6aad0 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1808,6 +1808,11 @@ static void setup_for_endstop_move() { #endif // AUTO_BED_LEVELING_FEATURE +static void unknown_position_error() { + LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN); + SERIAL_ECHO_START; + SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN); +} #if ENABLED(Z_PROBE_SLED) @@ -3651,6 +3656,11 @@ inline void gcode_M42() { */ inline void gcode_M48() { + if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS] || !axis_known_position[Z_AXIS]) { + unknown_position_error(); + return; + } + double sum = 0.0, mean = 0.0, sigma = 0.0, sample_set[50]; uint8_t verbose_level = 1, n_samples = 10, n_legs = 0, schizoid_flag = 0;