From da0d91a79b1bf0fd1c4d4a568415073b70d17573 Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Mon, 20 Apr 2015 23:28:46 +0200 Subject: [PATCH 1/4] max endstopp no user will home to 0 with a max endstopp --- Marlin/Marlin_main.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 64d3d1f350..22f037075d 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1947,12 +1947,18 @@ inline void gcode_G28() { if (home_all_axis || homeY) HOMEAXIS(Y); // Set the X position, if included - if (code_seen(axis_codes[X_AXIS]) && code_has_value()) - current_position[X_AXIS] = code_value(); + if (code_seen(axis_codes[X_AXIS]) && code_has_value()) { + float v = code_value(); + if (X_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps + current_position[X_AXIS] = v; + } // Set the Y position, if included - if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) - current_position[Y_AXIS] = code_value(); + if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) { + float v = code_value(); + if (Y_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps + current_position[Y_AXIS] = code_value(); + } // Home Z last if homing towards the bed #if Z_HOME_DIR < 0 @@ -2038,8 +2044,11 @@ inline void gcode_G28() { #endif // Z_HOME_DIR < 0 // Set the Z position, if included - if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) + if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) { + float v = code_value(); + if (Z_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps current_position[Z_AXIS] = code_value(); + } #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0) if (home_all_axis || homeZ) current_position[Z_AXIS] += zprobe_zoffset; // Add Z_Probe offset (the distance is negative) From 61ae43f35e8523ab9785a0d79a3c6f7e73407e4a Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Mon, 20 Apr 2015 23:31:10 +0200 Subject: [PATCH 2/4] v <-> code_value --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 22f037075d..4987aaf1e2 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1957,7 +1957,7 @@ inline void gcode_G28() { if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) { float v = code_value(); if (Y_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps - current_position[Y_AXIS] = code_value(); + current_position[Y_AXIS] = v; } // Home Z last if homing towards the bed @@ -2047,7 +2047,7 @@ inline void gcode_G28() { if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) { float v = code_value(); if (Z_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps - current_position[Z_AXIS] = code_value(); + current_position[Z_AXIS] = v; } #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0) From c26d816839e556876522595e85c6aadd43c05844 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Apr 2015 12:09:57 +0200 Subject: [PATCH 3/4] filter any 0 --- Marlin/Marlin_main.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 4987aaf1e2..952aa2fb3e 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1948,16 +1948,14 @@ inline void gcode_G28() { // Set the X position, if included if (code_seen(axis_codes[X_AXIS]) && code_has_value()) { - float v = code_value(); - if (X_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps - current_position[X_AXIS] = v; + if (code_value_long() != 0) // filter 0 + current_position[X_AXIS] = code_value(); } // Set the Y position, if included if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) { - float v = code_value(); - if (Y_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps - current_position[Y_AXIS] = v; + if (code_value_long() != 0) // filter 0 + current_position[X_AXIS] = code_value(); } // Home Z last if homing towards the bed @@ -2045,9 +2043,8 @@ inline void gcode_G28() { // Set the Z position, if included if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) { - float v = code_value(); - if (Z_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps - current_position[Z_AXIS] = v; + if (code_value_long() != 0) // filter 0 + current_position[X_AXIS] = code_value(); } #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0) From be9e4ceddcf02741c7042753d8c1276f9443bc67 Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Thu, 23 Apr 2015 10:35:14 +0200 Subject: [PATCH 4/4] fix typo c'n'p ftw :/ --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 952aa2fb3e..d99b63b0b6 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1955,7 +1955,7 @@ inline void gcode_G28() { // Set the Y position, if included if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) { if (code_value_long() != 0) // filter 0 - current_position[X_AXIS] = code_value(); + current_position[Y_AXIS] = code_value(); } // Home Z last if homing towards the bed @@ -2044,7 +2044,7 @@ inline void gcode_G28() { // Set the Z position, if included if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) { if (code_value_long() != 0) // filter 0 - current_position[X_AXIS] = code_value(); + current_position[Z_AXIS] = code_value(); } #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0)