Browse Source

Merge Zig-Zag Endpoint (PR#65)

Richard Wackerbarth 10 years ago
parent
commit
9531b154ea
1 changed files with 7 additions and 11 deletions
  1. 7
    11
      Marlin/Marlin_main.cpp

+ 7
- 11
Marlin/Marlin_main.cpp View File

2561
         double eqnAMatrix[abl2 * 3], // "A" matrix of the linear system of equations
2561
         double eqnAMatrix[abl2 * 3], // "A" matrix of the linear system of equations
2562
                eqnBVector[abl2],     // "B" vector of Z points
2562
                eqnBVector[abl2],     // "B" vector of Z points
2563
                mean = 0.0;
2563
                mean = 0.0;
2564
+        int8_t indexIntoAB[auto_bed_leveling_grid_points][auto_bed_leveling_grid_points];
2564
       #endif // !DELTA
2565
       #endif // !DELTA
2565
 
2566
 
2566
       int probePointCounter = 0;
2567
       int probePointCounter = 0;
2567
-      bool zig = true;
2568
+      bool zig = (auto_bed_leveling_grid_points & 1) ? true : false; //always end at [RIGHT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION]
2568
 
2569
 
2569
       for (int yCount = 0; yCount < auto_bed_leveling_grid_points; yCount++) {
2570
       for (int yCount = 0; yCount < auto_bed_leveling_grid_points; yCount++) {
2570
         double yProbe = front_probe_bed_position + yGridSpacing * yCount;
2571
         double yProbe = front_probe_bed_position + yGridSpacing * yCount;
2581
           xInc = -1;
2582
           xInc = -1;
2582
         }
2583
         }
2583
 
2584
 
2584
-        #if DISABLED(DELTA)
2585
-          // If do_topography_map is set then don't zig-zag. Just scan in one direction.
2586
-          // This gets the probe points in more readable order.
2587
-          if (!do_topography_map) zig = !zig;
2588
-        #else
2589
-          zig = !zig;
2590
-        #endif
2585
+        zig = !zig;
2591
 
2586
 
2592
         for (int xCount = xStart; xCount != xStop; xCount += xInc) {
2587
         for (int xCount = xStart; xCount != xStop; xCount += xInc) {
2593
           double xProbe = left_probe_bed_position + xGridSpacing * xCount;
2588
           double xProbe = left_probe_bed_position + xGridSpacing * xCount;
2621
             eqnAMatrix[probePointCounter + 0 * abl2] = xProbe;
2616
             eqnAMatrix[probePointCounter + 0 * abl2] = xProbe;
2622
             eqnAMatrix[probePointCounter + 1 * abl2] = yProbe;
2617
             eqnAMatrix[probePointCounter + 1 * abl2] = yProbe;
2623
             eqnAMatrix[probePointCounter + 2 * abl2] = 1;
2618
             eqnAMatrix[probePointCounter + 2 * abl2] = 1;
2619
+            indexIntoAB[xCount][yCount] = probePointCounter;
2624
           #else
2620
           #else
2625
             bed_level[xCount][yCount] = measured_z + z_offset;
2621
             bed_level[xCount][yCount] = measured_z + z_offset;
2626
           #endif
2622
           #endif
2627
 
2623
 
2628
           probePointCounter++;
2624
           probePointCounter++;
2629
-
2625
+  
2630
           idle();
2626
           idle();
2631
 
2627
 
2632
         } //xProbe
2628
         } //xProbe
2679
 
2675
 
2680
           for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
2676
           for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
2681
             for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
2677
             for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
2682
-              int ind = yy * auto_bed_leveling_grid_points + xx;
2678
+              int ind = indexIntoAB[xx][yy];
2683
               float diff = eqnBVector[ind] - mean;
2679
               float diff = eqnBVector[ind] - mean;
2684
 
2680
 
2685
               float x_tmp = eqnAMatrix[ind + 0 * abl2],
2681
               float x_tmp = eqnAMatrix[ind + 0 * abl2],
2705
 
2701
 
2706
             for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
2702
             for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
2707
               for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
2703
               for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
2708
-                int ind = yy * auto_bed_leveling_grid_points + xx;
2704
+                int ind = indexIntoAB[xx][yy];
2709
                 float x_tmp = eqnAMatrix[ind + 0 * abl2],
2705
                 float x_tmp = eqnAMatrix[ind + 0 * abl2],
2710
                   y_tmp = eqnAMatrix[ind + 1 * abl2],
2706
                   y_tmp = eqnAMatrix[ind + 1 * abl2],
2711
                   z_tmp = 0;
2707
                   z_tmp = 0;

Loading…
Cancel
Save