[2.0.x] Followup to IDEX changes (#11707)

This commit is contained in:
Scott Lahteine
2018-09-03 23:15:31 -05:00
committed by GitHub
parent d62f4df0b7
commit d1ceaf5550
13 changed files with 250 additions and 273 deletions

View File

@@ -359,38 +359,36 @@ void GcodeSuite::G28(const bool always_home_all) {
#endif // !DELTA (G28)
/**
*
* This code block allows the DXC mode to survive (and function) across a G28 if it is an IDEX
* machine and the printer is currently in DXC_DUPLICATION_MODE.
* This is important because it lets a user use the LCD Panel to set an IDEX Duplication mode, and
* then print a standard GCode file that contains a single print that does a G28 and has no other
* IDEX specific commands in it.
*
**/
/**
* Preserve DXC mode across a G28 for IDEX printers in DXC_DUPLICATION_MODE.
* This is important because it lets a user use the LCD Panel to set an IDEX Duplication mode, and
* then print a standard GCode file that contains a single print that does a G28 and has no other
* IDEX specific commands in it.
*/
#if ENABLED(DUAL_X_CARRIAGE)
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
// Always home the 2nd (right) extruder first
active_extruder = 1;
homeaxis(X_AXIS);
// Always home the 2nd (right) extruder first
active_extruder = 1;
homeaxis(X_AXIS);
// Remember this extruder's position for later tool change
inactive_extruder_x_pos = current_position[X_AXIS];
// Remember this extruder's position for later tool change
inactive_extruder_x_pos = current_position[X_AXIS];
// Home the 1st (left) extruder
active_extruder = 0;
homeaxis(X_AXIS);
// Home the 1st (left) extruder
active_extruder = 0;
homeaxis(X_AXIS);
// Consider the active extruder to be parked
COPY(raised_parked_position, current_position);
delayed_move_time = 0;
active_extruder_parked = true;
extruder_duplication_enabled = IDEX_saved_duplication_state;
dual_x_carriage_mode = IDEX_saved_mode;
// Consider the active extruder to be parked
COPY(raised_parked_position, current_position);
delayed_move_time = 0;
active_extruder_parked = true;
extruder_duplication_enabled = IDEX_saved_duplication_state;
dual_x_carriage_mode = IDEX_saved_mode;
}
#endif
#endif // DUAL_X_CARRIAGE
endstops.not_homing();

View File

@@ -22,6 +22,8 @@
#include "../../inc/MarlinConfig.h"
#define DEBUG_DXC_MODE
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#include "../gcode.h"
@@ -53,75 +55,48 @@
void GcodeSuite::M605() {
planner.synchronize();
if (parser.seen('S')) {
DualXMode previous_mode, requested_mode = (DualXMode)parser.value_byte();
previous_mode = dual_x_carriage_mode;
if (parser.seen('S')) {
dual_x_carriage_mode = (DualXMode)parser.value_byte();
switch (dual_x_carriage_mode) {
case DXC_FULL_CONTROL_MODE:
case DXC_AUTO_PARK_MODE:
break;
case DXC_DUPLICATION_MODE:
if (parser.seen('X')) duplicate_extruder_x_offset = MAX(parser.value_linear_units(), X2_MIN_POS - x_home_pos(0));
if (parser.seen('R')) duplicate_extruder_temp_offset = parser.value_celsius_diff();
switch (dual_x_carriage_mode) {
case DXC_FULL_CONTROL_MODE:
case DXC_AUTO_PARK_MODE:
break;
case DXC_DUPLICATION_MODE:
if (parser.seen('X')) duplicate_extruder_x_offset = MAX(parser.value_linear_units(), X2_MIN_POS - x_home_pos(0));
if (parser.seen('R')) duplicate_extruder_temp_offset = parser.value_celsius_diff();
if (active_extruder != 0) tool_change(0);
break;
default:
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
break;
break;
default:
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
break;
}
active_extruder_parked = false;
extruder_duplication_enabled = false;
delayed_move_time = 0;
}
active_extruder_parked = false;
extruder_duplication_enabled = false;
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
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
else if (!parser.seen('W')) // if no S or W parameter, the DXC mode gets reset to the user's default
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
if (parser.seen('W')) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("IDEX mode: ");
switch (dual_x_carriage_mode) {
case DXC_FULL_CONTROL_MODE:
SERIAL_ECHOPGM("DXC_FULL_CONTROL_MODE\n");
break;
case DXC_AUTO_PARK_MODE:
SERIAL_ECHOPGM("DXC_AUTO_PARK_MODE\n");
break;
case DXC_DUPLICATION_MODE:
SERIAL_ECHOPGM("DXC_DUPLICATION_MODE\n");
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;
}
SERIAL_ECHOPGM("Active Ext: ");
SERIAL_ECHO((int) active_extruder);
if (active_extruder_parked == false)
SERIAL_ECHOPGM(" NOT ");
SERIAL_ECHOPGM(" parked.\n");
SERIAL_ECHOPGM("active_extruder_x_pos: ");
SERIAL_ECHO( current_position[X_AXIS]);
SERIAL_ECHOPGM(" inactive_extruder_x_pos: ");
SERIAL_ECHO( inactive_extruder_x_pos);
SERIAL_ECHOPGM("\n1st extruder x_home_pos(): ");
SERIAL_ECHO(x_home_pos(0));
SERIAL_ECHOPGM("\n2nd extruder x_home_pos(): ");
SERIAL_ECHO(x_home_pos(1));
SERIAL_ECHOPGM("\nextruder_duplication_enabled: ");
SERIAL_ECHO(extruder_duplication_enabled);
SERIAL_ECHOPGM("\nduplicate_extruder_x_offset: ");
SERIAL_ECHO(duplicate_extruder_x_offset);
SERIAL_ECHOPGM("\nduplicate_extruder_temp_offset: ");
SERIAL_ECHO(duplicate_extruder_temp_offset);
SERIAL_ECHOPGM("\ndelayed_move_time: ");
SERIAL_ECHO(delayed_move_time);
SERIAL_ECHOPGM("\n");
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_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);
}
}

View File

@@ -139,15 +139,14 @@ inline bool _enqueuecommand(const char* cmd, bool say_ok=false
*/
bool enqueue_and_echo_command(const char* cmd) {
//SERIAL_ECHO("enqueue_and_echo_command(\"");
//SERIAL_ECHO(cmd);
//SERIAL_ECHO("\") \n");
//
if ( *cmd == 0 || *cmd == '\n' || *cmd == 'r')
//{
//SERIAL_ECHO("Null command found... Did not queue!\n");
//SERIAL_ECHO("enqueue_and_echo_command(\"");
//SERIAL_ECHO(cmd);
//SERIAL_ECHO("\") \n");
if (*cmd == 0 || *cmd == '\n' || *cmd == 'r') {
//SERIAL_ECHO("Null command found... Did not queue!\n");
return true;
//}
}
if (_enqueuecommand(cmd)) {
SERIAL_ECHO_START();