ソースを参照

Operate in Native Machine Space

Scott Lahteine 6年前
コミット
640526f0c8

+ 16
- 18
Marlin/G26_Mesh_Validation_Tool.cpp ファイルの表示

@@ -279,7 +279,7 @@
279 279
 
280 280
         // If this mesh location is outside the printable_radius, skip it.
281 281
 
282
-        if (!position_is_reachable_raw_xy(circle_x, circle_y)) continue;
282
+        if (!position_is_reachable(circle_x, circle_y)) continue;
283 283
 
284 284
         xi = location.x_index;  // Just to shrink the next few lines and make them easier to understand
285 285
         yi = location.y_index;
@@ -328,16 +328,16 @@
328 328
           if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
329 329
           if (tmp_div_30 > 11) tmp_div_30 -= 360 / 30;
330 330
 
331
-          float x = circle_x + cos_table[tmp_div_30],    // for speed, these are now a lookup table entry
332
-                y = circle_y + sin_table[tmp_div_30],
331
+          float rx = circle_x + cos_table[tmp_div_30],    // for speed, these are now a lookup table entry
332
+                ry = circle_y + sin_table[tmp_div_30],
333 333
                 xe = circle_x + cos_table[tmp_div_30 + 1],
334 334
                 ye = circle_y + sin_table[tmp_div_30 + 1];
335 335
           #if IS_KINEMATIC
336 336
             // Check to make sure this segment is entirely on the bed, skip if not.
337
-            if (!position_is_reachable_raw_xy(x, y) || !position_is_reachable_raw_xy(xe, ye)) continue;
338
-          #else                                              // not, we need to skip
339
-            x  = constrain(x, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
340
-            y  = constrain(y, Y_MIN_POS + 1, Y_MAX_POS - 1);
337
+            if (!position_is_reachable(rx, ry) || !position_is_reachable(xe, ye)) continue;
338
+          #else                                               // not, we need to skip
339
+            rx = constrain(rx, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
340
+            ry = constrain(ry, Y_MIN_POS + 1, Y_MAX_POS - 1);
341 341
             xe = constrain(xe, X_MIN_POS + 1, X_MAX_POS - 1);
342 342
             ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
343 343
           #endif
@@ -353,7 +353,7 @@
353 353
           //  debug_current_and_destination(seg_msg);
354 354
           //}
355 355
 
356
-          print_line_from_here_to_there(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y), g26_layer_height, LOGICAL_X_POSITION(xe), LOGICAL_Y_POSITION(ye), g26_layer_height);
356
+          print_line_from_here_to_there(rx, ry, g26_layer_height, xe, ye, g26_layer_height);
357 357
 
358 358
         }
359 359
         if (look_for_lines_to_connect())
@@ -459,7 +459,7 @@
459 459
               sy = ey = constrain(mesh_index_to_ypos(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
460 460
               ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
461 461
 
462
-              if (position_is_reachable_raw_xy(sx, sy) && position_is_reachable_raw_xy(ex, ey)) {
462
+              if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
463 463
 
464 464
                 if (g26_debug_flag) {
465 465
                   SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx);
@@ -470,8 +470,7 @@
470 470
                   SERIAL_EOL();
471 471
                   //debug_current_and_destination(PSTR("Connecting horizontal line."));
472 472
                 }
473
-
474
-                print_line_from_here_to_there(LOGICAL_X_POSITION(sx), LOGICAL_Y_POSITION(sy), g26_layer_height, LOGICAL_X_POSITION(ex), LOGICAL_Y_POSITION(ey), g26_layer_height);
473
+                print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
475 474
               }
476 475
               bit_set(horizontal_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if we skipped it
477 476
             }
@@ -493,7 +492,7 @@
493 492
                 sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1);
494 493
                 ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
495 494
 
496
-                if (position_is_reachable_raw_xy(sx, sy) && position_is_reachable_raw_xy(ex, ey)) {
495
+                if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
497 496
 
498 497
                   if (g26_debug_flag) {
499 498
                     SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx);
@@ -504,7 +503,7 @@
504 503
                     SERIAL_EOL();
505 504
                     debug_current_and_destination(PSTR("Connecting vertical line."));
506 505
                   }
507
-                  print_line_from_here_to_there(LOGICAL_X_POSITION(sx), LOGICAL_Y_POSITION(sy), g26_layer_height, LOGICAL_X_POSITION(ex), LOGICAL_Y_POSITION(ey), g26_layer_height);
506
+                  print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
508 507
                 }
509 508
                 bit_set(vertical_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if skipped
510 509
               }
@@ -596,9 +595,8 @@
596 595
 
597 596
     // If the end point of the line is closer to the nozzle, flip the direction,
598 597
     // moving from the end to the start. On very small lines the optimization isn't worth it.
599
-    if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length)) {
598
+    if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length))
600 599
       return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
601
-    }
602 600
 
603 601
     // Decide whether to retract & bump
604 602
 
@@ -737,9 +735,9 @@
737 735
       return UBL_ERR;
738 736
     }
739 737
 
740
-    g26_x_pos = parser.linearval('X', current_position[X_AXIS]);
741
-    g26_y_pos = parser.linearval('Y', current_position[Y_AXIS]);
742
-    if (!position_is_reachable_xy(g26_x_pos, g26_y_pos)) {
738
+    g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS];
739
+    g26_y_pos = parser.seenval('Y') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[Y_AXIS];
740
+    if (!position_is_reachable(g26_x_pos, g26_y_pos)) {
743 741
       SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
744 742
       return UBL_ERR;
745 743
     }

+ 16
- 25
Marlin/Marlin.h ファイルの表示

@@ -252,14 +252,14 @@ extern float current_position[NUM_AXIS];
252 252
   #define WORKSPACE_OFFSET(AXIS) 0
253 253
 #endif
254 254
 
255
-#define LOGICAL_POSITION(POS, AXIS) ((POS) + WORKSPACE_OFFSET(AXIS))
256
-#define RAW_POSITION(POS, AXIS)     ((POS) - WORKSPACE_OFFSET(AXIS))
255
+#define NATIVE_TO_LOGICAL(POS, AXIS) ((POS) + WORKSPACE_OFFSET(AXIS))
256
+#define LOGICAL_TO_NATIVE(POS, AXIS) ((POS) - WORKSPACE_OFFSET(AXIS))
257 257
 
258 258
 #if HAS_POSITION_SHIFT || DISABLED(DELTA)
259
-  #define LOGICAL_X_POSITION(POS)   LOGICAL_POSITION(POS, X_AXIS)
260
-  #define LOGICAL_Y_POSITION(POS)   LOGICAL_POSITION(POS, Y_AXIS)
261
-  #define RAW_X_POSITION(POS)       RAW_POSITION(POS, X_AXIS)
262
-  #define RAW_Y_POSITION(POS)       RAW_POSITION(POS, Y_AXIS)
259
+  #define LOGICAL_X_POSITION(POS)   NATIVE_TO_LOGICAL(POS, X_AXIS)
260
+  #define LOGICAL_Y_POSITION(POS)   NATIVE_TO_LOGICAL(POS, Y_AXIS)
261
+  #define RAW_X_POSITION(POS)       LOGICAL_TO_NATIVE(POS, X_AXIS)
262
+  #define RAW_Y_POSITION(POS)       LOGICAL_TO_NATIVE(POS, Y_AXIS)
263 263
 #else
264 264
   #define LOGICAL_X_POSITION(POS)   (POS)
265 265
   #define LOGICAL_Y_POSITION(POS)   (POS)
@@ -267,9 +267,8 @@ extern float current_position[NUM_AXIS];
267 267
   #define RAW_Y_POSITION(POS)       (POS)
268 268
 #endif
269 269
 
270
-#define LOGICAL_Z_POSITION(POS)     LOGICAL_POSITION(POS, Z_AXIS)
271
-#define RAW_Z_POSITION(POS)         RAW_POSITION(POS, Z_AXIS)
272
-#define RAW_CURRENT_POSITION(A)     RAW_##A##_POSITION(current_position[A##_AXIS])
270
+#define LOGICAL_Z_POSITION(POS)     NATIVE_TO_LOGICAL(POS, Z_AXIS)
271
+#define RAW_Z_POSITION(POS)         LOGICAL_TO_NATIVE(POS, Z_AXIS)
273 272
 
274 273
 // Hotend Offsets
275 274
 #if HOTENDS > 1
@@ -293,7 +292,7 @@ extern float soft_endstop_min[XYZ], soft_endstop_max[XYZ];
293 292
 
294 293
 #if IS_KINEMATIC
295 294
   extern float delta[ABC];
296
-  void inverse_kinematics(const float logical[XYZ]);
295
+  void inverse_kinematics(const float raw[XYZ]);
297 296
 #endif
298 297
 
299 298
 #if ENABLED(DELTA)
@@ -313,7 +312,7 @@ extern float soft_endstop_min[XYZ], soft_endstop_max[XYZ];
313 312
   extern int bilinear_grid_spacing[2], bilinear_start[2];
314 313
   extern float bilinear_grid_factor[2],
315 314
                z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
316
-  float bilinear_z_offset(const float logical[XYZ]);
315
+  float bilinear_z_offset(const float raw[XYZ]);
317 316
 #endif
318 317
 
319 318
 #if ENABLED(AUTO_BED_LEVELING_UBL)
@@ -455,7 +454,7 @@ void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s
455 454
     extern const float L1, L2;
456 455
   #endif
457 456
 
458
-  inline bool position_is_reachable_raw_xy(const float &rx, const float &ry) {
457
+  inline bool position_is_reachable(const float &rx, const float &ry) {
459 458
     #if ENABLED(DELTA)
460 459
       return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS);
461 460
     #elif IS_SCARA
@@ -470,24 +469,24 @@ void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s
470 469
     #endif
471 470
   }
472 471
 
473
-  inline bool position_is_reachable_by_probe_raw_xy(const float &rx, const float &ry) {
472
+  inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
474 473
 
475 474
     // Both the nozzle and the probe must be able to reach the point.
476 475
     // This won't work on SCARA since the probe offset rotates with the arm.
477 476
 
478
-    return position_is_reachable_raw_xy(rx, ry)
479
-        && position_is_reachable_raw_xy(rx - X_PROBE_OFFSET_FROM_EXTRUDER, ry - Y_PROBE_OFFSET_FROM_EXTRUDER);
477
+    return position_is_reachable(rx, ry)
478
+        && position_is_reachable(rx - X_PROBE_OFFSET_FROM_EXTRUDER, ry - Y_PROBE_OFFSET_FROM_EXTRUDER);
480 479
   }
481 480
 
482 481
 #else // CARTESIAN
483 482
 
484
-  inline bool position_is_reachable_raw_xy(const float &rx, const float &ry) {
483
+  inline bool position_is_reachable(const float &rx, const float &ry) {
485 484
       // Add 0.001 margin to deal with float imprecision
486 485
       return WITHIN(rx, X_MIN_POS - 0.001, X_MAX_POS + 0.001)
487 486
           && WITHIN(ry, Y_MIN_POS - 0.001, Y_MAX_POS + 0.001);
488 487
   }
489 488
 
490
-  inline bool position_is_reachable_by_probe_raw_xy(const float &rx, const float &ry) {
489
+  inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
491 490
       // Add 0.001 margin to deal with float imprecision
492 491
       return WITHIN(rx, MIN_PROBE_X - 0.001, MAX_PROBE_X + 0.001)
493 492
           && WITHIN(ry, MIN_PROBE_Y - 0.001, MAX_PROBE_Y + 0.001);
@@ -495,12 +494,4 @@ void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s
495 494
 
496 495
 #endif // CARTESIAN
497 496
 
498
-FORCE_INLINE bool position_is_reachable_by_probe_xy(const float &lx, const float &ly) {
499
-  return position_is_reachable_by_probe_raw_xy(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
500
-}
501
-
502
-FORCE_INLINE bool position_is_reachable_xy(const float &lx, const float &ly) {
503
-  return position_is_reachable_raw_xy(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
504
-}
505
-
506 497
 #endif // MARLIN_H

+ 200
- 222
Marlin/Marlin_main.cpp
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 33
- 37
Marlin/planner.cpp ファイルの表示

@@ -112,7 +112,7 @@ float Planner::min_feedrate_mm_s,
112 112
   #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
113 113
     float Planner::z_fade_height,      // Initialized by settings.load()
114 114
           Planner::inverse_z_fade_height,
115
-          Planner::last_raw_lz;
115
+          Planner::last_fade_z;
116 116
   #endif
117 117
 #endif
118 118
 
@@ -523,14 +523,14 @@ void Planner::check_axes_activity() {
523 523
 
524 524
 #if PLANNER_LEVELING
525 525
   /**
526
-   * lx, ly, lz - logical (cartesian, not delta) positions in mm
526
+   * rx, ry, rz - cartesian position in mm
527 527
    */
528
-  void Planner::apply_leveling(float &lx, float &ly, float &lz) {
528
+  void Planner::apply_leveling(float &rx, float &ry, float &rz) {
529 529
 
530 530
     if (!leveling_active) return;
531 531
 
532 532
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
533
-      const float fade_scaling_factor = fade_scaling_factor_for_z(lz);
533
+      const float fade_scaling_factor = fade_scaling_factor_for_z(rz);
534 534
       if (!fade_scaling_factor) return;
535 535
     #else
536 536
       constexpr float fade_scaling_factor = 1.0;
@@ -538,11 +538,11 @@ void Planner::check_axes_activity() {
538 538
 
539 539
     #if ENABLED(AUTO_BED_LEVELING_UBL)
540 540
 
541
-      lz += ubl.get_z_correction(lx, ly) * fade_scaling_factor;
541
+      rz += ubl.get_z_correction(rx, ry) * fade_scaling_factor;
542 542
 
543 543
     #elif ENABLED(MESH_BED_LEVELING)
544 544
 
545
-      lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly)
545
+      rz += mbl.get_z(rx, ry
546 546
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
547 547
           , fade_scaling_factor
548 548
         #endif
@@ -552,40 +552,38 @@ void Planner::check_axes_activity() {
552 552
 
553 553
       UNUSED(fade_scaling_factor);
554 554
 
555
-      float dx = RAW_X_POSITION(lx) - (X_TILT_FULCRUM),
556
-            dy = RAW_Y_POSITION(ly) - (Y_TILT_FULCRUM),
557
-            dz = RAW_Z_POSITION(lz);
555
+      float dx = rx - (X_TILT_FULCRUM),
556
+            dy = ry - (Y_TILT_FULCRUM);
558 557
 
559
-      apply_rotation_xyz(bed_level_matrix, dx, dy, dz);
558
+      apply_rotation_xyz(bed_level_matrix, dx, dy, rz);
560 559
 
561
-      lx = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
562
-      ly = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
563
-      lz = LOGICAL_Z_POSITION(dz);
560
+      rx = dx + X_TILT_FULCRUM;
561
+      ry = dy + Y_TILT_FULCRUM;
564 562
 
565 563
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
566 564
 
567
-      float tmp[XYZ] = { lx, ly, 0 };
568
-      lz += bilinear_z_offset(tmp) * fade_scaling_factor;
565
+      float tmp[XYZ] = { rx, ry, 0 };
566
+      rz += bilinear_z_offset(tmp) * fade_scaling_factor;
569 567
 
570 568
     #endif
571 569
   }
572 570
 
573
-  void Planner::unapply_leveling(float logical[XYZ]) {
571
+  void Planner::unapply_leveling(float raw[XYZ]) {
574 572
 
575 573
     #if HAS_LEVELING
576 574
       if (!leveling_active) return;
577 575
     #endif
578 576
 
579 577
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
580
-      if (!leveling_active_at_z(logical[Z_AXIS])) return;
578
+      if (!leveling_active_at_z(raw[Z_AXIS])) return;
581 579
     #endif
582 580
 
583 581
     #if ENABLED(AUTO_BED_LEVELING_UBL)
584 582
 
585
-      const float z_physical = RAW_Z_POSITION(logical[Z_AXIS]),
586
-                  z_correct = ubl.get_z_correction(logical[X_AXIS], logical[Y_AXIS]),
583
+      const float z_physical = raw[Z_AXIS],
584
+                  z_correct = ubl.get_z_correction(raw[X_AXIS], raw[Y_AXIS]),
587 585
                   z_virtual = z_physical - z_correct;
588
-            float z_logical = LOGICAL_Z_POSITION(z_virtual);
586
+            float z_raw = z_virtual;
589 587
 
590 588
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
591 589
 
@@ -598,15 +596,15 @@ void Planner::check_axes_activity() {
598 596
         //    so L=(P-M)/(1-M/H) for L<H
599 597
 
600 598
         if (planner.z_fade_height) {
601
-          if (z_logical >= planner.z_fade_height)
602
-            z_logical = LOGICAL_Z_POSITION(z_physical);
599
+          if (z_raw >= planner.z_fade_height)
600
+            z_raw = z_physical;
603 601
           else
604
-            z_logical /= 1.0 - z_correct * planner.inverse_z_fade_height;
602
+            z_raw /= 1.0 - z_correct * planner.inverse_z_fade_height;
605 603
         }
606 604
 
607 605
       #endif // ENABLE_LEVELING_FADE_HEIGHT
608 606
 
609
-      logical[Z_AXIS] = z_logical;
607
+      raw[Z_AXIS] = z_raw;
610 608
 
611 609
       return; // don't fall thru to other ENABLE_LEVELING_FADE_HEIGHT logic
612 610
 
@@ -616,10 +614,10 @@ void Planner::check_axes_activity() {
616 614
 
617 615
       if (leveling_active) {
618 616
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
619
-          const float c = mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]), 1.0);
620
-          logical[Z_AXIS] = (z_fade_height * (RAW_Z_POSITION(logical[Z_AXIS]) - c)) / (z_fade_height - c);
617
+          const float c = mbl.get_z(raw[X_AXIS], raw[Y_AXIS], 1.0);
618
+          raw[Z_AXIS] = (z_fade_height * (raw[Z_AXIS]) - c) / (z_fade_height - c);
621 619
         #else
622
-          logical[Z_AXIS] -= mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));
620
+          raw[Z_AXIS] -= mbl.get_z(raw[X_AXIS], raw[Y_AXIS]);
623 621
         #endif
624 622
       }
625 623
 
@@ -627,23 +625,21 @@ void Planner::check_axes_activity() {
627 625
 
628 626
       matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
629 627
 
630
-      float dx = RAW_X_POSITION(logical[X_AXIS]) - (X_TILT_FULCRUM),
631
-            dy = RAW_Y_POSITION(logical[Y_AXIS]) - (Y_TILT_FULCRUM),
632
-            dz = RAW_Z_POSITION(logical[Z_AXIS]);
628
+      float dx = raw[X_AXIS] - (X_TILT_FULCRUM),
629
+            dy = raw[Y_AXIS] - (Y_TILT_FULCRUM);
633 630
 
634
-      apply_rotation_xyz(inverse, dx, dy, dz);
631
+      apply_rotation_xyz(inverse, dx, dy, raw[Z_AXIS]);
635 632
 
636
-      logical[X_AXIS] = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
637
-      logical[Y_AXIS] = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
638
-      logical[Z_AXIS] = LOGICAL_Z_POSITION(dz);
633
+      raw[X_AXIS] = dx + X_TILT_FULCRUM;
634
+      raw[Y_AXIS] = dy + Y_TILT_FULCRUM;
639 635
 
640 636
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
641 637
 
642 638
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
643
-        const float c = bilinear_z_offset(logical);
644
-        logical[Z_AXIS] = (z_fade_height * (RAW_Z_POSITION(logical[Z_AXIS]) - c)) / (z_fade_height - c);
639
+        const float c = bilinear_z_offset(raw);
640
+        raw[Z_AXIS] = (z_fade_height * (raw[Z_AXIS]) - c) / (z_fade_height - c);
645 641
       #else
646
-        logical[Z_AXIS] -= bilinear_z_offset(logical);
642
+        raw[Z_AXIS] -= bilinear_z_offset(raw);
647 643
       #endif
648 644
 
649 645
     #endif

+ 32
- 33
Marlin/planner.h ファイルの表示

@@ -192,7 +192,7 @@ class Planner {
192 192
     static uint32_t cutoff_long;
193 193
 
194 194
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
195
-      static float last_raw_lz;
195
+      static float last_fade_z;
196 196
     #endif
197 197
 
198 198
     #if ENABLED(DISABLE_INACTIVE_EXTRUDER)
@@ -255,21 +255,20 @@ class Planner {
255 255
        *  Returns 1.0 if planner.z_fade_height is 0.0.
256 256
        *  Returns 0.0 if Z is past the specified 'Fade Height'.
257 257
        */
258
-      inline static float fade_scaling_factor_for_z(const float &lz) {
258
+      inline static float fade_scaling_factor_for_z(const float &rz) {
259 259
         static float z_fade_factor = 1.0;
260 260
         if (z_fade_height) {
261
-          const float raw_lz = RAW_Z_POSITION(lz);
262
-          if (raw_lz >= z_fade_height) return 0.0;
263
-          if (last_raw_lz != raw_lz) {
264
-            last_raw_lz = raw_lz;
265
-            z_fade_factor = 1.0 - raw_lz * inverse_z_fade_height;
261
+          if (rz >= z_fade_height) return 0.0;
262
+          if (last_fade_z != rz) {
263
+            last_fade_z = rz;
264
+            z_fade_factor = 1.0 - rz * inverse_z_fade_height;
266 265
           }
267 266
           return z_fade_factor;
268 267
         }
269 268
         return 1.0;
270 269
       }
271 270
 
272
-      FORCE_INLINE static void force_fade_recalc() { last_raw_lz = -999.999; }
271
+      FORCE_INLINE static void force_fade_recalc() { last_fade_z = -999.999; }
273 272
 
274 273
       FORCE_INLINE static void set_z_fade_height(const float &zfh) {
275 274
         z_fade_height = zfh > 0 ? zfh : 0;
@@ -277,40 +276,40 @@ class Planner {
277 276
         force_fade_recalc();
278 277
       }
279 278
 
280
-      FORCE_INLINE static bool leveling_active_at_z(const float &lz) {
281
-        return !z_fade_height || RAW_Z_POSITION(lz) < z_fade_height;
279
+      FORCE_INLINE static bool leveling_active_at_z(const float &rz) {
280
+        return !z_fade_height || rz < z_fade_height;
282 281
       }
283 282
 
284 283
     #else
285 284
 
286
-      FORCE_INLINE static float fade_scaling_factor_for_z(const float &lz) {
287
-        UNUSED(lz);
285
+      FORCE_INLINE static float fade_scaling_factor_for_z(const float &rz) {
286
+        UNUSED(rz);
288 287
         return 1.0;
289 288
       }
290 289
 
291
-      FORCE_INLINE static bool leveling_active_at_z(const float &lz) { UNUSED(lz); return true; }
290
+      FORCE_INLINE static bool leveling_active_at_z(const float &rz) { UNUSED(rz); return true; }
292 291
 
293 292
     #endif
294 293
 
295 294
     #if PLANNER_LEVELING
296 295
 
297
-      #define ARG_X float lx
298
-      #define ARG_Y float ly
299
-      #define ARG_Z float lz
296
+      #define ARG_X float rx
297
+      #define ARG_Y float ry
298
+      #define ARG_Z float rz
300 299
 
301 300
       /**
302 301
        * Apply leveling to transform a cartesian position
303 302
        * as it will be given to the planner and steppers.
304 303
        */
305
-      static void apply_leveling(float &lx, float &ly, float &lz);
306
-      static void apply_leveling(float logical[XYZ]) { apply_leveling(logical[X_AXIS], logical[Y_AXIS], logical[Z_AXIS]); }
307
-      static void unapply_leveling(float logical[XYZ]);
304
+      static void apply_leveling(float &rx, float &ry, float &rz);
305
+      static void apply_leveling(float raw[XYZ]) { apply_leveling(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]); }
306
+      static void unapply_leveling(float raw[XYZ]);
308 307
 
309 308
     #else
310 309
 
311
-      #define ARG_X const float &lx
312
-      #define ARG_Y const float &ly
313
-      #define ARG_Z const float &lz
310
+      #define ARG_X const float &rx
311
+      #define ARG_Y const float &ry
312
+      #define ARG_Z const float &rz
314 313
 
315 314
     #endif
316 315
 
@@ -337,15 +336,15 @@ class Planner {
337 336
      * Kinematic machines should call buffer_line_kinematic (for leveled moves).
338 337
      * (Cartesians may also call buffer_line_kinematic.)
339 338
      *
340
-     *  lx,ly,lz,e   - target position in mm or degrees
339
+     *  rx,ry,rz,e   - target position in mm or degrees
341 340
      *  fr_mm_s      - (target) speed of the move (mm/s)
342 341
      *  extruder     - target extruder
343 342
      */
344 343
     static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
345 344
       #if PLANNER_LEVELING && IS_CARTESIAN
346
-        apply_leveling(lx, ly, lz);
345
+        apply_leveling(rx, ry, rz);
347 346
       #endif
348
-      _buffer_line(lx, ly, lz, e, fr_mm_s, extruder);
347
+      _buffer_line(rx, ry, rz, e, fr_mm_s, extruder);
349 348
     }
350 349
 
351 350
     /**
@@ -353,22 +352,22 @@ class Planner {
353 352
      * The target is cartesian, it's translated to delta/scara if
354 353
      * needed.
355 354
      *
356
-     *  ltarget  - x,y,z,e CARTESIAN target in mm
355
+     *  rtarget  - x,y,z,e CARTESIAN target in mm
357 356
      *  fr_mm_s  - (target) speed of the move (mm/s)
358 357
      *  extruder - target extruder
359 358
      */
360
-    static FORCE_INLINE void buffer_line_kinematic(const float ltarget[XYZE], const float &fr_mm_s, const uint8_t extruder) {
359
+    static FORCE_INLINE void buffer_line_kinematic(const float rtarget[XYZE], const float &fr_mm_s, const uint8_t extruder) {
361 360
       #if PLANNER_LEVELING
362
-        float lpos[XYZ] = { ltarget[X_AXIS], ltarget[Y_AXIS], ltarget[Z_AXIS] };
361
+        float lpos[XYZ] = { rtarget[X_AXIS], rtarget[Y_AXIS], rtarget[Z_AXIS] };
363 362
         apply_leveling(lpos);
364 363
       #else
365
-        const float * const lpos = ltarget;
364
+        const float * const lpos = rtarget;
366 365
       #endif
367 366
       #if IS_KINEMATIC
368 367
         inverse_kinematics(lpos);
369
-        _buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], ltarget[E_AXIS], fr_mm_s, extruder);
368
+        _buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], rtarget[E_AXIS], fr_mm_s, extruder);
370 369
       #else
371
-        _buffer_line(lpos[X_AXIS], lpos[Y_AXIS], lpos[Z_AXIS], ltarget[E_AXIS], fr_mm_s, extruder);
370
+        _buffer_line(lpos[X_AXIS], lpos[Y_AXIS], lpos[Z_AXIS], rtarget[E_AXIS], fr_mm_s, extruder);
372 371
       #endif
373 372
     }
374 373
 
@@ -383,9 +382,9 @@ class Planner {
383 382
      */
384 383
     static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
385 384
       #if PLANNER_LEVELING && IS_CARTESIAN
386
-        apply_leveling(lx, ly, lz);
385
+        apply_leveling(rx, ry, rz);
387 386
       #endif
388
-      _set_position_mm(lx, ly, lz, e);
387
+      _set_position_mm(rx, ry, rz, e);
389 388
     }
390 389
     static void set_position_mm_kinematic(const float position[NUM_AXIS]);
391 390
     static void set_position_mm(const AxisEnum axis, const float &v);

+ 21
- 21
Marlin/ubl.h ファイルの表示

@@ -114,14 +114,14 @@
114 114
       static bool g29_parameter_parsing();
115 115
       static void find_mean_mesh_height();
116 116
       static void shift_mesh_height();
117
-      static void probe_entire_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map, const bool stow_probe, bool do_furthest);
117
+      static void probe_entire_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map, const bool stow_probe, bool do_furthest);
118 118
       static void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
119 119
       static void tilt_mesh_based_on_3pts(const float &z1, const float &z2, const float &z3);
120 120
       static void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map);
121 121
       static void g29_what_command();
122 122
       static void g29_eeprom_dump();
123 123
       static void g29_compare_current_mesh_to_stored_mesh();
124
-      static void fine_tune_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map);
124
+      static void fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map);
125 125
       static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir);
126 126
       static void smart_fill_mesh();
127 127
 
@@ -244,10 +244,10 @@
244 244
        * z_correction_for_x_on_horizontal_mesh_line is an optimization for
245 245
        * the case where the printer is making a vertical line that only crosses horizontal mesh lines.
246 246
        */
247
-      inline static float z_correction_for_x_on_horizontal_mesh_line(const float &lx0, const int x1_i, const int yi) {
247
+      inline static float z_correction_for_x_on_horizontal_mesh_line(const float &rx0, const int x1_i, const int yi) {
248 248
         if (!WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 2) || !WITHIN(yi, 0, GRID_MAX_POINTS_Y - 1)) {
249 249
           serialprintPGM( !WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 1) ? PSTR("x1l_i") : PSTR("yi") );
250
-          SERIAL_ECHOPAIR(" out of bounds in z_correction_for_x_on_horizontal_mesh_line(lx0=", lx0);
250
+          SERIAL_ECHOPAIR(" out of bounds in z_correction_for_x_on_horizontal_mesh_line(rx0=", rx0);
251 251
           SERIAL_ECHOPAIR(",x1_i=", x1_i);
252 252
           SERIAL_ECHOPAIR(",yi=", yi);
253 253
           SERIAL_CHAR(')');
@@ -255,7 +255,7 @@
255 255
           return NAN;
256 256
         }
257 257
 
258
-        const float xratio = (RAW_X_POSITION(lx0) - mesh_index_to_xpos(x1_i)) * (1.0 / (MESH_X_DIST)),
258
+        const float xratio = (rx0 - mesh_index_to_xpos(x1_i)) * (1.0 / (MESH_X_DIST)),
259 259
                     z1 = z_values[x1_i][yi];
260 260
 
261 261
         return z1 + xratio * (z_values[x1_i + 1][yi] - z1);
@@ -264,10 +264,10 @@
264 264
       //
265 265
       // See comments above for z_correction_for_x_on_horizontal_mesh_line
266 266
       //
267
-      inline static float z_correction_for_y_on_vertical_mesh_line(const float &ly0, const int xi, const int y1_i) {
267
+      inline static float z_correction_for_y_on_vertical_mesh_line(const float &ry0, const int xi, const int y1_i) {
268 268
         if (!WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(y1_i, 0, GRID_MAX_POINTS_Y - 2)) {
269 269
           serialprintPGM( !WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) ? PSTR("xi") : PSTR("yl_i") );
270
-          SERIAL_ECHOPAIR(" out of bounds in z_correction_for_y_on_vertical_mesh_line(ly0=", ly0);
270
+          SERIAL_ECHOPAIR(" out of bounds in z_correction_for_y_on_vertical_mesh_line(ry0=", ry0);
271 271
           SERIAL_ECHOPAIR(", xi=", xi);
272 272
           SERIAL_ECHOPAIR(", y1_i=", y1_i);
273 273
           SERIAL_CHAR(')');
@@ -275,7 +275,7 @@
275 275
           return NAN;
276 276
         }
277 277
 
278
-        const float yratio = (RAW_Y_POSITION(ly0) - mesh_index_to_ypos(y1_i)) * (1.0 / (MESH_Y_DIST)),
278
+        const float yratio = (ry0 - mesh_index_to_ypos(y1_i)) * (1.0 / (MESH_Y_DIST)),
279 279
                     z1 = z_values[xi][y1_i];
280 280
 
281 281
         return z1 + yratio * (z_values[xi][y1_i + 1] - z1);
@@ -287,14 +287,14 @@
287 287
        * Z-Height at both ends. Then it does a linear interpolation of these heights based
288 288
        * on the Y position within the cell.
289 289
        */
290
-      static float get_z_correction(const float &lx0, const float &ly0) {
291
-        const int8_t cx = get_cell_index_x(RAW_X_POSITION(lx0)),
292
-                     cy = get_cell_index_y(RAW_Y_POSITION(ly0));
290
+      static float get_z_correction(const float &rx0, const float &ry0) {
291
+        const int8_t cx = get_cell_index_x(rx0),
292
+                     cy = get_cell_index_y(ry0);
293 293
 
294 294
         if (!WITHIN(cx, 0, GRID_MAX_POINTS_X - 2) || !WITHIN(cy, 0, GRID_MAX_POINTS_Y - 2)) {
295 295
 
296
-          SERIAL_ECHOPAIR("? in get_z_correction(lx0=", lx0);
297
-          SERIAL_ECHOPAIR(", ly0=", ly0);
296
+          SERIAL_ECHOPAIR("? in get_z_correction(rx0=", rx0);
297
+          SERIAL_ECHOPAIR(", ry0=", ry0);
298 298
           SERIAL_CHAR(')');
299 299
           SERIAL_EOL();
300 300
 
@@ -305,23 +305,23 @@
305 305
           return NAN;
306 306
         }
307 307
 
308
-        const float z1 = calc_z0(RAW_X_POSITION(lx0),
308
+        const float z1 = calc_z0(rx0,
309 309
                                  mesh_index_to_xpos(cx), z_values[cx][cy],
310 310
                                  mesh_index_to_xpos(cx + 1), z_values[cx + 1][cy]);
311 311
 
312
-        const float z2 = calc_z0(RAW_X_POSITION(lx0),
312
+        const float z2 = calc_z0(rx0,
313 313
                                  mesh_index_to_xpos(cx), z_values[cx][cy + 1],
314 314
                                  mesh_index_to_xpos(cx + 1), z_values[cx + 1][cy + 1]);
315 315
 
316
-        float z0 = calc_z0(RAW_Y_POSITION(ly0),
316
+        float z0 = calc_z0(ry0,
317 317
                            mesh_index_to_ypos(cy), z1,
318 318
                            mesh_index_to_ypos(cy + 1), z2);
319 319
 
320 320
         #if ENABLED(DEBUG_LEVELING_FEATURE)
321 321
           if (DEBUGGING(MESH_ADJUST)) {
322
-            SERIAL_ECHOPAIR(" raw get_z_correction(", lx0);
322
+            SERIAL_ECHOPAIR(" raw get_z_correction(", rx0);
323 323
             SERIAL_CHAR(',');
324
-            SERIAL_ECHO(ly0);
324
+            SERIAL_ECHO(ry0);
325 325
             SERIAL_ECHOPGM(") = ");
326 326
             SERIAL_ECHO_F(z0, 6);
327 327
           }
@@ -343,9 +343,9 @@
343 343
 
344 344
           #if ENABLED(DEBUG_LEVELING_FEATURE)
345 345
             if (DEBUGGING(MESH_ADJUST)) {
346
-              SERIAL_ECHOPAIR("??? Yikes!  NAN in get_z_correction(", lx0);
346
+              SERIAL_ECHOPAIR("??? Yikes!  NAN in get_z_correction(", rx0);
347 347
               SERIAL_CHAR(',');
348
-              SERIAL_ECHO(ly0);
348
+              SERIAL_ECHO(ry0);
349 349
               SERIAL_CHAR(')');
350 350
               SERIAL_EOL();
351 351
             }
@@ -362,7 +362,7 @@
362 362
         return i < GRID_MAX_POINTS_Y ? pgm_read_float(&_mesh_index_to_ypos[i]) : MESH_MIN_Y + i * (MESH_Y_DIST);
363 363
       }
364 364
 
365
-      static bool prepare_segmented_line_to(const float ltarget[XYZE], const float &feedrate);
365
+      static bool prepare_segmented_line_to(const float rtarget[XYZE], const float &feedrate);
366 366
       static void line_to_destination_cartesian(const float &fr, uint8_t e);
367 367
 
368 368
   }; // class unified_bed_leveling

+ 48
- 51
Marlin/ubl_G29.cpp ファイルの表示

@@ -51,7 +51,7 @@
51 51
 
52 52
   extern float meshedit_done;
53 53
   extern long babysteps_done;
54
-  extern float probe_pt(const float &lx, const float &ly, const bool, const uint8_t, const bool=true);
54
+  extern float probe_pt(const float &rx, const float &ry, const bool, const uint8_t, const bool=true);
55 55
   extern bool set_probe_deployed(bool);
56 56
   extern void set_bed_leveling_enabled(bool);
57 57
   typedef void (*screenFunc_t)();
@@ -392,11 +392,11 @@
392 392
           restore_ubl_active_state_and_leave();
393 393
         }
394 394
         else { // grid_size == 0 : A 3-Point leveling has been requested
395
-          float z3, z2, z1 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_1_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_1_Y), false, g29_verbose_level);
395
+          float z3, z2, z1 = probe_pt(UBL_PROBE_PT_1_X, UBL_PROBE_PT_1_Y, false, g29_verbose_level);
396 396
           if (!isnan(z1)) {
397
-            z2 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_2_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_2_Y), false, g29_verbose_level);
397
+            z2 = probe_pt(UBL_PROBE_PT_2_X, UBL_PROBE_PT_2_Y, false, g29_verbose_level);
398 398
             if (!isnan(z2))
399
-              z3 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_3_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_3_Y), true, g29_verbose_level);
399
+              z3 = probe_pt(UBL_PROBE_PT_3_X, UBL_PROBE_PT_3_Y, true, g29_verbose_level);
400 400
           }
401 401
 
402 402
           if (isnan(z1) || isnan(z2) || isnan(z3)) { // probe_pt will return NAN if unreachable
@@ -410,9 +410,9 @@
410 410
           // its height is.)
411 411
 
412 412
           save_ubl_active_state_and_disable();
413
-          z1 -= get_z_correction(LOGICAL_X_POSITION(UBL_PROBE_PT_1_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_1_Y)) /* + zprobe_zoffset */ ;
414
-          z2 -= get_z_correction(LOGICAL_X_POSITION(UBL_PROBE_PT_2_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_2_Y)) /* + zprobe_zoffset */ ;
415
-          z3 -= get_z_correction(LOGICAL_X_POSITION(UBL_PROBE_PT_3_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_3_Y)) /* + zprobe_zoffset */ ;
413
+          z1 -= get_z_correction(UBL_PROBE_PT_1_X, UBL_PROBE_PT_1_Y) /* + zprobe_zoffset */ ;
414
+          z2 -= get_z_correction(UBL_PROBE_PT_2_X, UBL_PROBE_PT_2_Y) /* + zprobe_zoffset */ ;
415
+          z3 -= get_z_correction(UBL_PROBE_PT_3_X, UBL_PROBE_PT_3_Y) /* + zprobe_zoffset */ ;
416 416
 
417 417
           do_blocking_move_to_xy(0.5 * (MESH_MAX_X - (MESH_MIN_X)), 0.5 * (MESH_MAX_Y - (MESH_MIN_Y)));
418 418
           tilt_mesh_based_on_3pts(z1, z2, z3);
@@ -496,7 +496,7 @@
496 496
               }
497 497
             }
498 498
 
499
-            if (!position_is_reachable_xy(g29_x_pos, g29_y_pos)) {
499
+            if (!position_is_reachable(g29_x_pos, g29_y_pos)) {
500 500
               SERIAL_PROTOCOLLNPGM("XY outside printable radius.");
501 501
               return;
502 502
             }
@@ -640,8 +640,8 @@
640 640
               SERIAL_ECHOPAIR(" J ", y);
641 641
               SERIAL_ECHOPGM(" Z ");
642 642
               SERIAL_ECHO_F(z_values[x][y], 6);
643
-              SERIAL_ECHOPAIR(" ; X ", LOGICAL_X_POSITION(mesh_index_to_xpos(x)));
644
-              SERIAL_ECHOPAIR(", Y ", LOGICAL_Y_POSITION(mesh_index_to_ypos(y)));
643
+              SERIAL_ECHOPAIR(" ; X ", mesh_index_to_xpos(x));
644
+              SERIAL_ECHOPAIR(", Y ", mesh_index_to_ypos(y));
645 645
               SERIAL_EOL();
646 646
             }
647 647
         return;
@@ -732,7 +732,7 @@
732 732
      * Probe all invalidated locations of the mesh that can be reached by the probe.
733 733
      * This attempts to fill in locations closest to the nozzle's start location first.
734 734
      */
735
-    void unified_bed_leveling::probe_entire_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map, const bool stow_probe, bool close_or_far) {
735
+    void unified_bed_leveling::probe_entire_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map, const bool stow_probe, bool close_or_far) {
736 736
       mesh_index_pair location;
737 737
 
738 738
       has_control_of_lcd_panel = true;
@@ -755,13 +755,13 @@
755 755
           }
756 756
         #endif
757 757
 
758
-        location = find_closest_mesh_point_of_type(INVALID, lx, ly, USE_PROBE_AS_REFERENCE, NULL, close_or_far);
758
+        location = find_closest_mesh_point_of_type(INVALID, rx, ry, USE_PROBE_AS_REFERENCE, NULL, close_or_far);
759 759
 
760 760
         if (location.x_index >= 0) {    // mesh point found and is reachable by probe
761 761
           const float rawx = mesh_index_to_xpos(location.x_index),
762 762
                       rawy = mesh_index_to_ypos(location.y_index);
763 763
 
764
-          const float measured_z = probe_pt(LOGICAL_X_POSITION(rawx), LOGICAL_Y_POSITION(rawy), stow_probe, g29_verbose_level); // TODO: Needs error handling
764
+          const float measured_z = probe_pt(rawx, rawy, stow_probe, g29_verbose_level); // TODO: Needs error handling
765 765
           z_values[location.x_index][location.y_index] = measured_z;
766 766
         }
767 767
 
@@ -773,8 +773,8 @@
773 773
       restore_ubl_active_state_and_leave();
774 774
 
775 775
       do_blocking_move_to_xy(
776
-        constrain(lx - (X_PROBE_OFFSET_FROM_EXTRUDER), MESH_MIN_X, MESH_MAX_X),
777
-        constrain(ly - (Y_PROBE_OFFSET_FROM_EXTRUDER), MESH_MIN_Y, MESH_MAX_Y)
776
+        constrain(rx - (X_PROBE_OFFSET_FROM_EXTRUDER), MESH_MIN_X, MESH_MAX_X),
777
+        constrain(ry - (Y_PROBE_OFFSET_FROM_EXTRUDER), MESH_MIN_Y, MESH_MAX_Y)
778 778
       );
779 779
     }
780 780
 
@@ -946,28 +946,26 @@
946 946
       return thickness;
947 947
     }
948 948
 
949
-    void unified_bed_leveling::manually_probe_remaining_mesh(const float &lx, const float &ly, const float &z_clearance, const float &thick, const bool do_ubl_mesh_map) {
949
+    void unified_bed_leveling::manually_probe_remaining_mesh(const float &rx, const float &ry, const float &z_clearance, const float &thick, const bool do_ubl_mesh_map) {
950 950
 
951 951
       has_control_of_lcd_panel = true;
952 952
 
953 953
       save_ubl_active_state_and_disable();   // we don't do bed level correction because we want the raw data when we probe
954 954
       do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
955
-      do_blocking_move_to_xy(lx, ly);
955
+      do_blocking_move_to_xy(rx, ry);
956 956
 
957 957
       lcd_return_to_status();
958 958
 
959 959
       mesh_index_pair location;
960 960
       do {
961
-        location = find_closest_mesh_point_of_type(INVALID, lx, ly, USE_NOZZLE_AS_REFERENCE, NULL, false);
961
+        location = find_closest_mesh_point_of_type(INVALID, rx, ry, USE_NOZZLE_AS_REFERENCE, NULL, false);
962 962
         // It doesn't matter if the probe can't reach the NAN location. This is a manual probe.
963 963
         if (location.x_index < 0 && location.y_index < 0) continue;
964 964
 
965
-        const float rawx = mesh_index_to_xpos(location.x_index),
966
-                    rawy = mesh_index_to_ypos(location.y_index),
967
-                    xProbe = LOGICAL_X_POSITION(rawx),
968
-                    yProbe = LOGICAL_Y_POSITION(rawy);
965
+        const float xProbe = mesh_index_to_xpos(location.x_index),
966
+                    yProbe = mesh_index_to_ypos(location.y_index);
969 967
 
970
-        if (!position_is_reachable_raw_xy(rawx, rawy)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points)
968
+        if (!position_is_reachable(xProbe, yProbe)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points)
971 969
 
972 970
         do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
973 971
 
@@ -1031,7 +1029,7 @@
1031 1029
       restore_ubl_active_state_and_leave();
1032 1030
       KEEPALIVE_STATE(IN_HANDLER);
1033 1031
       do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
1034
-      do_blocking_move_to_xy(lx, ly);
1032
+      do_blocking_move_to_xy(rx, ry);
1035 1033
     }
1036 1034
   #endif // NEWPANEL
1037 1035
 
@@ -1103,8 +1101,8 @@
1103 1101
     }
1104 1102
 
1105 1103
     // If X or Y are not valid, use center of the bed values
1106
-    if (!WITHIN(RAW_X_POSITION(g29_x_pos), X_MIN_BED, X_MAX_BED)) g29_x_pos = LOGICAL_X_POSITION(X_CENTER);
1107
-    if (!WITHIN(RAW_Y_POSITION(g29_y_pos), Y_MIN_BED, Y_MAX_BED)) g29_y_pos = LOGICAL_Y_POSITION(Y_CENTER);
1104
+    if (!WITHIN(g29_x_pos, X_MIN_BED, X_MAX_BED)) g29_x_pos = X_CENTER;
1105
+    if (!WITHIN(g29_y_pos, Y_MIN_BED, Y_MAX_BED)) g29_y_pos = Y_CENTER;
1108 1106
 
1109 1107
     if (err_flag) return UBL_ERR;
1110 1108
 
@@ -1230,7 +1228,7 @@
1230 1228
 
1231 1229
     SERIAL_PROTOCOLPGM("X-Axis Mesh Points at: ");
1232 1230
     for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
1233
-      SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(mesh_index_to_xpos(i)), 3);
1231
+      SERIAL_PROTOCOL_F(mesh_index_to_xpos(i), 3);
1234 1232
       SERIAL_PROTOCOLPGM("  ");
1235 1233
       safe_delay(25);
1236 1234
     }
@@ -1238,7 +1236,7 @@
1238 1236
 
1239 1237
     SERIAL_PROTOCOLPGM("Y-Axis Mesh Points at: ");
1240 1238
     for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; i++) {
1241
-      SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(mesh_index_to_ypos(i)), 3);
1239
+      SERIAL_PROTOCOL_F(mesh_index_to_ypos(i), 3);
1242 1240
       SERIAL_PROTOCOLPGM("  ");
1243 1241
       safe_delay(25);
1244 1242
     }
@@ -1342,13 +1340,13 @@
1342 1340
         z_values[x][y] -= tmp_z_values[x][y];
1343 1341
   }
1344 1342
 
1345
-  mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const MeshPointType type, const float &lx, const float &ly, const bool probe_as_reference, unsigned int bits[16], const bool far_flag) {
1343
+  mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const MeshPointType type, const float &rx, const float &ry, const bool probe_as_reference, unsigned int bits[16], const bool far_flag) {
1346 1344
     mesh_index_pair out_mesh;
1347 1345
     out_mesh.x_index = out_mesh.y_index = -1;
1348 1346
 
1349 1347
     // Get our reference position. Either the nozzle or probe location.
1350
-    const float px = RAW_X_POSITION(lx) - (probe_as_reference == USE_PROBE_AS_REFERENCE ? X_PROBE_OFFSET_FROM_EXTRUDER : 0),
1351
-                py = RAW_Y_POSITION(ly) - (probe_as_reference == USE_PROBE_AS_REFERENCE ? Y_PROBE_OFFSET_FROM_EXTRUDER : 0);
1348
+    const float px = rx - (probe_as_reference == USE_PROBE_AS_REFERENCE ? X_PROBE_OFFSET_FROM_EXTRUDER : 0),
1349
+                py = ry - (probe_as_reference == USE_PROBE_AS_REFERENCE ? Y_PROBE_OFFSET_FROM_EXTRUDER : 0);
1352 1350
 
1353 1351
     float best_so_far = far_flag ? -99999.99 : 99999.99;
1354 1352
 
@@ -1361,7 +1359,6 @@
1361 1359
         ) {
1362 1360
           // We only get here if we found a Mesh Point of the specified type
1363 1361
 
1364
-          float raw_x = RAW_CURRENT_POSITION(X), raw_y = RAW_CURRENT_POSITION(Y);
1365 1362
           const float mx = mesh_index_to_xpos(i),
1366 1363
                       my = mesh_index_to_ypos(j);
1367 1364
 
@@ -1369,7 +1366,7 @@
1369 1366
           // Also for round beds, there are grid points outside the bed the nozzle can't reach.
1370 1367
           // Prune them from the list and ignore them till the next Phase (manual nozzle probing).
1371 1368
 
1372
-          if (probe_as_reference ? !position_is_reachable_by_probe_raw_xy(mx, my) : !position_is_reachable_raw_xy(mx, my))
1369
+          if (probe_as_reference ? !position_is_reachable_by_probe(mx, my) : !position_is_reachable(mx, my))
1373 1370
             continue;
1374 1371
 
1375 1372
           // Reachable. Check if it's the best_so_far location to the nozzle.
@@ -1395,9 +1392,9 @@
1395 1392
             }
1396 1393
           }
1397 1394
           else
1398
-          // factor in the distance from the current location for the normal case
1399
-          // so the nozzle isn't running all over the bed.
1400
-            distance += HYPOT(raw_x - mx, raw_y - my) * 0.1;
1395
+            // factor in the distance from the current location for the normal case
1396
+            // so the nozzle isn't running all over the bed.
1397
+            distance += HYPOT(current_position[X_AXIS] - mx, current_position[Y_AXIS] - my) * 0.1;
1401 1398
 
1402 1399
           // if far_flag, look for farthest point
1403 1400
           if (far_flag == (distance > best_so_far) && distance != best_so_far) {
@@ -1415,7 +1412,7 @@
1415 1412
 
1416 1413
   #if ENABLED(NEWPANEL)
1417 1414
 
1418
-    void unified_bed_leveling::fine_tune_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map) {
1415
+    void unified_bed_leveling::fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map) {
1419 1416
       if (!parser.seen('R'))    // fine_tune_mesh() is special. If no repetition count flag is specified
1420 1417
         g29_repetition_cnt = 1;   // do exactly one mesh location. Otherwise use what the parser decided.
1421 1418
 
@@ -1430,7 +1427,7 @@
1430 1427
 
1431 1428
       mesh_index_pair location;
1432 1429
 
1433
-      if (!position_is_reachable_xy(lx, ly)) {
1430
+      if (!position_is_reachable(rx, ry)) {
1434 1431
         SERIAL_PROTOCOLLNPGM("(X,Y) outside printable radius.");
1435 1432
         return;
1436 1433
       }
@@ -1440,12 +1437,12 @@
1440 1437
       LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH);
1441 1438
 
1442 1439
       do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
1443
-      do_blocking_move_to_xy(lx, ly);
1440
+      do_blocking_move_to_xy(rx, ry);
1444 1441
 
1445 1442
       uint16_t not_done[16];
1446 1443
       memset(not_done, 0xFF, sizeof(not_done));
1447 1444
       do {
1448
-        location = find_closest_mesh_point_of_type(SET_IN_BITMAP, lx, ly, USE_NOZZLE_AS_REFERENCE, not_done, false);
1445
+        location = find_closest_mesh_point_of_type(SET_IN_BITMAP, rx, ry, USE_NOZZLE_AS_REFERENCE, not_done, false);
1449 1446
 
1450 1447
         if (location.x_index < 0) break; // stop when we can't find any more reachable points.
1451 1448
 
@@ -1455,7 +1452,7 @@
1455 1452
         const float rawx = mesh_index_to_xpos(location.x_index),
1456 1453
                     rawy = mesh_index_to_ypos(location.y_index);
1457 1454
 
1458
-        if (!position_is_reachable_raw_xy(rawx, rawy)) // SHOULD NOT OCCUR because find_closest_mesh_point_of_type will only return reachable
1455
+        if (!position_is_reachable(rawx, rawy)) // SHOULD NOT OCCUR because find_closest_mesh_point_of_type will only return reachable
1459 1456
           break;
1460 1457
 
1461 1458
         float new_z = z_values[location.x_index][location.y_index];
@@ -1464,7 +1461,7 @@
1464 1461
           new_z = 0.0;
1465 1462
 
1466 1463
         do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);    // Move the nozzle to where we are going to edit
1467
-        do_blocking_move_to_xy(LOGICAL_X_POSITION(rawx), LOGICAL_Y_POSITION(rawy));
1464
+        do_blocking_move_to_xy(rawx, rawy);
1468 1465
 
1469 1466
         new_z = FLOOR(new_z * 1000.0) * 0.001; // Chop off digits after the 1000ths place
1470 1467
 
@@ -1526,7 +1523,7 @@
1526 1523
       restore_ubl_active_state_and_leave();
1527 1524
       do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
1528 1525
 
1529
-      do_blocking_move_to_xy(lx, ly);
1526
+      do_blocking_move_to_xy(rx, ry);
1530 1527
 
1531 1528
       LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH);
1532 1529
       SERIAL_ECHOLNPGM("Done Editing Mesh");
@@ -1610,10 +1607,10 @@
1610 1607
 
1611 1608
       bool zig_zag = false;
1612 1609
       for (uint8_t ix = 0; ix < g29_grid_size; ix++) {
1613
-        const float x = float(x_min) + ix * dx;
1610
+        const float rx = float(x_min) + ix * dx;
1614 1611
         for (int8_t iy = 0; iy < g29_grid_size; iy++) {
1615
-          const float y = float(y_min) + dy * (zig_zag ? g29_grid_size - 1 - iy : iy);
1616
-          float measured_z = probe_pt(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y), parser.seen('E'), g29_verbose_level); // TODO: Needs error handling
1612
+          const float ry = float(y_min) + dy * (zig_zag ? g29_grid_size - 1 - iy : iy);
1613
+          float measured_z = probe_pt(rx, ry, parser.seen('E'), g29_verbose_level); // TODO: Needs error handling
1617 1614
           #if ENABLED(DEBUG_LEVELING_FEATURE)
1618 1615
             if (DEBUGGING(LEVELING)) {
1619 1616
               SERIAL_CHAR('(');
@@ -1622,17 +1619,17 @@
1622 1619
               SERIAL_PROTOCOL_F(y, 7);
1623 1620
               SERIAL_ECHOPGM(")   logical: ");
1624 1621
               SERIAL_CHAR('(');
1625
-              SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(x), 7);
1622
+              SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(rx), 7);
1626 1623
               SERIAL_CHAR(',');
1627
-              SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(y), 7);
1624
+              SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(ry), 7);
1628 1625
               SERIAL_ECHOPGM(")   measured: ");
1629 1626
               SERIAL_PROTOCOL_F(measured_z, 7);
1630 1627
               SERIAL_ECHOPGM("   correction: ");
1631
-              SERIAL_PROTOCOL_F(get_z_correction(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y)), 7);
1628
+              SERIAL_PROTOCOL_F(get_z_correction(rx, ry), 7);
1632 1629
             }
1633 1630
           #endif
1634 1631
 
1635
-          measured_z -= get_z_correction(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y)) /* + zprobe_zoffset */ ;
1632
+          measured_z -= get_z_correction(rx, ry) /* + zprobe_zoffset */ ;
1636 1633
 
1637 1634
           #if ENABLED(DEBUG_LEVELING_FEATURE)
1638 1635
             if (DEBUGGING(LEVELING)) {
@@ -1642,7 +1639,7 @@
1642 1639
             }
1643 1640
           #endif
1644 1641
 
1645
-          incremental_LSF(&lsf_results, x, y, measured_z);
1642
+          incremental_LSF(&lsf_results, rx, ry, measured_z);
1646 1643
         }
1647 1644
 
1648 1645
         zig_zag ^= true;

+ 41
- 48
Marlin/ubl_motion.cpp ファイルの表示

@@ -125,10 +125,10 @@
125 125
                   destination[E_AXIS]
126 126
                 };
127 127
 
128
-    const int cell_start_xi = get_cell_index_x(RAW_X_POSITION(start[X_AXIS])),
129
-              cell_start_yi = get_cell_index_y(RAW_Y_POSITION(start[Y_AXIS])),
130
-              cell_dest_xi  = get_cell_index_x(RAW_X_POSITION(end[X_AXIS])),
131
-              cell_dest_yi  = get_cell_index_y(RAW_Y_POSITION(end[Y_AXIS]));
128
+    const int cell_start_xi = get_cell_index_x(start[X_AXIS]),
129
+              cell_start_yi = get_cell_index_y(start[Y_AXIS]),
130
+              cell_dest_xi  = get_cell_index_x(end[X_AXIS]),
131
+              cell_dest_yi  = get_cell_index_y(end[Y_AXIS]);
132 132
 
133 133
     if (g26_debug_flag) {
134 134
       SERIAL_ECHOPAIR(" ubl.line_to_destination(xe=", end[X_AXIS]);
@@ -173,7 +173,7 @@
173 173
        * to create a 1-over number for us. That will allow us to do a floating point multiply instead of a floating point divide.
174 174
        */
175 175
 
176
-      const float xratio = (RAW_X_POSITION(end[X_AXIS]) - mesh_index_to_xpos(cell_dest_xi)) * (1.0 / (MESH_X_DIST));
176
+      const float xratio = (end[X_AXIS] - mesh_index_to_xpos(cell_dest_xi)) * (1.0 / (MESH_X_DIST));
177 177
 
178 178
       float z1 = z_values[cell_dest_xi    ][cell_dest_yi    ] + xratio *
179 179
                 (z_values[cell_dest_xi + 1][cell_dest_yi    ] - z_values[cell_dest_xi][cell_dest_yi    ]),
@@ -185,7 +185,7 @@
185 185
       // we are done with the fractional X distance into the cell. Now with the two Z-Heights we have calculated, we
186 186
       // are going to apply the Y-Distance into the cell to interpolate the final Z correction.
187 187
 
188
-      const float yratio = (RAW_Y_POSITION(end[Y_AXIS]) - mesh_index_to_ypos(cell_dest_yi)) * (1.0 / (MESH_Y_DIST));
188
+      const float yratio = (end[Y_AXIS] - mesh_index_to_ypos(cell_dest_yi)) * (1.0 / (MESH_Y_DIST));
189 189
       float z0 = cell_dest_yi < GRID_MAX_POINTS_Y - 1 ? (z1 + (z2 - z1) * yratio) * planner.fade_scaling_factor_for_z(end[Z_AXIS]) : 0.0;
190 190
 
191 191
       /**
@@ -261,7 +261,7 @@
261 261
       current_yi += down_flag;  // Line is heading down, we just want to go to the bottom
262 262
       while (current_yi != cell_dest_yi + down_flag) {
263 263
         current_yi += dyi;
264
-        const float next_mesh_line_y = LOGICAL_Y_POSITION(mesh_index_to_ypos(current_yi));
264
+        const float next_mesh_line_y = mesh_index_to_ypos(current_yi);
265 265
 
266 266
         /**
267 267
          * if the slope of the line is infinite, we won't do the calculations
@@ -282,7 +282,7 @@
282 282
          */
283 283
         if (isnan(z0)) z0 = 0.0;
284 284
 
285
-        const float y = LOGICAL_Y_POSITION(mesh_index_to_ypos(current_yi));
285
+        const float y = mesh_index_to_ypos(current_yi);
286 286
 
287 287
         /**
288 288
          * Without this check, it is possible for the algorithm to generate a zero length move in the case
@@ -331,7 +331,7 @@
331 331
                                 // edge of this cell for the first move.
332 332
       while (current_xi != cell_dest_xi + left_flag) {
333 333
         current_xi += dxi;
334
-        const float next_mesh_line_x = LOGICAL_X_POSITION(mesh_index_to_xpos(current_xi)),
334
+        const float next_mesh_line_x = mesh_index_to_xpos(current_xi),
335 335
                     y = m * next_mesh_line_x + c;   // Calculate Y at the next X mesh line
336 336
 
337 337
         float z0 = z_correction_for_y_on_vertical_mesh_line(y, current_xi, current_yi)
@@ -346,7 +346,7 @@
346 346
          */
347 347
         if (isnan(z0)) z0 = 0.0;
348 348
 
349
-        const float x = LOGICAL_X_POSITION(mesh_index_to_xpos(current_xi));
349
+        const float x = mesh_index_to_xpos(current_xi);
350 350
 
351 351
         /**
352 352
          * Without this check, it is possible for the algorithm to generate a zero length move in the case
@@ -396,8 +396,8 @@
396 396
 
397 397
     while (xi_cnt > 0 || yi_cnt > 0) {
398 398
 
399
-      const float next_mesh_line_x = LOGICAL_X_POSITION(mesh_index_to_xpos(current_xi + dxi)),
400
-                  next_mesh_line_y = LOGICAL_Y_POSITION(mesh_index_to_ypos(current_yi + dyi)),
399
+      const float next_mesh_line_x = mesh_index_to_xpos(current_xi + dxi),
400
+                  next_mesh_line_y = mesh_index_to_ypos(current_yi + dyi),
401 401
                   y = m * next_mesh_line_x + c,   // Calculate Y at the next X mesh line
402 402
                   x = (next_mesh_line_y - c) / m; // Calculate X at the next Y mesh line
403 403
                                                   // (No need to worry about m being zero.
@@ -489,7 +489,7 @@
489 489
     // We don't want additional apply_leveling() performed by regular buffer_line or buffer_line_kinematic,
490 490
     // so we call _buffer_line directly here.  Per-segmented leveling and kinematics performed first.
491 491
 
492
-    inline void _O2 ubl_buffer_segment_raw( float rx, float ry, float rz, float le, float fr ) {
492
+    inline void _O2 ubl_buffer_segment_raw( float rx, float ry, float rz, float e, float fr ) {
493 493
 
494 494
       #if ENABLED(DELTA)  // apply delta inverse_kinematics
495 495
 
@@ -505,14 +505,11 @@
505 505
                                          - HYPOT2( delta_tower[C_AXIS][X_AXIS] - rx,
506 506
                                                    delta_tower[C_AXIS][Y_AXIS] - ry ));
507 507
 
508
-        planner._buffer_line(delta_A, delta_B, delta_C, le, fr, active_extruder);
508
+        planner._buffer_line(delta_A, delta_B, delta_C, e, fr, active_extruder);
509 509
 
510 510
       #elif IS_SCARA  // apply scara inverse_kinematics (should be changed to save raw->logical->raw)
511 511
 
512
-        const float lseg[XYZ] = { LOGICAL_X_POSITION(rx),
513
-                                  LOGICAL_Y_POSITION(ry),
514
-                                  LOGICAL_Z_POSITION(rz)
515
-                                };
512
+        const float lseg[XYZ] = { rx, ry, rz };
516 513
 
517 514
         inverse_kinematics(lseg); // this writes delta[ABC] from lseg[XYZ]
518 515
                                   // should move the feedrate scaling to scara inverse_kinematics
@@ -523,17 +520,13 @@
523 520
         scara_oldB = delta[B_AXIS];
524 521
         float s_feedrate = max(adiff, bdiff) * scara_feed_factor;
525 522
 
526
-        planner._buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], le, s_feedrate, active_extruder);
523
+        planner._buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], e, s_feedrate, active_extruder);
527 524
 
528 525
       #else // CARTESIAN
529 526
 
530 527
         // Cartesian _buffer_line seems to take LOGICAL, not RAW coordinates
531 528
 
532
-        const float lx = LOGICAL_X_POSITION(rx),
533
-                    ly = LOGICAL_Y_POSITION(ry),
534
-                    lz = LOGICAL_Z_POSITION(rz);
535
-
536
-        planner._buffer_line(lx, ly, lz, le, fr, active_extruder);
529
+        planner._buffer_line(rx, ry, rz, e, fr, active_extruder);
537 530
 
538 531
       #endif
539 532
 
@@ -546,15 +539,15 @@
546 539
      * Returns true if did NOT move, false if moved (requires current_position update).
547 540
      */
548 541
 
549
-    bool _O2 unified_bed_leveling::prepare_segmented_line_to(const float ltarget[XYZE], const float &feedrate) {
542
+    bool _O2 unified_bed_leveling::prepare_segmented_line_to(const float rtarget[XYZE], const float &feedrate) {
550 543
 
551
-      if (!position_is_reachable_xy(ltarget[X_AXIS], ltarget[Y_AXIS]))  // fail if moving outside reachable boundary
544
+      if (!position_is_reachable(rtarget[X_AXIS], rtarget[Y_AXIS]))  // fail if moving outside reachable boundary
552 545
         return true; // did not move, so current_position still accurate
553 546
 
554
-      const float tot_dx = ltarget[X_AXIS] - current_position[X_AXIS],
555
-                  tot_dy = ltarget[Y_AXIS] - current_position[Y_AXIS],
556
-                  tot_dz = ltarget[Z_AXIS] - current_position[Z_AXIS],
557
-                  tot_de = ltarget[E_AXIS] - current_position[E_AXIS];
547
+      const float tot_dx = rtarget[X_AXIS] - current_position[X_AXIS],
548
+                  tot_dy = rtarget[Y_AXIS] - current_position[Y_AXIS],
549
+                  tot_dz = rtarget[Z_AXIS] - current_position[Z_AXIS],
550
+                  tot_de = rtarget[E_AXIS] - current_position[E_AXIS];
558 551
 
559 552
       const float cartesian_xy_mm = HYPOT(tot_dx, tot_dy);  // total horizontal xy distance
560 553
 
@@ -584,14 +577,14 @@
584 577
       // Note that E segment distance could vary slightly as z mesh height
585 578
       // changes for each segment, but small enough to ignore.
586 579
 
587
-      float seg_rx = RAW_X_POSITION(current_position[X_AXIS]),
588
-            seg_ry = RAW_Y_POSITION(current_position[Y_AXIS]),
589
-            seg_rz = RAW_Z_POSITION(current_position[Z_AXIS]),
580
+      float seg_rx = current_position[X_AXIS],
581
+            seg_ry = current_position[Y_AXIS],
582
+            seg_rz = current_position[Z_AXIS],
590 583
             seg_le = current_position[E_AXIS];
591 584
 
592 585
       const bool above_fade_height = (
593 586
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
594
-          planner.z_fade_height != 0 && planner.z_fade_height < RAW_Z_POSITION(ltarget[Z_AXIS])
587
+          planner.z_fade_height != 0 && planner.z_fade_height < rtarget[Z_AXIS]
595 588
         #else
596 589
           false
597 590
         #endif
@@ -599,7 +592,7 @@
599 592
 
600 593
       // Only compute leveling per segment if ubl active and target below z_fade_height.
601 594
 
602
-      if (!planner.leveling_active || !planner.leveling_active_at_z(ltarget[Z_AXIS])) {   // no mesh leveling
595
+      if (!planner.leveling_active || !planner.leveling_active_at_z(rtarget[Z_AXIS])) {   // no mesh leveling
603 596
 
604 597
         do {
605 598
 
@@ -609,13 +602,13 @@
609 602
             seg_rz += seg_dz;
610 603
             seg_le += seg_de;
611 604
           } else {              // last segment, use exact destination
612
-            seg_rx = RAW_X_POSITION(ltarget[X_AXIS]);
613
-            seg_ry = RAW_Y_POSITION(ltarget[Y_AXIS]);
614
-            seg_rz = RAW_Z_POSITION(ltarget[Z_AXIS]);
615
-            seg_le = ltarget[E_AXIS];
605
+            seg_rx = rtarget[X_AXIS];
606
+            seg_ry = rtarget[Y_AXIS];
607
+            seg_rz = rtarget[Z_AXIS];
608
+            seg_le = rtarget[E_AXIS];
616 609
           }
617 610
 
618
-          ubl_buffer_segment_raw( seg_rx, seg_ry, seg_rz, seg_le, feedrate );
611
+          ubl_buffer_segment_raw(seg_rx, seg_ry, seg_rz, seg_le, feedrate);
619 612
 
620 613
         } while (segments);
621 614
 
@@ -625,7 +618,7 @@
625 618
       // Otherwise perform per-segment leveling
626 619
 
627 620
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
628
-        const float fade_scaling_factor = planner.fade_scaling_factor_for_z(ltarget[Z_AXIS]);
621
+        const float fade_scaling_factor = planner.fade_scaling_factor_for_z(rtarget[Z_AXIS]);
629 622
       #else
630 623
         constexpr float fade_scaling_factor = 1.0;
631 624
       #endif
@@ -690,16 +683,16 @@
690 683
 
691 684
           float z_cxcy = (z_cxy0 + z_cxym * cy) * fade_scaling_factor; // interpolated mesh z height along cx at cy, scaled for fade
692 685
 
693
-          if (--segments == 0) {                    // if this is last segment, use ltarget for exact
694
-            seg_rx = RAW_X_POSITION(ltarget[X_AXIS]);
695
-            seg_ry = RAW_Y_POSITION(ltarget[Y_AXIS]);
696
-            seg_rz = RAW_Z_POSITION(ltarget[Z_AXIS]);
697
-            seg_le = ltarget[E_AXIS];
686
+          if (--segments == 0) {                    // if this is last segment, use rtarget for exact
687
+            seg_rx = rtarget[X_AXIS];
688
+            seg_ry = rtarget[Y_AXIS];
689
+            seg_rz = rtarget[Z_AXIS];
690
+            seg_le = rtarget[E_AXIS];
698 691
           }
699 692
 
700
-          ubl_buffer_segment_raw( seg_rx, seg_ry, seg_rz + z_cxcy, seg_le, feedrate );
693
+          ubl_buffer_segment_raw(seg_rx, seg_ry, seg_rz + z_cxcy, seg_le, feedrate);
701 694
 
702
-          if (segments == 0 )                       // done with last segment
695
+          if (segments == 0)                        // done with last segment
703 696
             return false;                           // did not set_current_from_destination()
704 697
 
705 698
           seg_rx += seg_dx;

+ 18
- 20
Marlin/ultralcd.cpp ファイルの表示

@@ -1673,7 +1673,7 @@ void kill_screen(const char* lcd_msg) {
1673 1673
      */
1674 1674
     static int8_t bed_corner;
1675 1675
     void _lcd_goto_next_corner() {
1676
-      line_to_z(LOGICAL_Z_POSITION(4.0));
1676
+      line_to_z(4.0);
1677 1677
       switch (bed_corner) {
1678 1678
         case 0:
1679 1679
           current_position[X_AXIS] = X_MIN_BED + 10;
@@ -1690,7 +1690,7 @@ void kill_screen(const char* lcd_msg) {
1690 1690
           break;
1691 1691
       }
1692 1692
       planner.buffer_line_kinematic(current_position, MMM_TO_MMS(manual_feedrate_mm_m[X_AXIS]), active_extruder);
1693
-      line_to_z(LOGICAL_Z_POSITION(0.0));
1693
+      line_to_z(0.0);
1694 1694
       if (++bed_corner > 3) bed_corner = 0;
1695 1695
     }
1696 1696
 
@@ -1736,7 +1736,7 @@ void kill_screen(const char* lcd_msg) {
1736 1736
     //
1737 1737
     void _lcd_after_probing() {
1738 1738
       #if MANUAL_PROBE_HEIGHT > 0
1739
-        line_to_z(LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT);
1739
+        line_to_z(Z_MIN_POS + MANUAL_PROBE_HEIGHT);
1740 1740
       #endif
1741 1741
       // Display "Done" screen and wait for moves to complete
1742 1742
       #if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
@@ -1751,13 +1751,13 @@ void kill_screen(const char* lcd_msg) {
1751 1751
     #if ENABLED(MESH_BED_LEVELING)
1752 1752
 
1753 1753
       // Utility to go to the next mesh point
1754
-      inline void _manual_probe_goto_xy(float x, float y) {
1754
+      inline void _manual_probe_goto_xy(const float rx, const float ry) {
1755 1755
         #if MANUAL_PROBE_HEIGHT > 0
1756 1756
           const float prev_z = current_position[Z_AXIS];
1757
-          line_to_z(LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT);
1757
+          line_to_z(Z_MIN_POS + MANUAL_PROBE_HEIGHT);
1758 1758
         #endif
1759
-        current_position[X_AXIS] = LOGICAL_X_POSITION(x);
1760
-        current_position[Y_AXIS] = LOGICAL_Y_POSITION(y);
1759
+        current_position[X_AXIS] = rx;
1760
+        current_position[Y_AXIS] = ry;
1761 1761
         planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
1762 1762
         #if MANUAL_PROBE_HEIGHT > 0
1763 1763
           line_to_z(prev_z);
@@ -1888,8 +1888,8 @@ void kill_screen(const char* lcd_msg) {
1888 1888
 
1889 1889
         // Controls the loop until the move is done
1890 1890
         _manual_probe_goto_xy(
1891
-          LOGICAL_X_POSITION(mbl.index_to_xpos[px]),
1892
-          LOGICAL_Y_POSITION(mbl.index_to_ypos[py])
1891
+          mbl.index_to_xpos[px],
1892
+          mbl.index_to_ypos[py]
1893 1893
         );
1894 1894
 
1895 1895
         // After the blocking function returns, change menus
@@ -2368,8 +2368,8 @@ void kill_screen(const char* lcd_msg) {
2368 2368
      * UBL LCD Map Movement
2369 2369
      */
2370 2370
     void ubl_map_move_to_xy() {
2371
-      current_position[X_AXIS] = LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]));
2372
-      current_position[Y_AXIS] = LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]));
2371
+      current_position[X_AXIS] = pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]);
2372
+      current_position[Y_AXIS] = pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]);
2373 2373
       planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
2374 2374
     }
2375 2375
 
@@ -2703,26 +2703,24 @@ void kill_screen(const char* lcd_msg) {
2703 2703
       lcd_goto_screen(_lcd_calibrate_homing);
2704 2704
     }
2705 2705
 
2706
-    void _man_probe_pt(const float &lx, const float &ly) {
2706
+    void _man_probe_pt(const float rx, const float ry) {
2707 2707
       #if HAS_LEVELING
2708 2708
         reset_bed_level(); // After calibration bed-level data is no longer valid
2709 2709
       #endif
2710 2710
 
2711
-      float z_dest = LOGICAL_Z_POSITION((Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5);
2712
-      line_to_z(z_dest);
2713
-      current_position[X_AXIS] = LOGICAL_X_POSITION(lx);
2714
-      current_position[Y_AXIS] = LOGICAL_Y_POSITION(ly);
2711
+      line_to_z((Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5);
2712
+      current_position[X_AXIS] = rx;
2713
+      current_position[Y_AXIS] = ry;
2715 2714
       line_to_current_z();
2716
-      z_dest = LOGICAL_Z_POSITION(Z_CLEARANCE_BETWEEN_PROBES);
2717
-      line_to_z(z_dest);
2715
+      line_to_z(Z_CLEARANCE_BETWEEN_PROBES);
2718 2716
 
2719 2717
       lcd_synchronize();
2720 2718
       move_menu_scale = PROBE_MANUALLY_STEP;
2721 2719
       lcd_goto_screen(lcd_move_z);
2722 2720
     }
2723 2721
 
2724
-    float lcd_probe_pt(const float &lx, const float &ly) {
2725
-      _man_probe_pt(lx, ly);
2722
+    float lcd_probe_pt(const float &rx, const float &ry) {
2723
+      _man_probe_pt(rx, ry);
2726 2724
       KEEPALIVE_STATE(PAUSED_FOR_USER);
2727 2725
       defer_return_to_status = true;
2728 2726
       wait_for_user = true;

+ 1
- 1
Marlin/ultralcd.h ファイルの表示

@@ -202,7 +202,7 @@ void lcd_reset_status();
202 202
 #endif
203 203
 
204 204
 #if ENABLED(DELTA_CALIBRATION_MENU)
205
-  float lcd_probe_pt(const float &lx, const float &ly);
205
+  float lcd_probe_pt(const float &rx, const float &ry);
206 206
 #endif
207 207
 
208 208
 #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)

+ 3
- 3
Marlin/ultralcd_impl_DOGM.h ファイルの表示

@@ -645,9 +645,9 @@ static void lcd_implementation_status_screen() {
645 645
 
646 646
   // At the first page, regenerate the XYZ strings
647 647
   if (page.page == 0) {
648
-    strcpy(xstring, ftostr4sign(current_position[X_AXIS]));
649
-    strcpy(ystring, ftostr4sign(current_position[Y_AXIS]));
650
-    strcpy(zstring, ftostr52sp(FIXFLOAT(current_position[Z_AXIS])));
648
+    strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])));
649
+    strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])));
650
+    strcpy(zstring, ftostr52sp(FIXFLOAT(LOGICAL_Z_POSITION(current_position[Z_AXIS]))));
651 651
     #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
652 652
       strcpy(wstring, ftostr12ns(filament_width_meas));
653 653
       strcpy(mstring, itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));

+ 5
- 3
Marlin/ultralcd_impl_HD44780.h ファイルの表示

@@ -618,7 +618,9 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
618 618
   lcd.print(itostr3(t1 + 0.5));
619 619
   lcd.write('/');
620 620
 
621
-  #if HEATER_IDLE_HANDLER
621
+  #if !HEATER_IDLE_HANDLER
622
+    UNUSED(blink);
623
+  #else
622 624
     const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
623 625
       #if HAS_TEMP_BED
624 626
         thermalManager.is_bed_idle()
@@ -776,12 +778,12 @@ static void lcd_implementation_status_screen() {
776 778
         // When everything is ok you see a constant 'X'.
777 779
 
778 780
         _draw_axis_label(X_AXIS, PSTR(MSG_X), blink);
779
-        lcd.print(ftostr4sign(current_position[X_AXIS]));
781
+        lcd.print(ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])));
780 782
 
781 783
         lcd.write(' ');
782 784
 
783 785
         _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
784
-        lcd.print(ftostr4sign(current_position[Y_AXIS]));
786
+        lcd.print(ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])));
785 787
 
786 788
       #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
787 789
 

読み込み中…
キャンセル
保存