|
@@ -147,7 +147,7 @@
|
147
|
147
|
S<print> T<travel> minimum speeds
|
148
|
148
|
B<minimum segment time>
|
149
|
149
|
X<max X jerk>, Y<max Y jerk>, Z<max Z jerk>, E<max E jerk>
|
150
|
|
- * M206 - Set additional homing offset.
|
|
150
|
+ * M206 - Set additional homing offset. (Disabled by NO_WORKSPACE_OFFSETS or DELTA)
|
151
|
151
|
* M207 - Set Retract Length: S<length>, Feedrate: F<units/min>, and Z lift: Z<distance>. (Requires FWRETRACT)
|
152
|
152
|
* M208 - Set Recover (unretract) Additional (!) Length: S<length> and Feedrate: F<units/min>. (Requires FWRETRACT)
|
153
|
153
|
* M209 - Turn Automatic Retract Detection on/off: S<0|1> (For slicers that don't support G10/11). (Requires FWRETRACT)
|
|
@@ -180,7 +180,7 @@
|
180
|
180
|
* M410 - Quickstop. Abort all planned moves.
|
181
|
181
|
* M420 - Enable/Disable Leveling (with current values) S1=enable S0=disable (Requires MESH_BED_LEVELING or ABL)
|
182
|
182
|
* M421 - Set a single Z coordinate in the Mesh Leveling grid. X<units> Y<units> Z<units> (Requires MESH_BED_LEVELING or AUTO_BED_LEVELING_UBL)
|
183
|
|
- * M428 - Set the home_offset based on the current_position. Nearest edge applies.
|
|
183
|
+ * M428 - Set the home_offset based on the current_position. Nearest edge applies. (Disabled by NO_WORKSPACE_OFFSETS or DELTA)
|
184
|
184
|
* M500 - Store parameters in EEPROM. (Requires EEPROM_SETTINGS)
|
185
|
185
|
* M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS)
|
186
|
186
|
* M502 - Revert to the default "factory settings". ** Does not write them to EEPROM! **
|
|
@@ -409,18 +409,20 @@ bool axis_relative_modes[] = AXIS_RELATIVE_MODES,
|
409
|
409
|
float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA),
|
410
|
410
|
volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
|
411
|
411
|
|
412
|
|
-#if DISABLED(NO_WORKSPACE_OFFSETS)
|
413
|
|
-
|
414
|
|
- // The distance that XYZ has been offset by G92. Reset by G28.
|
415
|
|
- float position_shift[XYZ] = { 0 };
|
416
|
|
-
|
417
|
|
- // This offset is added to the configured home position.
|
418
|
|
- // Set by M206, M428, or menu item. Saved to EEPROM.
|
419
|
|
- float home_offset[XYZ] = { 0 };
|
420
|
|
-
|
421
|
|
- // The above two are combined to save on computes
|
422
|
|
- float workspace_offset[XYZ] = { 0 };
|
423
|
|
-
|
|
412
|
+#if HAS_WORKSPACE_OFFSET
|
|
413
|
+ #if HAS_POSITION_SHIFT
|
|
414
|
+ // The distance that XYZ has been offset by G92. Reset by G28.
|
|
415
|
+ float position_shift[XYZ] = { 0 };
|
|
416
|
+ #endif
|
|
417
|
+ #if HAS_HOME_OFFSET
|
|
418
|
+ // This offset is added to the configured home position.
|
|
419
|
+ // Set by M206, M428, or menu item. Saved to EEPROM.
|
|
420
|
+ float home_offset[XYZ] = { 0 };
|
|
421
|
+ #endif
|
|
422
|
+ #if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
|
|
423
|
+ // The above two are combined to save on computes
|
|
424
|
+ float workspace_offset[XYZ] = { 0 };
|
|
425
|
+ #endif
|
424
|
426
|
#endif
|
425
|
427
|
|
426
|
428
|
// Software Endstops are based on the configured limits.
|
|
@@ -1382,7 +1384,7 @@ bool get_target_extruder_from_command(int code) {
|
1382
|
1384
|
|
1383
|
1385
|
#endif // DUAL_X_CARRIAGE
|
1384
|
1386
|
|
1385
|
|
-#if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
|
|
1387
|
+#if HAS_WORKSPACE_OFFSET || ENABLED(DUAL_X_CARRIAGE)
|
1386
|
1388
|
|
1387
|
1389
|
/**
|
1388
|
1390
|
* Software endstops can be used to monitor the open end of
|
|
@@ -1394,7 +1396,18 @@ bool get_target_extruder_from_command(int code) {
|
1394
|
1396
|
* at the same positions relative to the machine.
|
1395
|
1397
|
*/
|
1396
|
1398
|
void update_software_endstops(const AxisEnum axis) {
|
1397
|
|
- const float offs = workspace_offset[axis] = home_offset[axis] + position_shift[axis];
|
|
1399
|
+ const float offs = 0.0
|
|
1400
|
+ #if HAS_HOME_OFFSET
|
|
1401
|
+ + home_offset[axis]
|
|
1402
|
+ #endif
|
|
1403
|
+ #if HAS_POSITION_SHIFT
|
|
1404
|
+ + position_shift[axis]
|
|
1405
|
+ #endif
|
|
1406
|
+ ;
|
|
1407
|
+
|
|
1408
|
+ #if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
|
|
1409
|
+ workspace_offset[axis] = offs;
|
|
1410
|
+ #endif
|
1398
|
1411
|
|
1399
|
1412
|
#if ENABLED(DUAL_X_CARRIAGE)
|
1400
|
1413
|
if (axis == X_AXIS) {
|
|
@@ -1427,8 +1440,10 @@ bool get_target_extruder_from_command(int code) {
|
1427
|
1440
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1428
|
1441
|
if (DEBUGGING(LEVELING)) {
|
1429
|
1442
|
SERIAL_ECHOPAIR("For ", axis_codes[axis]);
|
1430
|
|
- #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
1443
|
+ #if HAS_HOME_OFFSET
|
1431
|
1444
|
SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]);
|
|
1445
|
+ #endif
|
|
1446
|
+ #if HAS_POSITION_SHIFT
|
1432
|
1447
|
SERIAL_ECHOPAIR("\n position_shift = ", position_shift[axis]);
|
1433
|
1448
|
#endif
|
1434
|
1449
|
SERIAL_ECHOPAIR("\n soft_endstop_min = ", soft_endstop_min[axis]);
|
|
@@ -1442,9 +1457,9 @@ bool get_target_extruder_from_command(int code) {
|
1442
|
1457
|
#endif
|
1443
|
1458
|
}
|
1444
|
1459
|
|
1445
|
|
-#endif // NO_WORKSPACE_OFFSETS
|
|
1460
|
+#endif // HAS_WORKSPACE_OFFSET || DUAL_X_CARRIAGE
|
1446
|
1461
|
|
1447
|
|
-#if DISABLED(NO_WORKSPACE_OFFSETS) && DISABLED(DELTA)
|
|
1462
|
+#if HAS_M206_COMMAND
|
1448
|
1463
|
/**
|
1449
|
1464
|
* Change the home offset for an axis, update the current
|
1450
|
1465
|
* position and the software endstops to retain the same
|
|
@@ -1458,7 +1473,7 @@ bool get_target_extruder_from_command(int code) {
|
1458
|
1473
|
home_offset[axis] = v;
|
1459
|
1474
|
update_software_endstops(axis);
|
1460
|
1475
|
}
|
1461
|
|
-#endif // !NO_WORKSPACE_OFFSETS && !DELTA
|
|
1476
|
+#endif // HAS_M206_COMMAND
|
1462
|
1477
|
|
1463
|
1478
|
/**
|
1464
|
1479
|
* Set an axis' current position to its home position (after homing).
|
|
@@ -1489,7 +1504,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
1489
|
1504
|
|
1490
|
1505
|
axis_known_position[axis] = axis_homed[axis] = true;
|
1491
|
1506
|
|
1492
|
|
- #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
1507
|
+ #if HAS_POSITION_SHIFT
|
1493
|
1508
|
position_shift[axis] = 0;
|
1494
|
1509
|
update_software_endstops(axis);
|
1495
|
1510
|
#endif
|
|
@@ -1565,7 +1580,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
1565
|
1580
|
|
1566
|
1581
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1567
|
1582
|
if (DEBUGGING(LEVELING)) {
|
1568
|
|
- #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
1583
|
+ #if HAS_HOME_OFFSET
|
1569
|
1584
|
SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]);
|
1570
|
1585
|
SERIAL_ECHOLNPAIR("] = ", home_offset[axis]);
|
1571
|
1586
|
#endif
|
|
@@ -5366,7 +5381,7 @@ inline void gcode_G92() {
|
5366
|
5381
|
current_position[i] = code_value_axis_units(i);
|
5367
|
5382
|
if (i != E_AXIS) didXYZ = true;
|
5368
|
5383
|
#else
|
5369
|
|
- #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
5384
|
+ #if HAS_POSITION_SHIFT
|
5370
|
5385
|
float p = current_position[i];
|
5371
|
5386
|
#endif
|
5372
|
5387
|
float v = code_value_axis_units(i);
|
|
@@ -5375,7 +5390,7 @@ inline void gcode_G92() {
|
5375
|
5390
|
|
5376
|
5391
|
if (i != E_AXIS) {
|
5377
|
5392
|
didXYZ = true;
|
5378
|
|
- #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
5393
|
+ #if HAS_POSITION_SHIFT
|
5379
|
5394
|
position_shift[i] += v - p; // Offset the coordinate space
|
5380
|
5395
|
update_software_endstops((AxisEnum)i);
|
5381
|
5396
|
#endif
|
|
@@ -7382,7 +7397,7 @@ inline void gcode_M205() {
|
7382
|
7397
|
if (code_seen('E')) planner.max_jerk[E_AXIS] = code_value_axis_units(E_AXIS);
|
7383
|
7398
|
}
|
7384
|
7399
|
|
7385
|
|
-#if DISABLED(NO_WORKSPACE_OFFSETS) && DISABLED(DELTA)
|
|
7400
|
+#if HAS_M206_COMMAND
|
7386
|
7401
|
|
7387
|
7402
|
/**
|
7388
|
7403
|
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
|
|
@@ -7401,7 +7416,7 @@ inline void gcode_M205() {
|
7401
|
7416
|
report_current_position();
|
7402
|
7417
|
}
|
7403
|
7418
|
|
7404
|
|
-#endif // NO_WORKSPACE_OFFSETS
|
|
7419
|
+#endif // HAS_M206_COMMAND
|
7405
|
7420
|
|
7406
|
7421
|
#if ENABLED(DELTA)
|
7407
|
7422
|
/**
|
|
@@ -8280,7 +8295,7 @@ void quickstop_stepper() {
|
8280
|
8295
|
|
8281
|
8296
|
#endif
|
8282
|
8297
|
|
8283
|
|
-#if DISABLED(NO_WORKSPACE_OFFSETS) && DISABLED(DELTA)
|
|
8298
|
+#if HAS_M206_COMMAND
|
8284
|
8299
|
|
8285
|
8300
|
/**
|
8286
|
8301
|
* M428: Set home_offset based on the distance between the
|
|
@@ -8322,7 +8337,7 @@ void quickstop_stepper() {
|
8322
|
8337
|
}
|
8323
|
8338
|
}
|
8324
|
8339
|
|
8325
|
|
-#endif // NO_WORKSPACE_OFFSETS
|
|
8340
|
+#endif // HAS_M206_COMMAND
|
8326
|
8341
|
|
8327
|
8342
|
/**
|
8328
|
8343
|
* M500: Store settings in EEPROM
|
|
@@ -9301,9 +9316,9 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
|
9301
|
9316
|
// The newly-selected extruder XY is actually at...
|
9302
|
9317
|
current_position[X_AXIS] += xydiff[X_AXIS];
|
9303
|
9318
|
current_position[Y_AXIS] += xydiff[Y_AXIS];
|
9304
|
|
- #if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE)
|
|
9319
|
+ #if HAS_WORKSPACE_OFFSET || ENABLED(DUAL_X_CARRIAGE)
|
9305
|
9320
|
for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
|
9306
|
|
- #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
9321
|
+ #if HAS_POSITION_SHIFT
|
9307
|
9322
|
position_shift[i] += xydiff[i];
|
9308
|
9323
|
#endif
|
9309
|
9324
|
update_software_endstops((AxisEnum)i);
|
|
@@ -9895,7 +9910,7 @@ void process_next_command() {
|
9895
|
9910
|
gcode_M205();
|
9896
|
9911
|
break;
|
9897
|
9912
|
|
9898
|
|
- #if DISABLED(NO_WORKSPACE_OFFSETS) && DISABLED(DELTA)
|
|
9913
|
+ #if HAS_M206_COMMAND
|
9899
|
9914
|
case 206: // M206: Set home offsets
|
9900
|
9915
|
gcode_M206();
|
9901
|
9916
|
break;
|
|
@@ -10063,7 +10078,7 @@ void process_next_command() {
|
10063
|
10078
|
break;
|
10064
|
10079
|
#endif
|
10065
|
10080
|
|
10066
|
|
- #if DISABLED(NO_WORKSPACE_OFFSETS) && DISABLED(DELTA)
|
|
10081
|
+ #if HAS_M206_COMMAND
|
10067
|
10082
|
case 428: // M428: Apply current_position to home_offset
|
10068
|
10083
|
gcode_M428();
|
10069
|
10084
|
break;
|
|
@@ -10584,8 +10599,8 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
10584
|
10599
|
* splitting the move where it crosses mesh borders.
|
10585
|
10600
|
*/
|
10586
|
10601
|
void mesh_line_to_destination(float fr_mm_s, uint8_t x_splits = 0xff, uint8_t y_splits = 0xff) {
|
10587
|
|
- int cx1 = mbl.cell_index_x(RAW_CURRENT_POSITION(X_AXIS)),
|
10588
|
|
- cy1 = mbl.cell_index_y(RAW_CURRENT_POSITION(Y_AXIS)),
|
|
10602
|
+ int cx1 = mbl.cell_index_x(RAW_CURRENT_POSITION(X)),
|
|
10603
|
+ cy1 = mbl.cell_index_y(RAW_CURRENT_POSITION(Y)),
|
10589
|
10604
|
cx2 = mbl.cell_index_x(RAW_X_POSITION(destination[X_AXIS])),
|
10590
|
10605
|
cy2 = mbl.cell_index_y(RAW_Y_POSITION(destination[Y_AXIS]));
|
10591
|
10606
|
NOMORE(cx1, GRID_MAX_POINTS_X - 2);
|
|
@@ -11799,7 +11814,7 @@ void setup() {
|
11799
|
11814
|
// This also updates variables in the planner, elsewhere
|
11800
|
11815
|
(void)settings.load();
|
11801
|
11816
|
|
11802
|
|
- #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
11817
|
+ #if HAS_M206_COMMAND
|
11803
|
11818
|
// Initialize current position based on home_offset
|
11804
|
11819
|
COPY(current_position, home_offset);
|
11805
|
11820
|
#else
|