Merge pull request #4362 from thinkyhead/rc_duplication_mode

DUAL_NOZZLE_DUPLICATION_MODE
This commit is contained in:
Scott Lahteine 2016-07-22 21:17:59 -07:00 committed by GitHub
commit 652fd8a826
23 changed files with 124 additions and 35 deletions

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -134,7 +134,7 @@ void idle(
void manage_inactivity(bool ignore_stepper_queue = false);
#if ENABLED(DUAL_X_CARRIAGE)
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
extern bool extruder_duplication_enabled;
#endif

View File

@ -1394,6 +1394,10 @@ XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH);
XYZ_CONSTS_FROM_CONFIG(float, home_bump_mm, HOME_BUMP_MM);
XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
bool extruder_duplication_enabled = false; // Used in Dual X mode 2
#endif
#if ENABLED(DUAL_X_CARRIAGE)
#define DXC_FULL_CONTROL_MODE 0
@ -1425,7 +1429,6 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
static millis_t delayed_move_time = 0; // used in mode 1
static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
static float duplicate_extruder_temp_offset = 0; // used in mode 2
bool extruder_duplication_enabled = false; // used in mode 2
#endif //DUAL_X_CARRIAGE
@ -2812,12 +2815,13 @@ inline void gcode_G4() {
current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
sync_plan_position();
int x_axis_home_dir =
#if ENABLED(DUAL_X_CARRIAGE)
int x_axis_home_dir = x_home_dir(active_extruder);
extruder_duplication_enabled = false;
x_home_dir(active_extruder)
#else
int x_axis_home_dir = home_dir(X_AXIS);
home_dir(X_AXIS)
#endif
;
float mlx = max_length(X_AXIS),
mly = max_length(Y_AXIS),
@ -2870,6 +2874,10 @@ inline void gcode_G28() {
tool_change(0, 0, true);
#endif
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
extruder_duplication_enabled = false;
#endif
/**
* For mesh bed leveling deactivate the mesh calculations, will be turned
* on again when homing all axis
@ -2988,7 +2996,6 @@ inline void gcode_G28() {
if (home_all_axis || homeX) {
#if ENABLED(DUAL_X_CARRIAGE)
int tmp_extruder = active_extruder;
extruder_duplication_enabled = false;
active_extruder = !active_extruder;
HOMEAXIS(X);
inactive_extruder_x_pos = current_position[X_AXIS];
@ -6449,7 +6456,17 @@ inline void gcode_M503() {
delayed_move_time = 0;
}
#endif // DUAL_X_CARRIAGE
#elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
inline void gcode_M605() {
stepper.synchronize();
extruder_duplication_enabled = code_seen('S') && code_value_int() == 2;
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(MSG_DUPLICATION_MODE, extruder_duplication_enabled ? MSG_ON : MSG_OFF);
SERIAL_EOL;
}
#endif // M605
#if ENABLED(LIN_ADVANCE)
/**

View File

@ -175,7 +175,7 @@
*/
#if ENABLED(SWITCHING_EXTRUDER)
#if ENABLED(DUAL_X_CARRIAGE)
#error "SINGLENOZZLE and DUAL_X_CARRIAGE are incompatible."
#error "SWITCHING_EXTRUDER and DUAL_X_CARRIAGE are incompatible."
#elif EXTRUDERS != 2
#error "SWITCHING_EXTRUDER requires exactly 2 EXTRUDERS."
#elif NUM_SERVOS < 1
@ -572,6 +572,23 @@
#error "TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT."
#endif
/**
* Basic 2-nozzle duplication mode
*/
#if ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#if HOTENDS != 2
#error "DUAL_NOZZLE_DUPLICATION_MODE requires exactly 2 hotends."
#elif ENABLED(DUAL_X_CARRIAGE)
#error "DUAL_NOZZLE_DUPLICATION_MODE is incompatible with DUAL_X_CARRIAGE."
#elif ENABLED(SINGLENOZZLE)
#error "DUAL_NOZZLE_DUPLICATION_MODE is incompatible with SINGLENOZZLE."
#elif ENABLED(MIXING_EXTRUDER)
#error "DUAL_NOZZLE_DUPLICATION_MODE is incompatible with MIXING_EXTRUDER."
#elif ENABLED(SWITCHING_EXTRUDER)
#error "DUAL_NOZZLE_DUPLICATION_MODE is incompatible with SWITCHING_EXTRUDER."
#endif
#endif
/**
* Test Extruder Pins
*/

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -335,6 +335,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -337,6 +337,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -334,6 +334,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -329,6 +329,9 @@
#define AXIS_RELATIVE_MODES {false, false, false, false}
// Allow duplication mode with a basic dual-nozzle extruder
//#define DUAL_NOZZLE_DUPLICATION_MODE
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false
#define INVERT_Y_STEP_PIN false

View File

@ -159,6 +159,7 @@
#define MSG_ENDSTOP_HIT "TRIGGERED"
#define MSG_ENDSTOP_OPEN "open"
#define MSG_HOTEND_OFFSET "Hotend offsets:"
#define MSG_DUPLICATION_MODE "Duplication mode: "
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir "
#define MSG_SD_INIT_FAIL "SD init fail"

View File

@ -72,7 +72,7 @@
#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
#define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
#define X2_ENABLE_READ READ(X_ENABLE_PIN)
#endif // DUAL_X_CARRIAGE
#endif
// Y motor
#define Y_STEP_INIT SET_OUTPUT(Y_STEP_PIN)
@ -195,14 +195,14 @@
#define NORM_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); } }
#define REV_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(INVERT_E2_DIR); } }
#elif EXTRUDERS > 1
#if DISABLED(DUAL_X_CARRIAGE)
#define E_STEP_WRITE(v) { if (current_block->active_extruder == 0) { E0_STEP_WRITE(v); } else { E1_STEP_WRITE(v); } }
#define NORM_E_DIR() { if (current_block->active_extruder == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }
#define REV_E_DIR() { if (current_block->active_extruder == 0) { E0_DIR_WRITE(INVERT_E0_DIR); } else { E1_DIR_WRITE(INVERT_E1_DIR); } }
#else
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#define E_STEP_WRITE(v) { if (extruder_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if (current_block->active_extruder == 0) { E0_STEP_WRITE(v); } else { E1_STEP_WRITE(v); } }
#define NORM_E_DIR() { if (extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if (current_block->active_extruder == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }
#define REV_E_DIR() { if (extruder_duplication_enabled) { E0_DIR_WRITE(INVERT_E0_DIR); E1_DIR_WRITE(INVERT_E1_DIR); } else if (current_block->active_extruder == 0) { E0_DIR_WRITE(INVERT_E0_DIR); } else { E1_DIR_WRITE(INVERT_E1_DIR); } }
#else
#define E_STEP_WRITE(v) { if (current_block->active_extruder == 0) { E0_STEP_WRITE(v); } else { E1_STEP_WRITE(v); } }
#define NORM_E_DIR() { if (current_block->active_extruder == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }
#define REV_E_DIR() { if (current_block->active_extruder == 0) { E0_DIR_WRITE(INVERT_E0_DIR); } else { E1_DIR_WRITE(INVERT_E1_DIR); } }
#endif
#elif ENABLED(MIXING_EXTRUDER)
#define E_STEP_WRITE(v) NOOP /* not used for mixing extruders! */