From c4409b8f611f03e58178f15d34ca6f3d0af1d87b Mon Sep 17 00:00:00 2001 From: sarusani <62053849+sarusani@users.noreply.github.com> Date: Tue, 25 Jul 2023 09:31:33 +0200 Subject: [PATCH] Delay Z-Axis on Autoload Delay z-axis movement when the operators hand is close to the printhead. --- Firmware/Marlin_main.cpp | 11 +++++++---- Firmware/ultralcd.cpp | 3 --- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index ad4ffa31c6..d7f3da7647 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3596,7 +3596,7 @@ static void gcode_M600(const bool automatic, const float x_position, const float custom_message_type = CustomMsg::Status; } -void gcode_M701(float fastLoadLength, uint8_t mmuSlotIndex){ +void gcode_M701(float fastLoadLength, uint8_t mmuSlotIndex, bool raise_z_axis = false){ FSensorBlockRunout fsBlockRunout; prusa_statistics(22); @@ -3612,6 +3612,10 @@ void gcode_M701(float fastLoadLength, uint8_t mmuSlotIndex){ current_position[E_AXIS] += fastLoadLength; plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FIRST); //fast sequence + if (raise_z_axis) { // backwards compatibility for 3.12 and older FW + raise_z_above(MIN_Z_FOR_LOAD); + } + load_filament_final_feed(); // slow sequence st_synchronize(); @@ -8510,13 +8514,12 @@ SERIAL_PROTOCOLPGM("\n\n"); // Z lift. For safety only allow positive values if (code_seen('Z')) z_target = fabs(code_value()); - else raise_z_above(MIN_Z_FOR_LOAD); // backwards compatibility for 3.12 and older FW - + // Raise the Z axis float delta = raise_z(z_target); // Load filament - gcode_M701(fastLoadLength, mmuSlotIndex); + gcode_M701(fastLoadLength, mmuSlotIndex, !code_seen('Z')); // if no z -> trigger MIN_Z_FOR_LOAD for backwards compatibility on 3.12 and older FW // Restore Z axis raise_z(-delta); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4f6d33e5c0..d599ffd4d5 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1944,7 +1944,6 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed) // modified elsewhere and needs to be redrawn in full. // reset bFilamentWaitingFlag immediately to avoid re-entry from raise_z_above()! - bool once = !bFilamentWaitingFlag; bFilamentWaitingFlag = true; // also force-enable lcd_draw_update (might be 0 when called from outside a menu) @@ -1961,12 +1960,10 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed) case FilamentAction::MmuLoad: case FilamentAction::MmuLoadingTest: lcd_puts_P(_i("Preheating to load")); ////MSG_PREHEATING_TO_LOAD c=20 - if (once) raise_z_above(MIN_Z_FOR_LOAD); break; case FilamentAction::UnLoad: case FilamentAction::MmuUnLoad: lcd_puts_P(_i("Preheating to unload")); ////MSG_PREHEATING_TO_UNLOAD c=20 - if (once) raise_z_above(MIN_Z_FOR_UNLOAD); break; case FilamentAction::MmuEject: lcd_puts_P(_i("Preheating to eject")); ////MSG_PREHEATING_TO_EJECT c=20