Преглед на файлове

Implement NO_WORKSPACE_OFFSETS

Scott Lahteine преди 8 години
родител
ревизия
5f7e85398b
променени са 3 файла, в които са добавени 221 реда и са изтрити 159 реда
  1. 25
    14
      Marlin/Marlin.h
  2. 172
    134
      Marlin/Marlin_main.cpp
  3. 24
    11
      Marlin/configuration_store.cpp

+ 25
- 14
Marlin/Marlin.h Целия файл

@@ -275,15 +275,34 @@ extern volatile bool wait_for_heatup;
275 275
 #endif
276 276
 
277 277
 extern float current_position[NUM_AXIS];
278
-extern float position_shift[XYZ];
279
-extern float home_offset[XYZ];
278
+
279
+// Workspace offsets
280
+#if DISABLED(NO_WORKSPACE_OFFSETS)
281
+  extern float position_shift[XYZ];
282
+  extern float home_offset[XYZ];
283
+  #define LOGICAL_POSITION(POS, AXIS) ((POS) + home_offset[AXIS] + position_shift[AXIS])
284
+  #define RAW_POSITION(POS, AXIS)     ((POS) - home_offset[AXIS] - position_shift[AXIS])
285
+#else
286
+  #define LOGICAL_POSITION(POS, AXIS) (POS)
287
+  #define RAW_POSITION(POS, AXIS)     (POS)
288
+#endif
289
+
290
+#define LOGICAL_X_POSITION(POS)     LOGICAL_POSITION(POS, X_AXIS)
291
+#define LOGICAL_Y_POSITION(POS)     LOGICAL_POSITION(POS, Y_AXIS)
292
+#define LOGICAL_Z_POSITION(POS)     LOGICAL_POSITION(POS, Z_AXIS)
293
+#define RAW_X_POSITION(POS)         RAW_POSITION(POS, X_AXIS)
294
+#define RAW_Y_POSITION(POS)         RAW_POSITION(POS, Y_AXIS)
295
+#define RAW_Z_POSITION(POS)         RAW_POSITION(POS, Z_AXIS)
296
+#define RAW_CURRENT_POSITION(AXIS)  RAW_POSITION(current_position[AXIS], AXIS)
280 297
 
281 298
 #if HOTENDS > 1
282 299
   extern float hotend_offset[XYZ][HOTENDS];
283 300
 #endif
284 301
 
285 302
 // Software Endstops
286
-void update_software_endstops(AxisEnum axis);
303
+extern float soft_endstop_min[XYZ];
304
+extern float soft_endstop_max[XYZ];
305
+
287 306
 #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
288 307
   extern bool soft_endstops_enabled;
289 308
   void clamp_to_software_endstops(float target[XYZ]);
@@ -291,18 +310,10 @@ void update_software_endstops(AxisEnum axis);
291 310
   #define soft_endstops_enabled false
292 311
   #define clamp_to_software_endstops(x) NOOP
293 312
 #endif
294
-extern float soft_endstop_min[XYZ];
295
-extern float soft_endstop_max[XYZ];
296 313
 
297
-#define LOGICAL_POSITION(POS, AXIS) ((POS) + home_offset[AXIS] + position_shift[AXIS])
298
-#define RAW_POSITION(POS, AXIS)     ((POS) - home_offset[AXIS] - position_shift[AXIS])
299
-#define LOGICAL_X_POSITION(POS)     LOGICAL_POSITION(POS, X_AXIS)
300
-#define LOGICAL_Y_POSITION(POS)     LOGICAL_POSITION(POS, Y_AXIS)
301
-#define LOGICAL_Z_POSITION(POS)     LOGICAL_POSITION(POS, Z_AXIS)
302
-#define RAW_X_POSITION(POS)         RAW_POSITION(POS, X_AXIS)
303
-#define RAW_Y_POSITION(POS)         RAW_POSITION(POS, Y_AXIS)
304
-#define RAW_Z_POSITION(POS)         RAW_POSITION(POS, Z_AXIS)
305
-#define RAW_CURRENT_POSITION(AXIS)  RAW_POSITION(current_position[AXIS], AXIS)
314
+#if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
315
+  void update_software_endstops(const AxisEnum axis);
316
+#endif
306 317
 
307 318
 // GCode support for external objects
308 319
 bool code_seen(char);

+ 172
- 134
Marlin/Marlin_main.cpp Целия файл

@@ -396,12 +396,16 @@ 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
+#endif
405 409
 
406 410
 // Software Endstops are based on the configured limits.
407 411
 #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
@@ -1333,76 +1337,83 @@ bool get_target_extruder_from_command(int code) {
1333 1337
 
1334 1338
 #endif // DUAL_X_CARRIAGE
1335 1339
 
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);
1340
+#if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
1347 1341
 
1348
-  #if ENABLED(DUAL_X_CARRIAGE)
1349
-    if (axis == X_AXIS) {
1342
+  /**
1343
+   * Software endstops can be used to monitor the open end of
1344
+   * an axis that has a hardware endstop on the other end. Or
1345
+   * they can prevent axes from moving past endstops and grinding.
1346
+   *
1347
+   * To keep doing their job as the coordinate system changes,
1348
+   * the software endstop positions must be refreshed to remain
1349
+   * at the same positions relative to the machine.
1350
+   */
1351
+  void update_software_endstops(const AxisEnum axis) {
1352
+    const float offs = LOGICAL_POSITION(0, axis);
1350 1353
 
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);
1354
+    #if ENABLED(DUAL_X_CARRIAGE)
1355
+      if (axis == X_AXIS) {
1353 1356
 
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;
1357
+        // In Dual X mode hotend_offset[X] is T1's home position
1358
+        float dual_max_x = max(hotend_offset[X_AXIS][1], X2_MAX_POS);
1359
+
1360
+        if (active_extruder != 0) {
1361
+          // T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger)
1362
+          soft_endstop_min[X_AXIS] = X2_MIN_POS + offs;
1363
+          soft_endstop_max[X_AXIS] = dual_max_x + offs;
1364
+        }
1365
+        else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
1366
+          // In Duplication Mode, T0 can move as far left as X_MIN_POS
1367
+          // but not so far to the right that T1 would move past the end
1368
+          soft_endstop_min[X_AXIS] = base_min_pos(X_AXIS) + offs;
1369
+          soft_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs;
1370
+        }
1371
+        else {
1372
+          // In other modes, T0 can move from X_MIN_POS to X_MAX_POS
1373
+          soft_endstop_min[axis] = base_min_pos(axis) + offs;
1374
+          soft_endstop_max[axis] = base_max_pos(axis) + offs;
1375
+        }
1369 1376
       }
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
1377
+    #else
1378
+      soft_endstop_min[axis] = base_min_pos(axis) + offs;
1379
+      soft_endstop_max[axis] = base_max_pos(axis) + offs;
1380
+    #endif
1375 1381
 
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
1382
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
1383
+      if (DEBUGGING(LEVELING)) {
1384
+        SERIAL_ECHOPAIR("For ", axis_codes[axis]);
1385
+        #if DISABLED(NO_WORKSPACE_OFFSETS)
1386
+          SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]);
1387
+          SERIAL_ECHOPAIR("\n position_shift = ", position_shift[axis]);
1388
+        #endif
1389
+        SERIAL_ECHOPAIR("\n soft_endstop_min = ", soft_endstop_min[axis]);
1390
+        SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]);
1391
+      }
1392
+    #endif
1385 1393
 
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
1394
+    #if ENABLED(DELTA)
1395
+      if (axis == Z_AXIS)
1396
+        delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top();
1397
+    #endif
1398
+  }
1390 1399
 
1391
-}
1400
+#endif // NO_WORKSPACE_OFFSETS
1392 1401
 
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
-}
1402
+#if DISABLED(NO_WORKSPACE_OFFSETS)
1403
+  /**
1404
+   * Change the home offset for an axis, update the current
1405
+   * position and the software endstops to retain the same
1406
+   * relative distance to the new home.
1407
+   *
1408
+   * Since this changes the current_position, code should
1409
+   * call sync_plan_position soon after this.
1410
+   */
1411
+  static void set_home_offset(AxisEnum axis, float v) {
1412
+    current_position[axis] += v - home_offset[axis];
1413
+    home_offset[axis] = v;
1414
+    update_software_endstops(axis);
1415
+  }
1416
+#endif // NO_WORKSPACE_OFFSETS
1406 1417
 
1407 1418
 /**
1408 1419
  * Set an axis' current position to its home position (after homing).
@@ -1433,8 +1444,10 @@ static void set_axis_is_at_home(AxisEnum axis) {
1433 1444
 
1434 1445
   axis_known_position[axis] = axis_homed[axis] = true;
1435 1446
 
1436
-  position_shift[axis] = 0;
1437
-  update_software_endstops(axis);
1447
+  #if DISABLED(NO_WORKSPACE_OFFSETS)
1448
+    position_shift[axis] = 0;
1449
+    update_software_endstops(axis);
1450
+  #endif
1438 1451
 
1439 1452
   #if ENABLED(DUAL_X_CARRIAGE)
1440 1453
     if (axis == X_AXIS && (active_extruder == 1 || dual_x_carriage_mode == DXC_DUPLICATION_MODE)) {
@@ -1507,8 +1520,10 @@ static void set_axis_is_at_home(AxisEnum axis) {
1507 1520
 
1508 1521
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1509 1522
     if (DEBUGGING(LEVELING)) {
1510
-      SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]);
1511
-      SERIAL_ECHOLNPAIR("] = ", home_offset[axis]);
1523
+      #if DISABLED(NO_WORKSPACE_OFFSETS)
1524
+        SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]);
1525
+        SERIAL_ECHOLNPAIR("] = ", home_offset[axis]);
1526
+      #endif
1512 1527
       DEBUG_POS("", current_position);
1513 1528
       SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis_codes[axis]);
1514 1529
       SERIAL_CHAR(')');
@@ -4603,8 +4618,10 @@ inline void gcode_G92() {
4603 4618
 
4604 4619
         if (i != E_AXIS) {
4605 4620
           didXYZ = true;
4606
-          position_shift[i] += v - p; // Offset the coordinate space
4607
-          update_software_endstops((AxisEnum)i);
4621
+          #if DISABLED(NO_WORKSPACE_OFFSETS)
4622
+            position_shift[i] += v - p; // Offset the coordinate space
4623
+            update_software_endstops((AxisEnum)i);
4624
+          #endif
4608 4625
         }
4609 4626
       #endif
4610 4627
     }
@@ -6334,22 +6351,26 @@ inline void gcode_M205() {
6334 6351
   if (code_seen('E')) planner.max_jerk[E_AXIS] = code_value_axis_units(E_AXIS);
6335 6352
 }
6336 6353
 
6337
-/**
6338
- * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
6339
- */
6340
-inline void gcode_M206() {
6341
-  LOOP_XYZ(i)
6342
-    if (code_seen(axis_codes[i]))
6343
-      set_home_offset((AxisEnum)i, code_value_axis_units(i));
6354
+#if DISABLED(NO_WORKSPACE_OFFSETS)
6344 6355
 
6345
-  #if ENABLED(MORGAN_SCARA)
6346
-    if (code_seen('T')) set_home_offset(A_AXIS, code_value_axis_units(A_AXIS)); // Theta
6347
-    if (code_seen('P')) set_home_offset(B_AXIS, code_value_axis_units(B_AXIS)); // Psi
6348
-  #endif
6356
+  /**
6357
+   * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
6358
+   */
6359
+  inline void gcode_M206() {
6360
+    LOOP_XYZ(i)
6361
+      if (code_seen(axis_codes[i]))
6362
+        set_home_offset((AxisEnum)i, code_value_axis_units(i));
6349 6363
 
6350
-  SYNC_PLAN_POSITION_KINEMATIC();
6351
-  report_current_position();
6352
-}
6364
+    #if ENABLED(MORGAN_SCARA)
6365
+      if (code_seen('T')) set_home_offset(A_AXIS, code_value_axis_units(A_AXIS)); // Theta
6366
+      if (code_seen('P')) set_home_offset(B_AXIS, code_value_axis_units(B_AXIS)); // Psi
6367
+    #endif
6368
+
6369
+    SYNC_PLAN_POSITION_KINEMATIC();
6370
+    report_current_position();
6371
+  }
6372
+
6373
+#endif // NO_WORKSPACE_OFFSETS
6353 6374
 
6354 6375
 #if ENABLED(DELTA)
6355 6376
   /**
@@ -7173,45 +7194,49 @@ void quickstop_stepper() {
7173 7194
 
7174 7195
 #endif
7175 7196
 
7176
-/**
7177
- * M428: Set home_offset based on the distance between the
7178
- *       current_position and the nearest "reference point."
7179
- *       If an axis is past center its endstop position
7180
- *       is the reference-point. Otherwise it uses 0. This allows
7181
- *       the Z offset to be set near the bed when using a max endstop.
7182
- *
7183
- *       M428 can't be used more than 2cm away from 0 or an endstop.
7184
- *
7185
- *       Use M206 to set these values directly.
7186
- */
7187
-inline void gcode_M428() {
7188
-  bool err = false;
7189
-  LOOP_XYZ(i) {
7190
-    if (axis_homed[i]) {
7191
-      float base = (current_position[i] > (soft_endstop_min[i] + soft_endstop_max[i]) * 0.5) ? base_home_pos((AxisEnum)i) : 0,
7192
-            diff = current_position[i] - LOGICAL_POSITION(base, i);
7193
-      if (diff > -20 && diff < 20) {
7194
-        set_home_offset((AxisEnum)i, home_offset[i] - diff);
7195
-      }
7196
-      else {
7197
-        SERIAL_ERROR_START;
7198
-        SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
7199
-        LCD_ALERTMESSAGEPGM("Err: Too far!");
7200
-        BUZZ(200, 40);
7201
-        err = true;
7202
-        break;
7197
+#if DISABLED(NO_WORKSPACE_OFFSETS)
7198
+
7199
+  /**
7200
+   * M428: Set home_offset based on the distance between the
7201
+   *       current_position and the nearest "reference point."
7202
+   *       If an axis is past center its endstop position
7203
+   *       is the reference-point. Otherwise it uses 0. This allows
7204
+   *       the Z offset to be set near the bed when using a max endstop.
7205
+   *
7206
+   *       M428 can't be used more than 2cm away from 0 or an endstop.
7207
+   *
7208
+   *       Use M206 to set these values directly.
7209
+   */
7210
+  inline void gcode_M428() {
7211
+    bool err = false;
7212
+    LOOP_XYZ(i) {
7213
+      if (axis_homed[i]) {
7214
+        float base = (current_position[i] > (soft_endstop_min[i] + soft_endstop_max[i]) * 0.5) ? base_home_pos((AxisEnum)i) : 0,
7215
+              diff = current_position[i] - LOGICAL_POSITION(base, i);
7216
+        if (diff > -20 && diff < 20) {
7217
+          set_home_offset((AxisEnum)i, home_offset[i] - diff);
7218
+        }
7219
+        else {
7220
+          SERIAL_ERROR_START;
7221
+          SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
7222
+          LCD_ALERTMESSAGEPGM("Err: Too far!");
7223
+          BUZZ(200, 40);
7224
+          err = true;
7225
+          break;
7226
+        }
7203 7227
       }
7204 7228
     }
7205
-  }
7206 7229
 
7207
-  if (!err) {
7208
-    SYNC_PLAN_POSITION_KINEMATIC();
7209
-    report_current_position();
7210
-    LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
7211
-    BUZZ(200, 659);
7212
-    BUZZ(200, 698);
7230
+    if (!err) {
7231
+      SYNC_PLAN_POSITION_KINEMATIC();
7232
+      report_current_position();
7233
+      LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
7234
+      BUZZ(200, 659);
7235
+      BUZZ(200, 698);
7236
+    }
7213 7237
   }
7214
-}
7238
+
7239
+#endif // NO_WORKSPACE_OFFSETS
7215 7240
 
7216 7241
 /**
7217 7242
  * M500: Store settings in EEPROM
@@ -8081,10 +8106,14 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
8081 8106
           // The newly-selected extruder XY is actually at...
8082 8107
           current_position[X_AXIS] += xydiff[X_AXIS];
8083 8108
           current_position[Y_AXIS] += xydiff[Y_AXIS];
8084
-          for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
8085
-            position_shift[i] += xydiff[i];
8086
-            update_software_endstops((AxisEnum)i);
8087
-          }
8109
+          #if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE)
8110
+            for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
8111
+              #if DISABLED(NO_WORKSPACE_OFFSETS)
8112
+                position_shift[i] += xydiff[i];
8113
+              #endif
8114
+              update_software_endstops((AxisEnum)i);
8115
+            }
8116
+          #endif
8088 8117
 
8089 8118
           // Set the new active extruder
8090 8119
           active_extruder = tmp_extruder;
@@ -8639,9 +8668,12 @@ void process_next_command() {
8639 8668
       case 205: //M205: Set advanced settings
8640 8669
         gcode_M205();
8641 8670
         break;
8642
-      case 206: // M206: Set home offsets
8643
-        gcode_M206();
8644
-        break;
8671
+
8672
+      #if DISABLED(NO_WORKSPACE_OFFSETS)
8673
+        case 206: // M206: Set home offsets
8674
+          gcode_M206();
8675
+          break;
8676
+      #endif
8645 8677
 
8646 8678
       #if ENABLED(DELTA)
8647 8679
         case 665: // M665: Set delta configurations
@@ -8805,9 +8837,11 @@ void process_next_command() {
8805 8837
           break;
8806 8838
       #endif
8807 8839
 
8808
-      case 428: // M428: Apply current_position to home_offset
8809
-        gcode_M428();
8810
-        break;
8840
+      #if DISABLED(NO_WORKSPACE_OFFSETS)
8841
+        case 428: // M428: Apply current_position to home_offset
8842
+          gcode_M428();
8843
+          break;
8844
+      #endif
8811 8845
 
8812 8846
       case 500: // M500: Store settings in EEPROM
8813 8847
         gcode_M500();
@@ -10488,8 +10522,12 @@ void setup() {
10488 10522
   // This also updates variables in the planner, elsewhere
10489 10523
   Config_RetrieveSettings();
10490 10524
 
10491
-  // Initialize current position based on home_offset
10492
-  memcpy(current_position, home_offset, sizeof(home_offset));
10525
+  #if DISABLED(NO_WORKSPACE_OFFSETS)
10526
+    // Initialize current position based on home_offset
10527
+    memcpy(current_position, home_offset, sizeof(home_offset));
10528
+  #else
10529
+    ZERO(current_position);
10530
+  #endif
10493 10531
 
10494 10532
   // Vital to init stepper/planner equivalent for current_position
10495 10533
   SYNC_PLAN_POSITION_KINEMATIC();

+ 24
- 11
Marlin/configuration_store.cpp Целия файл

@@ -171,8 +171,10 @@ void Config_Postprocess() {
171 171
 
172 172
   calculate_volumetric_multipliers();
173 173
 
174
-  // Software endstops depend on home_offset
175
-  LOOP_XYZ(i) update_software_endstops((AxisEnum)i);
174
+  #if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
175
+    // Software endstops depend on home_offset
176
+    LOOP_XYZ(i) update_software_endstops((AxisEnum)i);
177
+  #endif
176 178
 }
177 179
 
178 180
 #if ENABLED(EEPROM_SETTINGS)
@@ -251,6 +253,9 @@ void Config_Postprocess() {
251 253
     EEPROM_WRITE(planner.min_travel_feedrate_mm_s);
252 254
     EEPROM_WRITE(planner.min_segment_time);
253 255
     EEPROM_WRITE(planner.max_jerk);
256
+    #if ENABLED(NO_WORKSPACE_OFFSETS)
257
+      float home_offset[XYZ] = { 0 };
258
+    #endif
254 259
     EEPROM_WRITE(home_offset);
255 260
 
256 261
     #if HOTENDS > 1
@@ -498,6 +503,10 @@ void Config_Postprocess() {
498 503
       EEPROM_READ(planner.min_travel_feedrate_mm_s);
499 504
       EEPROM_READ(planner.min_segment_time);
500 505
       EEPROM_READ(planner.max_jerk);
506
+
507
+      #if ENABLED(NO_WORKSPACE_OFFSETS)
508
+        float home_offset[XYZ];
509
+      #endif
501 510
       EEPROM_READ(home_offset);
502 511
 
503 512
       #if HOTENDS > 1
@@ -726,7 +735,9 @@ void Config_ResetDefault() {
726 735
   planner.max_jerk[Y_AXIS] = DEFAULT_YJERK;
727 736
   planner.max_jerk[Z_AXIS] = DEFAULT_ZJERK;
728 737
   planner.max_jerk[E_AXIS] = DEFAULT_EJERK;
729
-  home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0;
738
+  #if DISABLED(NO_WORKSPACE_OFFSETS)
739
+    ZERO(home_offset);
740
+  #endif
730 741
 
731 742
   #if HOTENDS > 1
732 743
     constexpr float tmp4[XYZ][HOTENDS] = {
@@ -937,15 +948,17 @@ void Config_ResetDefault() {
937 948
     SERIAL_ECHOPAIR(" E", planner.max_jerk[E_AXIS]);
938 949
     SERIAL_EOL;
939 950
 
940
-    CONFIG_ECHO_START;
941
-    if (!forReplay) {
942
-      SERIAL_ECHOLNPGM("Home offset (mm)");
951
+    #if DISABLED(NO_WORKSPACE_OFFSETS)
943 952
       CONFIG_ECHO_START;
944
-    }
945
-    SERIAL_ECHOPAIR("  M206 X", home_offset[X_AXIS]);
946
-    SERIAL_ECHOPAIR(" Y", home_offset[Y_AXIS]);
947
-    SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS]);
948
-    SERIAL_EOL;
953
+      if (!forReplay) {
954
+        SERIAL_ECHOLNPGM("Home offset (mm)");
955
+        CONFIG_ECHO_START;
956
+      }
957
+      SERIAL_ECHOPAIR("  M206 X", home_offset[X_AXIS]);
958
+      SERIAL_ECHOPAIR(" Y", home_offset[Y_AXIS]);
959
+      SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS]);
960
+      SERIAL_EOL;
961
+    #endif
949 962
 
950 963
     #if HOTENDS > 1
951 964
       CONFIG_ECHO_START;

Loading…
Отказ
Запис