@ -31,6 +31,9 @@
# include "../Marlin.h"
# include "../Marlin.h"
# define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
# include "../core/debug_out.h"
# if EXTRUDERS > 1
# if EXTRUDERS > 1
toolchange_settings_t toolchange_settings ; // Initialized by settings.load()
toolchange_settings_t toolchange_settings ; // Initialized by settings.load()
# endif
# endif
@ -169,12 +172,10 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
current_position [ X_AXIS ] = mpe_settings . parking_xpos [ tmp_extruder ] + offsetcompensation ;
current_position [ X_AXIS ] = mpe_settings . parking_xpos [ tmp_extruder ] + offsetcompensation ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) {
if ( DEBUGGING ( LEVELING ) ) {
SERIAL _ECHOPAIR( " (1) Move extruder " , int ( tmp_extruder ) ) ;
DEBUG _ECHOPAIR( " (1) Move extruder " , int ( tmp_extruder ) ) ;
DEBUG_POS ( " to new extruder ParkPos " , current_position ) ;
DEBUG_POS ( " to new extruder ParkPos " , current_position ) ;
}
}
# endif
planner . buffer_line ( current_position , mpe_settings . fast_feedrate , tmp_extruder ) ;
planner . buffer_line ( current_position , mpe_settings . fast_feedrate , tmp_extruder ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -183,12 +184,10 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
current_position [ X_AXIS ] = grabpos + offsetcompensation ;
current_position [ X_AXIS ] = grabpos + offsetcompensation ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) {
if ( DEBUGGING ( LEVELING ) ) {
SERIAL _ECHOPAIR( " (2) Couple extruder " , int ( tmp_extruder ) ) ;
DEBUG _ECHOPAIR( " (2) Couple extruder " , int ( tmp_extruder ) ) ;
DEBUG_POS ( " to new extruder GrabPos " , current_position ) ;
DEBUG_POS ( " to new extruder GrabPos " , current_position ) ;
}
}
# endif
planner . buffer_line ( current_position , mpe_settings . slow_feedrate , tmp_extruder ) ;
planner . buffer_line ( current_position , mpe_settings . slow_feedrate , tmp_extruder ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -199,12 +198,10 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
// STEP 3
// STEP 3
current_position [ X_AXIS ] = mpe_settings . parking_xpos [ tmp_extruder ] + offsetcompensation ;
current_position [ X_AXIS ] = mpe_settings . parking_xpos [ tmp_extruder ] + offsetcompensation ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) {
if ( DEBUGGING ( LEVELING ) ) {
SERIAL _ECHOPAIR( " (3) Move extruder " , int ( tmp_extruder ) ) ;
DEBUG _ECHOPAIR( " (3) Move extruder " , int ( tmp_extruder ) ) ;
DEBUG_POS ( " back to new extruder ParkPos " , current_position ) ;
DEBUG_POS ( " back to new extruder ParkPos " , current_position ) ;
}
}
# endif
planner . buffer_line ( current_position , mpe_settings . slow_feedrate , tmp_extruder ) ;
planner . buffer_line ( current_position , mpe_settings . slow_feedrate , tmp_extruder ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -212,12 +209,10 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
// STEP 4
// STEP 4
current_position [ X_AXIS ] = mpe_settings . parking_xpos [ active_extruder ] + ( active_extruder = = 0 ? MPE_TRAVEL_DISTANCE : - MPE_TRAVEL_DISTANCE ) + offsetcompensation ;
current_position [ X_AXIS ] = mpe_settings . parking_xpos [ active_extruder ] + ( active_extruder = = 0 ? MPE_TRAVEL_DISTANCE : - MPE_TRAVEL_DISTANCE ) + offsetcompensation ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) {
if ( DEBUGGING ( LEVELING ) ) {
SERIAL _ECHOPAIR( " (4) Move extruder " , int ( tmp_extruder ) ) ;
DEBUG _ECHOPAIR( " (4) Move extruder " , int ( tmp_extruder ) ) ;
DEBUG_POS ( " close to old extruder ParkPos " , current_position ) ;
DEBUG_POS ( " close to old extruder ParkPos " , current_position ) ;
}
}
# endif
planner . buffer_line ( current_position , mpe_settings . fast_feedrate , tmp_extruder ) ;
planner . buffer_line ( current_position , mpe_settings . fast_feedrate , tmp_extruder ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -226,12 +221,10 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
current_position [ X_AXIS ] = mpe_settings . parking_xpos [ active_extruder ] + offsetcompensation ;
current_position [ X_AXIS ] = mpe_settings . parking_xpos [ active_extruder ] + offsetcompensation ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) {
if ( DEBUGGING ( LEVELING ) ) {
SERIAL _ECHOPAIR( " (5) Park extruder " , int ( tmp_extruder ) ) ;
DEBUG _ECHOPAIR( " (5) Park extruder " , int ( tmp_extruder ) ) ;
DEBUG_POS ( " at old extruder ParkPos " , current_position ) ;
DEBUG_POS ( " at old extruder ParkPos " , current_position ) ;
}
}
# endif
planner . buffer_line ( current_position , mpe_settings . slow_feedrate , tmp_extruder ) ;
planner . buffer_line ( current_position , mpe_settings . slow_feedrate , tmp_extruder ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -240,19 +233,15 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
current_position [ X_AXIS ] = oldx ;
current_position [ X_AXIS ] = oldx ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) {
if ( DEBUGGING ( LEVELING ) ) {
SERIAL _ECHOPAIR( " (6) Move extruder " , int ( tmp_extruder ) ) ;
DEBUG _ECHOPAIR( " (6) Move extruder " , int ( tmp_extruder ) ) ;
DEBUG_POS ( " to starting position " , current_position ) ;
DEBUG_POS ( " to starting position " , current_position ) ;
}
}
# endif
planner . buffer_line ( current_position , mpe_settings . fast_feedrate , tmp_extruder ) ;
planner . buffer_line ( current_position , mpe_settings . fast_feedrate , tmp_extruder ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPGM ( " Autopark done. " ) ;
if ( DEBUGGING ( LEVELING ) ) SERIAL_ECHOLNPGM ( " Autopark done. " ) ;
# endif
}
}
# elif ENABLED(PARKING_EXTRUDER)
# elif ENABLED(PARKING_EXTRUDER)
@ -302,15 +291,11 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
// STEP 1
// STEP 1
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Start Autopark " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Start Autopark " , current_position ) ;
# endif
current_position [ Z_AXIS ] + = toolchange_settings . z_raise ;
current_position [ Z_AXIS ] + = toolchange_settings . z_raise ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " (1) Raise Z-Axis " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " (1) Raise Z-Axis " , current_position ) ;
# endif
fast_line_to_current ( Z_AXIS ) ;
fast_line_to_current ( Z_AXIS ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -319,43 +304,33 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
current_position [ X_AXIS ] = parkingposx [ active_extruder ] + x_offset ;
current_position [ X_AXIS ] = parkingposx [ active_extruder ] + x_offset ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) {
if ( DEBUGGING ( LEVELING ) ) {
SERIAL _ECHOLNPAIR( " (2) Park extruder " , int ( active_extruder ) ) ;
DEBUG _ECHOLNPAIR( " (2) Park extruder " , int ( active_extruder ) ) ;
DEBUG_POS ( " Moving ParkPos " , current_position ) ;
DEBUG_POS ( " Moving ParkPos " , current_position ) ;
}
}
# endif
fast_line_to_current ( X_AXIS ) ;
fast_line_to_current ( X_AXIS ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
// STEP 3
// STEP 3
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPGM ( " (3) Disengage magnet " ) ;
if ( DEBUGGING ( LEVELING ) ) SERIAL_ECHOLNPGM ( " (3) Disengage magnet " ) ;
# endif
pe_deactivate_solenoid ( active_extruder ) ;
pe_deactivate_solenoid ( active_extruder ) ;
// STEP 4
// STEP 4
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPGM ( " (4) Move to position near new extruder " ) ;
if ( DEBUGGING ( LEVELING ) ) SERIAL_ECHOLNPGM ( " (4) Move to position near new extruder " ) ;
# endif
current_position [ X_AXIS ] + = active_extruder ? - 10 : 10 ; // move 10mm away from parked extruder
current_position [ X_AXIS ] + = active_extruder ? - 10 : 10 ; // move 10mm away from parked extruder
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move away from parked extruder " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move away from parked extruder " , current_position ) ;
# endif
fast_line_to_current ( X_AXIS ) ;
fast_line_to_current ( X_AXIS ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
// STEP 5
// STEP 5
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPGM ( " (5) Engage magnetic field " ) ;
if ( DEBUGGING ( LEVELING ) ) SERIAL_ECHOLNPGM ( " (5) Engage magnetic field " ) ;
# endif
# if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
# if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
pe_activate_solenoid ( active_extruder ) ; //just save power for inverted magnets
pe_activate_solenoid ( active_extruder ) ; //just save power for inverted magnets
@ -368,9 +343,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
current_position [ X_AXIS ] = grabpos + ( tmp_extruder ? - 10 : 10 ) ;
current_position [ X_AXIS ] = grabpos + ( tmp_extruder ? - 10 : 10 ) ;
fast_line_to_current ( X_AXIS ) ;
fast_line_to_current ( X_AXIS ) ;
current_position [ X_AXIS ] = grabpos ;
current_position [ X_AXIS ] = grabpos ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " (6) Unpark extruder " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " (6) Unpark extruder " , current_position ) ;
# endif
planner . buffer_line ( current_position , planner . settings . max_feedrate_mm_s [ X_AXIS ] * 0.5 , active_extruder ) ;
planner . buffer_line ( current_position , planner . settings . max_feedrate_mm_s [ X_AXIS ] * 0.5 , active_extruder ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -382,16 +355,12 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
# endif
# endif
;
;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " (7) Move midway between hotends " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " (7) Move midway between hotends " , current_position ) ;
# endif
fast_line_to_current ( X_AXIS ) ;
fast_line_to_current ( X_AXIS ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
DEBUG_ECHOLNPGM ( " Autopark done. " ) ;
SERIAL_ECHOLNPGM ( " Autopark done. " ) ;
# endif
}
}
else { // nomove == true
else { // nomove == true
// Only engage magnetic field for new extruder
// Only engage magnetic field for new extruder
@ -405,9 +374,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
current_position [ Z_AXIS ] + = hotend_offset [ Z_AXIS ] [ active_extruder ] - hotend_offset [ Z_AXIS ] [ tmp_extruder ] ;
current_position [ Z_AXIS ] + = hotend_offset [ Z_AXIS ] [ active_extruder ] - hotend_offset [ Z_AXIS ] [ tmp_extruder ] ;
# endif
# endif
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Applying Z-offset " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Applying Z-offset " , current_position ) ;
# endif
}
}
# endif // PARKING_EXTRUDER
# endif // PARKING_EXTRUDER
@ -433,15 +400,11 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
// 1. Raise Z to give enough clearance
// 1. Raise Z to give enough clearance
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Starting Toolhead change " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Starting Toolhead change " , current_position ) ;
# endif
current_position [ Z_AXIS ] + = toolchange_settings . z_raise ;
current_position [ Z_AXIS ] + = toolchange_settings . z_raise ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " (1) Raise Z-Axis " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " (1) Raise Z-Axis " , current_position ) ;
# endif
fast_line_to_current ( Z_AXIS ) ;
fast_line_to_current ( Z_AXIS ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -450,86 +413,66 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
current_position [ X_AXIS ] = placexpos ;
current_position [ X_AXIS ] = placexpos ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) {
if ( DEBUGGING ( LEVELING ) ) {
SERIAL _ECHOLNPAIR( " (2) Place old tool " , int ( active_extruder ) ) ;
DEBUG _ECHOLNPAIR( " (2) Place old tool " , int ( active_extruder ) ) ;
DEBUG_POS ( " Move X SwitchPos " , current_position ) ;
DEBUG_POS ( " Move X SwitchPos " , current_position ) ;
}
}
# endif
fast_line_to_current ( X_AXIS ) ;
fast_line_to_current ( X_AXIS ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
current_position [ Y_AXIS ] = SWITCHING_TOOLHEAD_Y_POS - SWITCHING_TOOLHEAD_Y_SECURITY ;
current_position [ Y_AXIS ] = SWITCHING_TOOLHEAD_Y_POS - SWITCHING_TOOLHEAD_Y_SECURITY ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move Y SwitchPos + Security " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move Y SwitchPos + Security " , current_position ) ;
# endif
fast_line_to_current ( Y_AXIS ) ;
fast_line_to_current ( Y_AXIS ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
// 3. Unlock tool and drop it in the dock
// 3. Unlock tool and drop it in the dock
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPGM ( " (3) Unlock and Place Toolhead " ) ;
if ( DEBUGGING ( LEVELING ) ) SERIAL_ECHOLNPGM ( " (3) Unlock and Place Toolhead " ) ;
# endif
MOVE_SERVO ( SWITCHING_TOOLHEAD_SERVO_NR , angles [ 1 ] ) ;
MOVE_SERVO ( SWITCHING_TOOLHEAD_SERVO_NR , angles [ 1 ] ) ;
safe_delay ( 500 ) ;
safe_delay ( 500 ) ;
current_position [ Y_AXIS ] = SWITCHING_TOOLHEAD_Y_POS ;
current_position [ Y_AXIS ] = SWITCHING_TOOLHEAD_Y_POS ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move Y SwitchPos " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move Y SwitchPos " , current_position ) ;
# endif
planner . buffer_line ( current_position , ( planner . settings . max_feedrate_mm_s [ Y_AXIS ] * 0.5 ) , active_extruder ) ;
planner . buffer_line ( current_position , ( planner . settings . max_feedrate_mm_s [ Y_AXIS ] * 0.5 ) , active_extruder ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
safe_delay ( 200 ) ;
safe_delay ( 200 ) ;
current_position [ Y_AXIS ] - = SWITCHING_TOOLHEAD_Y_CLEAR ;
current_position [ Y_AXIS ] - = SWITCHING_TOOLHEAD_Y_CLEAR ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move back Y clear " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move back Y clear " , current_position ) ;
# endif
fast_line_to_current ( Y_AXIS ) ; // move away from docked toolhead
fast_line_to_current ( Y_AXIS ) ; // move away from docked toolhead
planner . synchronize ( ) ;
planner . synchronize ( ) ;
// 4. Move to the new toolhead
// 4. Move to the new toolhead
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPGM ( " (4) Move to new toolhead position " ) ;
if ( DEBUGGING ( LEVELING ) ) SERIAL_ECHOLNPGM ( " (4) Move to new toolhead position " ) ;
# endif
current_position [ X_AXIS ] = grabxpos ;
current_position [ X_AXIS ] = grabxpos ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move to new toolhead X " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move to new toolhead X " , current_position ) ;
# endif
fast_line_to_current ( X_AXIS ) ;
fast_line_to_current ( X_AXIS ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
current_position [ Y_AXIS ] = SWITCHING_TOOLHEAD_Y_POS - SWITCHING_TOOLHEAD_Y_SECURITY ;
current_position [ Y_AXIS ] = SWITCHING_TOOLHEAD_Y_POS - SWITCHING_TOOLHEAD_Y_SECURITY ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move Y SwitchPos + Security " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move Y SwitchPos + Security " , current_position ) ;
# endif
fast_line_to_current ( Y_AXIS ) ;
fast_line_to_current ( Y_AXIS ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
// 5. Grab and lock the new toolhead
// 5. Grab and lock the new toolhead
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPGM ( " (5) Grab and lock new toolhead " ) ;
if ( DEBUGGING ( LEVELING ) ) SERIAL_ECHOLNPGM ( " (5) Grab and lock new toolhead " ) ;
# endif
current_position [ Y_AXIS ] = SWITCHING_TOOLHEAD_Y_POS ;
current_position [ Y_AXIS ] = SWITCHING_TOOLHEAD_Y_POS ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move Y SwitchPos " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move Y SwitchPos " , current_position ) ;
# endif
planner . buffer_line ( current_position , planner . settings . max_feedrate_mm_s [ Y_AXIS ] * 0.5 , active_extruder ) ;
planner . buffer_line ( current_position , planner . settings . max_feedrate_mm_s [ Y_AXIS ] * 0.5 , active_extruder ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -540,16 +483,12 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
current_position [ Y_AXIS ] - = SWITCHING_TOOLHEAD_Y_CLEAR ;
current_position [ Y_AXIS ] - = SWITCHING_TOOLHEAD_Y_CLEAR ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move back Y clear " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move back Y clear " , current_position ) ;
# endif
fast_line_to_current ( Y_AXIS ) ; // move away from docked toolhead
fast_line_to_current ( Y_AXIS ) ; // move away from docked toolhead
planner . synchronize ( ) ;
planner . synchronize ( ) ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPGM ( " Toolhead change done. " ) ;
if ( DEBUGGING ( LEVELING ) ) SERIAL_ECHOLNPGM ( " Toolhead change done. " ) ;
# endif
}
}
# endif // SWITCHING_TOOLHEAD
# endif // SWITCHING_TOOLHEAD
@ -563,17 +502,15 @@ inline void invalid_extruder_error(const uint8_t e) {
# if ENABLED(DUAL_X_CARRIAGE)
# if ENABLED(DUAL_X_CARRIAGE)
inline void dualx_tool_change ( const uint8_t tmp_extruder , bool & no_move ) {
inline void dualx_tool_change ( const uint8_t tmp_extruder , bool & no_move ) {
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) {
if ( DEBUGGING ( LEVELING ) ) {
SERIAL _ECHOPGM( " Dual X Carriage Mode " ) ;
DEBUG _ECHOPGM( " Dual X Carriage Mode " ) ;
switch ( dual_x_carriage_mode ) {
switch ( dual_x_carriage_mode ) {
case DXC_FULL_CONTROL_MODE : SERIAL _ECHOLNPGM( " DXC_FULL_CONTROL_MODE " ) ; break ;
case DXC_FULL_CONTROL_MODE : DEBUG _ECHOLNPGM( " DXC_FULL_CONTROL_MODE " ) ; break ;
case DXC_AUTO_PARK_MODE : SERIAL _ECHOLNPGM( " DXC_AUTO_PARK_MODE " ) ; break ;
case DXC_AUTO_PARK_MODE : DEBUG _ECHOLNPGM( " DXC_AUTO_PARK_MODE " ) ; break ;
case DXC_DUPLICATION_MODE : SERIAL _ECHOLNPGM( " DXC_DUPLICATION_MODE " ) ; break ;
case DXC_DUPLICATION_MODE : DEBUG _ECHOLNPGM( " DXC_DUPLICATION_MODE " ) ; break ;
case DXC_SCALED_DUPLICATION_MODE : SERIAL _ECHOLNPGM( " DXC_SCALED_DUPLICATION_MODE " ) ; break ;
case DXC_SCALED_DUPLICATION_MODE : DEBUG _ECHOLNPGM( " DXC_SCALED_DUPLICATION_MODE " ) ; break ;
}
}
}
}
# endif
const float xhome = x_home_pos ( active_extruder ) ;
const float xhome = x_home_pos ( active_extruder ) ;
if ( dual_x_carriage_mode = = DXC_AUTO_PARK_MODE
if ( dual_x_carriage_mode = = DXC_AUTO_PARK_MODE
@ -581,9 +518,8 @@ inline void invalid_extruder_error(const uint8_t e) {
& & ( delayed_move_time | | current_position [ X_AXIS ] ! = xhome ) & & ! no_move
& & ( delayed_move_time | | current_position [ X_AXIS ] ! = xhome ) & & ! no_move
) {
) {
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPAIR ( " MoveX to " , xhome ) ;
if ( DEBUGGING ( LEVELING ) ) SERIAL_ECHOLNPAIR ( " MoveX to " , xhome ) ;
# endif
// Park old head
// Park old head
planner . buffer_line ( xhome , current_position [ Y_AXIS ] , current_position [ Z_AXIS ] , current_position [ E_AXIS ] , planner . settings . max_feedrate_mm_s [ X_AXIS ] , active_extruder ) ;
planner . buffer_line ( xhome , current_position [ Y_AXIS ] , current_position [ Z_AXIS ] , current_position [ E_AXIS ] , planner . settings . max_feedrate_mm_s [ X_AXIS ] , active_extruder ) ;
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -599,9 +535,7 @@ inline void invalid_extruder_error(const uint8_t e) {
// This function resets the max/min values - the current position may be overwritten below.
// This function resets the max/min values - the current position may be overwritten below.
set_axis_is_at_home ( X_AXIS ) ;
set_axis_is_at_home ( X_AXIS ) ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " New Extruder " , current_position ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " New Extruder " , current_position ) ;
# endif
switch ( dual_x_carriage_mode ) {
switch ( dual_x_carriage_mode ) {
case DXC_FULL_CONTROL_MODE :
case DXC_FULL_CONTROL_MODE :
@ -620,12 +554,10 @@ inline void invalid_extruder_error(const uint8_t e) {
break ;
break ;
}
}
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) {
if ( DEBUGGING ( LEVELING ) ) {
SERIAL _ECHOLNPAIR( " Active extruder parked: " , active_extruder_parked ? " yes " : " no " ) ;
DEBUG _ECHOLNPAIR( " Active extruder parked: " , active_extruder_parked ? " yes " : " no " ) ;
DEBUG_POS ( " New extruder (parked) " , current_position ) ;
DEBUG_POS ( " New extruder (parked) " , current_position ) ;
}
}
# endif
}
}
# endif // DUAL_X_CARRIAGE
# endif // DUAL_X_CARRIAGE
@ -680,9 +612,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
if ( ! no_move & & ! all_axes_homed ( ) ) {
if ( ! no_move & & ! all_axes_homed ( ) ) {
no_move = true ;
no_move = true ;
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPGM ( " No move on toolchange " ) ;
if ( DEBUGGING ( LEVELING ) ) SERIAL_ECHOLNPGM ( " No move on toolchange " ) ;
# endif
}
}
# if HAS_LCD_MENU
# if HAS_LCD_MENU
@ -777,10 +707,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
move_nozzle_servo ( tmp_extruder ) ;
move_nozzle_servo ( tmp_extruder ) ;
# endif
# endif
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_ECHOLNPAIR ( " Offset Tool XY by { " , xdiff , " , " , ydiff , " , " , zdiff , " } " ) ;
if ( DEBUGGING ( LEVELING ) )
SERIAL_ECHOLNPAIR ( " Offset Tool XY by { " , xdiff , " , " , ydiff , " , " , zdiff , " } " ) ;
# endif
// The newly-selected extruder XY is actually at...
// The newly-selected extruder XY is actually at...
current_position [ X_AXIS ] + = xdiff ;
current_position [ X_AXIS ] + = xdiff ;
@ -802,9 +729,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
// Return to position and lower again
// Return to position and lower again
if ( safe_to_move & & ! no_move & & IsRunning ( ) ) {
if ( safe_to_move & & ! no_move & & IsRunning ( ) ) {
# if ENABLED(DEBUG_LEVELING_FEATURE)
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move back " , destination ) ;
if ( DEBUGGING ( LEVELING ) ) DEBUG_POS ( " Move back " , destination ) ;
# endif
# if ENABLED(SINGLENOZZLE)
# if ENABLED(SINGLENOZZLE)
# if FAN_COUNT > 0
# if FAN_COUNT > 0