Переглянути джерело

Merge pull request #8229 from thinkyhead/bf1_native_operation

[1.1.x] Operate in Native Machine Space
Scott Lahteine 7 роки тому
джерело
коміт
309890cb8c
Аккаунт користувача з таким Email не знайдено

+ 16
- 18
Marlin/G26_Mesh_Validation_Tool.cpp Переглянути файл

279
 
279
 
280
         // If this mesh location is outside the printable_radius, skip it.
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
         xi = location.x_index;  // Just to shrink the next few lines and make them easier to understand
284
         xi = location.x_index;  // Just to shrink the next few lines and make them easier to understand
285
         yi = location.y_index;
285
         yi = location.y_index;
328
           if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
328
           if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
329
           if (tmp_div_30 > 11) tmp_div_30 -= 360 / 30;
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
                 xe = circle_x + cos_table[tmp_div_30 + 1],
333
                 xe = circle_x + cos_table[tmp_div_30 + 1],
334
                 ye = circle_y + sin_table[tmp_div_30 + 1];
334
                 ye = circle_y + sin_table[tmp_div_30 + 1];
335
           #if IS_KINEMATIC
335
           #if IS_KINEMATIC
336
             // Check to make sure this segment is entirely on the bed, skip if not.
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
             xe = constrain(xe, X_MIN_POS + 1, X_MAX_POS - 1);
341
             xe = constrain(xe, X_MIN_POS + 1, X_MAX_POS - 1);
342
             ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
342
             ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
343
           #endif
343
           #endif
353
           //  debug_current_and_destination(seg_msg);
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
         if (look_for_lines_to_connect())
359
         if (look_for_lines_to_connect())
459
               sy = ey = constrain(mesh_index_to_ypos(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
459
               sy = ey = constrain(mesh_index_to_ypos(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
460
               ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
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
                 if (g26_debug_flag) {
464
                 if (g26_debug_flag) {
465
                   SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx);
465
                   SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx);
470
                   SERIAL_EOL();
470
                   SERIAL_EOL();
471
                   //debug_current_and_destination(PSTR("Connecting horizontal line."));
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
               bit_set(horizontal_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if we skipped it
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
                 sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1);
492
                 sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1);
494
                 ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
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
                   if (g26_debug_flag) {
497
                   if (g26_debug_flag) {
499
                     SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx);
498
                     SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx);
504
                     SERIAL_EOL();
503
                     SERIAL_EOL();
505
                     debug_current_and_destination(PSTR("Connecting vertical line."));
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
                 bit_set(vertical_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if skipped
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
 
595
 
597
     // If the end point of the line is closer to the nozzle, flip the direction,
596
     // If the end point of the line is closer to the nozzle, flip the direction,
598
     // moving from the end to the start. On very small lines the optimization isn't worth it.
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
       return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
599
       return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
601
-    }
602
 
600
 
603
     // Decide whether to retract & bump
601
     // Decide whether to retract & bump
604
 
602
 
737
       return UBL_ERR;
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
       SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
741
       SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
744
       return UBL_ERR;
742
       return UBL_ERR;
745
     }
743
     }

+ 16
- 25
Marlin/Marlin.h Переглянути файл

252
   #define WORKSPACE_OFFSET(AXIS) 0
252
   #define WORKSPACE_OFFSET(AXIS) 0
253
 #endif
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
 #if HAS_POSITION_SHIFT || DISABLED(DELTA)
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
 #else
263
 #else
264
   #define LOGICAL_X_POSITION(POS)   (POS)
264
   #define LOGICAL_X_POSITION(POS)   (POS)
265
   #define LOGICAL_Y_POSITION(POS)   (POS)
265
   #define LOGICAL_Y_POSITION(POS)   (POS)
267
   #define RAW_Y_POSITION(POS)       (POS)
267
   #define RAW_Y_POSITION(POS)       (POS)
268
 #endif
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
 // Hotend Offsets
273
 // Hotend Offsets
275
 #if HOTENDS > 1
274
 #if HOTENDS > 1
293
 
292
 
294
 #if IS_KINEMATIC
293
 #if IS_KINEMATIC
295
   extern float delta[ABC];
294
   extern float delta[ABC];
296
-  void inverse_kinematics(const float logical[XYZ]);
295
+  void inverse_kinematics(const float raw[XYZ]);
297
 #endif
296
 #endif
298
 
297
 
299
 #if ENABLED(DELTA)
298
 #if ENABLED(DELTA)
313
   extern int bilinear_grid_spacing[2], bilinear_start[2];
312
   extern int bilinear_grid_spacing[2], bilinear_start[2];
314
   extern float bilinear_grid_factor[2],
313
   extern float bilinear_grid_factor[2],
315
                z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
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
 #endif
316
 #endif
318
 
317
 
319
 #if ENABLED(AUTO_BED_LEVELING_UBL)
318
 #if ENABLED(AUTO_BED_LEVELING_UBL)
455
     extern const float L1, L2;
454
     extern const float L1, L2;
456
   #endif
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
     #if ENABLED(DELTA)
458
     #if ENABLED(DELTA)
460
       return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS);
459
       return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS);
461
     #elif IS_SCARA
460
     #elif IS_SCARA
470
     #endif
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
     // Both the nozzle and the probe must be able to reach the point.
474
     // Both the nozzle and the probe must be able to reach the point.
476
     // This won't work on SCARA since the probe offset rotates with the arm.
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
 #else // CARTESIAN
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
       // Add 0.001 margin to deal with float imprecision
484
       // Add 0.001 margin to deal with float imprecision
486
       return WITHIN(rx, X_MIN_POS - 0.001, X_MAX_POS + 0.001)
485
       return WITHIN(rx, X_MIN_POS - 0.001, X_MAX_POS + 0.001)
487
           && WITHIN(ry, Y_MIN_POS - 0.001, Y_MAX_POS + 0.001);
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
       // Add 0.001 margin to deal with float imprecision
490
       // Add 0.001 margin to deal with float imprecision
492
       return WITHIN(rx, MIN_PROBE_X - 0.001, MAX_PROBE_X + 0.001)
491
       return WITHIN(rx, MIN_PROBE_X - 0.001, MAX_PROBE_X + 0.001)
493
           && WITHIN(ry, MIN_PROBE_Y - 0.001, MAX_PROBE_Y + 0.001);
492
           && WITHIN(ry, MIN_PROBE_Y - 0.001, MAX_PROBE_Y + 0.001);
495
 
494
 
496
 #endif // CARTESIAN
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
 #endif // MARLIN_H
497
 #endif // MARLIN_H

+ 214
- 227
Marlin/Marlin_main.cpp
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 33
- 37
Marlin/planner.cpp Переглянути файл

112
   #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
112
   #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
113
     float Planner::z_fade_height,      // Initialized by settings.load()
113
     float Planner::z_fade_height,      // Initialized by settings.load()
114
           Planner::inverse_z_fade_height,
114
           Planner::inverse_z_fade_height,
115
-          Planner::last_raw_lz;
115
+          Planner::last_fade_z;
116
   #endif
116
   #endif
117
 #endif
117
 #endif
118
 
118
 
523
 
523
 
524
 #if PLANNER_LEVELING
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
     if (!leveling_active) return;
530
     if (!leveling_active) return;
531
 
531
 
532
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
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
       if (!fade_scaling_factor) return;
534
       if (!fade_scaling_factor) return;
535
     #else
535
     #else
536
       constexpr float fade_scaling_factor = 1.0;
536
       constexpr float fade_scaling_factor = 1.0;
538
 
538
 
539
     #if ENABLED(AUTO_BED_LEVELING_UBL)
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
     #elif ENABLED(MESH_BED_LEVELING)
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
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
546
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
547
           , fade_scaling_factor
547
           , fade_scaling_factor
548
         #endif
548
         #endif
552
 
552
 
553
       UNUSED(fade_scaling_factor);
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
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
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
     #endif
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
     #if HAS_LEVELING
573
     #if HAS_LEVELING
576
       if (!leveling_active) return;
574
       if (!leveling_active) return;
577
     #endif
575
     #endif
578
 
576
 
579
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
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
     #endif
579
     #endif
582
 
580
 
583
     #if ENABLED(AUTO_BED_LEVELING_UBL)
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
                   z_virtual = z_physical - z_correct;
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
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
588
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
591
 
589
 
598
         //    so L=(P-M)/(1-M/H) for L<H
596
         //    so L=(P-M)/(1-M/H) for L<H
599
 
597
 
600
         if (planner.z_fade_height) {
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
           else
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
       #endif // ENABLE_LEVELING_FADE_HEIGHT
605
       #endif // ENABLE_LEVELING_FADE_HEIGHT
608
 
606
 
609
-      logical[Z_AXIS] = z_logical;
607
+      raw[Z_AXIS] = z_raw;
610
 
608
 
611
       return; // don't fall thru to other ENABLE_LEVELING_FADE_HEIGHT logic
609
       return; // don't fall thru to other ENABLE_LEVELING_FADE_HEIGHT logic
612
 
610
 
616
 
614
 
617
       if (leveling_active) {
615
       if (leveling_active) {
618
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
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
         #else
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
         #endif
621
         #endif
624
       }
622
       }
625
 
623
 
627
 
625
 
628
       matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
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
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
636
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
641
 
637
 
642
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
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
       #else
641
       #else
646
-        logical[Z_AXIS] -= bilinear_z_offset(logical);
642
+        raw[Z_AXIS] -= bilinear_z_offset(raw);
647
       #endif
643
       #endif
648
 
644
 
649
     #endif
645
     #endif

+ 32
- 33
Marlin/planner.h Переглянути файл

192
     static uint32_t cutoff_long;
192
     static uint32_t cutoff_long;
193
 
193
 
194
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
194
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
195
-      static float last_raw_lz;
195
+      static float last_fade_z;
196
     #endif
196
     #endif
197
 
197
 
198
     #if ENABLED(DISABLE_INACTIVE_EXTRUDER)
198
     #if ENABLED(DISABLE_INACTIVE_EXTRUDER)
255
        *  Returns 1.0 if planner.z_fade_height is 0.0.
255
        *  Returns 1.0 if planner.z_fade_height is 0.0.
256
        *  Returns 0.0 if Z is past the specified 'Fade Height'.
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
         static float z_fade_factor = 1.0;
259
         static float z_fade_factor = 1.0;
260
         if (z_fade_height) {
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
           return z_fade_factor;
266
           return z_fade_factor;
268
         }
267
         }
269
         return 1.0;
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
       FORCE_INLINE static void set_z_fade_height(const float &zfh) {
273
       FORCE_INLINE static void set_z_fade_height(const float &zfh) {
275
         z_fade_height = zfh > 0 ? zfh : 0;
274
         z_fade_height = zfh > 0 ? zfh : 0;
277
         force_fade_recalc();
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
     #else
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
         return 1.0;
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
     #endif
292
     #endif
294
 
293
 
295
     #if PLANNER_LEVELING
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
        * Apply leveling to transform a cartesian position
301
        * Apply leveling to transform a cartesian position
303
        * as it will be given to the planner and steppers.
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
     #else
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
     #endif
314
     #endif
316
 
315
 
337
      * Kinematic machines should call buffer_line_kinematic (for leveled moves).
336
      * Kinematic machines should call buffer_line_kinematic (for leveled moves).
338
      * (Cartesians may also call buffer_line_kinematic.)
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
      *  fr_mm_s      - (target) speed of the move (mm/s)
340
      *  fr_mm_s      - (target) speed of the move (mm/s)
342
      *  extruder     - target extruder
341
      *  extruder     - target extruder
343
      */
342
      */
344
     static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
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
       #if PLANNER_LEVELING && IS_CARTESIAN
344
       #if PLANNER_LEVELING && IS_CARTESIAN
346
-        apply_leveling(lx, ly, lz);
345
+        apply_leveling(rx, ry, rz);
347
       #endif
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
      * The target is cartesian, it's translated to delta/scara if
352
      * The target is cartesian, it's translated to delta/scara if
354
      * needed.
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
      *  fr_mm_s  - (target) speed of the move (mm/s)
356
      *  fr_mm_s  - (target) speed of the move (mm/s)
358
      *  extruder - target extruder
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
       #if PLANNER_LEVELING
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
         apply_leveling(lpos);
362
         apply_leveling(lpos);
364
       #else
363
       #else
365
-        const float * const lpos = ltarget;
364
+        const float * const lpos = rtarget;
366
       #endif
365
       #endif
367
       #if IS_KINEMATIC
366
       #if IS_KINEMATIC
368
         inverse_kinematics(lpos);
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
       #else
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
       #endif
371
       #endif
373
     }
372
     }
374
 
373
 
383
      */
382
      */
384
     static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
383
     static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
385
       #if PLANNER_LEVELING && IS_CARTESIAN
384
       #if PLANNER_LEVELING && IS_CARTESIAN
386
-        apply_leveling(lx, ly, lz);
385
+        apply_leveling(rx, ry, rz);
387
       #endif
386
       #endif
388
-      _set_position_mm(lx, ly, lz, e);
387
+      _set_position_mm(rx, ry, rz, e);
389
     }
388
     }
390
     static void set_position_mm_kinematic(const float position[NUM_AXIS]);
389
     static void set_position_mm_kinematic(const float position[NUM_AXIS]);
391
     static void set_position_mm(const AxisEnum axis, const float &v);
390
     static void set_position_mm(const AxisEnum axis, const float &v);

+ 21
- 21
Marlin/ubl.h Переглянути файл

114
       static bool g29_parameter_parsing();
114
       static bool g29_parameter_parsing();
115
       static void find_mean_mesh_height();
115
       static void find_mean_mesh_height();
116
       static void shift_mesh_height();
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
       static void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
118
       static void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
119
       static void tilt_mesh_based_on_3pts(const float &z1, const float &z2, const float &z3);
119
       static void tilt_mesh_based_on_3pts(const float &z1, const float &z2, const float &z3);
120
       static void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map);
120
       static void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map);
121
       static void g29_what_command();
121
       static void g29_what_command();
122
       static void g29_eeprom_dump();
122
       static void g29_eeprom_dump();
123
       static void g29_compare_current_mesh_to_stored_mesh();
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
       static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir);
125
       static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir);
126
       static void smart_fill_mesh();
126
       static void smart_fill_mesh();
127
 
127
 
244
        * z_correction_for_x_on_horizontal_mesh_line is an optimization for
244
        * z_correction_for_x_on_horizontal_mesh_line is an optimization for
245
        * the case where the printer is making a vertical line that only crosses horizontal mesh lines.
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
         if (!WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 2) || !WITHIN(yi, 0, GRID_MAX_POINTS_Y - 1)) {
248
         if (!WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 2) || !WITHIN(yi, 0, GRID_MAX_POINTS_Y - 1)) {
249
           serialprintPGM( !WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 1) ? PSTR("x1l_i") : PSTR("yi") );
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
           SERIAL_ECHOPAIR(",x1_i=", x1_i);
251
           SERIAL_ECHOPAIR(",x1_i=", x1_i);
252
           SERIAL_ECHOPAIR(",yi=", yi);
252
           SERIAL_ECHOPAIR(",yi=", yi);
253
           SERIAL_CHAR(')');
253
           SERIAL_CHAR(')');
255
           return NAN;
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
                     z1 = z_values[x1_i][yi];
259
                     z1 = z_values[x1_i][yi];
260
 
260
 
261
         return z1 + xratio * (z_values[x1_i + 1][yi] - z1);
261
         return z1 + xratio * (z_values[x1_i + 1][yi] - z1);
264
       //
264
       //
265
       // See comments above for z_correction_for_x_on_horizontal_mesh_line
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
         if (!WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(y1_i, 0, GRID_MAX_POINTS_Y - 2)) {
268
         if (!WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(y1_i, 0, GRID_MAX_POINTS_Y - 2)) {
269
           serialprintPGM( !WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) ? PSTR("xi") : PSTR("yl_i") );
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
           SERIAL_ECHOPAIR(", xi=", xi);
271
           SERIAL_ECHOPAIR(", xi=", xi);
272
           SERIAL_ECHOPAIR(", y1_i=", y1_i);
272
           SERIAL_ECHOPAIR(", y1_i=", y1_i);
273
           SERIAL_CHAR(')');
273
           SERIAL_CHAR(')');
275
           return NAN;
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
                     z1 = z_values[xi][y1_i];
279
                     z1 = z_values[xi][y1_i];
280
 
280
 
281
         return z1 + yratio * (z_values[xi][y1_i + 1] - z1);
281
         return z1 + yratio * (z_values[xi][y1_i + 1] - z1);
287
        * Z-Height at both ends. Then it does a linear interpolation of these heights based
287
        * Z-Height at both ends. Then it does a linear interpolation of these heights based
288
        * on the Y position within the cell.
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
         if (!WITHIN(cx, 0, GRID_MAX_POINTS_X - 2) || !WITHIN(cy, 0, GRID_MAX_POINTS_Y - 2)) {
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
           SERIAL_CHAR(')');
298
           SERIAL_CHAR(')');
299
           SERIAL_EOL();
299
           SERIAL_EOL();
300
 
300
 
305
           return NAN;
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
                                  mesh_index_to_xpos(cx), z_values[cx][cy],
309
                                  mesh_index_to_xpos(cx), z_values[cx][cy],
310
                                  mesh_index_to_xpos(cx + 1), z_values[cx + 1][cy]);
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
                                  mesh_index_to_xpos(cx), z_values[cx][cy + 1],
313
                                  mesh_index_to_xpos(cx), z_values[cx][cy + 1],
314
                                  mesh_index_to_xpos(cx + 1), z_values[cx + 1][cy + 1]);
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
                            mesh_index_to_ypos(cy), z1,
317
                            mesh_index_to_ypos(cy), z1,
318
                            mesh_index_to_ypos(cy + 1), z2);
318
                            mesh_index_to_ypos(cy + 1), z2);
319
 
319
 
320
         #if ENABLED(DEBUG_LEVELING_FEATURE)
320
         #if ENABLED(DEBUG_LEVELING_FEATURE)
321
           if (DEBUGGING(MESH_ADJUST)) {
321
           if (DEBUGGING(MESH_ADJUST)) {
322
-            SERIAL_ECHOPAIR(" raw get_z_correction(", lx0);
322
+            SERIAL_ECHOPAIR(" raw get_z_correction(", rx0);
323
             SERIAL_CHAR(',');
323
             SERIAL_CHAR(',');
324
-            SERIAL_ECHO(ly0);
324
+            SERIAL_ECHO(ry0);
325
             SERIAL_ECHOPGM(") = ");
325
             SERIAL_ECHOPGM(") = ");
326
             SERIAL_ECHO_F(z0, 6);
326
             SERIAL_ECHO_F(z0, 6);
327
           }
327
           }
343
 
343
 
344
           #if ENABLED(DEBUG_LEVELING_FEATURE)
344
           #if ENABLED(DEBUG_LEVELING_FEATURE)
345
             if (DEBUGGING(MESH_ADJUST)) {
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
               SERIAL_CHAR(',');
347
               SERIAL_CHAR(',');
348
-              SERIAL_ECHO(ly0);
348
+              SERIAL_ECHO(ry0);
349
               SERIAL_CHAR(')');
349
               SERIAL_CHAR(')');
350
               SERIAL_EOL();
350
               SERIAL_EOL();
351
             }
351
             }
362
         return i < GRID_MAX_POINTS_Y ? pgm_read_float(&_mesh_index_to_ypos[i]) : MESH_MIN_Y + i * (MESH_Y_DIST);
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
       static void line_to_destination_cartesian(const float &fr, uint8_t e);
366
       static void line_to_destination_cartesian(const float &fr, uint8_t e);
367
 
367
 
368
   }; // class unified_bed_leveling
368
   }; // class unified_bed_leveling

+ 48
- 51
Marlin/ubl_G29.cpp Переглянути файл

51
 
51
 
52
   extern float meshedit_done;
52
   extern float meshedit_done;
53
   extern long babysteps_done;
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
   extern bool set_probe_deployed(bool);
55
   extern bool set_probe_deployed(bool);
56
   extern void set_bed_leveling_enabled(bool);
56
   extern void set_bed_leveling_enabled(bool);
57
   typedef void (*screenFunc_t)();
57
   typedef void (*screenFunc_t)();
392
           restore_ubl_active_state_and_leave();
392
           restore_ubl_active_state_and_leave();
393
         }
393
         }
394
         else { // grid_size == 0 : A 3-Point leveling has been requested
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
           if (!isnan(z1)) {
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
             if (!isnan(z2))
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
           if (isnan(z1) || isnan(z2) || isnan(z3)) { // probe_pt will return NAN if unreachable
402
           if (isnan(z1) || isnan(z2) || isnan(z3)) { // probe_pt will return NAN if unreachable
410
           // its height is.)
410
           // its height is.)
411
 
411
 
412
           save_ubl_active_state_and_disable();
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
           do_blocking_move_to_xy(0.5 * (MESH_MAX_X - (MESH_MIN_X)), 0.5 * (MESH_MAX_Y - (MESH_MIN_Y)));
417
           do_blocking_move_to_xy(0.5 * (MESH_MAX_X - (MESH_MIN_X)), 0.5 * (MESH_MAX_Y - (MESH_MIN_Y)));
418
           tilt_mesh_based_on_3pts(z1, z2, z3);
418
           tilt_mesh_based_on_3pts(z1, z2, z3);
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
               SERIAL_PROTOCOLLNPGM("XY outside printable radius.");
500
               SERIAL_PROTOCOLLNPGM("XY outside printable radius.");
501
               return;
501
               return;
502
             }
502
             }
640
               SERIAL_ECHOPAIR(" J ", y);
640
               SERIAL_ECHOPAIR(" J ", y);
641
               SERIAL_ECHOPGM(" Z ");
641
               SERIAL_ECHOPGM(" Z ");
642
               SERIAL_ECHO_F(z_values[x][y], 6);
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
               SERIAL_EOL();
645
               SERIAL_EOL();
646
             }
646
             }
647
         return;
647
         return;
732
      * Probe all invalidated locations of the mesh that can be reached by the probe.
732
      * Probe all invalidated locations of the mesh that can be reached by the probe.
733
      * This attempts to fill in locations closest to the nozzle's start location first.
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
       mesh_index_pair location;
736
       mesh_index_pair location;
737
 
737
 
738
       has_control_of_lcd_panel = true;
738
       has_control_of_lcd_panel = true;
755
           }
755
           }
756
         #endif
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
         if (location.x_index >= 0) {    // mesh point found and is reachable by probe
760
         if (location.x_index >= 0) {    // mesh point found and is reachable by probe
761
           const float rawx = mesh_index_to_xpos(location.x_index),
761
           const float rawx = mesh_index_to_xpos(location.x_index),
762
                       rawy = mesh_index_to_ypos(location.y_index);
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
           z_values[location.x_index][location.y_index] = measured_z;
765
           z_values[location.x_index][location.y_index] = measured_z;
766
         }
766
         }
767
 
767
 
773
       restore_ubl_active_state_and_leave();
773
       restore_ubl_active_state_and_leave();
774
 
774
 
775
       do_blocking_move_to_xy(
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
       return thickness;
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
       has_control_of_lcd_panel = true;
951
       has_control_of_lcd_panel = true;
952
 
952
 
953
       save_ubl_active_state_and_disable();   // we don't do bed level correction because we want the raw data when we probe
953
       save_ubl_active_state_and_disable();   // we don't do bed level correction because we want the raw data when we probe
954
       do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
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
       lcd_return_to_status();
957
       lcd_return_to_status();
958
 
958
 
959
       mesh_index_pair location;
959
       mesh_index_pair location;
960
       do {
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
         // It doesn't matter if the probe can't reach the NAN location. This is a manual probe.
962
         // It doesn't matter if the probe can't reach the NAN location. This is a manual probe.
963
         if (location.x_index < 0 && location.y_index < 0) continue;
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
         do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
970
         do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
973
 
971
 
1031
       restore_ubl_active_state_and_leave();
1029
       restore_ubl_active_state_and_leave();
1032
       KEEPALIVE_STATE(IN_HANDLER);
1030
       KEEPALIVE_STATE(IN_HANDLER);
1033
       do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
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
   #endif // NEWPANEL
1034
   #endif // NEWPANEL
1037
 
1035
 
1103
     }
1101
     }
1104
 
1102
 
1105
     // If X or Y are not valid, use center of the bed values
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
     if (err_flag) return UBL_ERR;
1107
     if (err_flag) return UBL_ERR;
1110
 
1108
 
1230
 
1228
 
1231
     SERIAL_PROTOCOLPGM("X-Axis Mesh Points at: ");
1229
     SERIAL_PROTOCOLPGM("X-Axis Mesh Points at: ");
1232
     for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
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
       SERIAL_PROTOCOLPGM("  ");
1232
       SERIAL_PROTOCOLPGM("  ");
1235
       safe_delay(25);
1233
       safe_delay(25);
1236
     }
1234
     }
1238
 
1236
 
1239
     SERIAL_PROTOCOLPGM("Y-Axis Mesh Points at: ");
1237
     SERIAL_PROTOCOLPGM("Y-Axis Mesh Points at: ");
1240
     for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; i++) {
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
       SERIAL_PROTOCOLPGM("  ");
1240
       SERIAL_PROTOCOLPGM("  ");
1243
       safe_delay(25);
1241
       safe_delay(25);
1244
     }
1242
     }
1342
         z_values[x][y] -= tmp_z_values[x][y];
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
     mesh_index_pair out_mesh;
1344
     mesh_index_pair out_mesh;
1347
     out_mesh.x_index = out_mesh.y_index = -1;
1345
     out_mesh.x_index = out_mesh.y_index = -1;
1348
 
1346
 
1349
     // Get our reference position. Either the nozzle or probe location.
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
     float best_so_far = far_flag ? -99999.99 : 99999.99;
1351
     float best_so_far = far_flag ? -99999.99 : 99999.99;
1354
 
1352
 
1361
         ) {
1359
         ) {
1362
           // We only get here if we found a Mesh Point of the specified type
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
           const float mx = mesh_index_to_xpos(i),
1362
           const float mx = mesh_index_to_xpos(i),
1366
                       my = mesh_index_to_ypos(j);
1363
                       my = mesh_index_to_ypos(j);
1367
 
1364
 
1369
           // Also for round beds, there are grid points outside the bed the nozzle can't reach.
1366
           // Also for round beds, there are grid points outside the bed the nozzle can't reach.
1370
           // Prune them from the list and ignore them till the next Phase (manual nozzle probing).
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
             continue;
1370
             continue;
1374
 
1371
 
1375
           // Reachable. Check if it's the best_so_far location to the nozzle.
1372
           // Reachable. Check if it's the best_so_far location to the nozzle.
1395
             }
1392
             }
1396
           }
1393
           }
1397
           else
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
           // if far_flag, look for farthest point
1399
           // if far_flag, look for farthest point
1403
           if (far_flag == (distance > best_so_far) && distance != best_so_far) {
1400
           if (far_flag == (distance > best_so_far) && distance != best_so_far) {
1415
 
1412
 
1416
   #if ENABLED(NEWPANEL)
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
       if (!parser.seen('R'))    // fine_tune_mesh() is special. If no repetition count flag is specified
1416
       if (!parser.seen('R'))    // fine_tune_mesh() is special. If no repetition count flag is specified
1420
         g29_repetition_cnt = 1;   // do exactly one mesh location. Otherwise use what the parser decided.
1417
         g29_repetition_cnt = 1;   // do exactly one mesh location. Otherwise use what the parser decided.
1421
 
1418
 
1430
 
1427
 
1431
       mesh_index_pair location;
1428
       mesh_index_pair location;
1432
 
1429
 
1433
-      if (!position_is_reachable_xy(lx, ly)) {
1430
+      if (!position_is_reachable(rx, ry)) {
1434
         SERIAL_PROTOCOLLNPGM("(X,Y) outside printable radius.");
1431
         SERIAL_PROTOCOLLNPGM("(X,Y) outside printable radius.");
1435
         return;
1432
         return;
1436
       }
1433
       }
1440
       LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH);
1437
       LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH);
1441
 
1438
 
1442
       do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
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
       uint16_t not_done[16];
1442
       uint16_t not_done[16];
1446
       memset(not_done, 0xFF, sizeof(not_done));
1443
       memset(not_done, 0xFF, sizeof(not_done));
1447
       do {
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
         if (location.x_index < 0) break; // stop when we can't find any more reachable points.
1447
         if (location.x_index < 0) break; // stop when we can't find any more reachable points.
1451
 
1448
 
1455
         const float rawx = mesh_index_to_xpos(location.x_index),
1452
         const float rawx = mesh_index_to_xpos(location.x_index),
1456
                     rawy = mesh_index_to_ypos(location.y_index);
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
           break;
1456
           break;
1460
 
1457
 
1461
         float new_z = z_values[location.x_index][location.y_index];
1458
         float new_z = z_values[location.x_index][location.y_index];
1464
           new_z = 0.0;
1461
           new_z = 0.0;
1465
 
1462
 
1466
         do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);    // Move the nozzle to where we are going to edit
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
         new_z = FLOOR(new_z * 1000.0) * 0.001; // Chop off digits after the 1000ths place
1466
         new_z = FLOOR(new_z * 1000.0) * 0.001; // Chop off digits after the 1000ths place
1470
 
1467
 
1526
       restore_ubl_active_state_and_leave();
1523
       restore_ubl_active_state_and_leave();
1527
       do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
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
       LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH);
1528
       LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH);
1532
       SERIAL_ECHOLNPGM("Done Editing Mesh");
1529
       SERIAL_ECHOLNPGM("Done Editing Mesh");
1610
 
1607
 
1611
       bool zig_zag = false;
1608
       bool zig_zag = false;
1612
       for (uint8_t ix = 0; ix < g29_grid_size; ix++) {
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
         for (int8_t iy = 0; iy < g29_grid_size; iy++) {
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
           #if ENABLED(DEBUG_LEVELING_FEATURE)
1614
           #if ENABLED(DEBUG_LEVELING_FEATURE)
1618
             if (DEBUGGING(LEVELING)) {
1615
             if (DEBUGGING(LEVELING)) {
1619
               SERIAL_CHAR('(');
1616
               SERIAL_CHAR('(');
1622
               SERIAL_PROTOCOL_F(y, 7);
1619
               SERIAL_PROTOCOL_F(y, 7);
1623
               SERIAL_ECHOPGM(")   logical: ");
1620
               SERIAL_ECHOPGM(")   logical: ");
1624
               SERIAL_CHAR('(');
1621
               SERIAL_CHAR('(');
1625
-              SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(x), 7);
1622
+              SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(rx), 7);
1626
               SERIAL_CHAR(',');
1623
               SERIAL_CHAR(',');
1627
-              SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(y), 7);
1624
+              SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(ry), 7);
1628
               SERIAL_ECHOPGM(")   measured: ");
1625
               SERIAL_ECHOPGM(")   measured: ");
1629
               SERIAL_PROTOCOL_F(measured_z, 7);
1626
               SERIAL_PROTOCOL_F(measured_z, 7);
1630
               SERIAL_ECHOPGM("   correction: ");
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
           #endif
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
           #if ENABLED(DEBUG_LEVELING_FEATURE)
1634
           #if ENABLED(DEBUG_LEVELING_FEATURE)
1638
             if (DEBUGGING(LEVELING)) {
1635
             if (DEBUGGING(LEVELING)) {
1642
             }
1639
             }
1643
           #endif
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
         zig_zag ^= true;
1645
         zig_zag ^= true;

+ 41
- 48
Marlin/ubl_motion.cpp Переглянути файл

125
                   destination[E_AXIS]
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
     if (g26_debug_flag) {
133
     if (g26_debug_flag) {
134
       SERIAL_ECHOPAIR(" ubl.line_to_destination(xe=", end[X_AXIS]);
134
       SERIAL_ECHOPAIR(" ubl.line_to_destination(xe=", end[X_AXIS]);
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.
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
       float z1 = z_values[cell_dest_xi    ][cell_dest_yi    ] + xratio *
178
       float z1 = z_values[cell_dest_xi    ][cell_dest_yi    ] + xratio *
179
                 (z_values[cell_dest_xi + 1][cell_dest_yi    ] - z_values[cell_dest_xi][cell_dest_yi    ]),
179
                 (z_values[cell_dest_xi + 1][cell_dest_yi    ] - z_values[cell_dest_xi][cell_dest_yi    ]),
185
       // we are done with the fractional X distance into the cell. Now with the two Z-Heights we have calculated, we
185
       // we are done with the fractional X distance into the cell. Now with the two Z-Heights we have calculated, we
186
       // are going to apply the Y-Distance into the cell to interpolate the final Z correction.
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
       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;
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
       current_yi += down_flag;  // Line is heading down, we just want to go to the bottom
261
       current_yi += down_flag;  // Line is heading down, we just want to go to the bottom
262
       while (current_yi != cell_dest_yi + down_flag) {
262
       while (current_yi != cell_dest_yi + down_flag) {
263
         current_yi += dyi;
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
          * if the slope of the line is infinite, we won't do the calculations
267
          * if the slope of the line is infinite, we won't do the calculations
282
          */
282
          */
283
         if (isnan(z0)) z0 = 0.0;
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
          * Without this check, it is possible for the algorithm to generate a zero length move in the case
288
          * Without this check, it is possible for the algorithm to generate a zero length move in the case
331
                                 // edge of this cell for the first move.
331
                                 // edge of this cell for the first move.
332
       while (current_xi != cell_dest_xi + left_flag) {
332
       while (current_xi != cell_dest_xi + left_flag) {
333
         current_xi += dxi;
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
                     y = m * next_mesh_line_x + c;   // Calculate Y at the next X mesh line
335
                     y = m * next_mesh_line_x + c;   // Calculate Y at the next X mesh line
336
 
336
 
337
         float z0 = z_correction_for_y_on_vertical_mesh_line(y, current_xi, current_yi)
337
         float z0 = z_correction_for_y_on_vertical_mesh_line(y, current_xi, current_yi)
346
          */
346
          */
347
         if (isnan(z0)) z0 = 0.0;
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
          * Without this check, it is possible for the algorithm to generate a zero length move in the case
352
          * Without this check, it is possible for the algorithm to generate a zero length move in the case
396
 
396
 
397
     while (xi_cnt > 0 || yi_cnt > 0) {
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
                   y = m * next_mesh_line_x + c,   // Calculate Y at the next X mesh line
401
                   y = m * next_mesh_line_x + c,   // Calculate Y at the next X mesh line
402
                   x = (next_mesh_line_y - c) / m; // Calculate X at the next Y mesh line
402
                   x = (next_mesh_line_y - c) / m; // Calculate X at the next Y mesh line
403
                                                   // (No need to worry about m being zero.
403
                                                   // (No need to worry about m being zero.
489
     // We don't want additional apply_leveling() performed by regular buffer_line or buffer_line_kinematic,
489
     // We don't want additional apply_leveling() performed by regular buffer_line or buffer_line_kinematic,
490
     // so we call _buffer_line directly here.  Per-segmented leveling and kinematics performed first.
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
       #if ENABLED(DELTA)  // apply delta inverse_kinematics
494
       #if ENABLED(DELTA)  // apply delta inverse_kinematics
495
 
495
 
505
                                          - HYPOT2( delta_tower[C_AXIS][X_AXIS] - rx,
505
                                          - HYPOT2( delta_tower[C_AXIS][X_AXIS] - rx,
506
                                                    delta_tower[C_AXIS][Y_AXIS] - ry ));
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
       #elif IS_SCARA  // apply scara inverse_kinematics (should be changed to save raw->logical->raw)
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
         inverse_kinematics(lseg); // this writes delta[ABC] from lseg[XYZ]
514
         inverse_kinematics(lseg); // this writes delta[ABC] from lseg[XYZ]
518
                                   // should move the feedrate scaling to scara inverse_kinematics
515
                                   // should move the feedrate scaling to scara inverse_kinematics
523
         scara_oldB = delta[B_AXIS];
520
         scara_oldB = delta[B_AXIS];
524
         float s_feedrate = max(adiff, bdiff) * scara_feed_factor;
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
       #else // CARTESIAN
525
       #else // CARTESIAN
529
 
526
 
530
         // Cartesian _buffer_line seems to take LOGICAL, not RAW coordinates
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
       #endif
531
       #endif
539
 
532
 
546
      * Returns true if did NOT move, false if moved (requires current_position update).
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
         return true; // did not move, so current_position still accurate
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
       const float cartesian_xy_mm = HYPOT(tot_dx, tot_dy);  // total horizontal xy distance
552
       const float cartesian_xy_mm = HYPOT(tot_dx, tot_dy);  // total horizontal xy distance
560
 
553
 
584
       // Note that E segment distance could vary slightly as z mesh height
577
       // Note that E segment distance could vary slightly as z mesh height
585
       // changes for each segment, but small enough to ignore.
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
             seg_le = current_position[E_AXIS];
583
             seg_le = current_position[E_AXIS];
591
 
584
 
592
       const bool above_fade_height = (
585
       const bool above_fade_height = (
593
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
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
         #else
588
         #else
596
           false
589
           false
597
         #endif
590
         #endif
599
 
592
 
600
       // Only compute leveling per segment if ubl active and target below z_fade_height.
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
         do {
597
         do {
605
 
598
 
609
             seg_rz += seg_dz;
602
             seg_rz += seg_dz;
610
             seg_le += seg_de;
603
             seg_le += seg_de;
611
           } else {              // last segment, use exact destination
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
         } while (segments);
613
         } while (segments);
621
 
614
 
625
       // Otherwise perform per-segment leveling
618
       // Otherwise perform per-segment leveling
626
 
619
 
627
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
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
       #else
622
       #else
630
         constexpr float fade_scaling_factor = 1.0;
623
         constexpr float fade_scaling_factor = 1.0;
631
       #endif
624
       #endif
690
 
683
 
691
           float z_cxcy = (z_cxy0 + z_cxym * cy) * fade_scaling_factor; // interpolated mesh z height along cx at cy, scaled for fade
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
             return false;                           // did not set_current_from_destination()
696
             return false;                           // did not set_current_from_destination()
704
 
697
 
705
           seg_rx += seg_dx;
698
           seg_rx += seg_dx;

+ 18
- 20
Marlin/ultralcd.cpp Переглянути файл

1673
      */
1673
      */
1674
     static int8_t bed_corner;
1674
     static int8_t bed_corner;
1675
     void _lcd_goto_next_corner() {
1675
     void _lcd_goto_next_corner() {
1676
-      line_to_z(LOGICAL_Z_POSITION(4.0));
1676
+      line_to_z(4.0);
1677
       switch (bed_corner) {
1677
       switch (bed_corner) {
1678
         case 0:
1678
         case 0:
1679
           current_position[X_AXIS] = X_MIN_BED + 10;
1679
           current_position[X_AXIS] = X_MIN_BED + 10;
1690
           break;
1690
           break;
1691
       }
1691
       }
1692
       planner.buffer_line_kinematic(current_position, MMM_TO_MMS(manual_feedrate_mm_m[X_AXIS]), active_extruder);
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
       if (++bed_corner > 3) bed_corner = 0;
1694
       if (++bed_corner > 3) bed_corner = 0;
1695
     }
1695
     }
1696
 
1696
 
1736
     //
1736
     //
1737
     void _lcd_after_probing() {
1737
     void _lcd_after_probing() {
1738
       #if MANUAL_PROBE_HEIGHT > 0
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
       #endif
1740
       #endif
1741
       // Display "Done" screen and wait for moves to complete
1741
       // Display "Done" screen and wait for moves to complete
1742
       #if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
1742
       #if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
1751
     #if ENABLED(MESH_BED_LEVELING)
1751
     #if ENABLED(MESH_BED_LEVELING)
1752
 
1752
 
1753
       // Utility to go to the next mesh point
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
         #if MANUAL_PROBE_HEIGHT > 0
1755
         #if MANUAL_PROBE_HEIGHT > 0
1756
           const float prev_z = current_position[Z_AXIS];
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
         #endif
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
         planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
1761
         planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
1762
         #if MANUAL_PROBE_HEIGHT > 0
1762
         #if MANUAL_PROBE_HEIGHT > 0
1763
           line_to_z(prev_z);
1763
           line_to_z(prev_z);
1888
 
1888
 
1889
         // Controls the loop until the move is done
1889
         // Controls the loop until the move is done
1890
         _manual_probe_goto_xy(
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
         // After the blocking function returns, change menus
1895
         // After the blocking function returns, change menus
2368
      * UBL LCD Map Movement
2368
      * UBL LCD Map Movement
2369
      */
2369
      */
2370
     void ubl_map_move_to_xy() {
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
       planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
2373
       planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
2374
     }
2374
     }
2375
 
2375
 
2703
       lcd_goto_screen(_lcd_calibrate_homing);
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
       #if HAS_LEVELING
2707
       #if HAS_LEVELING
2708
         reset_bed_level(); // After calibration bed-level data is no longer valid
2708
         reset_bed_level(); // After calibration bed-level data is no longer valid
2709
       #endif
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
       line_to_current_z();
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
       lcd_synchronize();
2717
       lcd_synchronize();
2720
       move_menu_scale = PROBE_MANUALLY_STEP;
2718
       move_menu_scale = PROBE_MANUALLY_STEP;
2721
       lcd_goto_screen(lcd_move_z);
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
       KEEPALIVE_STATE(PAUSED_FOR_USER);
2724
       KEEPALIVE_STATE(PAUSED_FOR_USER);
2727
       defer_return_to_status = true;
2725
       defer_return_to_status = true;
2728
       wait_for_user = true;
2726
       wait_for_user = true;

+ 1
- 1
Marlin/ultralcd.h Переглянути файл

202
 #endif
202
 #endif
203
 
203
 
204
 #if ENABLED(DELTA_CALIBRATION_MENU)
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
 #endif
206
 #endif
207
 
207
 
208
 #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
208
 #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)

+ 3
- 3
Marlin/ultralcd_impl_DOGM.h Переглянути файл

645
 
645
 
646
   // At the first page, regenerate the XYZ strings
646
   // At the first page, regenerate the XYZ strings
647
   if (page.page == 0) {
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
     #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
651
     #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
652
       strcpy(wstring, ftostr12ns(filament_width_meas));
652
       strcpy(wstring, ftostr12ns(filament_width_meas));
653
       strcpy(mstring, itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
653
       strcpy(mstring, itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));

+ 5
- 3
Marlin/ultralcd_impl_HD44780.h Переглянути файл

618
   lcd.print(itostr3(t1 + 0.5));
618
   lcd.print(itostr3(t1 + 0.5));
619
   lcd.write('/');
619
   lcd.write('/');
620
 
620
 
621
-  #if HEATER_IDLE_HANDLER
621
+  #if !HEATER_IDLE_HANDLER
622
+    UNUSED(blink);
623
+  #else
622
     const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
624
     const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
623
       #if HAS_TEMP_BED
625
       #if HAS_TEMP_BED
624
         thermalManager.is_bed_idle()
626
         thermalManager.is_bed_idle()
776
         // When everything is ok you see a constant 'X'.
778
         // When everything is ok you see a constant 'X'.
777
 
779
 
778
         _draw_axis_label(X_AXIS, PSTR(MSG_X), blink);
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
         lcd.write(' ');
783
         lcd.write(' ');
782
 
784
 
783
         _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
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
       #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
788
       #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
787
 
789
 

Завантаження…
Відмінити
Зберегти