Browse Source

Use GRID_MAX_POINTS. Some formatting

Scott Lahteine 7 years ago
parent
commit
a7fb55ea6d
5 changed files with 21 additions and 28 deletions
  1. 2
    5
      Marlin/G26_Mesh_Validation_Tool.cpp
  2. 2
    2
      Marlin/planner.cpp
  3. 1
    3
      Marlin/ubl.h
  4. 8
    10
      Marlin/ubl_G29.cpp
  5. 8
    8
      Marlin/ultralcd.cpp

+ 2
- 5
Marlin/G26_Mesh_Validation_Tool.cpp View File

@@ -69,7 +69,7 @@
69 69
    *   B #  Bed         Set the Bed Temperature.  If not specified, a default of 60 C. will be assumed.
70 70
    *
71 71
    *   C    Current     When searching for Mesh Intersection points to draw, use the current nozzle location
72
-                        as the base for any distance comparison.
72
+   *                    as the base for any distance comparison.
73 73
    *
74 74
    *   D    Disable     Disable the Unified Bed Leveling System.  In the normal case the user is invoking this
75 75
    *                    command to see how well a Mesh as been adjusted to match a print surface.  In order to do
@@ -748,10 +748,7 @@
748 748
     }
749 749
 
750 750
     /**
751
-     * We save the question of what to do with the Unified Bed Leveling System's Activation until the very
752
-     * end.  The reason is, if one of the parameters specified up above is incorrect, we don't want to
753
-     * alter the system's status.  We wait until we know everything is correct before altering the state
754
-     * of the system.
751
+     * Wait until all parameters are verified before altering the state!
755 752
      */
756 753
     ubl.state.active = !code_seen('D');
757 754
 

+ 2
- 2
Marlin/planner.cpp View File

@@ -539,7 +539,7 @@ void Planner::check_axes_activity() {
539 539
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
540 540
         // if z_fade_height enabled (nonzero) and raw_z above it, no leveling required
541 541
         if ((planner.z_fade_height) && (planner.z_fade_height <= RAW_Z_POSITION(lz))) return;
542
-        lz += ubl.state.z_offset + ubl.get_z_correction(lx,ly) * ubl.fade_scaling_factor_for_z(lz);
542
+        lz += ubl.state.z_offset + ubl.get_z_correction(lx, ly) * ubl.fade_scaling_factor_for_z(lz);
543 543
       #else // no fade
544 544
         lz += ubl.state.z_offset + ubl.get_z_correction(lx,ly);
545 545
       #endif // FADE
@@ -617,7 +617,7 @@ void Planner::check_axes_activity() {
617 617
           //    so U==(L-O-M)/(1-M/H) for U<H
618 618
 
619 619
           if (planner.z_fade_height) {
620
-            float z_unfaded = z_unlevel / (1.0 - z_ublmesh * planner.inverse_z_fade_height);
620
+            const float z_unfaded = z_unlevel / (1.0 - z_ublmesh * planner.inverse_z_fade_height);
621 621
             if (z_unfaded < planner.z_fade_height)  // don't know until after compute
622 622
               z_unlevel = z_unfaded;
623 623
           }

+ 1
- 3
Marlin/ubl.h View File

@@ -61,8 +61,7 @@
61 61
 
62 62
   void dump(char * const str, const float &f);
63 63
   void probe_entire_mesh(const float&, const float&, const bool, const bool, const bool);
64
-  void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
65
-  float measure_business_card_thickness(const float&);
64
+  float measure_business_card_thickness(float&);
66 65
   mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const float&, const float&, const bool, unsigned int[16], bool);
67 66
   void shift_mesh_height();
68 67
   void fine_tune_mesh(const float&, const float&, const bool);
@@ -108,7 +107,6 @@
108 107
       void probe_entire_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map, const bool stow_probe, bool do_furthest);
109 108
       void tilt_mesh_based_on_3pts(const float &z1, const float &z2, const float &z3);
110 109
       void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map);
111
-      void manually_probe_remaining_mesh(const float &lx, const float &ly, const float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map);
112 110
       void save_ubl_active_state_and_disable();
113 111
       void restore_ubl_active_state_and_leave();
114 112
       void g29_what_command();

+ 8
- 10
Marlin/ubl_G29.cpp View File

@@ -56,7 +56,7 @@
56 56
   extern bool set_probe_deployed(bool);
57 57
   void smart_fill_mesh();
58 58
   float measure_business_card_thickness(float &in_height);
59
-  void manually_probe_remaining_mesh(const float &lx, const float &ly, float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map);
59
+  void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
60 60
 
61 61
   bool ProbeStay = true;
62 62
 
@@ -482,7 +482,7 @@
482 482
            */
483 483
           if (c_flag) {
484 484
 
485
-            if ( repetition_cnt >= ( GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y )) {
485
+            if (repetition_cnt >= GRID_MAX_POINTS) {
486 486
               for ( uint8_t x = 0; x < GRID_MAX_POINTS_X; x++ ) {
487 487
                 for ( uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++ ) {
488 488
                   ubl.z_values[x][y] = ubl_constant;
@@ -735,7 +735,7 @@
735 735
     ubl.save_ubl_active_state_and_disable();   // we don't do bed level correction because we want the raw data when we probe
736 736
     DEPLOY_PROBE();
737 737
 
738
-    uint16_t max_iterations = ( GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y );
738
+    uint16_t max_iterations = GRID_MAX_POINTS;
739 739
 
740 740
     do {
741 741
       if (ubl_lcd_clicked()) {
@@ -941,7 +941,7 @@
941 941
     return thickness;
942 942
   }
943 943
 
944
-  void manually_probe_remaining_mesh(const float &lx, const float &ly, float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map) {
944
+  void manually_probe_remaining_mesh(const float &lx, const float &ly, const float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map) {
945 945
 
946 946
     ubl.has_control_of_lcd_panel = true;
947 947
     ubl.save_ubl_active_state_and_disable();   // we don't do bed level correction because we want the raw data when we probe
@@ -956,14 +956,11 @@
956 956
       if (location.x_index < 0 && location.y_index < 0) continue;
957 957
 
958 958
       const float rawx = pgm_read_float(&ubl.mesh_index_to_xpos[location.x_index]),
959
-                  rawy = pgm_read_float(&ubl.mesh_index_to_ypos[location.y_index]);
960
-
961
-      const float xProbe = LOGICAL_X_POSITION(rawx),
959
+                  rawy = pgm_read_float(&ubl.mesh_index_to_ypos[location.y_index]),
960
+                  xProbe = LOGICAL_X_POSITION(rawx),
962 961
                   yProbe = LOGICAL_Y_POSITION(rawy);
963 962
 
964
-      if ( ! position_is_reachable_raw_xy( rawx, rawy )) {    // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points)
965
-        break;
966
-      }
963
+      if (!position_is_reachable_raw_xy(rawx, rawy)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points)
967 964
 
968 965
       do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
969 966
 
@@ -1129,6 +1126,7 @@
1129 1126
       SERIAL_PROTOCOLLNPGM("Invalid map type.\n");
1130 1127
       return UBL_ERR;
1131 1128
     }
1129
+
1132 1130
     // Check if a map type was specified
1133 1131
     if (code_seen('M')) { // Warning! Use of 'M' flouts established standards.
1134 1132
       map_type = code_has_value() ? code_value_int() : 0;

+ 8
- 8
Marlin/ultralcd.cpp View File

@@ -1674,13 +1674,13 @@ void kill_screen(const char* lcd_msg) {
1674 1674
 
1675 1675
     void _lcd_ubl_level_bed();
1676 1676
 
1677
-    int UBL_STORAGE_SLOT = 0;
1678
-    int CUSTOM_BED_TEMP = 50;
1679
-    int CUSTOM_HOTEND_TEMP = 190;
1680
-    int SIDE_POINTS = 3;
1681
-    int UBL_FILLIN_AMOUNT = 5;
1682
-    int UBL_HEIGHT_AMOUNT;
1683
-    int map_type;
1677
+    int UBL_STORAGE_SLOT = 0,
1678
+        CUSTOM_BED_TEMP = 50,
1679
+        CUSTOM_HOTEND_TEMP = 190,
1680
+        SIDE_POINTS = 3,
1681
+        UBL_FILLIN_AMOUNT = 5,
1682
+        UBL_HEIGHT_AMOUNT,
1683
+        map_type;
1684 1684
 
1685 1685
     char UBL_LCD_GCODE [30];
1686 1686
 
@@ -1858,7 +1858,7 @@ void kill_screen(const char* lcd_msg) {
1858 1858
      * UBL Build Mesh submenu
1859 1859
      */
1860 1860
     void _lcd_ubl_build_mesh() {
1861
-      int GRID_NUM_POINTS = GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y ;
1861
+      int GRID_NUM_POINTS = GRID_MAX_POINTS;
1862 1862
       START_MENU();
1863 1863
       MENU_BACK(MSG_UBL_TOOLS);
1864 1864
       #if (WATCH_THE_BED)

Loading…
Cancel
Save