|
@@ -226,21 +226,21 @@ float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
|
226
|
226
|
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
|
227
|
227
|
bool axis_known_position[3] = { false };
|
228
|
228
|
|
229
|
|
-// Extruder offset
|
|
229
|
+// Extruder offsets
|
230
|
230
|
#if EXTRUDERS > 1
|
231
|
231
|
#ifndef EXTRUDER_OFFSET_X
|
232
|
|
- #define EXTRUDER_OFFSET_X 0
|
|
232
|
+ #define EXTRUDER_OFFSET_X { 0 }
|
233
|
233
|
#endif
|
234
|
234
|
#ifndef EXTRUDER_OFFSET_Y
|
235
|
|
- #define EXTRUDER_OFFSET_Y 0
|
|
235
|
+ #define EXTRUDER_OFFSET_Y { 0 }
|
236
|
236
|
#endif
|
237
|
|
- #ifndef DUAL_X_CARRIAGE
|
238
|
|
- #define NUM_EXTRUDER_OFFSETS 2 // only in XY plane
|
239
|
|
- #else
|
240
|
|
- #define NUM_EXTRUDER_OFFSETS 3 // supports offsets in XYZ plane
|
241
|
|
- #endif
|
242
|
|
- #define _EXY { EXTRUDER_OFFSET_X, EXTRUDER_OFFSET_Y }
|
243
|
|
- float extruder_offset[EXTRUDERS][NUM_EXTRUDER_OFFSETS] = ARRAY_BY_EXTRUDERS(_EXY, _EXY, _EXY, _EXY);
|
|
237
|
+ float extruder_offset[][EXTRUDERS] = {
|
|
238
|
+ EXTRUDER_OFFSET_X,
|
|
239
|
+ EXTRUDER_OFFSET_Y
|
|
240
|
+ #ifdef DUAL_X_CARRIAGE
|
|
241
|
+ , { 0 } // supports offsets in XYZ plane
|
|
242
|
+ #endif
|
|
243
|
+ };
|
244
|
244
|
#endif
|
245
|
245
|
|
246
|
246
|
uint8_t active_extruder = 0;
|
|
@@ -935,7 +935,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
|
935
|
935
|
// second X-carriage offset when homed - otherwise X2_HOME_POS is used.
|
936
|
936
|
// This allow soft recalibration of the second extruder offset position without firmware reflash
|
937
|
937
|
// (through the M218 command).
|
938
|
|
- return (extruder_offset[1][X_AXIS] > 0) ? extruder_offset[1][X_AXIS] : X2_HOME_POS;
|
|
938
|
+ return (extruder_offset[X_AXIS][1] > 0) ? extruder_offset[X_AXIS][1] : X2_HOME_POS;
|
939
|
939
|
}
|
940
|
940
|
|
941
|
941
|
static int x_home_dir(int extruder) {
|
|
@@ -959,14 +959,14 @@ static void axis_is_at_home(int axis) {
|
959
|
959
|
if (active_extruder != 0) {
|
960
|
960
|
current_position[X_AXIS] = x_home_pos(active_extruder);
|
961
|
961
|
min_pos[X_AXIS] = X2_MIN_POS;
|
962
|
|
- max_pos[X_AXIS] = max(extruder_offset[1][X_AXIS], X2_MAX_POS);
|
|
962
|
+ max_pos[X_AXIS] = max(extruder_offset[X_AXIS][1], X2_MAX_POS);
|
963
|
963
|
return;
|
964
|
964
|
}
|
965
|
965
|
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
|
966
|
966
|
float xoff = home_offset[X_AXIS];
|
967
|
967
|
current_position[X_AXIS] = base_home_pos(X_AXIS) + xoff;
|
968
|
968
|
min_pos[X_AXIS] = base_min_pos(X_AXIS) + xoff;
|
969
|
|
- max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + xoff, max(extruder_offset[1][X_AXIS], X2_MAX_POS) - duplicate_extruder_x_offset);
|
|
969
|
+ max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + xoff, max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
|
970
|
970
|
return;
|
971
|
971
|
}
|
972
|
972
|
}
|
|
@@ -3780,23 +3780,23 @@ inline void gcode_M206() {
|
3780
|
3780
|
inline void gcode_M218() {
|
3781
|
3781
|
if (setTargetedHotend(218)) return;
|
3782
|
3782
|
|
3783
|
|
- if (code_seen('X')) extruder_offset[tmp_extruder][X_AXIS] = code_value();
|
3784
|
|
- if (code_seen('Y')) extruder_offset[tmp_extruder][Y_AXIS] = code_value();
|
|
3783
|
+ if (code_seen('X')) extruder_offset[X_AXIS][tmp_extruder] = code_value();
|
|
3784
|
+ if (code_seen('Y')) extruder_offset[Y_AXIS][tmp_extruder] = code_value();
|
3785
|
3785
|
|
3786
|
3786
|
#ifdef DUAL_X_CARRIAGE
|
3787
|
|
- if (code_seen('Z')) extruder_offset[tmp_extruder][Z_AXIS] = code_value();
|
|
3787
|
+ if (code_seen('Z')) extruder_offset[Z_AXIS][tmp_extruder] = code_value();
|
3788
|
3788
|
#endif
|
3789
|
3789
|
|
3790
|
3790
|
SERIAL_ECHO_START;
|
3791
|
3791
|
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
3792
|
3792
|
for (tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++) {
|
3793
|
3793
|
SERIAL_ECHO(" ");
|
3794
|
|
- SERIAL_ECHO(extruder_offset[tmp_extruder][X_AXIS]);
|
|
3794
|
+ SERIAL_ECHO(extruder_offset[X_AXIS][tmp_extruder]);
|
3795
|
3795
|
SERIAL_ECHO(",");
|
3796
|
|
- SERIAL_ECHO(extruder_offset[tmp_extruder][Y_AXIS]);
|
|
3796
|
+ SERIAL_ECHO(extruder_offset[Y_AXIS][tmp_extruder]);
|
3797
|
3797
|
#ifdef DUAL_X_CARRIAGE
|
3798
|
3798
|
SERIAL_ECHO(",");
|
3799
|
|
- SERIAL_ECHO(extruder_offset[tmp_extruder][Z_AXIS]);
|
|
3799
|
+ SERIAL_ECHO(extruder_offset[Z_AXIS][tmp_extruder]);
|
3800
|
3800
|
#endif
|
3801
|
3801
|
}
|
3802
|
3802
|
SERIAL_EOL;
|
|
@@ -4487,13 +4487,13 @@ inline void gcode_M503() {
|
4487
|
4487
|
SERIAL_ECHO_START;
|
4488
|
4488
|
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
4489
|
4489
|
SERIAL_ECHO(" ");
|
4490
|
|
- SERIAL_ECHO(extruder_offset[0][X_AXIS]);
|
|
4490
|
+ SERIAL_ECHO(extruder_offset[X_AXIS][0]);
|
4491
|
4491
|
SERIAL_ECHO(",");
|
4492
|
|
- SERIAL_ECHO(extruder_offset[0][Y_AXIS]);
|
|
4492
|
+ SERIAL_ECHO(extruder_offset[Y_AXIS][0]);
|
4493
|
4493
|
SERIAL_ECHO(" ");
|
4494
|
4494
|
SERIAL_ECHO(duplicate_extruder_x_offset);
|
4495
|
4495
|
SERIAL_ECHO(",");
|
4496
|
|
- SERIAL_ECHOLN(extruder_offset[1][Y_AXIS]);
|
|
4496
|
+ SERIAL_ECHOLN(extruder_offset[Y_AXIS][1]);
|
4497
|
4497
|
break;
|
4498
|
4498
|
case DXC_FULL_CONTROL_MODE:
|
4499
|
4499
|
case DXC_AUTO_PARK_MODE:
|
|
@@ -4628,11 +4628,11 @@ inline void gcode_T() {
|
4628
|
4628
|
|
4629
|
4629
|
// apply Y & Z extruder offset (x offset is already used in determining home pos)
|
4630
|
4630
|
current_position[Y_AXIS] = current_position[Y_AXIS] -
|
4631
|
|
- extruder_offset[active_extruder][Y_AXIS] +
|
4632
|
|
- extruder_offset[tmp_extruder][Y_AXIS];
|
|
4631
|
+ extruder_offset[Y_AXIS][active_extruder] +
|
|
4632
|
+ extruder_offset[Y_AXIS][tmp_extruder];
|
4633
|
4633
|
current_position[Z_AXIS] = current_position[Z_AXIS] -
|
4634
|
|
- extruder_offset[active_extruder][Z_AXIS] +
|
4635
|
|
- extruder_offset[tmp_extruder][Z_AXIS];
|
|
4634
|
+ extruder_offset[Z_AXIS][active_extruder] +
|
|
4635
|
+ extruder_offset[Z_AXIS][tmp_extruder];
|
4636
|
4636
|
|
4637
|
4637
|
active_extruder = tmp_extruder;
|
4638
|
4638
|
|
|
@@ -4662,7 +4662,7 @@ inline void gcode_T() {
|
4662
|
4662
|
#else // !DUAL_X_CARRIAGE
|
4663
|
4663
|
// Offset extruder (only by XY)
|
4664
|
4664
|
for (int i=X_AXIS; i<=Y_AXIS; i++)
|
4665
|
|
- current_position[i] += extruder_offset[tmp_extruder][i] - extruder_offset[active_extruder][i];
|
|
4665
|
+ current_position[i] += extruder_offset[i][tmp_extruder] - extruder_offset[i][active_extruder];
|
4666
|
4666
|
// Set the new active extruder and position
|
4667
|
4667
|
active_extruder = tmp_extruder;
|
4668
|
4668
|
#endif // !DUAL_X_CARRIAGE
|