Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

//#define TREX3 // Turn this on for T-Rex 3 features like dual filament run out sensors

#define ROXYs_TRex // Turn this on to get customizations only available on Roxy's T-Rex 2+
//#define ROXYs_TRex // Turn this on to get customizations only available on Roxy's T-Rex 2+
// Marlin controlled heat bed, Max7219 debug LED's, less bright LED light level
// More aggressive PID numbers for hotends (due to double fans)
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,7 @@
// Mode 2 (DXC_DUPLICATION_MODE) : Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all
// actions of the first x-carriage. This allows the printer to print 2 arbitrary items at
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// Mode 3 (DXC_SYMMETRIC_DUPLICATION_MODE) : Symmetric Duplication mode. The firmware will perform similarly to DXC_DUPLICATION_MODE except in a mirror
// image of the first x-carriage. ie. If you are printing a right hand shoe on the 1st extruder, you will
// get a left hand shoe on the 2nd extruder.
// Mode 3 (DXC_SCALED_DUPLICATION_MODE) : Not working yet, but support routines in place

// This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/feature/Max7219_Debug_LEDs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ uint8_t Max7219::led_line[MAX7219_LINES]; // = { 0 };
#if _ROT == 0 || _ROT == 270
#define _LED_BIT(Q) (7 - ((Q) & 0x7))
#define _LED_UNIT(Q) ((Q) & ~0x7)
//#define _LED_UNIT(Q) ((MAX7219_NUMBER_UNITS - 1 - ((Q) >> 3)) << 3) // some Max7219 boards have rotated the matrix
// this line can be substituted to correct orientation
#else
#define _LED_BIT(Q) ((Q) & 0x7)
#define _LED_UNIT(Q) ((MAX7219_NUMBER_UNITS - 1 - ((Q) >> 3)) << 3)
Expand Down
66 changes: 55 additions & 11 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ static void do_pause_e_move(const float &length, const float &fr) {
bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=0*/, const int8_t max_beep_count/*=0*/,
const bool show_lcd/*=false*/, const bool pause_for_user/*=false*/,
const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/
DXC_ARGS
) {
#if DISABLED(ULTIPANEL)
UNUSED(show_lcd);
Expand Down Expand Up @@ -184,6 +185,13 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode);
#endif

#if ENABLED(DUAL_X_CARRIAGE)
const int8_t saved_ext = active_extruder;
const bool saved_ext_dup_mode = extruder_duplication_enabled;
active_extruder = DXC_ext;
extruder_duplication_enabled = false;
#endif

// Slow Load filament
if (slow_load_length) do_pause_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE);

Expand All @@ -201,6 +209,12 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
#endif
}

#if ENABLED(DUAL_X_CARRIAGE) // Tie the two extruders movement back together.
active_extruder = saved_ext;
extruder_duplication_enabled = saved_ext_dup_mode;
stepper.set_directions();
#endif

#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)

#if ENABLED(ULTIPANEL)
Expand Down Expand Up @@ -328,7 +342,8 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
*/
uint8_t did_pause_print = 0;

bool pause_print(const float &retract, const point_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/) {
bool pause_print(const float &retract, const point_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) {

if (did_pause_print) return false; // already paused

#ifdef ACTION_ON_PAUSE
Expand Down Expand Up @@ -380,10 +395,22 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
if (!axis_unhomed_error())
Nozzle::park(2, park_point);

// Unload the filament
if (unload_length)
#if ENABLED(DUAL_X_CARRIAGE)
const int8_t saved_ext = active_extruder;
const bool saved_ext_dup_mode = extruder_duplication_enabled;
active_extruder = DXC_ext;
extruder_duplication_enabled = false;
#endif

if (unload_length) // Unload the filament
unload_filament(unload_length, show_lcd);

#if ENABLED(DUAL_X_CARRIAGE)
active_extruder = saved_ext;
extruder_duplication_enabled = saved_ext_dup_mode;
stepper.set_directions();
#endif

return true;
}

Expand All @@ -394,7 +421,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
*
* Used by M125 and M600
*/
void wait_for_filament_reload(const int8_t max_beep_count/*=0*/) {
void wait_for_filament_reload(const int8_t max_beep_count/*=0*/ DXC_ARGS) {
bool nozzle_timed_out = false;

#if ENABLED(ULTIPANEL)
Expand All @@ -413,6 +440,13 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/) {
HOTEND_LOOP()
thermalManager.start_heater_idle_timer(e, nozzle_timeout);

#if ENABLED(DUAL_X_CARRIAGE)
const int8_t saved_ext = active_extruder;
const bool saved_ext_dup_mode = extruder_duplication_enabled;
active_extruder = DXC_ext;
extruder_duplication_enabled = false;
#endif

// Wait for filament insert by user and press button
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true; // LCD click or M108 will clear this
Expand Down Expand Up @@ -477,6 +511,11 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/) {

idle(true);
}
#if ENABLED(DUAL_X_CARRIAGE)
active_extruder = saved_ext;
extruder_duplication_enabled = saved_ext_dup_mode;
stepper.set_directions();
#endif
KEEPALIVE_STATE(IN_HANDLER);
}

Expand All @@ -498,7 +537,15 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/) {
* - Send host action for resume, if configured
* - Resume the current SD print job, if any
*/
void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/) {
void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {
/*
SERIAL_ECHOPGM("start of resume_print()\n");
SERIAL_ECHOPAIR("\ndual_x_carriage_mode:", dual_x_carriage_mode);
SERIAL_ECHOPAIR("\nextruder_duplication_enabled:", extruder_duplication_enabled);
SERIAL_ECHOPAIR("\nactive_extruder:", active_extruder);
SERIAL_ECHOPGM("\n\n");
*/

if (!did_pause_print) return;

// Re-enable the heaters if they timed out
Expand All @@ -508,14 +555,11 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
thermalManager.reset_heater_idle_timer(e);
}

if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) {
// Load the new filament
load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out);
}
if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // Load the new filament
load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, ADVANCED_PAUSE_MODE_PAUSE_PRINT DXC_PASS);

#if ENABLED(ULTIPANEL)
// "Wait for print to resume"
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME);
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME); // "Wait for print to resume"
#endif

// Intelligent resuming
Expand Down
18 changes: 14 additions & 4 deletions Marlin/src/feature/pause.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,24 @@ extern float filament_change_unload_length[EXTRUDERS],

extern uint8_t did_pause_print;

bool pause_print(const float &retract, const point_t &park_point, const float &unload_length=0, const bool show_lcd=false);
#if ENABLED(DUAL_X_CARRIAGE)
#define DXC_PARAMS , const int8_t DXC_ext=-1
#define DXC_ARGS , const int8_t DXC_ext
#define DXC_PASS , DXC_ext
#else
#define DXC_PARAMS
#define DXC_ARGS
#define DXC_PASS
#endif

void wait_for_filament_reload(const int8_t max_beep_count=0);
bool pause_print(const float &retract, const point_t &park_point, const float &unload_length=0, const bool show_lcd=false DXC_PARAMS);

void resume_print(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, const int8_t max_beep_count=0);
void wait_for_filament_reload(const int8_t max_beep_count=0 DXC_PARAMS);

void resume_print(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, const int8_t max_beep_count=0 DXC_PARAMS);

bool load_filament(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=0, const int8_t max_beep_count=0, const bool show_lcd=false,
const bool pause_for_user=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT);
const bool pause_for_user=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT DXC_PARAMS);

bool unload_filament(const float &unload_length, const bool show_lcd=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT);

Expand Down
39 changes: 24 additions & 15 deletions Marlin/src/feature/runout.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,31 @@ class FilamentRunoutSensor {
#else
// Read the sensor for the active extruder
bool is_out;
switch (active_extruder) {
case 0: is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING; break;
case 1: is_out = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 2
case 2: is_out = READ(FIL_RUNOUT3_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 3
case 3: is_out = READ(FIL_RUNOUT4_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 4
case 4: is_out = READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 5
case 5: is_out = READ(FIL_RUNOUT6_PIN) == FIL_RUNOUT_INVERTING; break;
#endif
#endif
#endif
#endif
#if ENABLED(DUAL_X_CARRIAGE)
const bool out1 = READ(FIL_RUNOUT_PIN ) == FIL_RUNOUT_INVERTING,
out2 = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING;
if (extruder_duplication_enabled)
is_out = out1 || out2;
else
is_out = active_extruder ? out2 : out1;
#else
switch (active_extruder) {
case 0: is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING; break;
case 1: is_out = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 2
case 2: is_out = READ(FIL_RUNOUT3_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 3
case 3: is_out = READ(FIL_RUNOUT4_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 4
case 4: is_out = READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 5
case 5: is_out = READ(FIL_RUNOUT6_PIN) == FIL_RUNOUT_INVERTING; break;
#endif // > 5
#endif // > 4
#endif // > 3
#endif // > 2
}
#endif
#endif
return (is_out ? ++runout_count : (runout_count = 0)) > FIL_RUNOUT_THRESHOLD;
}
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ void GcodeSuite::G28(const bool always_home_all) {
*/
#if ENABLED(DUAL_X_CARRIAGE)

if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
if (dxc_is_duplicating()) {

// Always home the 2nd (right) extruder first
active_extruder = 1;
Expand All @@ -387,7 +387,10 @@ void GcodeSuite::G28(const bool always_home_all) {
delayed_move_time = 0;
active_extruder_parked = true;
extruder_duplication_enabled = IDEX_saved_duplication_state;
extruder_duplication_enabled = false;

dual_x_carriage_mode = IDEX_saved_mode;
stepper.set_directions();
}

#endif // DUAL_X_CARRIAGE
Expand Down
65 changes: 55 additions & 10 deletions Marlin/src/gcode/control/M605.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
* units x-offset and an optional differential hotend temperature of
* mmm degrees. E.g., with "M605 S2 X100 R2" the second extruder will duplicate
* the first with a spacing of 100mm in the x direction and 2 degrees hotter.
* M605 S3 : Enable Symmetric Duplication mode. The second extruder will duplicate the first extruder's
* M605 S3 : Enable Scaled Duplication mode. The second extruder will duplicate the first extruder's
* movement similar to the M605 S2 mode. However, the second extruder will be producing
* a mirror image of the first extruder. The initial x-offset and temperature differential are
* a scaled image of the first extruder. The initial x-offset and temperature differential are
* set with M605 S2 [Xnnn] [Rmmm] and then followed with a M605 S3 to start the mirrored movement.
* M605 W : IDEX What? command.
*
Expand All @@ -56,7 +56,27 @@
planner.synchronize();

if (parser.seen('S')) {
const DualXMode previous_mode = dual_x_carriage_mode;

dual_x_carriage_mode = (DualXMode)parser.value_byte();
scaled_duplication_mode = false;

if (dual_x_carriage_mode == DXC_SCALED_DUPLICATION_MODE) {
if (previous_mode != DXC_DUPLICATION_MODE) {
SERIAL_ECHOPGM("Printer must be in DXC_DUPLICATION_MODE prior to \n");
SERIAL_ECHOPGM("specifying DXC_SCALED_DUPLICATION_MODE.\n");
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
return;
}
scaled_duplication_mode = true;
stepper.set_directions();
float x_jog = current_position[X_AXIS] - .1;
for (uint8_t i = 2; --i;) {
planner.buffer_line(x_jog, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate_mm_s, 0);
x_jog += .1;
}
return;
}

switch (dual_x_carriage_mode) {
case DXC_FULL_CONTROL_MODE:
Expand All @@ -73,6 +93,7 @@
}
active_extruder_parked = false;
extruder_duplication_enabled = false;
stepper.set_directions();
delayed_move_time = 0;
}
else if (!parser.seen('W')) // if no S or W parameter, the DXC mode gets reset to the user's default
Expand All @@ -82,21 +103,45 @@
SERIAL_ECHO_START();
SERIAL_ECHOPGM("IDEX mode: ");
switch (dual_x_carriage_mode) {
case DXC_FULL_CONTROL_MODE: SERIAL_ECHOPGM("DXC_FULL_CONTROL_MODE"); break;
case DXC_AUTO_PARK_MODE: SERIAL_ECHOPGM("DXC_AUTO_PARK_MODE"); break;
case DXC_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_DUPLICATION_MODE"); break;
case DXC_FULL_CONTROL_MODE: SERIAL_ECHOPGM("DXC_FULL_CONTROL_MODE"); break;
case DXC_AUTO_PARK_MODE: SERIAL_ECHOPGM("DXC_AUTO_PARK_MODE"); break;
case DXC_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_DUPLICATION_MODE"); break;
case DXC_SCALED_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_SCALED_DUPLICATION_MODE"); break;
}
SERIAL_ECHOPAIR("\nActive Ext: ", int(active_extruder));
if (!active_extruder_parked) SERIAL_ECHOPGM(" NOT ");
SERIAL_ECHOLNPGM(" parked.");
SERIAL_ECHOPAIR("active_extruder_x_pos: ", current_position[X_AXIS]);
SERIAL_ECHOPAIR(" inactive_extruder_x_pos: ", inactive_extruder_x_pos);
SERIAL_ECHOPAIR("\nT0 Home X: ", x_home_pos(0));
SERIAL_ECHOPAIR("\nT1 Home X: ", x_home_pos(1));
SERIAL_ECHOPGM(" parked.");
SERIAL_ECHOPAIR("\nactive_extruder_x_pos: ", current_position[X_AXIS]);
SERIAL_ECHOPAIR("\ninactive_extruder_x_pos: ", inactive_extruder_x_pos);
SERIAL_ECHOPAIR("\nextruder_duplication_enabled: ", int(extruder_duplication_enabled));
SERIAL_ECHOPAIR("\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset);
SERIAL_ECHOPAIR("\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset);
SERIAL_ECHOPAIR("\ndelayed_move_time: ", delayed_move_time);
SERIAL_ECHOPAIR("\nX1 Home X: ", x_home_pos(0));
SERIAL_ECHOPAIR("\nX1_MIN_POS=", int(X1_MIN_POS));
SERIAL_ECHOPAIR("\nX1_MAX_POS=", int(X1_MAX_POS));
SERIAL_ECHOPAIR("\nX2 Home X: ", x_home_pos(1));
SERIAL_ECHOPAIR("\nX2_MIN_POS=", int(X2_MIN_POS));
SERIAL_ECHOPAIR("\nX2_MAX_POS=", int(X2_MAX_POS));
SERIAL_ECHOPAIR("\nX2_HOME_DIR=", int(X2_HOME_DIR));
SERIAL_ECHOPAIR("\nX2_HOME_POS=", int(X2_HOME_POS));
SERIAL_ECHOPAIR("\nDEFAULT_DUAL_X_CARRIAGE_MODE=", STRINGIFY(DEFAULT_DUAL_X_CARRIAGE_MODE));
SERIAL_ECHOPAIR("\nTOOLCHANGE_PARK_ZLIFT=", float(TOOLCHANGE_PARK_ZLIFT));
SERIAL_ECHOPAIR("\nTOOLCHANGE_UNPARK_ZLIFT=", float(TOOLCHANGE_UNPARK_ZLIFT));
SERIAL_ECHOPAIR("\nDEFAULT_DUPLICATION_X_OFFSET=", int(DEFAULT_DUPLICATION_X_OFFSET));

SERIAL_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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/leds/M7219.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void GcodeSuite::M7219() {
SERIAL_ECHOPGM("led_line[");
if (r < 10) SERIAL_CHAR(' ');
SERIAL_ECHO(int(r));
SERIAL_ECHO("]=");
SERIAL_ECHOPGM("]=");
for (uint8_t b = 8; b--;) SERIAL_CHAR('0' + TEST(max7219.led_line[r], b));
SERIAL_EOL();
}
Expand Down
Loading