From 3db35ba9be05355fdad018fb9128335e03097f7a Mon Sep 17 00:00:00 2001 From: Thomas Moore Date: Mon, 22 Jan 2018 10:21:42 -0600 Subject: [PATCH] [2.0.x] Fix change filament for delta machines (#9295) --- Marlin/src/feature/pause.cpp | 15 +++++++++------ Marlin/src/gcode/feature/pause/M603.cpp | 2 +- Marlin/src/gcode/feature/pause/M701_M702.cpp | 10 ++++++++++ Marlin/src/gcode/gcode.cpp | 10 +++++----- Marlin/src/inc/Conditionals_post.h | 6 ++++++ 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index c22fbb8330..5425e35700 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -119,7 +119,7 @@ static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_ static void do_pause_e_move(const float &length, const float &fr) { set_destination_from_current(); destination[E_AXIS] += length / planner.e_factor[active_extruder]; - buffer_line_to_destination(fr); + planner.buffer_line_kinematic(destination, fr, active_extruder); stepper.synchronize(); set_current_from_destination(); } @@ -137,8 +137,8 @@ static void do_pause_e_move(const float &length, const float &fr) { * Returns 'true' if load was completed, 'false' for abort */ bool load_filament(const float &load_length/*=0*/, const float &purge_length/*=0*/, const int8_t max_beep_count/*=0*/, - const bool show_lcd/*=false*/, const bool pause_for_user/*=false*/, - const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/ + const bool show_lcd/*=false*/, const bool pause_for_user/*=false*/, + const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/ ) { #if DISABLED(ULTIPANEL) UNUSED(show_lcd); @@ -232,7 +232,7 @@ bool load_filament(const float &load_length/*=0*/, const float &purge_length/*=0 * Returns 'true' if unload was completed, 'false' for abort */ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, - const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/ + const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/ ) { if (!ensure_safe_temperature(mode)) { #if ENABLED(ULTIPANEL) @@ -336,8 +336,11 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) do_pause_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE); - // Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos) - Nozzle::park(2, park_point); + #if ENABLED(NO_MOTION_BEFORE_HOMING) + if (!axis_unhomed_error()) + #endif + // Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos) + Nozzle::park(2, park_point); // Unload the filament if (unload_length) diff --git a/Marlin/src/gcode/feature/pause/M603.cpp b/Marlin/src/gcode/feature/pause/M603.cpp index feabe2b929..3ac44cc7b9 100644 --- a/Marlin/src/gcode/feature/pause/M603.cpp +++ b/Marlin/src/gcode/feature/pause/M603.cpp @@ -41,7 +41,7 @@ * L[distance] - Extrude distance for insertion, for the specified extruder * */ -inline void GcodeSuite::M603() { +void GcodeSuite::M603() { if (get_target_extruder_from_command()) return; diff --git a/Marlin/src/gcode/feature/pause/M701_M702.cpp b/Marlin/src/gcode/feature/pause/M701_M702.cpp index c9f354d097..301890cc45 100644 --- a/Marlin/src/gcode/feature/pause/M701_M702.cpp +++ b/Marlin/src/gcode/feature/pause/M701_M702.cpp @@ -50,6 +50,11 @@ void GcodeSuite::M701() { point_t park_point = NOZZLE_PARK_POINT; + #if ENABLED(NO_MOTION_BEFORE_HOMING) + // Only raise Z if the machine is homed + if (axis_unhomed_error()) park_point.z = 0; + #endif + if (get_target_extruder_from_command()) return; // Z axis lift @@ -107,6 +112,11 @@ void GcodeSuite::M701() { void GcodeSuite::M702() { point_t park_point = NOZZLE_PARK_POINT; + #if ENABLED(NO_MOTION_BEFORE_HOMING) + // Only raise Z if the machine is homed + if (axis_unhomed_error()) park_point.z = 0; + #endif + if (get_target_extruder_from_command()) return; // Z axis lift diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 421d0b1f62..45f7dc6108 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -633,17 +633,17 @@ void GcodeSuite::process_parsed_command() { #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - case 600: // M600: Pause for filament change - M600(); - break; + case 600: M600(); break; // M600: Pause for Filament Change + case 603: M603(); break; // M603: Configure Filament Change #endif // ADVANCED_PAUSE_FEATURE #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) case 605: M605(); break; // M605: Set Dual X Carriage movement mode #endif - #if ENABLED(MK2_MULTIPLEXER) - case 702: M702(); break; // M702: Unload all extruders + #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) + case 701: M701(); break; // M701: Load Filament + case 702: M702(); break; // M702: Unload Filament #endif #if ENABLED(LIN_ADVANCE) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 1a5c410904..39d23bcf68 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1249,6 +1249,12 @@ #endif #endif #endif + +// Nozzle park +#if ENABLED(NOZZLE_PARK_FEATURE) && ENABLED(DELTA) + #undef NOZZLE_PARK_Z_FEEDRATE + #define NOZZLE_PARK_Z_FEEDRATE NOZZLE_PARK_XY_FEEDRATE +#endif // Force SDCARD_SORT_ALPHA to be enabled for Graphical LCD on LPC1768 // because of a bug in the shared SPI implementation. (See #8122)