Browse Source

Pass array pointer to unapply_leveling

Scott Lahteine 8 years ago
parent
commit
22ece0081e
3 changed files with 13 additions and 14 deletions
  1. 3
    3
      Marlin/Marlin_main.cpp
  2. 9
    10
      Marlin/planner.cpp
  3. 1
    1
      Marlin/planner.h

+ 3
- 3
Marlin/Marlin_main.cpp View File

@@ -3150,7 +3150,7 @@ inline void gcode_G28() {
3150 3150
             if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Rest Origin", current_position);
3151 3151
           #endif
3152 3152
         #else
3153
-          planner.unapply_leveling(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
3153
+          planner.unapply_leveling(current_position);
3154 3154
           #if ENABLED(DEBUG_LEVELING_FEATURE)
3155 3155
             if (DEBUGGING(LEVELING)) DEBUG_POS("MBL adjusted MESH_HOME_SEARCH_Z", current_position);
3156 3156
           #endif
@@ -3160,7 +3160,7 @@ inline void gcode_G28() {
3160 3160
         current_position[Z_AXIS] = pre_home_z;
3161 3161
         SYNC_PLAN_POSITION_KINEMATIC();
3162 3162
         mbl.set_active(true);
3163
-        planner.unapply_leveling(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
3163
+        planner.unapply_leveling(current_position);
3164 3164
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3165 3165
           if (DEBUGGING(LEVELING)) DEBUG_POS("MBL Home X or Y", current_position);
3166 3166
         #endif
@@ -8053,7 +8053,7 @@ void get_cartesian_from_steppers() {
8053 8053
 void set_current_from_steppers_for_axis(const AxisEnum axis) {
8054 8054
   get_cartesian_from_steppers();
8055 8055
   #if PLANNER_LEVELING
8056
-    planner.unapply_leveling(cartes[X_AXIS], cartes[Y_AXIS], cartes[Z_AXIS]);
8056
+    planner.unapply_leveling(cartes);
8057 8057
   #endif
8058 8058
   if (axis == ALL_AXES)
8059 8059
     memcpy(current_position, cartes, sizeof(cartes));

+ 9
- 10
Marlin/planner.cpp View File

@@ -570,7 +570,7 @@ void Planner::check_axes_activity() {
570 570
     #endif
571 571
   }
572 572
 
573
-  void Planner::unapply_leveling(float &lx, float &ly, float &lz) {
573
+  void Planner::unapply_leveling(float logical[XYZ]) {
574 574
 
575 575
     #if ENABLED(AUTO_BED_LEVELING_FEATURE)
576 576
       if (!abl_enabled) return;
@@ -579,26 +579,25 @@ void Planner::check_axes_activity() {
579 579
     #if ENABLED(MESH_BED_LEVELING)
580 580
 
581 581
       if (mbl.active())
582
-        lz -= mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
582
+        logical[Z_AXIS] -= mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));
583 583
 
584 584
     #elif ENABLED(AUTO_BED_LEVELING_LINEAR)
585 585
 
586 586
       matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
587 587
 
588
-      float dx = RAW_X_POSITION(lx) - (X_TILT_FULCRUM),
589
-            dy = RAW_Y_POSITION(ly) - (Y_TILT_FULCRUM),
590
-            dz = RAW_Z_POSITION(lz);
588
+      float dx = RAW_X_POSITION(logical[X_AXIS]) - (X_TILT_FULCRUM),
589
+            dy = RAW_Y_POSITION(logical[Y_AXIS]) - (Y_TILT_FULCRUM),
590
+            dz = RAW_Z_POSITION(logical[Z_AXIS]);
591 591
 
592 592
       apply_rotation_xyz(inverse, dx, dy, dz);
593 593
 
594
-      lx = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
595
-      ly = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
596
-      lz = LOGICAL_Z_POSITION(dz);
594
+      logical[X_AXIS] = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
595
+      logical[Y_AXIS] = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
596
+      logical[Z_AXIS] = LOGICAL_Z_POSITION(dz);
597 597
 
598 598
     #elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
599 599
 
600
-      float tmp[XYZ] = { lx, ly, 0 };
601
-      lz -= nonlinear_z_offset(tmp);
600
+      logical[Z_AXIS] -= nonlinear_z_offset(logical);
602 601
 
603 602
     #endif
604 603
   }

+ 1
- 1
Marlin/planner.h View File

@@ -219,7 +219,7 @@ class Planner {
219 219
        * as it will be given to the planner and steppers.
220 220
        */
221 221
       static void apply_leveling(float &lx, float &ly, float &lz);
222
-      static void unapply_leveling(float &lx, float &ly, float &lz);
222
+      static void unapply_leveling(float logical[XYZ]);
223 223
 
224 224
     #endif
225 225
 

Loading…
Cancel
Save