Fix IDEX layer shift and DIR states (#19756)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
nb-rapidia
2020-10-16 14:59:55 -07:00
committed by GitHub
parent aa901ac4a2
commit 418b3e5ee2
15 changed files with 152 additions and 132 deletions

View File

@ -110,9 +110,8 @@ void GcodeSuite::G35() {
tool_change(0, true);
#endif
#if HAS_DUPLICATION_MODE
extruder_duplication_enabled = false;
#endif
// Disable duplication mode on homing
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
// Home all before this procedure
home_all_axes();

View File

@ -134,8 +134,8 @@
if (DEBUGGING(LEVELING)) DEBUG_POS("home_z_safely", destination);
// This causes the carriage on Dual X to unpark
TERN_(DUAL_X_CARRIAGE, active_extruder_parked = false);
// Free the active extruder for movement
TERN_(DUAL_X_CARRIAGE, idex_set_parked(false));
TERN_(SENSORLESS_HOMING, safe_delay(500)); // Short delay needed to settle
@ -282,7 +282,7 @@ void GcodeSuite::G28() {
tool_change(0, true);
#endif
TERN_(HAS_DUPLICATION_MODE, extruder_duplication_enabled = false);
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
remember_feedrate_scaling_off();
@ -342,16 +342,14 @@ void GcodeSuite::G28() {
homeaxis(X_AXIS);
// Remember this extruder's position for later tool change
inactive_extruder_x_pos = current_position.x;
inactive_extruder_x = current_position.x;
// Home the 1st (left) extruder
active_extruder = 0;
homeaxis(X_AXIS);
// Consider the active extruder to be parked
raised_parked_position = current_position;
delayed_move_time = 0;
active_extruder_parked = true;
// Consider the active extruder to be in its "parked" position
idex_set_parked();
#else
@ -392,7 +390,7 @@ void GcodeSuite::G28() {
*/
#if ENABLED(DUAL_X_CARRIAGE)
if (dxc_is_duplicating()) {
if (idex_is_duplicating()) {
TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing = begin_slow_homing());
@ -401,19 +399,17 @@ void GcodeSuite::G28() {
homeaxis(X_AXIS);
// Remember this extruder's position for later tool change
inactive_extruder_x_pos = current_position.x;
inactive_extruder_x = current_position.x;
// Home the 1st (left) extruder
active_extruder = 0;
homeaxis(X_AXIS);
// Consider the active extruder to be parked
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;
stepper.set_directions();
idex_set_parked();
dual_x_carriage_mode = IDEX_saved_mode;
set_duplication_enabled(IDEX_saved_duplication_state);
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
}

View File

@ -113,7 +113,7 @@ void GcodeSuite::G34() {
tool_change(0, true);
#endif
TERN_(HAS_DUPLICATION_MODE, extruder_duplication_enabled = false);
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
// In BLTOUCH HS mode, the probe travels in a deployed state.
// Users of G34 might have a badly misaligned bed, so raise Z by the

View File

@ -68,7 +68,7 @@
const DualXMode previous_mode = dual_x_carriage_mode;
dual_x_carriage_mode = (DualXMode)parser.value_byte();
mirrored_duplication_mode = false;
idex_set_mirrored_mode(false);
if (dual_x_carriage_mode == DXC_MIRRORED_MODE) {
if (previous_mode != DXC_DUPLICATION_MODE) {
@ -77,8 +77,7 @@
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
return;
}
mirrored_duplication_mode = true;
stepper.set_directions();
idex_set_mirrored_mode(true);
float x_jog = current_position.x - .1;
for (uint8_t i = 2; --i;) {
planner.buffer_line(x_jog, current_position.y, current_position.z, current_position.e, feedrate_mm_s, 0);
@ -102,10 +101,8 @@
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
break;
}
active_extruder_parked = false;
extruder_duplication_enabled = false;
stepper.set_directions();
delayed_move_time = 0;
idex_set_parked(false);
set_duplication_enabled(false);
}
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;
@ -125,7 +122,7 @@
if (!active_extruder_parked) DEBUG_ECHOPGM(" NOT ");
DEBUG_ECHOPGM(" parked.");
DEBUG_ECHOPAIR("\nactive_extruder_x_pos: ", current_position.x);
DEBUG_ECHOPAIR("\ninactive_extruder_x_pos: ", inactive_extruder_x_pos);
DEBUG_ECHOPAIR("\ninactive_extruder_x: ", inactive_extruder_x);
DEBUG_ECHOPAIR("\nextruder_duplication_enabled: ", int(extruder_duplication_enabled));
DEBUG_ECHOPAIR("\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset);
DEBUG_ECHOPAIR("\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset);
@ -166,7 +163,7 @@
if (parser.seenval('P')) duplication_e_mask = parser.value_int(); // Set the mask directly
else if (parser.seenval('E')) duplication_e_mask = pow(2, parser.value_int() + 1) - 1; // Set the mask by E index
ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0));
extruder_duplication_enabled = ena && (duplication_e_mask >= 3);
set_duplication_enabled(ena && (duplication_e_mask >= 3));
}
SERIAL_ECHO_START();
SERIAL_ECHOPGM(STR_DUPLICATION_MODE);

View File

@ -87,7 +87,7 @@ void GcodeSuite::M600() {
if (!parser.seen('T')) { // If no tool index is specified, M600 was (probably) sent in response to filament runout.
// In this case, for duplicating modes set DXC_ext to the extruder that ran out.
#if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1
if (dxc_is_duplicating())
if (idex_is_duplicating())
DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_STATE) ? 1 : 0;
#else
DXC_ext = active_extruder;
@ -108,7 +108,7 @@ void GcodeSuite::M600() {
#if HAS_MULTI_EXTRUDER
// Change toolhead if specified
const uint8_t active_extruder_before_filament_change = active_extruder;
if (active_extruder != target_extruder && TERN1(DUAL_X_CARRIAGE, !dxc_is_duplicating()))
if (active_extruder != target_extruder && TERN1(DUAL_X_CARRIAGE, !idex_is_duplicating()))
tool_change(target_extruder, false);
#endif

View File

@ -94,7 +94,7 @@ void GcodeSuite::M104() {
thermalManager.setTargetHotend(temp, target_extruder);
#if ENABLED(DUAL_X_CARRIAGE)
if (dxc_is_duplicating() && target_extruder == 0)
if (idex_is_duplicating() && target_extruder == 0)
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
#endif
@ -172,7 +172,7 @@ void GcodeSuite::M109() {
thermalManager.setTargetHotend(temp, target_extruder);
#if ENABLED(DUAL_X_CARRIAGE)
if (dxc_is_duplicating() && target_extruder == 0)
if (idex_is_duplicating() && target_extruder == 0)
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
#endif