|
@@ -396,12 +396,19 @@ bool axis_relative_modes[] = AXIS_RELATIVE_MODES,
|
396
|
396
|
float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA),
|
397
|
397
|
volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
|
398
|
398
|
|
399
|
|
-// The distance that XYZ has been offset by G92. Reset by G28.
|
400
|
|
-float position_shift[XYZ] = { 0 };
|
|
399
|
+#if DISABLED(NO_WORKSPACE_OFFSETS)
|
401
|
400
|
|
402
|
|
-// This offset is added to the configured home position.
|
403
|
|
-// Set by M206, M428, or menu item. Saved to EEPROM.
|
404
|
|
-float home_offset[XYZ] = { 0 };
|
|
401
|
+ // The distance that XYZ has been offset by G92. Reset by G28.
|
|
402
|
+ float position_shift[XYZ] = { 0 };
|
|
403
|
+
|
|
404
|
+ // This offset is added to the configured home position.
|
|
405
|
+ // Set by M206, M428, or menu item. Saved to EEPROM.
|
|
406
|
+ float home_offset[XYZ] = { 0 };
|
|
407
|
+
|
|
408
|
+ // The above two are combined to save on computes
|
|
409
|
+ float workspace_offset[XYZ] = { 0 };
|
|
410
|
+
|
|
411
|
+#endif
|
405
|
412
|
|
406
|
413
|
// Software Endstops are based on the configured limits.
|
407
|
414
|
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
|
|
@@ -1333,76 +1340,83 @@ bool get_target_extruder_from_command(int code) {
|
1333
|
1340
|
|
1334
|
1341
|
#endif // DUAL_X_CARRIAGE
|
1335
|
1342
|
|
1336
|
|
-/**
|
1337
|
|
- * Software endstops can be used to monitor the open end of
|
1338
|
|
- * an axis that has a hardware endstop on the other end. Or
|
1339
|
|
- * they can prevent axes from moving past endstops and grinding.
|
1340
|
|
- *
|
1341
|
|
- * To keep doing their job as the coordinate system changes,
|
1342
|
|
- * the software endstop positions must be refreshed to remain
|
1343
|
|
- * at the same positions relative to the machine.
|
1344
|
|
- */
|
1345
|
|
-void update_software_endstops(AxisEnum axis) {
|
1346
|
|
- float offs = LOGICAL_POSITION(0, axis);
|
|
1343
|
+#if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
|
1347
|
1344
|
|
1348
|
|
- #if ENABLED(DUAL_X_CARRIAGE)
|
1349
|
|
- if (axis == X_AXIS) {
|
|
1345
|
+ /**
|
|
1346
|
+ * Software endstops can be used to monitor the open end of
|
|
1347
|
+ * an axis that has a hardware endstop on the other end. Or
|
|
1348
|
+ * they can prevent axes from moving past endstops and grinding.
|
|
1349
|
+ *
|
|
1350
|
+ * To keep doing their job as the coordinate system changes,
|
|
1351
|
+ * the software endstop positions must be refreshed to remain
|
|
1352
|
+ * at the same positions relative to the machine.
|
|
1353
|
+ */
|
|
1354
|
+ void update_software_endstops(const AxisEnum axis) {
|
|
1355
|
+ const float offs = workspace_offset[axis] = LOGICAL_POSITION(0, axis);
|
1350
|
1356
|
|
1351
|
|
- // In Dual X mode hotend_offset[X] is T1's home position
|
1352
|
|
- float dual_max_x = max(hotend_offset[X_AXIS][1], X2_MAX_POS);
|
|
1357
|
+ #if ENABLED(DUAL_X_CARRIAGE)
|
|
1358
|
+ if (axis == X_AXIS) {
|
1353
|
1359
|
|
1354
|
|
- if (active_extruder != 0) {
|
1355
|
|
- // T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger)
|
1356
|
|
- soft_endstop_min[X_AXIS] = X2_MIN_POS + offs;
|
1357
|
|
- soft_endstop_max[X_AXIS] = dual_max_x + offs;
|
1358
|
|
- }
|
1359
|
|
- else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
|
1360
|
|
- // In Duplication Mode, T0 can move as far left as X_MIN_POS
|
1361
|
|
- // but not so far to the right that T1 would move past the end
|
1362
|
|
- soft_endstop_min[X_AXIS] = base_min_pos(X_AXIS) + offs;
|
1363
|
|
- soft_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs;
|
1364
|
|
- }
|
1365
|
|
- else {
|
1366
|
|
- // In other modes, T0 can move from X_MIN_POS to X_MAX_POS
|
1367
|
|
- soft_endstop_min[axis] = base_min_pos(axis) + offs;
|
1368
|
|
- soft_endstop_max[axis] = base_max_pos(axis) + offs;
|
|
1360
|
+ // In Dual X mode hotend_offset[X] is T1's home position
|
|
1361
|
+ float dual_max_x = max(hotend_offset[X_AXIS][1], X2_MAX_POS);
|
|
1362
|
+
|
|
1363
|
+ if (active_extruder != 0) {
|
|
1364
|
+ // T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger)
|
|
1365
|
+ soft_endstop_min[X_AXIS] = X2_MIN_POS + offs;
|
|
1366
|
+ soft_endstop_max[X_AXIS] = dual_max_x + offs;
|
|
1367
|
+ }
|
|
1368
|
+ else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
|
|
1369
|
+ // In Duplication Mode, T0 can move as far left as X_MIN_POS
|
|
1370
|
+ // but not so far to the right that T1 would move past the end
|
|
1371
|
+ soft_endstop_min[X_AXIS] = base_min_pos(X_AXIS) + offs;
|
|
1372
|
+ soft_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs;
|
|
1373
|
+ }
|
|
1374
|
+ else {
|
|
1375
|
+ // In other modes, T0 can move from X_MIN_POS to X_MAX_POS
|
|
1376
|
+ soft_endstop_min[axis] = base_min_pos(axis) + offs;
|
|
1377
|
+ soft_endstop_max[axis] = base_max_pos(axis) + offs;
|
|
1378
|
+ }
|
1369
|
1379
|
}
|
1370
|
|
- }
|
1371
|
|
- #else
|
1372
|
|
- soft_endstop_min[axis] = base_min_pos(axis) + offs;
|
1373
|
|
- soft_endstop_max[axis] = base_max_pos(axis) + offs;
|
1374
|
|
- #endif
|
|
1380
|
+ #else
|
|
1381
|
+ soft_endstop_min[axis] = base_min_pos(axis) + offs;
|
|
1382
|
+ soft_endstop_max[axis] = base_max_pos(axis) + offs;
|
|
1383
|
+ #endif
|
1375
|
1384
|
|
1376
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
1377
|
|
- if (DEBUGGING(LEVELING)) {
|
1378
|
|
- SERIAL_ECHOPAIR("For ", axis_codes[axis]);
|
1379
|
|
- SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]);
|
1380
|
|
- SERIAL_ECHOPAIR("\n position_shift = ", position_shift[axis]);
|
1381
|
|
- SERIAL_ECHOPAIR("\n soft_endstop_min = ", soft_endstop_min[axis]);
|
1382
|
|
- SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]);
|
1383
|
|
- }
|
1384
|
|
- #endif
|
|
1385
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
1386
|
+ if (DEBUGGING(LEVELING)) {
|
|
1387
|
+ SERIAL_ECHOPAIR("For ", axis_codes[axis]);
|
|
1388
|
+ #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
1389
|
+ SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]);
|
|
1390
|
+ SERIAL_ECHOPAIR("\n position_shift = ", position_shift[axis]);
|
|
1391
|
+ #endif
|
|
1392
|
+ SERIAL_ECHOPAIR("\n soft_endstop_min = ", soft_endstop_min[axis]);
|
|
1393
|
+ SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]);
|
|
1394
|
+ }
|
|
1395
|
+ #endif
|
1385
|
1396
|
|
1386
|
|
- #if ENABLED(DELTA)
|
1387
|
|
- if (axis == Z_AXIS)
|
1388
|
|
- delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top();
|
1389
|
|
- #endif
|
|
1397
|
+ #if ENABLED(DELTA)
|
|
1398
|
+ if (axis == Z_AXIS)
|
|
1399
|
+ delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top();
|
|
1400
|
+ #endif
|
|
1401
|
+ }
|
1390
|
1402
|
|
1391
|
|
-}
|
|
1403
|
+#endif // NO_WORKSPACE_OFFSETS
|
1392
|
1404
|
|
1393
|
|
-/**
|
1394
|
|
- * Change the home offset for an axis, update the current
|
1395
|
|
- * position and the software endstops to retain the same
|
1396
|
|
- * relative distance to the new home.
|
1397
|
|
- *
|
1398
|
|
- * Since this changes the current_position, code should
|
1399
|
|
- * call sync_plan_position soon after this.
|
1400
|
|
- */
|
1401
|
|
-static void set_home_offset(AxisEnum axis, float v) {
|
1402
|
|
- current_position[axis] += v - home_offset[axis];
|
1403
|
|
- home_offset[axis] = v;
|
1404
|
|
- update_software_endstops(axis);
|
1405
|
|
-}
|
|
1405
|
+#if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
1406
|
+ /**
|
|
1407
|
+ * Change the home offset for an axis, update the current
|
|
1408
|
+ * position and the software endstops to retain the same
|
|
1409
|
+ * relative distance to the new home.
|
|
1410
|
+ *
|
|
1411
|
+ * Since this changes the current_position, code should
|
|
1412
|
+ * call sync_plan_position soon after this.
|
|
1413
|
+ */
|
|
1414
|
+ static void set_home_offset(const AxisEnum axis, const float v) {
|
|
1415
|
+ current_position[axis] += v - home_offset[axis];
|
|
1416
|
+ home_offset[axis] = v;
|
|
1417
|
+ update_software_endstops(axis);
|
|
1418
|
+ }
|
|
1419
|
+#endif // NO_WORKSPACE_OFFSETS
|
1406
|
1420
|
|
1407
|
1421
|
/**
|
1408
|
1422
|
* Set an axis' current position to its home position (after homing).
|
|
@@ -1433,8 +1447,10 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
1433
|
1447
|
|
1434
|
1448
|
axis_known_position[axis] = axis_homed[axis] = true;
|
1435
|
1449
|
|
1436
|
|
- position_shift[axis] = 0;
|
1437
|
|
- update_software_endstops(axis);
|
|
1450
|
+ #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
1451
|
+ position_shift[axis] = 0;
|
|
1452
|
+ update_software_endstops(axis);
|
|
1453
|
+ #endif
|
1438
|
1454
|
|
1439
|
1455
|
#if ENABLED(DUAL_X_CARRIAGE)
|
1440
|
1456
|
if (axis == X_AXIS && (active_extruder == 1 || dual_x_carriage_mode == DXC_DUPLICATION_MODE)) {
|
|
@@ -1507,8 +1523,10 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
1507
|
1523
|
|
1508
|
1524
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
1509
|
1525
|
if (DEBUGGING(LEVELING)) {
|
1510
|
|
- SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]);
|
1511
|
|
- SERIAL_ECHOLNPAIR("] = ", home_offset[axis]);
|
|
1526
|
+ #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
1527
|
+ SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]);
|
|
1528
|
+ SERIAL_ECHOLNPAIR("] = ", home_offset[axis]);
|
|
1529
|
+ #endif
|
1512
|
1530
|
DEBUG_POS("", current_position);
|
1513
|
1531
|
SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis_codes[axis]);
|
1514
|
1532
|
SERIAL_CHAR(')');
|
|
@@ -1549,8 +1567,8 @@ inline void line_to_destination(float fr_mm_s) {
|
1549
|
1567
|
}
|
1550
|
1568
|
inline void line_to_destination() { line_to_destination(feedrate_mm_s); }
|
1551
|
1569
|
|
1552
|
|
-inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
|
1553
|
|
-inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
|
|
1570
|
+inline void set_current_to_destination() { COPY(current_position, destination); }
|
|
1571
|
+inline void set_destination_to_current() { COPY(destination, current_position); }
|
1554
|
1572
|
|
1555
|
1573
|
#if IS_KINEMATIC
|
1556
|
1574
|
/**
|
|
@@ -3557,7 +3575,7 @@ inline void gcode_G28() {
|
3557
|
3575
|
HOMEAXIS(X);
|
3558
|
3576
|
|
3559
|
3577
|
// Consider the active extruder to be parked
|
3560
|
|
- memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
|
|
3578
|
+ COPY(raised_parked_position, current_position);
|
3561
|
3579
|
delayed_move_time = 0;
|
3562
|
3580
|
active_extruder_parked = true;
|
3563
|
3581
|
|
|
@@ -4357,7 +4375,7 @@ inline void gcode_G28() {
|
4357
|
4375
|
#endif
|
4358
|
4376
|
|
4359
|
4377
|
float converted[XYZ];
|
4360
|
|
- memcpy(converted, current_position, sizeof(converted));
|
|
4378
|
+ COPY(converted, current_position);
|
4361
|
4379
|
|
4362
|
4380
|
planner.abl_enabled = true;
|
4363
|
4381
|
planner.unapply_leveling(converted); // use conversion machinery
|
|
@@ -4379,7 +4397,7 @@ inline void gcode_G28() {
|
4379
|
4397
|
}
|
4380
|
4398
|
|
4381
|
4399
|
// The rotated XY and corrected Z are now current_position
|
4382
|
|
- memcpy(current_position, converted, sizeof(converted));
|
|
4400
|
+ COPY(current_position, converted);
|
4383
|
4401
|
|
4384
|
4402
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
4385
|
4403
|
if (DEBUGGING(LEVELING)) DEBUG_POS("G29 corrected XYZ", current_position);
|
|
@@ -4595,8 +4613,10 @@ inline void gcode_G92() {
|
4595
|
4613
|
|
4596
|
4614
|
if (i != E_AXIS) {
|
4597
|
4615
|
didXYZ = true;
|
4598
|
|
- position_shift[i] += v - p; // Offset the coordinate space
|
4599
|
|
- update_software_endstops((AxisEnum)i);
|
|
4616
|
+ #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
4617
|
+ position_shift[i] += v - p; // Offset the coordinate space
|
|
4618
|
+ update_software_endstops((AxisEnum)i);
|
|
4619
|
+ #endif
|
4600
|
4620
|
}
|
4601
|
4621
|
#endif
|
4602
|
4622
|
}
|
|
@@ -6326,22 +6346,26 @@ inline void gcode_M205() {
|
6326
|
6346
|
if (code_seen('E')) planner.max_jerk[E_AXIS] = code_value_axis_units(E_AXIS);
|
6327
|
6347
|
}
|
6328
|
6348
|
|
6329
|
|
-/**
|
6330
|
|
- * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
|
6331
|
|
- */
|
6332
|
|
-inline void gcode_M206() {
|
6333
|
|
- LOOP_XYZ(i)
|
6334
|
|
- if (code_seen(axis_codes[i]))
|
6335
|
|
- set_home_offset((AxisEnum)i, code_value_axis_units(i));
|
|
6349
|
+#if DISABLED(NO_WORKSPACE_OFFSETS)
|
6336
|
6350
|
|
6337
|
|
- #if ENABLED(MORGAN_SCARA)
|
6338
|
|
- if (code_seen('T')) set_home_offset(A_AXIS, code_value_axis_units(A_AXIS)); // Theta
|
6339
|
|
- if (code_seen('P')) set_home_offset(B_AXIS, code_value_axis_units(B_AXIS)); // Psi
|
6340
|
|
- #endif
|
|
6351
|
+ /**
|
|
6352
|
+ * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
|
|
6353
|
+ */
|
|
6354
|
+ inline void gcode_M206() {
|
|
6355
|
+ LOOP_XYZ(i)
|
|
6356
|
+ if (code_seen(axis_codes[i]))
|
|
6357
|
+ set_home_offset((AxisEnum)i, code_value_axis_units(i));
|
6341
|
6358
|
|
6342
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
6343
|
|
- report_current_position();
|
6344
|
|
-}
|
|
6359
|
+ #if ENABLED(MORGAN_SCARA)
|
|
6360
|
+ if (code_seen('T')) set_home_offset(A_AXIS, code_value_axis_units(A_AXIS)); // Theta
|
|
6361
|
+ if (code_seen('P')) set_home_offset(B_AXIS, code_value_axis_units(B_AXIS)); // Psi
|
|
6362
|
+ #endif
|
|
6363
|
+
|
|
6364
|
+ SYNC_PLAN_POSITION_KINEMATIC();
|
|
6365
|
+ report_current_position();
|
|
6366
|
+ }
|
|
6367
|
+
|
|
6368
|
+#endif // NO_WORKSPACE_OFFSETS
|
6345
|
6369
|
|
6346
|
6370
|
#if ENABLED(DELTA)
|
6347
|
6371
|
/**
|
|
@@ -7165,45 +7189,49 @@ void quickstop_stepper() {
|
7165
|
7189
|
|
7166
|
7190
|
#endif
|
7167
|
7191
|
|
7168
|
|
-/**
|
7169
|
|
- * M428: Set home_offset based on the distance between the
|
7170
|
|
- * current_position and the nearest "reference point."
|
7171
|
|
- * If an axis is past center its endstop position
|
7172
|
|
- * is the reference-point. Otherwise it uses 0. This allows
|
7173
|
|
- * the Z offset to be set near the bed when using a max endstop.
|
7174
|
|
- *
|
7175
|
|
- * M428 can't be used more than 2cm away from 0 or an endstop.
|
7176
|
|
- *
|
7177
|
|
- * Use M206 to set these values directly.
|
7178
|
|
- */
|
7179
|
|
-inline void gcode_M428() {
|
7180
|
|
- bool err = false;
|
7181
|
|
- LOOP_XYZ(i) {
|
7182
|
|
- if (axis_homed[i]) {
|
7183
|
|
- float base = (current_position[i] > (soft_endstop_min[i] + soft_endstop_max[i]) * 0.5) ? base_home_pos((AxisEnum)i) : 0,
|
7184
|
|
- diff = current_position[i] - LOGICAL_POSITION(base, i);
|
7185
|
|
- if (diff > -20 && diff < 20) {
|
7186
|
|
- set_home_offset((AxisEnum)i, home_offset[i] - diff);
|
7187
|
|
- }
|
7188
|
|
- else {
|
7189
|
|
- SERIAL_ERROR_START;
|
7190
|
|
- SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
|
7191
|
|
- LCD_ALERTMESSAGEPGM("Err: Too far!");
|
7192
|
|
- BUZZ(200, 40);
|
7193
|
|
- err = true;
|
7194
|
|
- break;
|
|
7192
|
+#if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
7193
|
+
|
|
7194
|
+ /**
|
|
7195
|
+ * M428: Set home_offset based on the distance between the
|
|
7196
|
+ * current_position and the nearest "reference point."
|
|
7197
|
+ * If an axis is past center its endstop position
|
|
7198
|
+ * is the reference-point. Otherwise it uses 0. This allows
|
|
7199
|
+ * the Z offset to be set near the bed when using a max endstop.
|
|
7200
|
+ *
|
|
7201
|
+ * M428 can't be used more than 2cm away from 0 or an endstop.
|
|
7202
|
+ *
|
|
7203
|
+ * Use M206 to set these values directly.
|
|
7204
|
+ */
|
|
7205
|
+ inline void gcode_M428() {
|
|
7206
|
+ bool err = false;
|
|
7207
|
+ LOOP_XYZ(i) {
|
|
7208
|
+ if (axis_homed[i]) {
|
|
7209
|
+ float base = (current_position[i] > (soft_endstop_min[i] + soft_endstop_max[i]) * 0.5) ? base_home_pos((AxisEnum)i) : 0,
|
|
7210
|
+ diff = current_position[i] - LOGICAL_POSITION(base, i);
|
|
7211
|
+ if (diff > -20 && diff < 20) {
|
|
7212
|
+ set_home_offset((AxisEnum)i, home_offset[i] - diff);
|
|
7213
|
+ }
|
|
7214
|
+ else {
|
|
7215
|
+ SERIAL_ERROR_START;
|
|
7216
|
+ SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
|
|
7217
|
+ LCD_ALERTMESSAGEPGM("Err: Too far!");
|
|
7218
|
+ BUZZ(200, 40);
|
|
7219
|
+ err = true;
|
|
7220
|
+ break;
|
|
7221
|
+ }
|
7195
|
7222
|
}
|
7196
|
7223
|
}
|
7197
|
|
- }
|
7198
|
7224
|
|
7199
|
|
- if (!err) {
|
7200
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
7201
|
|
- report_current_position();
|
7202
|
|
- LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
|
7203
|
|
- BUZZ(200, 659);
|
7204
|
|
- BUZZ(200, 698);
|
|
7225
|
+ if (!err) {
|
|
7226
|
+ SYNC_PLAN_POSITION_KINEMATIC();
|
|
7227
|
+ report_current_position();
|
|
7228
|
+ LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
|
|
7229
|
+ BUZZ(200, 659);
|
|
7230
|
+ BUZZ(200, 698);
|
|
7231
|
+ }
|
7205
|
7232
|
}
|
7206
|
|
-}
|
|
7233
|
+
|
|
7234
|
+#endif // NO_WORKSPACE_OFFSETS
|
7207
|
7235
|
|
7208
|
7236
|
/**
|
7209
|
7237
|
* M500: Store settings in EEPROM
|
|
@@ -7929,7 +7957,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
|
7929
|
7957
|
break;
|
7930
|
7958
|
case DXC_AUTO_PARK_MODE:
|
7931
|
7959
|
// record raised toolhead position for use by unpark
|
7932
|
|
- memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
|
|
7960
|
+ COPY(raised_parked_position, current_position);
|
7933
|
7961
|
raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT;
|
7934
|
7962
|
#if ENABLED(max_software_endstops)
|
7935
|
7963
|
NOMORE(raised_parked_position[Z_AXIS], soft_endstop_max[Z_AXIS]);
|
|
@@ -8073,10 +8101,14 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
|
8073
|
8101
|
// The newly-selected extruder XY is actually at...
|
8074
|
8102
|
current_position[X_AXIS] += xydiff[X_AXIS];
|
8075
|
8103
|
current_position[Y_AXIS] += xydiff[Y_AXIS];
|
8076
|
|
- for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
|
8077
|
|
- position_shift[i] += xydiff[i];
|
8078
|
|
- update_software_endstops((AxisEnum)i);
|
8079
|
|
- }
|
|
8104
|
+ #if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE)
|
|
8105
|
+ for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
|
|
8106
|
+ #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
8107
|
+ position_shift[i] += xydiff[i];
|
|
8108
|
+ #endif
|
|
8109
|
+ update_software_endstops((AxisEnum)i);
|
|
8110
|
+ }
|
|
8111
|
+ #endif
|
8080
|
8112
|
|
8081
|
8113
|
// Set the new active extruder
|
8082
|
8114
|
active_extruder = tmp_extruder;
|
|
@@ -8631,9 +8663,12 @@ void process_next_command() {
|
8631
|
8663
|
case 205: //M205: Set advanced settings
|
8632
|
8664
|
gcode_M205();
|
8633
|
8665
|
break;
|
8634
|
|
- case 206: // M206: Set home offsets
|
8635
|
|
- gcode_M206();
|
8636
|
|
- break;
|
|
8666
|
+
|
|
8667
|
+ #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
8668
|
+ case 206: // M206: Set home offsets
|
|
8669
|
+ gcode_M206();
|
|
8670
|
+ break;
|
|
8671
|
+ #endif
|
8637
|
8672
|
|
8638
|
8673
|
#if ENABLED(DELTA)
|
8639
|
8674
|
case 665: // M665: Set delta configurations
|
|
@@ -8797,9 +8832,11 @@ void process_next_command() {
|
8797
|
8832
|
break;
|
8798
|
8833
|
#endif
|
8799
|
8834
|
|
8800
|
|
- case 428: // M428: Apply current_position to home_offset
|
8801
|
|
- gcode_M428();
|
8802
|
|
- break;
|
|
8835
|
+ #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
8836
|
+ case 428: // M428: Apply current_position to home_offset
|
|
8837
|
+ gcode_M428();
|
|
8838
|
+ break;
|
|
8839
|
+ #endif
|
8803
|
8840
|
|
8804
|
8841
|
case 500: // M500: Store settings in EEPROM
|
8805
|
8842
|
gcode_M500();
|
|
@@ -9287,7 +9324,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
9287
|
9324
|
planner.unapply_leveling(cartes);
|
9288
|
9325
|
#endif
|
9289
|
9326
|
if (axis == ALL_AXES)
|
9290
|
|
- memcpy(current_position, cartes, sizeof(cartes));
|
|
9327
|
+ COPY(current_position, cartes);
|
9291
|
9328
|
else
|
9292
|
9329
|
current_position[axis] = cartes[axis];
|
9293
|
9330
|
}
|
|
@@ -9322,14 +9359,14 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
9322
|
9359
|
// Split at the left/front border of the right/top square
|
9323
|
9360
|
int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2);
|
9324
|
9361
|
if (cx2 != cx1 && TEST(x_splits, gcx)) {
|
9325
|
|
- memcpy(end, destination, sizeof(end));
|
|
9362
|
+ COPY(end, destination);
|
9326
|
9363
|
destination[X_AXIS] = LOGICAL_X_POSITION(mbl.get_probe_x(gcx));
|
9327
|
9364
|
normalized_dist = (destination[X_AXIS] - current_position[X_AXIS]) / (end[X_AXIS] - current_position[X_AXIS]);
|
9328
|
9365
|
destination[Y_AXIS] = MBL_SEGMENT_END(Y);
|
9329
|
9366
|
CBI(x_splits, gcx);
|
9330
|
9367
|
}
|
9331
|
9368
|
else if (cy2 != cy1 && TEST(y_splits, gcy)) {
|
9332
|
|
- memcpy(end, destination, sizeof(end));
|
|
9369
|
+ COPY(end, destination);
|
9333
|
9370
|
destination[Y_AXIS] = LOGICAL_Y_POSITION(mbl.get_probe_y(gcy));
|
9334
|
9371
|
normalized_dist = (destination[Y_AXIS] - current_position[Y_AXIS]) / (end[Y_AXIS] - current_position[Y_AXIS]);
|
9335
|
9372
|
destination[X_AXIS] = MBL_SEGMENT_END(X);
|
|
@@ -9349,7 +9386,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
9349
|
9386
|
mesh_line_to_destination(fr_mm_s, x_splits, y_splits);
|
9350
|
9387
|
|
9351
|
9388
|
// Restore destination from stack
|
9352
|
|
- memcpy(destination, end, sizeof(end));
|
|
9389
|
+ COPY(destination, end);
|
9353
|
9390
|
mesh_line_to_destination(fr_mm_s, x_splits, y_splits);
|
9354
|
9391
|
}
|
9355
|
9392
|
|
|
@@ -9385,14 +9422,14 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
9385
|
9422
|
// Split at the left/front border of the right/top square
|
9386
|
9423
|
int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2);
|
9387
|
9424
|
if (cx2 != cx1 && TEST(x_splits, gcx)) {
|
9388
|
|
- memcpy(end, destination, sizeof(end));
|
|
9425
|
+ COPY(end, destination);
|
9389
|
9426
|
destination[X_AXIS] = LOGICAL_X_POSITION(bilinear_start[X_AXIS] + ABL_BG_SPACING(X_AXIS) * gcx);
|
9390
|
9427
|
normalized_dist = (destination[X_AXIS] - current_position[X_AXIS]) / (end[X_AXIS] - current_position[X_AXIS]);
|
9391
|
9428
|
destination[Y_AXIS] = LINE_SEGMENT_END(Y);
|
9392
|
9429
|
CBI(x_splits, gcx);
|
9393
|
9430
|
}
|
9394
|
9431
|
else if (cy2 != cy1 && TEST(y_splits, gcy)) {
|
9395
|
|
- memcpy(end, destination, sizeof(end));
|
|
9432
|
+ COPY(end, destination);
|
9396
|
9433
|
destination[Y_AXIS] = LOGICAL_Y_POSITION(bilinear_start[Y_AXIS] + ABL_BG_SPACING(Y_AXIS) * gcy);
|
9397
|
9434
|
normalized_dist = (destination[Y_AXIS] - current_position[Y_AXIS]) / (end[Y_AXIS] - current_position[Y_AXIS]);
|
9398
|
9435
|
destination[X_AXIS] = LINE_SEGMENT_END(X);
|
|
@@ -9412,7 +9449,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
9412
|
9449
|
bilinear_line_to_destination(fr_mm_s, x_splits, y_splits);
|
9413
|
9450
|
|
9414
|
9451
|
// Restore destination from stack
|
9415
|
|
- memcpy(destination, end, sizeof(end));
|
|
9452
|
+ COPY(destination, end);
|
9416
|
9453
|
bilinear_line_to_destination(fr_mm_s, x_splits, y_splits);
|
9417
|
9454
|
}
|
9418
|
9455
|
|
|
@@ -9507,7 +9544,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
9507
|
9544
|
|
9508
|
9545
|
// Get the logical current position as starting point
|
9509
|
9546
|
float logical[XYZE];
|
9510
|
|
- memcpy(logical, current_position, sizeof(logical));
|
|
9547
|
+ COPY(logical, current_position);
|
9511
|
9548
|
|
9512
|
9549
|
#define DELTA_VAR logical
|
9513
|
9550
|
|
|
@@ -10480,8 +10517,12 @@ void setup() {
|
10480
|
10517
|
// This also updates variables in the planner, elsewhere
|
10481
|
10518
|
Config_RetrieveSettings();
|
10482
|
10519
|
|
10483
|
|
- // Initialize current position based on home_offset
|
10484
|
|
- memcpy(current_position, home_offset, sizeof(home_offset));
|
|
10520
|
+ #if DISABLED(NO_WORKSPACE_OFFSETS)
|
|
10521
|
+ // Initialize current position based on home_offset
|
|
10522
|
+ COPY(current_position, home_offset);
|
|
10523
|
+ #else
|
|
10524
|
+ ZERO(current_position);
|
|
10525
|
+ #endif
|
10485
|
10526
|
|
10486
|
10527
|
// Vital to init stepper/planner equivalent for current_position
|
10487
|
10528
|
SYNC_PLAN_POSITION_KINEMATIC();
|