@ -32,25 +32,34 @@
# include "../../module/tool_change.h"
# include "../../module/tool_change.h"
# include "../../module/planner.h"
# include "../../module/planner.h"
# define DEBUG_OUT ENABLED(DEBUG_DXC_MODE)
# include "../../core/debug_out.h"
# if ENABLED(DUAL_X_CARRIAGE)
# if ENABLED(DUAL_X_CARRIAGE)
/**
/**
* M605 : Set dual x - carriage movement mode
* M605 : Set dual x - carriage movement mode
*
*
* M605 : Restore user specified DEFAULT_DUAL_X_CARRIAGE_MODE
* M605 S0 : ( FULL_CONTROL ) The slicer has full control over both X - carriages and can achieve optimal travel
* M605 S0 : Full control mode . The slicer has full control over x - carriage movement
* results as long as it supports dual X - carriages .
* M605 S1 : Auto - park mode . The inactive head will auto park / unpark without slicer involvement
*
* M605 S2 [ Xnnn ] [ Rmmm ] : Duplication mode . The second extruder will duplicate the first with nnn
* M605 S1 : ( AUTO_PARK ) The firmware automatically parks and unparks the X - carriages on tool - change so that
* units x - offset and an optional differential hotend temperature of
* additional slicer support is not required .
* mmm degrees . E . g . , with " M605 S2 X100 R2 " the second extruder will duplicate
*
* the first with a spacing of 100 mm in the x direction and 2 degrees hotter .
* M605 S2 X R : ( DUPLICATION ) The firmware moves the second X - carriage and extruder in synchronization with
* M605 S3 : Enable Scaled Duplication mode . The second extruder will duplicate the first extruder ' s
* the first X - carriage and extruder , to print 2 copies of the same object at the same time .
* movement similar to the M605 S2 mode . However , the second extruder will be producing
* Set the constant X - offset and temperature differential with M605 S2 X [ offs ] R [ deg ] and
* a scaled image of the first extruder . The initial x - offset and temperature differential are
* follow with " M605 S2 " to initiate duplicated movement . For example , use " M605 S2 X100 R2 " to
* set with M605 S2 [ Xnnn ] [ Rmmm ] and then followed with a M605 S3 to start the mirrored movement .
* make a copy 100 mm to the right with E1 2 ° hotter than E0 .
*
* M605 S3 : ( MIRRORED ) Formbot / Vivedino - inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis .
* The temperature differential and initial X offset must be set with " M605 S2 X[offs] R[deg] " ,
* then followed by " M605 S3 " to initiate mirrored movement .
*
* M605 W : IDEX What ? command .
* M605 W : IDEX What ? command .
*
*
* Note : the X axis should be homed after changing dual x - carriage mode .
* Note : the X axis should be homed after changing Dual X - carriage mode .
*/
*/
void GcodeSuite : : M605 ( ) {
void GcodeSuite : : M605 ( ) {
planner . synchronize ( ) ;
planner . synchronize ( ) ;
@ -59,18 +68,16 @@
const DualXMode previous_mode = dual_x_carriage_mode ;
const DualXMode previous_mode = dual_x_carriage_mode ;
dual_x_carriage_mode = ( DualXMode ) parser . value_byte ( ) ;
dual_x_carriage_mode = ( DualXMode ) parser . value_byte ( ) ;
mirrored_duplication_mode = false ;
#if 0
if ( dual_x_carriage_mode = = DXC_MIRRORED_MODE ) {
scaled_duplication_mode = false ;
if ( dual_x_carriage_mode = = DXC_SCALED_DUPLICATION_MODE ) {
if ( previous_mode ! = DXC_DUPLICATION_MODE ) {
if ( previous_mode ! = DXC_DUPLICATION_MODE ) {
SERIAL_ECHOLNPGM ( " Printer must be in DXC_DUPLICATION_MODE prior to " ) ;
SERIAL_ECHOLNPGM ( " Printer must be in DXC_DUPLICATION_MODE prior to " ) ;
SERIAL_ECHOLNPGM ( " specifying DXC_ SCALED_DUPLICATION _MODE." ) ;
SERIAL_ECHOLNPGM ( " specifying DXC_MIRRORED_MODE. " ) ;
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE ;
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE ;
return ;
return ;
}
}
scal ed_duplication_mode = true ;
mirror ed_duplication_mode = true ;
stepper . set_directions ( ) ;
stepper . set_directions ( ) ;
float x_jog = current_position [ X_AXIS ] - .1 ;
float x_jog = current_position [ X_AXIS ] - .1 ;
for ( uint8_t i = 2 ; - - i ; ) {
for ( uint8_t i = 2 ; - - i ; ) {
@ -79,7 +86,6 @@
}
}
return ;
return ;
}
}
# endif
switch ( dual_x_carriage_mode ) {
switch ( dual_x_carriage_mode ) {
case DXC_FULL_CONTROL_MODE :
case DXC_FULL_CONTROL_MODE :
@ -105,47 +111,37 @@
# ifdef DEBUG_DXC_MODE
# ifdef DEBUG_DXC_MODE
if ( parser . seen ( ' W ' ) ) {
if ( parser . seen ( ' W ' ) ) {
SERIAL _ECHO_START( ) ;
DEBUG _ECHO_START( ) ;
SERIAL_ECHOPGM( " IDEX mode: " ) ;
DEBUG_ECHOPGM( " Dual X Carriage Mode " ) ;
switch ( dual_x_carriage_mode ) {
switch ( dual_x_carriage_mode ) {
case DXC_FULL_CONTROL_MODE : SERIAL_ECHOPGM ( " DXC_FULL_CONTROL_MODE " ) ; break ;
case DXC_FULL_CONTROL_MODE : DEBUG_ECHOPGM ( " FULL_CONTROL " ) ; break ;
case DXC_AUTO_PARK_MODE : SERIAL_ECHOPGM ( " DXC_AUTO_PARK_MODE " ) ; break ;
case DXC_AUTO_PARK_MODE : DEBUG_ECHOPGM ( " AUTO_PARK " ) ; break ;
case DXC_DUPLICATION_MODE : SERIAL_ECHOPGM ( " DXC_DUPLICATION_MODE " ) ; break ;
case DXC_DUPLICATION_MODE : DEBUG_ECHOPGM ( " DUPLICATION " ) ; break ;
case DXC_ SCALED_DUPLICATION_MODE: SERIAL_ECHOPGM ( " DXC_SCALED_DUPLICATION_MODE " ) ; break ;
case DXC_ MIRRORED_MODE: DEBUG_ECHOPGM ( " MIRRORED " ) ; break ;
}
}
SERIAL_ECHOPAIR ( " \n Active Ext: " , int ( active_extruder ) ) ;
DEBUG_ECHOPAIR ( " \n Active Ext: " , int ( active_extruder ) ) ;
if ( ! active_extruder_parked ) SERIAL_ECHOPGM ( " NOT " ) ;
if ( ! active_extruder_parked ) DEBUG_ECHOPGM ( " NOT " ) ;
SERIAL_ECHOPGM ( " parked. " ) ;
DEBUG_ECHOPGM ( " parked. " ) ;
SERIAL_ECHOPAIR ( " \n active_extruder_x_pos: " , current_position [ X_AXIS ] ) ;
DEBUG_ECHOPAIR ( " \n active_extruder_x_pos: " , current_position [ X_AXIS ] ) ;
SERIAL_ECHOPAIR ( " \n inactive_extruder_x_pos: " , inactive_extruder_x_pos ) ;
DEBUG_ECHOPAIR ( " \n inactive_extruder_x_pos: " , inactive_extruder_x_pos ) ;
SERIAL_ECHOPAIR ( " \n extruder_duplication_enabled: " , int ( extruder_duplication_enabled ) ) ;
DEBUG_ECHOPAIR ( " \n extruder_duplication_enabled: " , int ( extruder_duplication_enabled ) ) ;
SERIAL_ECHOPAIR ( " \n duplicate_extruder_x_offset: " , duplicate_extruder_x_offset ) ;
DEBUG_ECHOPAIR ( " \n duplicate_extruder_x_offset: " , duplicate_extruder_x_offset ) ;
SERIAL_ECHOPAIR ( " \n duplicate_extruder_temp_offset: " , duplicate_extruder_temp_offset ) ;
DEBUG_ECHOPAIR ( " \n duplicate_extruder_temp_offset: " , duplicate_extruder_temp_offset ) ;
SERIAL_ECHOPAIR ( " \n delayed_move_time: " , delayed_move_time ) ;
DEBUG_ECHOPAIR ( " \n delayed_move_time: " , delayed_move_time ) ;
SERIAL_ECHOPAIR ( " \n X1 Home X: " , x_home_pos ( 0 ) ) ;
DEBUG_ECHOPAIR ( " \n X1 Home X: " , x_home_pos ( 0 ) , " \n X1_MIN_POS= " , int ( X1_MIN_POS ) , " \n X1_MAX_POS= " , int ( X1_MAX_POS ) ) ;
SERIAL_ECHOPAIR ( " \n X1_MIN_POS= " , int ( X1_MIN_POS ) ) ;
DEBUG_ECHOPAIR ( " \n X2 Home X: " , x_home_pos ( 1 ) , " \n X2_MIN_POS= " , int ( X2_MIN_POS ) , " \n X2_MAX_POS= " , int ( X2_MAX_POS ) ) ;
SERIAL_ECHOPAIR ( " \n X1_MAX_POS= " , int ( X1_MAX_POS ) ) ;
DEBUG_ECHOPAIR ( " \n X2_HOME_DIR= " , int ( X2_HOME_DIR ) , " \n X2_HOME_POS= " , int ( X2_HOME_POS ) ) ;
SERIAL_ECHOPAIR ( " \n X2 Home X: " , x_home_pos ( 1 ) ) ;
DEBUG_ECHOPAIR ( " \n DEFAULT_DUAL_X_CARRIAGE_MODE= " , STRINGIFY ( DEFAULT_DUAL_X_CARRIAGE_MODE ) ) ;
SERIAL_ECHOPAIR ( " \n X2_MIN_POS= " , int ( X2_MIN_POS ) ) ;
DEBUG_ECHOPAIR ( " \n TOOLCHANGE_ZRAISE= " , float ( TOOLCHANGE_ZRAISE ) ) ;
SERIAL_ECHOPAIR ( " \n X2_MAX_POS= " , int ( X2_MAX_POS ) ) ;
DEBUG_ECHOPAIR ( " \n DEFAULT_DUPLICATION_X_OFFSET= " , int ( DEFAULT_DUPLICATION_X_OFFSET ) ) ;
SERIAL_ECHOPAIR ( " \n X2_HOME_DIR= " , int ( X2_HOME_DIR ) ) ;
DEBUG_EOL ( ) ;
SERIAL_ECHOPAIR ( " \n X2_HOME_POS= " , int ( X2_HOME_POS ) ) ;
SERIAL_ECHOPAIR ( " \n DEFAULT_DUAL_X_CARRIAGE_MODE= " , STRINGIFY ( DEFAULT_DUAL_X_CARRIAGE_MODE ) ) ;
HOTEND_LOOP ( ) {
SERIAL_ECHOPAIR ( " \n TOOLCHANGE_ZRAISE= " , float ( TOOLCHANGE_ZRAISE ) ) ;
DEBUG_ECHOPAIR ( " nozzle: " , int ( e ) ) ;
SERIAL_ECHOPAIR ( " \n DEFAULT_DUPLICATION_X_OFFSET= " , int ( DEFAULT_DUPLICATION_X_OFFSET ) ) ;
LOOP_XYZ ( j ) DEBUG_ECHOPAIR ( " hotend_offset[ " , axis_codes [ j ] , " _AXIS][ " , int ( e ) , " ]= " , hotend_offset [ j ] [ e ] ) ;
SERIAL_EOL ( ) ;
DEBUG_EOL ( ) ;
for ( uint8_t i = 0 ; i < 2 ; i + + ) {
SERIAL_ECHOPAIR ( " nozzle: " , int ( i ) ) ;
LOOP_XYZ ( j ) {
SERIAL_ECHOPGM ( " hotend_offset[ " ) ;
SERIAL_CHAR ( axis_codes [ j ] ) ;
SERIAL_ECHOPAIR ( " _AXIS][ " , int ( i ) ) ;
SERIAL_ECHOPAIR ( " ]= " , hotend_offset [ j ] [ i ] ) ;
}
SERIAL_EOL ( ) ;
}
}
SERIAL _EOL( ) ;
DEBUG_EOL ( ) ;
}
}
# endif // DEBUG_DXC_MODE
# endif // DEBUG_DXC_MODE
}
}