From 93522d9091007a653241cfc55ca7713831d6c4a3 Mon Sep 17 00:00:00 2001 From: Mathew Winters Date: Sun, 2 Jan 2022 10:46:12 +1300 Subject: [PATCH 1/4] Nozzle wipe - allow auto home on one axis only. --- Marlin/Configuration.h | 6 ++++++ Marlin/src/gcode/feature/clean/G12.cpp | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 236c6a8a5461..dbbc3493b18a 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1982,6 +1982,12 @@ #define NOZZLE_CLEAN_MIN_TEMP 170 //#define NOZZLE_CLEAN_HEATUP // Heat up the nozzle instead of skipping wipe + // if purge/clean station is mounted to an axis, we can choose to only + // first home that axis. (eg X) to avoid dropping dripping filiment on board. (eg when nozzel moves toward bed) + #if EITHER(NOZZLE_CLEAN_NO_Z, NOZZLE_CLEAN_NO_Y) + #define NOZZLE_CLEAN_HOME_ONLY X_AXIS + #endif + // Explicit wipe G-code script applies to a G12 with no arguments. //#define WIPE_SEQUENCE_COMMANDS "G1 X-17 Y25 Z10 F4000\nG1 Z1\nM114\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 Z15\nM400\nG0 X-10.0 Y-9.0" diff --git a/Marlin/src/gcode/feature/clean/G12.cpp b/Marlin/src/gcode/feature/clean/G12.cpp index a0b87b1abc9e..7954c7790172 100644 --- a/Marlin/src/gcode/feature/clean/G12.cpp +++ b/Marlin/src/gcode/feature/clean/G12.cpp @@ -46,7 +46,18 @@ */ void GcodeSuite::G12() { // Don't allow nozzle cleaning without homing first - if (homing_needed_error()) return; + // Eg. if we have the brush mounted on X axis, then only require homing on X + // that will avoid dribbles and messes from moving the head vertically. + #ifdef NOZZLE_CLEAN_HOME_ONLY + linear_axis_bits_t axis_bits = axes_should_home(_BV(NOZZLE_CLEAN_HOME_ONLY)); + if (TEST(axis_bits, NOZZLE_CLEAN_HOME_ONLY)) { + char cmd[MAX_CMD_SIZE+16]; + sprintf_P(cmd, PSTR("G28 X")); + gcode.process_subcommands_now(cmd); + } + #else + if (homing_needed_error()) return; + #endif #ifdef WIPE_SEQUENCE_COMMANDS if (!parser.seen_any()) { From 6d9b11ba4a4ac8717aa8c09dd8776bdc746019ce Mon Sep 17 00:00:00 2001 From: Mathew Winters Date: Sun, 2 Jan 2022 11:02:52 +1300 Subject: [PATCH 2/4] Disable NOZZLE_CLEAN_HOME_ONLY by default --- Marlin/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index dbbc3493b18a..e46704fea404 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1985,7 +1985,7 @@ // if purge/clean station is mounted to an axis, we can choose to only // first home that axis. (eg X) to avoid dropping dripping filiment on board. (eg when nozzel moves toward bed) #if EITHER(NOZZLE_CLEAN_NO_Z, NOZZLE_CLEAN_NO_Y) - #define NOZZLE_CLEAN_HOME_ONLY X_AXIS + //#define NOZZLE_CLEAN_HOME_ONLY X_AXIS #endif // Explicit wipe G-code script applies to a G12 with no arguments. From d923e8135398f4c8f9df75e84a9bd415b59ddcaa Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 6 Jan 2022 22:00:27 -0600 Subject: [PATCH 3/4] Update G12.cpp --- Marlin/src/gcode/feature/clean/G12.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Marlin/src/gcode/feature/clean/G12.cpp b/Marlin/src/gcode/feature/clean/G12.cpp index 7954c7790172..16b9e4fb0b03 100644 --- a/Marlin/src/gcode/feature/clean/G12.cpp +++ b/Marlin/src/gcode/feature/clean/G12.cpp @@ -46,15 +46,12 @@ */ void GcodeSuite::G12() { // Don't allow nozzle cleaning without homing first - // Eg. if we have the brush mounted on X axis, then only require homing on X + // e.g., if we have the brush mounted on X axis, then only require homing on X // that will avoid dribbles and messes from moving the head vertically. #ifdef NOZZLE_CLEAN_HOME_ONLY linear_axis_bits_t axis_bits = axes_should_home(_BV(NOZZLE_CLEAN_HOME_ONLY)); - if (TEST(axis_bits, NOZZLE_CLEAN_HOME_ONLY)) { - char cmd[MAX_CMD_SIZE+16]; - sprintf_P(cmd, PSTR("G28 X")); - gcode.process_subcommands_now(cmd); - } + if (TEST(axis_bits, NOZZLE_CLEAN_HOME_ONLY)) + gcode.process_subcommands_now(F("G28X")); #else if (homing_needed_error()) return; #endif From 308f391bf7c0787d0f986ce125bd3bbac07610c1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 12 Mar 2022 19:05:19 -0600 Subject: [PATCH 4/4] only require some axes to home --- Marlin/Configuration.h | 6 ------ Marlin/src/gcode/feature/clean/G12.cpp | 11 ++--------- Marlin/src/module/motion.h | 2 +- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ba86d9d17182..d3c36ad4850d 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1991,12 +1991,6 @@ #define NOZZLE_CLEAN_MIN_TEMP 170 //#define NOZZLE_CLEAN_HEATUP // Heat up the nozzle instead of skipping wipe - // if purge/clean station is mounted to an axis, we can choose to only - // first home that axis. (eg X) to avoid dropping dripping filiment on board. (eg when nozzel moves toward bed) - #if EITHER(NOZZLE_CLEAN_NO_Z, NOZZLE_CLEAN_NO_Y) - //#define NOZZLE_CLEAN_HOME_ONLY X_AXIS - #endif - // Explicit wipe G-code script applies to a G12 with no arguments. //#define WIPE_SEQUENCE_COMMANDS "G1 X-17 Y25 Z10 F4000\nG1 Z1\nM114\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 Z15\nM400\nG0 X-10.0 Y-9.0" diff --git a/Marlin/src/gcode/feature/clean/G12.cpp b/Marlin/src/gcode/feature/clean/G12.cpp index 16b9e4fb0b03..999a9b10bd85 100644 --- a/Marlin/src/gcode/feature/clean/G12.cpp +++ b/Marlin/src/gcode/feature/clean/G12.cpp @@ -46,15 +46,8 @@ */ void GcodeSuite::G12() { // Don't allow nozzle cleaning without homing first - // e.g., if we have the brush mounted on X axis, then only require homing on X - // that will avoid dribbles and messes from moving the head vertically. - #ifdef NOZZLE_CLEAN_HOME_ONLY - linear_axis_bits_t axis_bits = axes_should_home(_BV(NOZZLE_CLEAN_HOME_ONLY)); - if (TEST(axis_bits, NOZZLE_CLEAN_HOME_ONLY)) - gcode.process_subcommands_now(F("G28X")); - #else - if (homing_needed_error()) return; - #endif + if (homing_needed_error(linear_bits & ~TERN0(NOZZLE_CLEAN_NO_Z, Z_AXIS) & ~TERN0(NOZZLE_CLEAN_NO_Y, Y_AXIS))) + return; #ifdef WIPE_SEQUENCE_COMMANDS if (!parser.seen_any()) { diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 9fe61aad3349..ca206bf89ac4 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -402,7 +402,7 @@ void set_axis_is_at_home(const AxisEnum axis); constexpr linear_axis_bits_t axis_homed = linear_bits, axis_trusted = linear_bits; // Zero-endstop machines are always homed and trusted inline void homeaxis(const AxisEnum axis) {} inline void set_axis_never_homed(const AxisEnum) {} - inline linear_axis_bits_t axes_should_home(linear_axis_bits_t=linear_bits) { return false; } + inline linear_axis_bits_t axes_should_home(linear_axis_bits_t=linear_bits) { return 0; } inline bool homing_needed_error(linear_axis_bits_t=linear_bits) { return false; } inline void set_axis_unhomed(const AxisEnum axis) {} inline void set_axis_untrusted(const AxisEnum axis) {}