@ -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 ] ,
const expr 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 ] ,
const expr 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 ;