Park heads with electromagnet (#14023)
This commit is contained in:
		
				
					committed by
					
						 Scott Lahteine
						Scott Lahteine
					
				
			
			
				
	
			
			
			
						parent
						
							fb9d30673f
						
					
				
				
					commit
					2f932a11b3
				
			| @@ -258,7 +258,16 @@ | ||||
|  */ | ||||
| //#define MAGNETIC_SWITCHING_TOOLHEAD | ||||
|  | ||||
| #if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) | ||||
| /** | ||||
|  * Electromagnetic Switching Toolhead | ||||
|  * | ||||
|  * Parking for CoreXY / HBot kinematics. | ||||
|  * Toolheads are parked at one edge and held with an electromagnet. | ||||
|  * Supports more than 2 Toolheads. See https://youtu.be/JolbsAKTKf4 | ||||
|  */ | ||||
| //#define ELECTROMAGNETIC_SWITCHING_TOOLHEAD | ||||
|  | ||||
| #if ANY(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD, ELECTROMAGNETIC_SWITCHING_TOOLHEAD) | ||||
|   #define SWITCHING_TOOLHEAD_Y_POS          235         // (mm) Y position of the toolhead dock | ||||
|   #define SWITCHING_TOOLHEAD_Y_SECURITY      10         // (mm) Security distance Y axis | ||||
|   #define SWITCHING_TOOLHEAD_Y_CLEAR         60         // (mm) Minimum distance from dock for unobstructed X axis | ||||
| @@ -269,6 +278,8 @@ | ||||
|   #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) | ||||
|     #define SWITCHING_TOOLHEAD_Y_RELEASE      5         // (mm) Security distance Y axis | ||||
|     #define SWITCHING_TOOLHEAD_X_SECURITY   -35         // (mm) Security distance X axis | ||||
|   #elif ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD) | ||||
|     #define SWITCHING_TOOLHEAD_Z_HOP          2         // (mm) Z raise for switching | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -153,7 +153,7 @@ | ||||
|   #include "feature/fanmux.h" | ||||
| #endif | ||||
|  | ||||
| #if DO_SWITCH_EXTRUDER || ANY(SWITCHING_NOZZLE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) | ||||
| #if DO_SWITCH_EXTRUDER || ANY(SWITCHING_NOZZLE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER, ELECTROMAGNETIC_SWITCHING_TOOLHEAD) | ||||
|   #include "module/tool_change.h" | ||||
| #endif | ||||
|  | ||||
| @@ -1078,6 +1078,10 @@ void setup() { | ||||
|     pe_solenoid_init(); | ||||
|   #endif | ||||
|  | ||||
|   #if ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD) | ||||
|     est_init(); | ||||
|   #endif | ||||
|  | ||||
|   #if ENABLED(POWER_LOSS_RECOVERY) | ||||
|     recovery.check(); | ||||
|   #endif | ||||
|   | ||||
| @@ -835,48 +835,42 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS | ||||
|   ); | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * Special tool-changing options | ||||
|  */ | ||||
| #if 1 < 0 \ | ||||
|   + ENABLED(SINGLENOZZLE) \ | ||||
|   + ENABLED(DUAL_X_CARRIAGE) \ | ||||
|   + ENABLED(PARKING_EXTRUDER) \ | ||||
|   + ENABLED(MAGNETIC_PARKING_EXTRUDER) \ | ||||
|   + ENABLED(SWITCHING_TOOLHEAD) \ | ||||
|   + ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) \ | ||||
|   + ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD) | ||||
|   #error "Please select only one of SINGLENOZZLE, DUAL_X_CARRIAGE, PARKING_EXTRUDER, SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD, or ELECTROMAGNETIC_SWITCHING_TOOLHEAD." | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * (Magnetic) Parking Extruder requirements | ||||
|  */ | ||||
| #if ENABLED(PARKING_EXTRUDER) | ||||
|   #if ENABLED(DUAL_X_CARRIAGE) | ||||
|     #error "PARKING_EXTRUDER and DUAL_X_CARRIAGE are incompatible." | ||||
|   #elif ENABLED(SINGLENOZZLE) | ||||
|     #error "PARKING_EXTRUDER and SINGLENOZZLE are incompatible." | ||||
|   #elif ENABLED(EXT_SOLENOID) | ||||
|     #error "PARKING_EXTRUDER and EXT_SOLENOID are incompatible. (Pins are used twice.)" | ||||
|   #elif ENABLED(MAGNETIC_PARKING_EXTRUDER) | ||||
|     #error "Enable only one of PARKING_EXTRUDER and MAGNETIC_PARKING_EXTRUDER." | ||||
| #if ANY(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) | ||||
|   #if ENABLED(EXT_SOLENOID) | ||||
|     #error "(MAGNETIC_)PARKING_EXTRUDER and EXT_SOLENOID are incompatible. (Pins are used twice.)" | ||||
|   #elif EXTRUDERS != 2 | ||||
|     #error "PARKING_EXTRUDER requires exactly 2 EXTRUDERS." | ||||
|   #elif !PIN_EXISTS(SOL0, SOL1) | ||||
|     #error "PARKING_EXTRUDER requires SOL0_PIN and SOL1_PIN." | ||||
|     #error "(MAGNETIC_)PARKING_EXTRUDER requires exactly 2 EXTRUDERS." | ||||
|   #elif !defined(PARKING_EXTRUDER_PARKING_X) | ||||
|     #error "PARKING_EXTRUDER requires PARKING_EXTRUDER_PARKING_X." | ||||
|     #error "(MAGNETIC_)PARKING_EXTRUDER requires PARKING_EXTRUDER_PARKING_X." | ||||
|   #elif !defined(TOOLCHANGE_ZRAISE) | ||||
|     #error "PARKING_EXTRUDER requires TOOLCHANGE_ZRAISE." | ||||
|   #elif TOOLCHANGE_ZRAISE < 0 | ||||
|     #error "TOOLCHANGE_ZRAISE must be 0 or higher." | ||||
|   #elif !defined(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE, LOW, HIGH) | ||||
|     #error "PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE must be defined as HIGH or LOW." | ||||
|   #elif !defined(PARKING_EXTRUDER_SOLENOIDS_DELAY) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_DELAY, 0, 2000) | ||||
|     #error "PARKING_EXTRUDER_SOLENOIDS_DELAY must be between 0 and 2000 (ms)." | ||||
|   #endif | ||||
| #elif ENABLED(MAGNETIC_PARKING_EXTRUDER) | ||||
|   #if ENABLED(DUAL_X_CARRIAGE) | ||||
|     #error "MAGNETIC_PARKING_EXTRUDER and DUAL_X_CARRIAGE are incompatible." | ||||
|   #elif ENABLED(SINGLENOZZLE) | ||||
|     #error "MAGNETIC_PARKING_EXTRUDER and SINGLENOZZLE are incompatible." | ||||
|   #elif ENABLED(EXT_SOLENOID) | ||||
|     #error "MAGNETIC_PARKING_EXTRUDER and EXT_SOLENOID are incompatible. (Pins are used twice.)" | ||||
|   #elif EXTRUDERS != 2 | ||||
|     #error "MAGNETIC_PARKING_EXTRUDER requires exactly 2 EXTRUDERS." | ||||
|   #elif !defined(PARKING_EXTRUDER_PARKING_X) | ||||
|     #error "MAGNETIC_PARKING_EXTRUDER requires PARKING_EXTRUDER_PARKING_X." | ||||
|   #elif !defined(TOOLCHANGE_ZRAISE) | ||||
|     #error "MAGNETIC_PARKING_EXTRUDER requires TOOLCHANGE_ZRAISE." | ||||
|     #error "(MAGNETIC_)PARKING_EXTRUDER requires TOOLCHANGE_ZRAISE." | ||||
|   #elif TOOLCHANGE_ZRAISE < 0 | ||||
|     #error "TOOLCHANGE_ZRAISE must be 0 or higher." | ||||
|   #elif ENABLED(PARKING_EXTRUDER) | ||||
|     #if !PIN_EXISTS(SOL0, SOL1) | ||||
|       #error "PARKING_EXTRUDER requires SOL0_PIN and SOL1_PIN." | ||||
|     #elif !defined(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE, LOW, HIGH) | ||||
|       #error "PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE must be defined as HIGH or LOW." | ||||
|     #elif !defined(PARKING_EXTRUDER_SOLENOIDS_DELAY) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_DELAY, 0, 2000) | ||||
|       #error "PARKING_EXTRUDER_SOLENOIDS_DELAY must be between 0 and 2000 (ms)." | ||||
|     #endif | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
| @@ -884,13 +878,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS | ||||
|  * Switching Toolhead requirements | ||||
|  */ | ||||
| #if ENABLED(SWITCHING_TOOLHEAD) | ||||
|   #if ENABLED(DUAL_X_CARRIAGE) | ||||
|     #error "SWITCHING_TOOLHEAD and DUAL_X_CARRIAGE are incompatible." | ||||
|   #elif ENABLED(SINGLENOZZLE) | ||||
|     #error "SWITCHING_TOOLHEAD and SINGLENOZZLE are incompatible." | ||||
|   #elif ENABLED(PARKING_EXTRUDER) | ||||
|     #error "SWITCHING_TOOLHEAD and PARKING_EXTRUDER are incompatible." | ||||
|   #elif !defined(SWITCHING_TOOLHEAD_SERVO_NR) | ||||
|   #if !defined(SWITCHING_TOOLHEAD_SERVO_NR) | ||||
|     #error "SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_SERVO_NR." | ||||
|   #elif EXTRUDERS < 2 | ||||
|     #error "SWITCHING_TOOLHEAD requires at least 2 EXTRUDERS." | ||||
| @@ -911,6 +899,22 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
| #if ANY(MAGNETIC_SWITCHING_TOOLHEAD, ELECTROMAGNETIC_SWITCHING_TOOLHEAD) | ||||
|   #if ENABLED(EXT_SOLENOID) | ||||
|     #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD and EXT_SOLENOID are incompatible. (Pins are used twice.)" | ||||
|   #elif !PIN_EXISTS(SOL0) | ||||
|     #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD requires SOL0_PIN." | ||||
|   #elif !defined(SWITCHING_TOOLHEAD_Y_POS) | ||||
|     #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_Y_POS" | ||||
|   #elif !defined(SWITCHING_TOOLHEAD_X_POS) | ||||
|     #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_X_POS" | ||||
|   #elif !defined(SWITCHING_TOOLHEAD_Z_HOP) | ||||
|     #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_Z_HOP." | ||||
|   #elif !defined(SWITCHING_TOOLHEAD_Y_CLEAR) | ||||
|     #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_Y_CLEAR." | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * Part-Cooling Fan Multiplexer requirements | ||||
|  */ | ||||
| @@ -1348,7 +1352,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS | ||||
|  * Dual X Carriage requirements | ||||
|  */ | ||||
| #if ENABLED(DUAL_X_CARRIAGE) | ||||
|   #if EXTRUDERS == 1 | ||||
|   #if EXTRUDERS < 2 | ||||
|     #error "DUAL_X_CARRIAGE requires 2 (or more) extruders." | ||||
|   #elif CORE_IS_XY || CORE_IS_XZ | ||||
|     #error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, or COREZX." | ||||
| @@ -1361,7 +1365,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS | ||||
|   #elif X_HOME_DIR != -1 || X2_HOME_DIR != 1 | ||||
|     #error "DUAL_X_CARRIAGE requires X_HOME_DIR -1 and X2_HOME_DIR 1." | ||||
|   #endif | ||||
| #endif // DUAL_X_CARRIAGE | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * Make sure auto fan pins don't conflict with the fan pin | ||||
| @@ -2286,7 +2290,7 @@ static_assert(   _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) | ||||
| /** | ||||
|  * Require soft endstops for certain setups | ||||
|  */ | ||||
| #if DISABLED(MIN_SOFTWARE_ENDSTOPS) || DISABLED(MAX_SOFTWARE_ENDSTOPS) | ||||
| #if !BOTH(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) | ||||
|   #if ENABLED(DUAL_X_CARRIAGE) | ||||
|     #error "DUAL_X_CARRIAGE requires both MIN_ and MAX_SOFTWARE_ENDSTOPS." | ||||
|   #elif HAS_HOTEND_OFFSET | ||||
|   | ||||
| @@ -310,7 +310,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { | ||||
|  | ||||
|       // STEP 3 | ||||
|  | ||||
|       if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Move to position near new extruder"); | ||||
|       if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Move near new extruder"); | ||||
|  | ||||
|       current_position[X_AXIS] += active_extruder ? -10 : 10; // move 10mm away from parked extruder | ||||
|  | ||||
| @@ -370,8 +370,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { | ||||
|  | ||||
|     constexpr uint16_t angles[2] = SWITCHING_TOOLHEAD_SERVO_ANGLES; | ||||
|  | ||||
|     const float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS, | ||||
|                 placexpos = toolheadposx[active_extruder], | ||||
|     constexpr float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS; | ||||
|     const float placexpos = toolheadposx[active_extruder], | ||||
|                 grabxpos = toolheadposx[tmp_extruder]; | ||||
|  | ||||
|     /** | ||||
| @@ -465,15 +465,13 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { | ||||
|     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Toolhead change done."); | ||||
|   } | ||||
|  | ||||
| #endif // SWITCHING_TOOLHEAD | ||||
|  | ||||
| #if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) | ||||
| #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) | ||||
|  | ||||
|   inline void magnetic_switching_toolhead_tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) { | ||||
|     if (no_move) return; | ||||
|  | ||||
|     const float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS, | ||||
|                 placexpos = toolheadposx[active_extruder], | ||||
|     constexpr float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS; | ||||
|     const float placexpos = toolheadposx[active_extruder], | ||||
|                 grabxpos = toolheadposx[tmp_extruder]; | ||||
|  | ||||
|     /** | ||||
| @@ -582,7 +580,138 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { | ||||
|     planner.synchronize(); | ||||
|   } | ||||
|  | ||||
| #endif // MAGNETIC_SWITCHING_TOOLHEAD | ||||
| #elif ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD) | ||||
|  | ||||
|   inline void est_activate_solenoid()   { OUT_WRITE(SOL0_PIN, HIGH); } | ||||
|   inline void est_deactivate_solenoid() { OUT_WRITE(SOL0_PIN, LOW); } | ||||
|   void est_init() { est_activate_solenoid(); } | ||||
|  | ||||
|   inline void electromagnetic_switching_toolhead(const uint8_t tmp_extruder, bool no_move) { | ||||
|     if (no_move) return; | ||||
|  | ||||
|     constexpr float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS; | ||||
|     const float placexpos = toolheadposx[active_extruder], | ||||
|                 grabxpos = toolheadposx[tmp_extruder]; | ||||
|  | ||||
|     /** | ||||
|      * 1. Raise Z-Axis to give enough clearance | ||||
|      * 2. Move to position near active extruder parking | ||||
|      * 3. Move gently to park position of active extruder | ||||
|      * 4. Disengage magnetic field, wait for delay | ||||
|      * 5. Leave extruder and move to position near new extruder parking | ||||
|      * 6. Move gently to park position of new extruder | ||||
|      * 7. Engage magnetic field for new extruder parking | ||||
|      * 8. Unpark extruder | ||||
|      * 9. Apply Z hotend offset to current position | ||||
|      */ | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Autopark", current_position); | ||||
|     #endif | ||||
|  | ||||
|     // 1. Raise Z-Axis to give enough clearance | ||||
|  | ||||
|     current_position[Z_AXIS] += SWITCHING_TOOLHEAD_Z_HOP; | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis ", current_position); | ||||
|     #endif | ||||
|     planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); | ||||
|  | ||||
|     // 2. Move to position near active extruder parking | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) { | ||||
|         planner.synchronize(); | ||||
|         SERIAL_ECHOLNPAIR("(2) Move near active extruder parking", active_extruder); | ||||
|         DEBUG_POS("Moving ParkPos", current_position); | ||||
|       } | ||||
|     #endif | ||||
|     current_position[X_AXIS] = placexpos + hotend_offset[X_AXIS][active_extruder]; | ||||
|     current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR + hotend_offset[Y_AXIS][active_extruder]; | ||||
|     planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); | ||||
|  | ||||
|     // 3. Move gently to park position of active extruder | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) { | ||||
|         planner.synchronize(); | ||||
|         SERIAL_ECHOLNPAIR("(3) Move gently to park position of active extruder", active_extruder); | ||||
|         DEBUG_POS("Moving ParkPos", current_position); | ||||
|       } | ||||
|     #endif | ||||
|  | ||||
|     current_position[Y_AXIS] -= SWITCHING_TOOLHEAD_Y_CLEAR; | ||||
|     planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.5, active_extruder); | ||||
|  | ||||
|     // 4. Disengage magnetic field, wait for delay | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Disengage magnet"); | ||||
|     #endif | ||||
|  | ||||
|     planner.synchronize(); | ||||
|     est_deactivate_solenoid(); | ||||
|  | ||||
|     // 5. Leave extruder and move to position near new extruder parking | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) { | ||||
|         SERIAL_ECHOLNPGM("(5) Move near new extruder parking"); | ||||
|         DEBUG_POS("Moving ParkPos", current_position); | ||||
|       } | ||||
|     #endif | ||||
|  | ||||
|     current_position[Y_AXIS] += SWITCHING_TOOLHEAD_Y_CLEAR; | ||||
|     planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.5f, active_extruder); | ||||
|  | ||||
|     current_position[X_AXIS] = grabxpos + hotend_offset[X_AXIS][active_extruder]; | ||||
|     current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR  + hotend_offset[Y_AXIS][active_extruder]; | ||||
|     planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); | ||||
|  | ||||
|     // 6. Move gently to park position of new extruder | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) { | ||||
|         planner.synchronize(); | ||||
|         SERIAL_ECHOLNPGM("(6) Move near new extruder"); | ||||
|       } | ||||
|     #endif | ||||
|  | ||||
|     current_position[Y_AXIS] -= SWITCHING_TOOLHEAD_Y_CLEAR; | ||||
|     planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.5f, active_extruder); | ||||
|  | ||||
|     // 7. Engage magnetic field for new extruder parking | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(7) Engage magnetic field"); | ||||
|     #endif | ||||
|  | ||||
|     planner.synchronize(); | ||||
|     est_activate_solenoid(); | ||||
|  | ||||
|     // 8. Unpark extruder | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(8) Unpark extruder"); | ||||
|     #endif | ||||
|  | ||||
|     current_position[Y_AXIS] += SWITCHING_TOOLHEAD_Y_CLEAR; | ||||
|  | ||||
|     planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS] * 0.5f, active_extruder); | ||||
|  | ||||
|     // 9. Apply Z hotend offset to current position | ||||
|  | ||||
|     current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; | ||||
|  | ||||
|     #if ENABLED(DEBUG_LEVELING_FEATURE) | ||||
|       if (DEBUGGING(LEVELING)) { | ||||
|         planner.synchronize(); | ||||
|         DEBUG_POS("(9) Applying Z-offset", current_position); | ||||
|       } | ||||
|     #endif | ||||
|   } | ||||
|  | ||||
| #endif // ELECTROMAGNETIC_SWITCHING_TOOLHEAD | ||||
|  | ||||
| inline void invalid_extruder_error(const uint8_t e) { | ||||
|   SERIAL_ECHO_START(); | ||||
| @@ -800,15 +929,17 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) { | ||||
|  | ||||
|       #if ENABLED(DUAL_X_CARRIAGE) | ||||
|         dualx_tool_change(tmp_extruder, no_move); | ||||
|       #elif ENABLED(PARKING_EXTRUDER) // Dual Parking extruder | ||||
|       #elif ENABLED(PARKING_EXTRUDER)                                   // Dual Parking extruder | ||||
|         parking_extruder_tool_change(tmp_extruder, no_move); | ||||
|       #elif ENABLED(MAGNETIC_PARKING_EXTRUDER) // Magnetic Parking extruder | ||||
|       #elif ENABLED(MAGNETIC_PARKING_EXTRUDER)                          // Magnetic Parking extruder | ||||
|         magnetic_parking_extruder_tool_change(tmp_extruder); | ||||
|       #elif ENABLED(SWITCHING_TOOLHEAD) // Switching Toolhead | ||||
|       #elif ENABLED(SWITCHING_TOOLHEAD)                                 // Switching Toolhead | ||||
|         switching_toolhead_tool_change(tmp_extruder, no_move); | ||||
|       #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching Toolhead | ||||
|       #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)                        // Magnetic Switching Toolhead | ||||
|         magnetic_switching_toolhead_tool_change(tmp_extruder, no_move); | ||||
|       #elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS | ||||
|       #elif ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)                 // Magnetic Switching ToolChanger | ||||
|         electromagnetic_switching_toolhead(tmp_extruder, no_move); | ||||
|       #elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS   // Switching Nozzle (single servo) | ||||
|         // Raise by a configured distance to avoid workpiece, except with | ||||
|         // SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead. | ||||
|         current_position[Z_AXIS] += MAX(-zdiff, 0.0) + toolchange_settings.z_raise; | ||||
|   | ||||
| @@ -92,6 +92,10 @@ | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
| #if ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD) | ||||
|   void est_init(); | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * Perform a tool-change, which may result in moving the | ||||
|  * previous tool out of the way and the new tool into place. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user