Browse Source

Use code_value_linear_units for known-linear axes

Scott Lahteine 7 years ago
parent
commit
69dfa54a84
1 changed files with 64 additions and 68 deletions
  1. 64
    68
      Marlin/Marlin_main.cpp

+ 64
- 68
Marlin/Marlin_main.cpp View File

@@ -1285,19 +1285,19 @@ inline bool code_value_bool() { return !code_has_value() || code_value_byte() >
1285 1285
     volumetric_unit_factor = pow(linear_unit_factor, 3.0);
1286 1286
   }
1287 1287
 
1288
-  inline float axis_unit_factor(int axis) {
1288
+  inline float axis_unit_factor(const AxisEnum axis) {
1289 1289
     return (axis >= E_AXIS && volumetric_enabled ? volumetric_unit_factor : linear_unit_factor);
1290 1290
   }
1291 1291
 
1292 1292
   inline float code_value_linear_units() { return code_value_float() * linear_unit_factor; }
1293
-  inline float code_value_axis_units(int axis) { return code_value_float() * axis_unit_factor(axis); }
1294
-  inline float code_value_per_axis_unit(int axis) { return code_value_float() / axis_unit_factor(axis); }
1293
+  inline float code_value_axis_units(const AxisEnum axis) { return code_value_float() * axis_unit_factor(axis); }
1294
+  inline float code_value_per_axis_unit(const AxisEnum axis) { return code_value_float() / axis_unit_factor(axis); }
1295 1295
 
1296 1296
 #else
1297 1297
 
1298
-  inline float code_value_linear_units() { return code_value_float(); }
1299
-  inline float code_value_axis_units(int axis) { UNUSED(axis); return code_value_float(); }
1300
-  inline float code_value_per_axis_unit(int axis) { UNUSED(axis); return code_value_float(); }
1298
+  #define code_value_linear_units() code_value_float()
1299
+  #define code_value_axis_units(A) code_value_float()
1300
+  #define code_value_per_axis_unit(A) code_value_float()
1301 1301
 
1302 1302
 #endif
1303 1303
 
@@ -3063,7 +3063,7 @@ static void homeaxis(const AxisEnum axis) {
3063 3063
 void gcode_get_destination() {
3064 3064
   LOOP_XYZE(i) {
3065 3065
     if (code_seen(axis_codes[i]))
3066
-      destination[i] = code_value_axis_units(i) + (axis_relative_modes[i] || relative_mode ? current_position[i] : 0);
3066
+      destination[i] = code_value_axis_units((AxisEnum)i) + (axis_relative_modes[i] || relative_mode ? current_position[i] : 0);
3067 3067
     else
3068 3068
       destination[i] = current_position[i];
3069 3069
   }
@@ -3232,7 +3232,7 @@ inline void gcode_G0_G1(
3232 3232
 
3233 3233
       float arc_offset[2] = { 0.0, 0.0 };
3234 3234
       if (code_seen('R')) {
3235
-        const float r = code_value_axis_units(X_AXIS),
3235
+        const float r = code_value_linear_units(),
3236 3236
                     x1 = current_position[X_AXIS], y1 = current_position[Y_AXIS],
3237 3237
                     x2 = destination[X_AXIS], y2 = destination[Y_AXIS];
3238 3238
         if (r && (x2 != x1 || y2 != y1)) {
@@ -3248,8 +3248,8 @@ inline void gcode_G0_G1(
3248 3248
         }
3249 3249
       }
3250 3250
       else {
3251
-        if (code_seen('I')) arc_offset[X_AXIS] = code_value_axis_units(X_AXIS);
3252
-        if (code_seen('J')) arc_offset[Y_AXIS] = code_value_axis_units(Y_AXIS);
3251
+        if (code_seen('I')) arc_offset[X_AXIS] = code_value_linear_units();
3252
+        if (code_seen('J')) arc_offset[Y_AXIS] = code_value_linear_units();
3253 3253
       }
3254 3254
 
3255 3255
       if (arc_offset[0] || arc_offset[1]) {
@@ -3302,10 +3302,10 @@ inline void gcode_G4() {
3302 3302
       gcode_get_destination();
3303 3303
 
3304 3304
       const float offset[] = {
3305
-        code_seen('I') ? code_value_axis_units(X_AXIS) : 0.0,
3306
-        code_seen('J') ? code_value_axis_units(Y_AXIS) : 0.0,
3307
-        code_seen('P') ? code_value_axis_units(X_AXIS) : 0.0,
3308
-        code_seen('Q') ? code_value_axis_units(Y_AXIS) : 0.0
3305
+        code_seen('I') ? code_value_linear_units() : 0.0,
3306
+        code_seen('J') ? code_value_linear_units() : 0.0,
3307
+        code_seen('P') ? code_value_linear_units() : 0.0,
3308
+        code_seen('Q') ? code_value_linear_units() : 0.0
3309 3309
       };
3310 3310
 
3311 3311
       plan_cubic_move(offset);
@@ -4023,7 +4023,7 @@ inline void gcode_G28() {
4023 4023
         }
4024 4024
 
4025 4025
         if (code_seen('Z')) {
4026
-          mbl.z_values[px][py] = code_value_axis_units(Z_AXIS);
4026
+          mbl.z_values[px][py] = code_value_linear_units();
4027 4027
         }
4028 4028
         else {
4029 4029
           SERIAL_CHAR('Z'); say_not_entered();
@@ -4033,7 +4033,7 @@ inline void gcode_G28() {
4033 4033
 
4034 4034
       case MeshSetZOffset:
4035 4035
         if (code_seen('Z')) {
4036
-          mbl.z_offset = code_value_axis_units(Z_AXIS);
4036
+          mbl.z_offset = code_value_linear_units();
4037 4037
         }
4038 4038
         else {
4039 4039
           SERIAL_CHAR('Z'); say_not_entered();
@@ -4305,7 +4305,7 @@ inline void gcode_G28() {
4305 4305
 
4306 4306
       #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
4307 4307
 
4308
-        zoffset = code_seen('Z') ? code_value_axis_units(Z_AXIS) : 0;
4308
+        zoffset = code_seen('Z') ? code_value_linear_units() : 0;
4309 4309
 
4310 4310
       #endif
4311 4311
 
@@ -4313,10 +4313,10 @@ inline void gcode_G28() {
4313 4313
 
4314 4314
         xy_probe_feedrate_mm_s = MMM_TO_MMS(code_seen('S') ? code_value_linear_units() : XY_PROBE_SPEED);
4315 4315
 
4316
-        left_probe_bed_position = code_seen('L') ? (int)code_value_axis_units(X_AXIS) : LOGICAL_X_POSITION(LEFT_PROBE_BED_POSITION);
4317
-        right_probe_bed_position = code_seen('R') ? (int)code_value_axis_units(X_AXIS) : LOGICAL_X_POSITION(RIGHT_PROBE_BED_POSITION);
4318
-        front_probe_bed_position = code_seen('F') ? (int)code_value_axis_units(Y_AXIS) : LOGICAL_Y_POSITION(FRONT_PROBE_BED_POSITION);
4319
-        back_probe_bed_position = code_seen('B') ? (int)code_value_axis_units(Y_AXIS) : LOGICAL_Y_POSITION(BACK_PROBE_BED_POSITION);
4316
+        left_probe_bed_position = code_seen('L') ? (int)code_value_linear_units() : LOGICAL_X_POSITION(LEFT_PROBE_BED_POSITION);
4317
+        right_probe_bed_position = code_seen('R') ? (int)code_value_linear_units() : LOGICAL_X_POSITION(RIGHT_PROBE_BED_POSITION);
4318
+        front_probe_bed_position = code_seen('F') ? (int)code_value_linear_units() : LOGICAL_Y_POSITION(FRONT_PROBE_BED_POSITION);
4319
+        back_probe_bed_position = code_seen('B') ? (int)code_value_linear_units() : LOGICAL_Y_POSITION(BACK_PROBE_BED_POSITION);
4320 4320
 
4321 4321
         const bool left_out_l = left_probe_bed_position < LOGICAL_X_POSITION(MIN_PROBE_X),
4322 4322
                    left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - (MIN_PROBE_EDGE),
@@ -4927,8 +4927,8 @@ inline void gcode_G28() {
4927 4927
    *     S = Stows the probe if 1 (default=1)
4928 4928
    */
4929 4929
   inline void gcode_G30() {
4930
-    float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
4931
-          Y_probe_location = code_seen('Y') ? code_value_axis_units(Y_AXIS) : current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
4930
+    float X_probe_location = code_seen('X') ? code_value_linear_units() : current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
4931
+          Y_probe_location = code_seen('Y') ? code_value_linear_units() : current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
4932 4932
 
4933 4933
     float pos[XYZ] = { X_probe_location, Y_probe_location, LOGICAL_Z_POSITION(0) };
4934 4934
     if (!position_is_reachable(pos, true)) return;
@@ -5431,13 +5431,13 @@ inline void gcode_G92() {
5431 5431
   LOOP_XYZE(i) {
5432 5432
     if (code_seen(axis_codes[i])) {
5433 5433
       #if IS_SCARA
5434
-        current_position[i] = code_value_axis_units(i);
5434
+        current_position[i] = code_value_axis_units((AxisEnum)i);
5435 5435
         if (i != E_AXIS) didXYZ = true;
5436 5436
       #else
5437 5437
         #if HAS_POSITION_SHIFT
5438
-          float p = current_position[i];
5438
+          const float p = current_position[i];
5439 5439
         #endif
5440
-        float v = code_value_axis_units(i);
5440
+        float v = code_value_axis_units((AxisEnum)i);
5441 5441
 
5442 5442
         current_position[i] = v;
5443 5443
 
@@ -6078,7 +6078,7 @@ inline void gcode_M42() {
6078 6078
 
6079 6079
     bool stow_probe_after_each = code_seen('E');
6080 6080
 
6081
-    float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
6081
+    float X_probe_location = code_seen('X') ? code_value_linear_units() : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
6082 6082
     #if DISABLED(DELTA)
6083 6083
       if (!WITHIN(X_probe_location, LOGICAL_X_POSITION(MIN_PROBE_X), LOGICAL_X_POSITION(MAX_PROBE_X))) {
6084 6084
         out_of_range_error(PSTR("X"));
@@ -6086,7 +6086,7 @@ inline void gcode_M42() {
6086 6086
       }
6087 6087
     #endif
6088 6088
 
6089
-    float Y_probe_location = code_seen('Y') ? code_value_axis_units(Y_AXIS) : Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER;
6089
+    float Y_probe_location = code_seen('Y') ? code_value_linear_units() : Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER;
6090 6090
     #if DISABLED(DELTA)
6091 6091
       if (!WITHIN(Y_probe_location, LOGICAL_Y_POSITION(MIN_PROBE_Y), LOGICAL_Y_POSITION(MAX_PROBE_Y))) {
6092 6092
         out_of_range_error(PSTR("Y"));
@@ -7063,7 +7063,7 @@ inline void gcode_M92() {
7063 7063
   LOOP_XYZE(i) {
7064 7064
     if (code_seen(axis_codes[i])) {
7065 7065
       if (i == E_AXIS) {
7066
-        float value = code_value_per_axis_unit(E_AXIS + TARGET_EXTRUDER);
7066
+        const float value = code_value_per_axis_unit(E_AXIS + TARGET_EXTRUDER);
7067 7067
         if (value < 20.0) {
7068 7068
           float factor = planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] / value; // increase e constants if M92 E14 is given for netfab.
7069 7069
           planner.max_jerk[E_AXIS] *= factor;
@@ -7250,7 +7250,7 @@ inline void gcode_M121() { endstops.enable_globally(false); }
7250 7250
     RUNPLAN(FILAMENT_CHANGE_RETRACT_FEEDRATE);
7251 7251
 
7252 7252
     // Lift Z axis
7253
-    const float z_lift = code_seen('Z') ? code_value_axis_units(Z_AXIS) :
7253
+    const float z_lift = code_seen('Z') ? code_value_linear_units() :
7254 7254
       #if defined(FILAMENT_CHANGE_Z_ADD) && FILAMENT_CHANGE_Z_ADD > 0
7255 7255
         FILAMENT_CHANGE_Z_ADD
7256 7256
       #else
@@ -7264,12 +7264,12 @@ inline void gcode_M121() { endstops.enable_globally(false); }
7264 7264
     }
7265 7265
 
7266 7266
     // Move XY axes to filament change position or given position
7267
-    destination[X_AXIS] = code_seen('X') ? code_value_axis_units(X_AXIS) : 0
7267
+    destination[X_AXIS] = code_seen('X') ? code_value_linear_units() : 0
7268 7268
       #ifdef FILAMENT_CHANGE_X_POS
7269 7269
         + FILAMENT_CHANGE_X_POS
7270 7270
       #endif
7271 7271
     ;
7272
-    destination[Y_AXIS] = code_seen('Y') ? code_value_axis_units(Y_AXIS) : 0
7272
+    destination[Y_AXIS] = code_seen('Y') ? code_value_linear_units() : 0
7273 7273
       #ifdef FILAMENT_CHANGE_Y_POS
7274 7274
         + FILAMENT_CHANGE_Y_POS
7275 7275
       #endif
@@ -7355,10 +7355,6 @@ inline void gcode_M200() {
7355 7355
         if (! filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
7356 7356
     }
7357 7357
   }
7358
-  else {
7359
-    //reserved for setting filament diameter via UFID or filament measuring device
7360
-    return;
7361
-  }
7362 7358
   calculate_volumetric_multipliers();
7363 7359
 }
7364 7360
 
@@ -7374,7 +7370,7 @@ inline void gcode_M201() {
7374 7370
   LOOP_XYZE(i) {
7375 7371
     if (code_seen(axis_codes[i])) {
7376 7372
       const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
7377
-      planner.max_acceleration_mm_per_s2[a] = code_value_axis_units(a);
7373
+      planner.max_acceleration_mm_per_s2[a] = code_value_axis_units((AxisEnum)a);
7378 7374
     }
7379 7375
   }
7380 7376
   // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
@@ -7384,7 +7380,7 @@ inline void gcode_M201() {
7384 7380
 #if 0 // Not used for Sprinter/grbl gen6
7385 7381
   inline void gcode_M202() {
7386 7382
     LOOP_XYZE(i) {
7387
-      if (code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value_axis_units(i) * planner.axis_steps_per_mm[i];
7383
+      if (code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value_axis_units((AxisEnum)i) * planner.axis_steps_per_mm[i];
7388 7384
     }
7389 7385
   }
7390 7386
 #endif
@@ -7402,7 +7398,7 @@ inline void gcode_M203() {
7402 7398
   LOOP_XYZE(i)
7403 7399
     if (code_seen(axis_codes[i])) {
7404 7400
       const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
7405
-      planner.max_feedrate_mm_s[a] = code_value_axis_units(a);
7401
+      planner.max_feedrate_mm_s[a] = code_value_axis_units((AxisEnum)a);
7406 7402
     }
7407 7403
 }
7408 7404
 
@@ -7449,10 +7445,10 @@ inline void gcode_M205() {
7449 7445
   if (code_seen('S')) planner.min_feedrate_mm_s = code_value_linear_units();
7450 7446
   if (code_seen('T')) planner.min_travel_feedrate_mm_s = code_value_linear_units();
7451 7447
   if (code_seen('B')) planner.min_segment_time = code_value_millis();
7452
-  if (code_seen('X')) planner.max_jerk[X_AXIS] = code_value_axis_units(X_AXIS);
7453
-  if (code_seen('Y')) planner.max_jerk[Y_AXIS] = code_value_axis_units(Y_AXIS);
7454
-  if (code_seen('Z')) planner.max_jerk[Z_AXIS] = code_value_axis_units(Z_AXIS);
7455
-  if (code_seen('E')) planner.max_jerk[E_AXIS] = code_value_axis_units(E_AXIS);
7448
+  if (code_seen('X')) planner.max_jerk[X_AXIS] = code_value_linear_units();
7449
+  if (code_seen('Y')) planner.max_jerk[Y_AXIS] = code_value_linear_units();
7450
+  if (code_seen('Z')) planner.max_jerk[Z_AXIS] = code_value_linear_units();
7451
+  if (code_seen('E')) planner.max_jerk[E_AXIS] = code_value_linear_units();
7456 7452
 }
7457 7453
 
7458 7454
 #if HAS_M206_COMMAND
@@ -7463,11 +7459,11 @@ inline void gcode_M205() {
7463 7459
   inline void gcode_M206() {
7464 7460
     LOOP_XYZ(i)
7465 7461
       if (code_seen(axis_codes[i]))
7466
-        set_home_offset((AxisEnum)i, code_value_axis_units(i));
7462
+        set_home_offset((AxisEnum)i, code_value_linear_units());
7467 7463
 
7468 7464
     #if ENABLED(MORGAN_SCARA)
7469
-      if (code_seen('T')) set_home_offset(A_AXIS, code_value_axis_units(A_AXIS)); // Theta
7470
-      if (code_seen('P')) set_home_offset(B_AXIS, code_value_axis_units(B_AXIS)); // Psi
7465
+      if (code_seen('T')) set_home_offset(A_AXIS, code_value_linear_units()); // Theta
7466
+      if (code_seen('P')) set_home_offset(B_AXIS, code_value_linear_units()); // Psi
7471 7467
     #endif
7472 7468
 
7473 7469
     SYNC_PLAN_POSITION_KINEMATIC();
@@ -7517,7 +7513,7 @@ inline void gcode_M205() {
7517 7513
     #endif
7518 7514
     LOOP_XYZ(i) {
7519 7515
       if (code_seen(axis_codes[i])) {
7520
-        endstop_adj[i] = code_value_axis_units(i);
7516
+        endstop_adj[i] = code_value_linear_units();
7521 7517
         #if ENABLED(DEBUG_LEVELING_FEATURE)
7522 7518
           if (DEBUGGING(LEVELING)) {
7523 7519
             SERIAL_ECHOPAIR("endstop_adj[", axis_codes[i]);
@@ -7539,7 +7535,7 @@ inline void gcode_M205() {
7539 7535
    * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
7540 7536
    */
7541 7537
   inline void gcode_M666() {
7542
-    if (code_seen('Z')) z_endstop_adj = code_value_axis_units(Z_AXIS);
7538
+    if (code_seen('Z')) z_endstop_adj = code_value_linear_units();
7543 7539
     SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj);
7544 7540
   }
7545 7541
 
@@ -7558,7 +7554,7 @@ inline void gcode_M205() {
7558 7554
   inline void gcode_M207() {
7559 7555
     if (code_seen('S')) retract_length = code_value_axis_units(E_AXIS);
7560 7556
     if (code_seen('F')) retract_feedrate_mm_s = MMM_TO_MMS(code_value_axis_units(E_AXIS));
7561
-    if (code_seen('Z')) retract_zlift = code_value_axis_units(Z_AXIS);
7557
+    if (code_seen('Z')) retract_zlift = code_value_linear_units();
7562 7558
     #if EXTRUDERS > 1
7563 7559
       if (code_seen('W')) retract_length_swap = code_value_axis_units(E_AXIS);
7564 7560
     #endif
@@ -7631,11 +7627,11 @@ inline void gcode_M211() {
7631 7627
   inline void gcode_M218() {
7632 7628
     if (get_target_extruder_from_command(218) || target_extruder == 0) return;
7633 7629
 
7634
-    if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value_axis_units(X_AXIS);
7635
-    if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value_axis_units(Y_AXIS);
7630
+    if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value_linear_units();
7631
+    if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value_linear_units();
7636 7632
 
7637 7633
     #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_EXTRUDER)
7638
-      if (code_seen('Z')) hotend_offset[Z_AXIS][target_extruder] = code_value_axis_units(Z_AXIS);
7634
+      if (code_seen('Z')) hotend_offset[Z_AXIS][target_extruder] = code_value_linear_units();
7639 7635
     #endif
7640 7636
 
7641 7637
     SERIAL_ECHO_START;
@@ -8285,11 +8281,11 @@ void quickstop_stepper() {
8285 8281
     int8_t px = 0, py = 0;
8286 8282
     float z = 0;
8287 8283
     bool hasX, hasY, hasZ, hasI, hasJ;
8288
-    if ((hasX = code_seen('X'))) px = mbl.probe_index_x(code_value_axis_units(X_AXIS));
8289
-    if ((hasY = code_seen('Y'))) py = mbl.probe_index_y(code_value_axis_units(Y_AXIS));
8290
-    if ((hasI = code_seen('I'))) px = code_value_axis_units(X_AXIS);
8291
-    if ((hasJ = code_seen('J'))) py = code_value_axis_units(Y_AXIS);
8292
-    if ((hasZ = code_seen('Z'))) z = code_value_axis_units(Z_AXIS);
8284
+    if ((hasX = code_seen('X'))) px = mbl.probe_index_x(code_value_linear_units());
8285
+    if ((hasY = code_seen('Y'))) py = mbl.probe_index_y(code_value_linear_units());
8286
+    if ((hasI = code_seen('I'))) px = code_value_linear_units();
8287
+    if ((hasJ = code_seen('J'))) py = code_value_linear_units();
8288
+    if ((hasZ = code_seen('Z'))) z = code_value_linear_units();
8293 8289
 
8294 8290
     if (hasX && hasY && hasZ) {
8295 8291
 
@@ -8325,9 +8321,9 @@ void quickstop_stepper() {
8325 8321
     int8_t px = 0, py = 0;
8326 8322
     float z = 0;
8327 8323
     bool hasI, hasJ, hasZ;
8328
-    if ((hasI = code_seen('I'))) px = code_value_axis_units(X_AXIS);
8329
-    if ((hasJ = code_seen('J'))) py = code_value_axis_units(Y_AXIS);
8330
-    if ((hasZ = code_seen('Z'))) z = code_value_axis_units(Z_AXIS);
8324
+    if ((hasI = code_seen('I'))) px = code_value_linear_units();
8325
+    if ((hasJ = code_seen('J'))) py = code_value_linear_units();
8326
+    if ((hasZ = code_seen('Z'))) z = code_value_linear_units();
8331 8327
 
8332 8328
     if (hasI && hasJ && hasZ) {
8333 8329
       if (WITHIN(px, 0, GRID_MAX_POINTS_X - 1) && WITHIN(py, 0, GRID_MAX_POINTS_X - 1)) {
@@ -8474,7 +8470,7 @@ inline void gcode_M503() {
8474 8470
     SERIAL_ECHO_START;
8475 8471
     SERIAL_ECHOPGM(MSG_ZPROBE_ZOFFSET " ");
8476 8472
     if (code_seen('Z')) {
8477
-      const float value = code_value_axis_units(Z_AXIS);
8473
+      const float value = code_value_linear_units();
8478 8474
       if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
8479 8475
         zprobe_zoffset = value;
8480 8476
         refresh_zprobe_zoffset();
@@ -8557,7 +8553,7 @@ inline void gcode_M503() {
8557 8553
     RUNPLAN(FILAMENT_CHANGE_RETRACT_FEEDRATE);
8558 8554
 
8559 8555
     // Lift Z axis
8560
-    float z_lift = code_seen('Z') ? code_value_axis_units(Z_AXIS) :
8556
+    float z_lift = code_seen('Z') ? code_value_linear_units() :
8561 8557
       #if defined(FILAMENT_CHANGE_Z_ADD) && FILAMENT_CHANGE_Z_ADD > 0
8562 8558
         FILAMENT_CHANGE_Z_ADD
8563 8559
       #else
@@ -8572,12 +8568,12 @@ inline void gcode_M503() {
8572 8568
     }
8573 8569
 
8574 8570
     // Move XY axes to filament exchange position
8575
-    if (code_seen('X')) destination[X_AXIS] = code_value_axis_units(X_AXIS);
8571
+    if (code_seen('X')) destination[X_AXIS] = code_value_linear_units();
8576 8572
     #ifdef FILAMENT_CHANGE_X_POS
8577 8573
       else destination[X_AXIS] = FILAMENT_CHANGE_X_POS;
8578 8574
     #endif
8579 8575
 
8580
-    if (code_seen('Y')) destination[Y_AXIS] = code_value_axis_units(Y_AXIS);
8576
+    if (code_seen('Y')) destination[Y_AXIS] = code_value_linear_units();
8581 8577
     #ifdef FILAMENT_CHANGE_Y_POS
8582 8578
       else destination[Y_AXIS] = FILAMENT_CHANGE_Y_POS;
8583 8579
     #endif
@@ -8766,7 +8762,7 @@ inline void gcode_M503() {
8766 8762
       case DXC_AUTO_PARK_MODE:
8767 8763
         break;
8768 8764
       case DXC_DUPLICATION_MODE:
8769
-        if (code_seen('X')) duplicate_extruder_x_offset = max(code_value_axis_units(X_AXIS), X2_MIN_POS - x_home_pos(0));
8765
+        if (code_seen('X')) duplicate_extruder_x_offset = max(code_value_linear_units(), X2_MIN_POS - x_home_pos(0));
8770 8766
         if (code_seen('R')) duplicate_extruder_temp_offset = code_value_temp_diff();
8771 8767
         SERIAL_ECHO_START;
8772 8768
         SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
@@ -9127,7 +9123,7 @@ inline void gcode_M355() {
9127 9123
    *
9128 9124
    */
9129 9125
   inline void gcode_M163() {
9130
-    int mix_index = code_seen('S') ? code_value_int() : 0;
9126
+    const int mix_index = code_seen('S') ? code_value_int() : 0;
9131 9127
     if (mix_index < MIXING_STEPPERS) {
9132 9128
       float mix_value = code_seen('P') ? code_value_float() : 0.0;
9133 9129
       NOLESS(mix_value, 0.0);
@@ -9144,7 +9140,7 @@ inline void gcode_M355() {
9144 9140
      *
9145 9141
      */
9146 9142
     inline void gcode_M164() {
9147
-      int tool_index = code_seen('S') ? code_value_int() : 0;
9143
+      const int tool_index = code_seen('S') ? code_value_int() : 0;
9148 9144
       if (tool_index < MIXING_VIRTUAL_TOOLS) {
9149 9145
         normalize_mix();
9150 9146
         for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
@@ -9542,7 +9538,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
9542 9538
 
9543 9539
     tool_change(
9544 9540
       tmp_extruder,
9545
-      code_seen('F') ? MMM_TO_MMS(code_value_axis_units(X_AXIS)) : 0.0,
9541
+      code_seen('F') ? MMM_TO_MMS(code_value_linear_units()) : 0.0,
9546 9542
       (tmp_extruder == active_extruder) || (code_seen('S') && code_value_bool())
9547 9543
     );
9548 9544
 

Loading…
Cancel
Save