From 88b2a6004a79380d19e5cff16ef21d1585a20be7 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Sat, 13 Oct 2018 16:31:12 -0400 Subject: [PATCH] Remove optomized tool change till stable --- Marlin/Configuration.h | 4 +- Marlin/src/module/tool_change.cpp | 166 ++++++++++++++++-------------- 2 files changed, 88 insertions(+), 82 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 76fca7b8ae..697284d159 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -638,12 +638,12 @@ #if ENABLED(Y_2208) #define Y_DRIVER_TYPE TMC2208_STANDALONE #else - #define Y_DRIVER_TYPE A4988 + #define Y_DRIVER_TYPE DRV8825 #endif #if ENABLED(Z_2208) #define Z_DRIVER_TYPE TMC2208_STANDALONE #else - #define Z_DRIVER_TYPE A4988 + #define Z_DRIVER_TYPE DRV8825 #endif //#define Y2_DRIVER_TYPE A4988 //#define Z2_DRIVER_TYPE A4988 diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 3bf18c6c97..0282aa6878 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -391,7 +391,7 @@ inline void invalid_extruder_error(const uint8_t e) { const float xhome = x_home_pos(active_extruder); if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && IsRunning() - && (delayed_move_time || current_position[X_AXIS] != xhome) && !no_move + && (delayed_move_time || current_position[X_AXIS] != xhome) ) { float raised_z = current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT; #if ENABLED(MAX_SOFTWARE_ENDSTOPS) @@ -413,6 +413,8 @@ inline void invalid_extruder_error(const uint8_t e) { planner.buffer_line(CUR_X, CUR_Y, raised_z, CUR_E, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); planner.buffer_line(xhome, CUR_Y, raised_z, CUR_E, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + planner.buffer_line(xhome, CUR_Y, CUR_Z, CUR_E, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); + planner.synchronize(); } @@ -441,6 +443,12 @@ inline void invalid_extruder_error(const uint8_t e) { inactive_extruder_x_pos = destination[X_AXIS]; break; case DXC_AUTO_PARK_MODE: + // record raised toolhead position for use by unpark + COPY(raised_parked_position, current_position); + raised_parked_position[Z_AXIS] += TOOLCHANGE_PARK_ZLIFT; + #if ENABLED(MAX_SOFTWARE_ENDSTOPS) + NOMORE(raised_parked_position[Z_AXIS], soft_endstop_max[Z_AXIS]); + #endif active_extruder_parked = true; delayed_move_time = 0; break; @@ -453,6 +461,7 @@ inline void invalid_extruder_error(const uint8_t e) { } #endif + // No extra case for HAS_ABL in DUAL_X_CARRIAGE. Does that mean they don't work together? } #endif // DUAL_X_CARRIAGE @@ -582,7 +591,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n // Raise, move, and lower again if (safe_to_move && !no_move && IsRunning()) { - #if DISABLED(SWITCHING_NOZZLE) && DISABLED(DUAL_X_CARRIAGE) + #if DISABLED(SWITCHING_NOZZLE) // Do a small lift to avoid the workpiece in the move back (below) current_position[Z_AXIS] += 1.0; planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); @@ -595,10 +604,10 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n // So we apply the offsets for y and z to the destination here. X cannot have an offset in this mode // as it is utilized for X2 home position. destination[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder]; - destination[Z_AXIS] -= (hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]) + TOOLCHANGE_PARK_ZLIFT; + destination[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; #endif // Move back to the original (or tweaked) position - do_blocking_move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], feedrate_mm_s); + do_blocking_move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]); #if ENABLED(DUAL_X_CARRIAGE) active_extruder_parked = false; #endif @@ -634,89 +643,86 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n select_multiplexed_stepper(tmp_extruder); #endif - #if EXTRUDERS > 1 + #if ENABLED(SINGLENOZZLE) - #if ENABLED(SINGLENOZZLE) + #if ENABLED(PREVENT_COLD_EXTRUSION) + if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder) && sn_settings.swap_length) { + SERIAL_ERROR_START(); + SERIAL_ERRORLNPGM(MSG_HOTEND_TOO_COLD); + active_extruder = tmp_extruder; + return; + } + #endif - #if ENABLED(PREVENT_COLD_EXTRUSION) - if ((!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) || sn_settings.swap_length == 0) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_HOTEND_TOO_COLD); - active_extruder = tmp_extruder; - return; - } + #if FAN_COUNT > 0 + singlenozzle_fan_speed[active_extruder] = fan_speed[0]; + fan_speed[0] = singlenozzle_fan_speed[tmp_extruder]; + #endif + + if (!no_move) set_destination_from_current(); + + if (sn_settings.swap_length) { + #if ENABLED(ADVANCED_PAUSE_FEATURE) + do_pause_e_move(-sn_settings.swap_length, MMM_TO_MMS(sn_settings.retract_speed)); + #else + current_position[E_AXIS] -= sn_settings.swap_length / planner.e_factor[active_extruder]; + planner.buffer_line(current_position, MMM_TO_MMS(sn_settings.retract_speed), active_extruder); + #endif + } + + if (!no_move) { + current_position[Z_AXIS] += ( + #if ENABLED(SINGLENOZZLE_SWAP_PARK) + singlenozzle_change_point.z + #else + SINGLENOZZLE_TOOLCHANGE_ZRAISE + #endif + ); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); + + #if ENABLED(SINGLENOZZLE_SWAP_PARK) + current_position[X_AXIS] = singlenozzle_change_point.x; + current_position[Y_AXIS] = singlenozzle_change_point.y; + planner.buffer_line(current_position, MMM_TO_MMS(SINGLENOZZLE_PARK_XY_FEEDRATE), active_extruder); + #endif + } + + singlenozzle_temp[active_extruder] = thermalManager.target_temperature[0]; + if (singlenozzle_temp[tmp_extruder] && singlenozzle_temp[tmp_extruder] != singlenozzle_temp[active_extruder]) { + thermalManager.setTargetHotend(singlenozzle_temp[tmp_extruder], 0); + #if ENABLED(ULTRA_LCD) + thermalManager.set_heating_message(0); + #endif + (void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling + } + + active_extruder = tmp_extruder; + + if (sn_settings.swap_length) { + #if ENABLED(ADVANCED_PAUSE_FEATURE) + do_pause_e_move(sn_settings.swap_length, sn_settings.prime_speed); + #else + current_position[E_AXIS] += sn_settings.swap_length / planner.e_factor[tmp_extruder]; + planner.buffer_line(current_position, sn_settings.prime_speed, tmp_extruder); + #endif + } + + if (!no_move) { + #if ENABLED(SINGLENOZZLE_SWAP_PARK) + current_position[X_AXIS] = destination[X_AXIS]; + current_position[Y_AXIS] = destination[Y_AXIS]; + planner.buffer_line(current_position, MMM_TO_MMS(SINGLENOZZLE_PARK_XY_FEEDRATE), active_extruder); #endif - #if FAN_COUNT > 0 - singlenozzle_fan_speed[active_extruder] = fan_speed[0]; - fan_speed[0] = singlenozzle_fan_speed[tmp_extruder]; - #endif + do_blocking_move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]); + } - if (!no_move) set_destination_from_current(); + #elif EXTRUDERS > 1 - if (sn_settings.swap_length) { - #if ENABLED(ADVANCED_PAUSE_FEATURE) - do_pause_e_move(-sn_settings.swap_length, MMM_TO_MMS(sn_settings.retract_speed)); - #else - current_position[E_AXIS] -= sn_settings.swap_length / planner.e_factor[active_extruder]; - planner.buffer_line(current_position, MMM_TO_MMS(sn_settings.retract_speed), active_extruder); - #endif - } + active_extruder = tmp_extruder; - if (!no_move) { - current_position[Z_AXIS] += ( - #if ENABLED(SINGLENOZZLE_SWAP_PARK) - singlenozzle_change_point.z - #else - SINGLENOZZLE_TOOLCHANGE_ZRAISE - #endif - ); - - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); - - #if ENABLED(SINGLENOZZLE_SWAP_PARK) - current_position[X_AXIS] = singlenozzle_change_point.x; - current_position[Y_AXIS] = singlenozzle_change_point.y; - planner.buffer_line(current_position, MMM_TO_MMS(SINGLENOZZLE_PARK_XY_FEEDRATE), active_extruder); - #endif - } - - singlenozzle_temp[active_extruder] = thermalManager.target_temperature[0]; - if (singlenozzle_temp[tmp_extruder] && singlenozzle_temp[tmp_extruder] != singlenozzle_temp[active_extruder]) { - thermalManager.setTargetHotend(singlenozzle_temp[tmp_extruder], 0); - #if ENABLED(ULTRA_LCD) - thermalManager.set_heating_message(0); - #endif - (void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling - } - - active_extruder = tmp_extruder; - - if (sn_settings.swap_length) { - #if ENABLED(ADVANCED_PAUSE_FEATURE) - do_pause_e_move(sn_settings.swap_length, sn_settings.prime_speed); - #else - current_position[E_AXIS] += sn_settings.swap_length / planner.e_factor[tmp_extruder]; - planner.buffer_line(current_position, sn_settings.prime_speed, tmp_extruder); - #endif - } - - if (!no_move) { - #if ENABLED(SINGLENOZZLE_SWAP_PARK) - current_position[X_AXIS] = destination[X_AXIS]; - current_position[Y_AXIS] = destination[Y_AXIS]; - planner.buffer_line(current_position, MMM_TO_MMS(SINGLENOZZLE_PARK_XY_FEEDRATE), active_extruder); - #endif - - do_blocking_move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]); - } - #else // !SINGLENOZZLE - - active_extruder = tmp_extruder; - - #endif // !SINGLENOZZLE - - #endif // EXTRUDERS > 1 + #endif #endif // HOTENDS <= 1