|
@@ -211,72 +211,37 @@ bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
|
211
|
211
|
int feedmultiply = 100; //100->1 200->2
|
212
|
212
|
int saved_feedmultiply;
|
213
|
213
|
int extrudemultiply = 100; //100->1 200->2
|
214
|
|
-int extruder_multiply[EXTRUDERS] = { 100
|
215
|
|
- #if EXTRUDERS > 1
|
216
|
|
- , 100
|
217
|
|
- #if EXTRUDERS > 2
|
218
|
|
- , 100
|
219
|
|
- #if EXTRUDERS > 3
|
220
|
|
- , 100
|
221
|
|
- #endif
|
222
|
|
- #endif
|
223
|
|
- #endif
|
224
|
|
-};
|
|
214
|
+int extruder_multiply[EXTRUDERS] = ARRAY_BY_EXTRUDERS(100, 100, 100, 100);
|
225
|
215
|
bool volumetric_enabled = false;
|
226
|
|
-float filament_size[EXTRUDERS] = { DEFAULT_NOMINAL_FILAMENT_DIA
|
227
|
|
- #if EXTRUDERS > 1
|
228
|
|
- , DEFAULT_NOMINAL_FILAMENT_DIA
|
229
|
|
- #if EXTRUDERS > 2
|
230
|
|
- , DEFAULT_NOMINAL_FILAMENT_DIA
|
231
|
|
- #if EXTRUDERS > 3
|
232
|
|
- , DEFAULT_NOMINAL_FILAMENT_DIA
|
233
|
|
- #endif
|
234
|
|
- #endif
|
235
|
|
- #endif
|
236
|
|
-};
|
237
|
|
-float volumetric_multiplier[EXTRUDERS] = {1.0
|
238
|
|
- #if EXTRUDERS > 1
|
239
|
|
- , 1.0
|
240
|
|
- #if EXTRUDERS > 2
|
241
|
|
- , 1.0
|
242
|
|
- #if EXTRUDERS > 3
|
243
|
|
- , 1.0
|
244
|
|
- #endif
|
245
|
|
- #endif
|
246
|
|
- #endif
|
247
|
|
-};
|
248
|
|
-float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
|
249
|
|
-float home_offset[3] = { 0, 0, 0 };
|
|
216
|
+float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA);
|
|
217
|
+float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS(1.0, 1.0, 1.0, 1.0);
|
|
218
|
+float current_position[NUM_AXIS] = { 0.0 };
|
|
219
|
+float home_offset[3] = { 0 };
|
250
|
220
|
#ifdef DELTA
|
251
|
|
- float endstop_adj[3] = { 0, 0, 0 };
|
|
221
|
+ float endstop_adj[3] = { 0 };
|
252
|
222
|
#elif defined(Z_DUAL_ENDSTOPS)
|
253
|
223
|
float z_endstop_adj = 0;
|
254
|
224
|
#endif
|
255
|
225
|
|
256
|
226
|
float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
|
257
|
227
|
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
|
258
|
|
-bool axis_known_position[3] = { false, false, false };
|
|
228
|
+bool axis_known_position[3] = { false };
|
259
|
229
|
|
260
|
230
|
// Extruder offset
|
261
|
231
|
#if EXTRUDERS > 1
|
262
|
|
-#ifndef DUAL_X_CARRIAGE
|
263
|
|
- #define NUM_EXTRUDER_OFFSETS 2 // only in XY plane
|
264
|
|
-#else
|
265
|
|
- #define NUM_EXTRUDER_OFFSETS 3 // supports offsets in XYZ plane
|
266
|
|
-#endif
|
267
|
|
-float extruder_offset[NUM_EXTRUDER_OFFSETS][EXTRUDERS] = {
|
268
|
|
- #if defined(EXTRUDER_OFFSET_X)
|
269
|
|
- EXTRUDER_OFFSET_X
|
270
|
|
- #else
|
271
|
|
- 0
|
|
232
|
+ #ifndef EXTRUDER_OFFSET_X
|
|
233
|
+ #define EXTRUDER_OFFSET_X 0
|
272
|
234
|
#endif
|
273
|
|
- ,
|
274
|
|
- #if defined(EXTRUDER_OFFSET_Y)
|
275
|
|
- EXTRUDER_OFFSET_Y
|
|
235
|
+ #ifndef EXTRUDER_OFFSET_Y
|
|
236
|
+ #define EXTRUDER_OFFSET_Y 0
|
|
237
|
+ #endif
|
|
238
|
+ #ifndef DUAL_X_CARRIAGE
|
|
239
|
+ #define NUM_EXTRUDER_OFFSETS 2 // only in XY plane
|
276
|
240
|
#else
|
277
|
|
- 0
|
|
241
|
+ #define NUM_EXTRUDER_OFFSETS 3 // supports offsets in XYZ plane
|
278
|
242
|
#endif
|
279
|
|
-};
|
|
243
|
+ #define _EXY { EXTRUDER_OFFSET_X, EXTRUDER_OFFSET_Y }
|
|
244
|
+ float extruder_offset[EXTRUDERS][NUM_EXTRUDER_OFFSETS] = ARRAY_BY_EXTRUDERS(_EXY, _EXY, _EXY, _EXY);
|
280
|
245
|
#endif
|
281
|
246
|
|
282
|
247
|
uint8_t active_extruder = 0;
|
|
@@ -295,28 +260,8 @@ int fanSpeed = 0;
|
295
|
260
|
#ifdef FWRETRACT
|
296
|
261
|
|
297
|
262
|
bool autoretract_enabled = false;
|
298
|
|
- bool retracted[EXTRUDERS] = { false
|
299
|
|
- #if EXTRUDERS > 1
|
300
|
|
- , false
|
301
|
|
- #if EXTRUDERS > 2
|
302
|
|
- , false
|
303
|
|
- #if EXTRUDERS > 3
|
304
|
|
- , false
|
305
|
|
- #endif
|
306
|
|
- #endif
|
307
|
|
- #endif
|
308
|
|
- };
|
309
|
|
- bool retracted_swap[EXTRUDERS] = { false
|
310
|
|
- #if EXTRUDERS > 1
|
311
|
|
- , false
|
312
|
|
- #if EXTRUDERS > 2
|
313
|
|
- , false
|
314
|
|
- #if EXTRUDERS > 3
|
315
|
|
- , false
|
316
|
|
- #endif
|
317
|
|
- #endif
|
318
|
|
- #endif
|
319
|
|
- };
|
|
263
|
+ bool retracted[EXTRUDERS] = { false };
|
|
264
|
+ bool retracted_swap[EXTRUDERS] = { false };
|
320
|
265
|
|
321
|
266
|
float retract_length = RETRACT_LENGTH;
|
322
|
267
|
float retract_length_swap = RETRACT_LENGTH_SWAP;
|
|
@@ -385,9 +330,9 @@ const char errormagic[] PROGMEM = "Error:";
|
385
|
330
|
const char echomagic[] PROGMEM = "echo:";
|
386
|
331
|
|
387
|
332
|
const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
|
388
|
|
-static float destination[NUM_AXIS] = { 0, 0, 0, 0 };
|
|
333
|
+static float destination[NUM_AXIS] = { 0 };
|
389
|
334
|
|
390
|
|
-static float offset[3] = { 0, 0, 0 };
|
|
335
|
+static float offset[3] = { 0 };
|
391
|
336
|
|
392
|
337
|
#ifndef DELTA
|
393
|
338
|
static bool home_all_axis = true;
|
|
@@ -993,7 +938,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
|
993
|
938
|
// second X-carriage offset when homed - otherwise X2_HOME_POS is used.
|
994
|
939
|
// This allow soft recalibration of the second extruder offset position without firmware reflash
|
995
|
940
|
// (through the M218 command).
|
996
|
|
- return (extruder_offset[X_AXIS][1] > 0) ? extruder_offset[X_AXIS][1] : X2_HOME_POS;
|
|
941
|
+ return (extruder_offset[1][X_AXIS] > 0) ? extruder_offset[1][X_AXIS] : X2_HOME_POS;
|
997
|
942
|
}
|
998
|
943
|
|
999
|
944
|
static int x_home_dir(int extruder) {
|
|
@@ -1017,14 +962,14 @@ static void axis_is_at_home(int axis) {
|
1017
|
962
|
if (active_extruder != 0) {
|
1018
|
963
|
current_position[X_AXIS] = x_home_pos(active_extruder);
|
1019
|
964
|
min_pos[X_AXIS] = X2_MIN_POS;
|
1020
|
|
- max_pos[X_AXIS] = max(extruder_offset[X_AXIS][1], X2_MAX_POS);
|
|
965
|
+ max_pos[X_AXIS] = max(extruder_offset[1][X_AXIS], X2_MAX_POS);
|
1021
|
966
|
return;
|
1022
|
967
|
}
|
1023
|
968
|
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
|
1024
|
969
|
current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS];
|
1025
|
970
|
min_pos[X_AXIS] = base_min_pos(X_AXIS) + home_offset[X_AXIS];
|
1026
|
971
|
max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + home_offset[X_AXIS],
|
1027
|
|
- max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
|
|
972
|
+ max(extruder_offset[1][X_AXIS], X2_MAX_POS) - duplicate_extruder_x_offset);
|
1028
|
973
|
return;
|
1029
|
974
|
}
|
1030
|
975
|
}
|
|
@@ -1077,12 +1022,18 @@ static void axis_is_at_home(int axis) {
|
1077
|
1022
|
#endif
|
1078
|
1023
|
}
|
1079
|
1024
|
|
|
1025
|
+/**
|
|
1026
|
+ * Shorthand to tell the planner our current position (in mm).
|
|
1027
|
+ */
|
|
1028
|
+inline void sync_plan_position() {
|
|
1029
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1030
|
+}
|
|
1031
|
+
|
1080
|
1032
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
1081
|
1033
|
#ifdef AUTO_BED_LEVELING_GRID
|
1082
|
1034
|
|
1083
|
1035
|
#ifndef DELTA
|
1084
|
|
-static void set_bed_level_equation_lsq(double *plane_equation_coefficients)
|
1085
|
|
-{
|
|
1036
|
+ static void set_bed_level_equation_lsq(double *plane_equation_coefficients) {
|
1086
|
1037
|
vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
1087
|
1038
|
planeNormal.debug("planeNormal");
|
1088
|
1039
|
plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
@@ -1093,13 +1044,13 @@ static void set_bed_level_equation_lsq(double *plane_equation_coefficients)
|
1093
|
1044
|
//uncorrected_position.debug("position before");
|
1094
|
1045
|
|
1095
|
1046
|
vector_3 corrected_position = plan_get_position();
|
1096
|
|
-// corrected_position.debug("position after");
|
|
1047
|
+ //corrected_position.debug("position after");
|
1097
|
1048
|
current_position[X_AXIS] = corrected_position.x;
|
1098
|
1049
|
current_position[Y_AXIS] = corrected_position.y;
|
1099
|
|
- current_position[Z_AXIS] = corrected_position.z;
|
|
1050
|
+ current_position[Z_AXIS] = zprobe_zoffset; // was: corrected_position.z
|
1100
|
1051
|
|
1101
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1102
|
|
-}
|
|
1052
|
+ sync_plan_position();
|
|
1053
|
+ }
|
1103
|
1054
|
#endif
|
1104
|
1055
|
|
1105
|
1056
|
#else // not AUTO_BED_LEVELING_GRID
|
|
@@ -1124,9 +1075,9 @@ static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float
|
1124
|
1075
|
vector_3 corrected_position = plan_get_position();
|
1125
|
1076
|
current_position[X_AXIS] = corrected_position.x;
|
1126
|
1077
|
current_position[Y_AXIS] = corrected_position.y;
|
1127
|
|
- current_position[Z_AXIS] = corrected_position.z;
|
|
1078
|
+ current_position[Z_AXIS] = zprobe_zoffset; // was: corrected_position.z
|
1128
|
1079
|
|
1129
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1080
|
+ sync_plan_position();
|
1130
|
1081
|
}
|
1131
|
1082
|
|
1132
|
1083
|
#endif // AUTO_BED_LEVELING_GRID
|
|
@@ -1172,18 +1123,14 @@ static void run_z_probe() {
|
1172
|
1123
|
endstops_hit_on_purpose();
|
1173
|
1124
|
|
1174
|
1125
|
// move back down slowly to find bed
|
1175
|
|
-
|
1176
|
|
- if (homing_bump_divisor[Z_AXIS] >= 1)
|
1177
|
|
- {
|
1178
|
|
- feedrate = homing_feedrate[Z_AXIS]/homing_bump_divisor[Z_AXIS];
|
|
1126
|
+ if (homing_bump_divisor[Z_AXIS] >= 1) {
|
|
1127
|
+ feedrate = homing_feedrate[Z_AXIS]/homing_bump_divisor[Z_AXIS];
|
1179
|
1128
|
}
|
1180
|
|
- else
|
1181
|
|
- {
|
1182
|
|
- feedrate = homing_feedrate[Z_AXIS]/10;
|
1183
|
|
- SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less then 1");
|
|
1129
|
+ else {
|
|
1130
|
+ feedrate = homing_feedrate[Z_AXIS]/10;
|
|
1131
|
+ SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less then 1");
|
1184
|
1132
|
}
|
1185
|
1133
|
|
1186
|
|
-
|
1187
|
1134
|
zPosition -= home_retract_mm(Z_AXIS) * 2;
|
1188
|
1135
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
|
1189
|
1136
|
st_synchronize();
|
|
@@ -1191,7 +1138,7 @@ static void run_z_probe() {
|
1191
|
1138
|
|
1192
|
1139
|
current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
|
1193
|
1140
|
// make sure the planner knows where we are as it may be a bit different than we last said to move to
|
1194
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1141
|
+ sync_plan_position();
|
1195
|
1142
|
|
1196
|
1143
|
#endif
|
1197
|
1144
|
}
|
|
@@ -1471,7 +1418,7 @@ static void homeaxis(int axis) {
|
1471
|
1418
|
#endif
|
1472
|
1419
|
|
1473
|
1420
|
current_position[axis] = 0;
|
1474
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1421
|
+ sync_plan_position();
|
1475
|
1422
|
|
1476
|
1423
|
|
1477
|
1424
|
#ifndef Z_PROBE_SLED
|
|
@@ -1497,7 +1444,7 @@ static void homeaxis(int axis) {
|
1497
|
1444
|
st_synchronize();
|
1498
|
1445
|
|
1499
|
1446
|
current_position[axis] = 0;
|
1500
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1447
|
+ sync_plan_position();
|
1501
|
1448
|
destination[axis] = -home_retract_mm(axis) * axis_home_dir;
|
1502
|
1449
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
1503
|
1450
|
st_synchronize();
|
|
@@ -1520,7 +1467,7 @@ static void homeaxis(int axis) {
|
1520
|
1467
|
if (axis==Z_AXIS)
|
1521
|
1468
|
{
|
1522
|
1469
|
feedrate = homing_feedrate[axis];
|
1523
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1470
|
+ sync_plan_position();
|
1524
|
1471
|
if (axis_home_dir > 0)
|
1525
|
1472
|
{
|
1526
|
1473
|
destination[axis] = (-1) * fabs(z_endstop_adj);
|
|
@@ -1540,7 +1487,7 @@ static void homeaxis(int axis) {
|
1540
|
1487
|
#ifdef DELTA
|
1541
|
1488
|
// retrace by the amount specified in endstop_adj
|
1542
|
1489
|
if (endstop_adj[axis] * axis_home_dir < 0) {
|
1543
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1490
|
+ sync_plan_position();
|
1544
|
1491
|
destination[axis] = endstop_adj[axis];
|
1545
|
1492
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
1546
|
1493
|
st_synchronize();
|
|
@@ -1596,7 +1543,7 @@ void refresh_cmd_timeout(void)
|
1596
|
1543
|
calculate_delta(current_position); // change cartesian kinematic to delta kinematic;
|
1597
|
1544
|
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
|
1598
|
1545
|
#else
|
1599
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1546
|
+ sync_plan_position();
|
1600
|
1547
|
#endif
|
1601
|
1548
|
prepare_move();
|
1602
|
1549
|
}
|
|
@@ -1612,7 +1559,7 @@ void refresh_cmd_timeout(void)
|
1612
|
1559
|
calculate_delta(current_position); // change cartesian kinematic to delta kinematic;
|
1613
|
1560
|
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
|
1614
|
1561
|
#else
|
1615
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1562
|
+ sync_plan_position();
|
1616
|
1563
|
#endif
|
1617
|
1564
|
//prepare_move();
|
1618
|
1565
|
}
|
|
@@ -1789,7 +1736,7 @@ inline void gcode_G28() {
|
1789
|
1736
|
|
1790
|
1737
|
// Move all carriages up together until the first endstop is hit.
|
1791
|
1738
|
for (int i = X_AXIS; i <= Z_AXIS; i++) current_position[i] = 0;
|
1792
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1739
|
+ sync_plan_position();
|
1793
|
1740
|
|
1794
|
1741
|
for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * Z_MAX_LENGTH;
|
1795
|
1742
|
feedrate = 1.732 * homing_feedrate[X_AXIS];
|
|
@@ -1829,7 +1776,7 @@ inline void gcode_G28() {
|
1829
|
1776
|
extruder_duplication_enabled = false;
|
1830
|
1777
|
#endif
|
1831
|
1778
|
|
1832
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1779
|
+ sync_plan_position();
|
1833
|
1780
|
destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir;
|
1834
|
1781
|
destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS);
|
1835
|
1782
|
feedrate = homing_feedrate[X_AXIS];
|
|
@@ -1844,7 +1791,7 @@ inline void gcode_G28() {
|
1844
|
1791
|
|
1845
|
1792
|
axis_is_at_home(X_AXIS);
|
1846
|
1793
|
axis_is_at_home(Y_AXIS);
|
1847
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1794
|
+ sync_plan_position();
|
1848
|
1795
|
destination[X_AXIS] = current_position[X_AXIS];
|
1849
|
1796
|
destination[Y_AXIS] = current_position[Y_AXIS];
|
1850
|
1797
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
@@ -1921,7 +1868,7 @@ inline void gcode_G28() {
|
1921
|
1868
|
feedrate = XY_TRAVEL_SPEED / 60;
|
1922
|
1869
|
current_position[Z_AXIS] = 0;
|
1923
|
1870
|
|
1924
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1871
|
+ sync_plan_position();
|
1925
|
1872
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
1926
|
1873
|
st_synchronize();
|
1927
|
1874
|
current_position[X_AXIS] = destination[X_AXIS];
|
|
@@ -1973,7 +1920,7 @@ inline void gcode_G28() {
|
1973
|
1920
|
if (home_all_axis || code_seen(axis_codes[Z_AXIS]))
|
1974
|
1921
|
current_position[Z_AXIS] += zprobe_zoffset; //Add Z_Probe offset (the distance is negative)
|
1975
|
1922
|
#endif
|
1976
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1923
|
+ sync_plan_position();
|
1977
|
1924
|
|
1978
|
1925
|
#endif // else DELTA
|
1979
|
1926
|
|
|
@@ -1998,7 +1945,7 @@ inline void gcode_G28() {
|
1998
|
1945
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
1999
|
1946
|
st_synchronize();
|
2000
|
1947
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
2001
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1948
|
+ sync_plan_position();
|
2002
|
1949
|
mbl.active = 1;
|
2003
|
1950
|
}
|
2004
|
1951
|
#endif
|
|
@@ -2069,7 +2016,7 @@ inline void gcode_G28() {
|
2069
|
2016
|
int ix, iy;
|
2070
|
2017
|
if (probe_point == 0) {
|
2071
|
2018
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
2072
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
2019
|
+ sync_plan_position();
|
2073
|
2020
|
} else {
|
2074
|
2021
|
ix = (probe_point-1) % MESH_NUM_X_POINTS;
|
2075
|
2022
|
iy = (probe_point-1) / MESH_NUM_X_POINTS;
|
|
@@ -2242,7 +2189,7 @@ inline void gcode_G28() {
|
2242
|
2189
|
current_position[X_AXIS] = uncorrected_position.x;
|
2243
|
2190
|
current_position[Y_AXIS] = uncorrected_position.y;
|
2244
|
2191
|
current_position[Z_AXIS] = uncorrected_position.z;
|
2245
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
2192
|
+ sync_plan_position();
|
2246
|
2193
|
|
2247
|
2194
|
#endif
|
2248
|
2195
|
}
|
|
@@ -2443,7 +2390,7 @@ inline void gcode_G28() {
|
2443
|
2390
|
|
2444
|
2391
|
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset
|
2445
|
2392
|
current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS]; //The difference is added to current position and sent to planner.
|
2446
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
2393
|
+ sync_plan_position();
|
2447
|
2394
|
}
|
2448
|
2395
|
#endif // !DELTA
|
2449
|
2396
|
|
|
@@ -2494,15 +2441,17 @@ inline void gcode_G92() {
|
2494
|
2441
|
if (!code_seen(axis_codes[E_AXIS]))
|
2495
|
2442
|
st_synchronize();
|
2496
|
2443
|
|
|
2444
|
+ bool didXYZ = false;
|
2497
|
2445
|
for (int i = 0; i < NUM_AXIS; i++) {
|
2498
|
2446
|
if (code_seen(axis_codes[i])) {
|
2499
|
|
- current_position[i] = code_value();
|
|
2447
|
+ float v = current_position[i] = code_value();
|
2500
|
2448
|
if (i == E_AXIS)
|
2501
|
|
- plan_set_e_position(current_position[E_AXIS]);
|
|
2449
|
+ plan_set_e_position(v);
|
2502
|
2450
|
else
|
2503
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
2451
|
+ didXYZ = true;
|
2504
|
2452
|
}
|
2505
|
2453
|
}
|
|
2454
|
+ if (didXYZ) sync_plan_position();
|
2506
|
2455
|
}
|
2507
|
2456
|
|
2508
|
2457
|
#ifdef ULTIPANEL
|
|
@@ -3760,23 +3709,23 @@ inline void gcode_M206() {
|
3760
|
3709
|
inline void gcode_M218() {
|
3761
|
3710
|
if (setTargetedHotend(218)) return;
|
3762
|
3711
|
|
3763
|
|
- if (code_seen('X')) extruder_offset[X_AXIS][tmp_extruder] = code_value();
|
3764
|
|
- if (code_seen('Y')) extruder_offset[Y_AXIS][tmp_extruder] = code_value();
|
|
3712
|
+ if (code_seen('X')) extruder_offset[tmp_extruder][X_AXIS] = code_value();
|
|
3713
|
+ if (code_seen('Y')) extruder_offset[tmp_extruder][Y_AXIS] = code_value();
|
3765
|
3714
|
|
3766
|
3715
|
#ifdef DUAL_X_CARRIAGE
|
3767
|
|
- if (code_seen('Z')) extruder_offset[Z_AXIS][tmp_extruder] = code_value();
|
|
3716
|
+ if (code_seen('Z')) extruder_offset[tmp_extruder][Z_AXIS] = code_value();
|
3768
|
3717
|
#endif
|
3769
|
3718
|
|
3770
|
3719
|
SERIAL_ECHO_START;
|
3771
|
3720
|
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
3772
|
3721
|
for (tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++) {
|
3773
|
3722
|
SERIAL_ECHO(" ");
|
3774
|
|
- SERIAL_ECHO(extruder_offset[X_AXIS][tmp_extruder]);
|
|
3723
|
+ SERIAL_ECHO(extruder_offset[tmp_extruder][X_AXIS]);
|
3775
|
3724
|
SERIAL_ECHO(",");
|
3776
|
|
- SERIAL_ECHO(extruder_offset[Y_AXIS][tmp_extruder]);
|
|
3725
|
+ SERIAL_ECHO(extruder_offset[tmp_extruder][Y_AXIS]);
|
3777
|
3726
|
#ifdef DUAL_X_CARRIAGE
|
3778
|
3727
|
SERIAL_ECHO(",");
|
3779
|
|
- SERIAL_ECHO(extruder_offset[Z_AXIS][tmp_extruder]);
|
|
3728
|
+ SERIAL_ECHO(extruder_offset[tmp_extruder][Z_AXIS]);
|
3780
|
3729
|
#endif
|
3781
|
3730
|
}
|
3782
|
3731
|
SERIAL_EOL;
|
|
@@ -4467,13 +4416,13 @@ inline void gcode_M503() {
|
4467
|
4416
|
SERIAL_ECHO_START;
|
4468
|
4417
|
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
4469
|
4418
|
SERIAL_ECHO(" ");
|
4470
|
|
- SERIAL_ECHO(extruder_offset[X_AXIS][0]);
|
|
4419
|
+ SERIAL_ECHO(extruder_offset[0][X_AXIS]);
|
4471
|
4420
|
SERIAL_ECHO(",");
|
4472
|
|
- SERIAL_ECHO(extruder_offset[Y_AXIS][0]);
|
|
4421
|
+ SERIAL_ECHO(extruder_offset[0][Y_AXIS]);
|
4473
|
4422
|
SERIAL_ECHO(" ");
|
4474
|
4423
|
SERIAL_ECHO(duplicate_extruder_x_offset);
|
4475
|
4424
|
SERIAL_ECHO(",");
|
4476
|
|
- SERIAL_ECHOLN(extruder_offset[Y_AXIS][1]);
|
|
4425
|
+ SERIAL_ECHOLN(extruder_offset[1][Y_AXIS]);
|
4477
|
4426
|
break;
|
4478
|
4427
|
case DXC_FULL_CONTROL_MODE:
|
4479
|
4428
|
case DXC_AUTO_PARK_MODE:
|
|
@@ -4608,11 +4557,11 @@ inline void gcode_T() {
|
4608
|
4557
|
|
4609
|
4558
|
// apply Y & Z extruder offset (x offset is already used in determining home pos)
|
4610
|
4559
|
current_position[Y_AXIS] = current_position[Y_AXIS] -
|
4611
|
|
- extruder_offset[Y_AXIS][active_extruder] +
|
4612
|
|
- extruder_offset[Y_AXIS][tmp_extruder];
|
|
4560
|
+ extruder_offset[active_extruder][Y_AXIS] +
|
|
4561
|
+ extruder_offset[tmp_extruder][Y_AXIS];
|
4613
|
4562
|
current_position[Z_AXIS] = current_position[Z_AXIS] -
|
4614
|
|
- extruder_offset[Z_AXIS][active_extruder] +
|
4615
|
|
- extruder_offset[Z_AXIS][tmp_extruder];
|
|
4563
|
+ extruder_offset[active_extruder][Z_AXIS] +
|
|
4564
|
+ extruder_offset[tmp_extruder][Z_AXIS];
|
4616
|
4565
|
|
4617
|
4566
|
active_extruder = tmp_extruder;
|
4618
|
4567
|
|
|
@@ -4642,7 +4591,7 @@ inline void gcode_T() {
|
4642
|
4591
|
#else // !DUAL_X_CARRIAGE
|
4643
|
4592
|
// Offset extruder (only by XY)
|
4644
|
4593
|
for (int i=X_AXIS; i<=Y_AXIS; i++)
|
4645
|
|
- current_position[i] += extruder_offset[i][tmp_extruder] - extruder_offset[i][active_extruder];
|
|
4594
|
+ current_position[i] += extruder_offset[tmp_extruder][i] - extruder_offset[active_extruder][i];
|
4646
|
4595
|
// Set the new active extruder and position
|
4647
|
4596
|
active_extruder = tmp_extruder;
|
4648
|
4597
|
#endif // !DUAL_X_CARRIAGE
|
|
@@ -4651,7 +4600,7 @@ inline void gcode_T() {
|
4651
|
4600
|
//sent position to plan_set_position();
|
4652
|
4601
|
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],current_position[E_AXIS]);
|
4653
|
4602
|
#else
|
4654
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
4603
|
+ sync_plan_position();
|
4655
|
4604
|
#endif
|
4656
|
4605
|
// Move to the old position if 'F' was in the parameters
|
4657
|
4606
|
if (make_move && !Stopped) prepare_move();
|
|
@@ -5492,7 +5441,7 @@ for (int s = 1; s <= steps; s++) {
|
5492
|
5441
|
plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
5493
|
5442
|
plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS],
|
5494
|
5443
|
current_position[E_AXIS], max_feedrate[X_AXIS], 1);
|
5495
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
5444
|
+ sync_plan_position();
|
5496
|
5445
|
st_synchronize();
|
5497
|
5446
|
extruder_duplication_enabled = true;
|
5498
|
5447
|
active_extruder_parked = false;
|