From 4900c28bf600f86ccbc3943072e9c573a443ecae Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Tue, 9 Apr 2019 19:33:40 -0400 Subject: [PATCH] Fix IDEX tool-change, and more (#13614) --- Marlin/src/gcode/motion/M290.cpp | 2 +- Marlin/src/lcd/language/language_de.h | 7 ++-- Marlin/src/lcd/language/language_en.h | 18 +++++----- Marlin/src/lcd/language/language_it.h | 7 ++-- Marlin/src/lcd/language/language_ko_KR.h | 7 ++-- Marlin/src/lcd/language/language_pt-br.h | 7 ++-- Marlin/src/lcd/language/language_sk.h | 7 ++-- Marlin/src/lcd/language/language_tr.h | 7 ++-- Marlin/src/lcd/menu/menu.cpp | 2 +- Marlin/src/lcd/menu/menu_configuration.cpp | 38 ++++++++++++++++------ Marlin/src/module/tool_change.cpp | 20 +----------- 11 files changed, 58 insertions(+), 64 deletions(-) diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index b816b5b9ab..4dd1fc4475 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -50,7 +50,7 @@ else { hotend_offset[Z_AXIS][active_extruder] -= offs; SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(MSG_IDEX_Z_OFFSET ": ", hotend_offset[Z_AXIS][active_extruder]); + SERIAL_ECHOLNPAIR(MSG_Z_OFFSET ": ", hotend_offset[Z_AXIS][active_extruder]); } #endif } diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index b844c1052b..241f3ab3cd 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -101,10 +101,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplizieren") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Spiegelkopie") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("vollstä. Kontrolle") -#define MSG_IDEX_X_OFFSET _UxGT("2. Düse X") -#define MSG_IDEX_Y_OFFSET _UxGT("2. Düse Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2. Düse Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Versätze speichern") +#define MSG_X_OFFSET _UxGT("2. Düse X") +#define MSG_Y_OFFSET _UxGT("2. Düse Y") +#define MSG_Z_OFFSET _UxGT("2. Düse Z") #define MSG_UBL_MANUAL_MESH _UxGT("Netz manuell erst.") #define MSG_UBL_BC_INSERT _UxGT("Unterlegen & messen") #define MSG_UBL_BC_INSERT2 _UxGT("Messen") diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 5aa284da96..dc6c26cf93 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -247,6 +247,9 @@ #ifndef MSG_IDEX_MENU #define MSG_IDEX_MENU _UxGT("IDEX Mode") #endif +#ifndef MSG_OFFSETS_MENU + #define MSG_OFFSETS_MENU _UxGT("Tool Offsets") +#endif #ifndef MSG_IDEX_MODE_AUTOPARK #define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") #endif @@ -259,17 +262,14 @@ #ifndef MSG_IDEX_MODE_FULL_CTRL #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Full control") #endif -#ifndef MSG_IDEX_X_OFFSET - #define MSG_IDEX_X_OFFSET _UxGT("2nd nozzle X") -#endif -#ifndef MSG_IDEX_Y_OFFSET - #define MSG_IDEX_Y_OFFSET _UxGT("2nd nozzle Y") +#ifndef MSG_X_OFFSET + #define MSG_X_OFFSET _UxGT("2nd nozzle X") #endif -#ifndef MSG_IDEX_Z_OFFSET - #define MSG_IDEX_Z_OFFSET _UxGT("2nd nozzle Z") +#ifndef MSG_Y_OFFSET + #define MSG_Y_OFFSET _UxGT("2nd nozzle Y") #endif -#ifndef MSG_IDEX_SAVE_OFFSETS - #define MSG_IDEX_SAVE_OFFSETS _UxGT("Save Offsets") +#ifndef MSG_Z_OFFSET + #define MSG_Z_OFFSET _UxGT("2nd nozzle Z") #endif #ifndef MSG_UBL_MANUAL_MESH #define MSG_UBL_MANUAL_MESH _UxGT("Manually Build Mesh") diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 5c2e2f5ebc..b954d26785 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -99,10 +99,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplicazione") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Copia speculare") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Pieno controllo") -#define MSG_IDEX_X_OFFSET _UxGT("2° ugello X") -#define MSG_IDEX_Y_OFFSET _UxGT("2° ugello Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2° ugello Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Memorizza Offsets") +#define MSG_X_OFFSET _UxGT("2° ugello X") +#define MSG_Y_OFFSET _UxGT("2° ugello Y") +#define MSG_Z_OFFSET _UxGT("2° ugello Z") #define MSG_UBL_MANUAL_MESH _UxGT("Mesh Manuale") #define MSG_UBL_BC_INSERT _UxGT("Metti spes. e misura") #define MSG_UBL_BC_INSERT2 _UxGT("Misura") diff --git a/Marlin/src/lcd/language/language_ko_KR.h b/Marlin/src/lcd/language/language_ko_KR.h index e367b501f7..2755727173 100644 --- a/Marlin/src/lcd/language/language_ko_KR.h +++ b/Marlin/src/lcd/language/language_ko_KR.h @@ -90,10 +90,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplication") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("미러 사본") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Full control") -#define MSG_IDEX_X_OFFSET _UxGT("2nd nozzle X") -#define MSG_IDEX_Y_OFFSET _UxGT("2nd nozzle Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2nd nozzle Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Save Offsets") +#define MSG_X_OFFSET _UxGT("2nd nozzle X") +#define MSG_Y_OFFSET _UxGT("2nd nozzle Y") +#define MSG_Z_OFFSET _UxGT("2nd nozzle Z") #define MSG_UBL_MANUAL_MESH _UxGT("Manually Build Mesh") #define MSG_UBL_BC_INSERT _UxGT("Place shim & measure") #define MSG_UBL_BC_INSERT2 _UxGT("Measure") diff --git a/Marlin/src/lcd/language/language_pt-br.h b/Marlin/src/lcd/language/language_pt-br.h index d48046776c..6baf1fdf06 100644 --- a/Marlin/src/lcd/language/language_pt-br.h +++ b/Marlin/src/lcd/language/language_pt-br.h @@ -101,10 +101,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplicação") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Cópia espelhada") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Controle Total") -#define MSG_IDEX_X_OFFSET _UxGT("2o bico X") -#define MSG_IDEX_Y_OFFSET _UxGT("2o bico Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2o bico Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Salvar Compensação") +#define MSG_X_OFFSET _UxGT("2o bico X") +#define MSG_Y_OFFSET _UxGT("2o bico Y") +#define MSG_Z_OFFSET _UxGT("2o bico Z") #define MSG_UBL_MANUAL_MESH _UxGT("Fazer malha manual") #define MSG_UBL_BC_INSERT _UxGT("Calçar e calibrar") diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 8841a57170..965ae22310 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -108,10 +108,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplikácia") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Zrkadlená kópia") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Plná kontrola") -#define MSG_IDEX_X_OFFSET _UxGT("2. tryska X") -#define MSG_IDEX_Y_OFFSET _UxGT("2. tryska Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2. tryska Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Uložiť offsety") +#define MSG_X_OFFSET _UxGT("2. tryska X") +#define MSG_Y_OFFSET _UxGT("2. tryska Y") +#define MSG_Z_OFFSET _UxGT("2. tryska Z") #define MSG_UBL_MANUAL_MESH _UxGT("Manuálna sieť bodov") #define MSG_UBL_BC_INSERT _UxGT("Položte a zmerajte") #define MSG_UBL_BC_INSERT2 _UxGT("Zmerajte") diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 0edb2e539b..f8569dd526 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -100,10 +100,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Kopyala") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Yansıtılmış kopya") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Tam Kontrol") -#define MSG_IDEX_X_OFFSET _UxGT("2. nozul X") -#define MSG_IDEX_Y_OFFSET _UxGT("2. nozul Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2. nozul Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Ofsetleri Kaydet") +#define MSG_X_OFFSET _UxGT("2. nozul X") +#define MSG_Y_OFFSET _UxGT("2. nozul Y") +#define MSG_Z_OFFSET _UxGT("2. nozul Z") #define MSG_UBL_MANUAL_MESH _UxGT("Elle Mesh Oluştur") #define MSG_UBL_BC_INSERT _UxGT("Altlık & Ölçü Ver") #define MSG_UBL_BC_INSERT2 _UxGT("Ölçü") diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index e737f32788..91b1ad448e 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -391,7 +391,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { if (ui.should_draw()) { #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) if (!do_probe) - draw_edit_screen(PSTR(MSG_IDEX_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder])); + draw_edit_screen(PSTR(MSG_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder])); else #endif draw_edit_screen(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset)); diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index d6115f5501..3dab293334 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -119,19 +119,37 @@ static void lcd_factory_settings() { #endif -#if ENABLED(DUAL_X_CARRIAGE) - +#if HAS_HOTEND_OFFSET #include "../../module/motion.h" #include "../../gcode/queue.h" - void _recalc_IDEX_settings() { - if (active_extruder) { // For the 2nd extruder re-home so the next tool-change gets the new offsets. + void _recalc_offsets() { + if (active_extruder && all_axes_known()) { // For the 2nd extruder re-home so the next tool-change gets the new offsets. enqueue_and_echo_commands_P(PSTR("G28")); // In future, we can babystep the 2nd extruder (if active), making homing unnecessary. active_extruder = 0; } } - void menu_IDEX() { + void menu_tool_offsets() { + START_MENU(); + MENU_BACK(MSG_MAIN); + #if ENABLED(DUAL_X_CARRIAGE) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], MIN(X2_HOME_POS, X2_MAX_POS) - 25.0, MAX(X2_HOME_POS, X2_MAX_POS) + 25.0, _recalc_offsets); + #else + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], -10.0, 10.0, _recalc_offsets); + #endif + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_Y_OFFSET, &hotend_offset[Y_AXIS][1], -10.0, 10.0, _recalc_offsets); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_Z_OFFSET, &hotend_offset[Z_AXIS][1], Z_PROBE_LOW_POINT, 10.0, _recalc_offsets); + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); + #endif + END_MENU(); + } +#endif + +#if ENABLED(DUAL_X_CARRIAGE) + + void menu_idex() { START_MENU(); MENU_BACK(MSG_MAIN); @@ -146,10 +164,6 @@ static void lcd_factory_settings() { : PSTR("M605 S1\nT0\nM605 S2 X200\nG28 X\nG1 X100\nM605 S3 X200") ); MENU_ITEM(gcode, MSG_IDEX_MODE_FULL_CTRL, PSTR("M605 S0\nG28 X")); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_IDEX_X_OFFSET , &hotend_offset[X_AXIS][1], MIN(X2_HOME_POS, X2_MAX_POS) - 25.0, MAX(X2_HOME_POS, X2_MAX_POS) + 25.0, _recalc_IDEX_settings); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_IDEX_Y_OFFSET , &hotend_offset[Y_AXIS][1], -10.0, 10.0, _recalc_IDEX_settings); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_IDEX_Z_OFFSET , &hotend_offset[Z_AXIS][1], -10.0, 10.0, _recalc_IDEX_settings); - MENU_ITEM(gcode, MSG_IDEX_SAVE_OFFSETS, PSTR("M500")); END_MENU(); } @@ -287,8 +301,12 @@ void menu_configuration() { MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, menu_delta_calibrate); #endif + #if HAS_HOTEND_OFFSET + MENU_ITEM(submenu, MSG_OFFSETS_MENU, menu_tool_offsets); + #endif + #if ENABLED(DUAL_X_CARRIAGE) - MENU_ITEM(submenu, MSG_IDEX_MENU, menu_IDEX); + MENU_ITEM(submenu, MSG_IDEX_MENU, menu_idex); #endif #if ENABLED(BLTOUCH) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index c52f263190..e0de12d285 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -121,7 +121,7 @@ void move_nozzle_servo(const uint8_t angle_index) { planner.synchronize(); - MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, servo_angles[SWITCHING_NOZZLE_SERVO_NR][e]); + MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, servo_angles[SWITCHING_NOZZLE_SERVO_NR][angle_index]); safe_delay(500); } @@ -519,10 +519,6 @@ inline void invalid_extruder_error(const uint8_t e) { planner.synchronize(); } - // Apply Y & Z extruder offset (X offset is used as home pos with Dual X) - current_position[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder]; - current_position[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; - // Activate the new extruder ahead of calling set_axis_is_at_home! active_extruder = tmp_extruder; @@ -784,20 +780,6 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n lower_nozzle(active_extruder); #endif - #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) && ADVANCED_PAUSE_RESUME_PRIME != 0 - if (should_swap && !too_cold) { - const float resume_eaxis = current_position[E_AXIS]; - #if ENABLED(ADVANCED_PAUSE_FEATURE) - do_pause_e_move(toolchange_settings.swap_length, toolchange_settings.prime_speed); - #else - current_position[E_AXIS] += (ADVANCED_PAUSE_RESUME_PRIME) / planner.e_factor[active_extruder]; - planner.buffer_line(current_position, ADVANCED_PAUSE_PURGE_FEEDRATE, active_extruder); - #endif - planner.synchronize(); - planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = resume_eaxis)); - } - #endif - } // (tmp_extruder != active_extruder) planner.synchronize();