Browse Source

Apply some general cleanup to code

Scott Lahteine 7 years ago
parent
commit
d076c1b604
4 changed files with 9 additions and 10 deletions
  1. 0
    1
      Marlin/Marlin.h
  2. 6
    6
      Marlin/Marlin_main.cpp
  3. 2
    2
      Marlin/mesh_bed_leveling.h
  4. 1
    1
      Marlin/ultralcd.cpp

+ 0
- 1
Marlin/Marlin.h View File

40
 #include "fastio.h"
40
 #include "fastio.h"
41
 #include "utility.h"
41
 #include "utility.h"
42
 
42
 
43
-
44
 #ifdef USBCON
43
 #ifdef USBCON
45
   #include "HardwareSerial.h"
44
   #include "HardwareSerial.h"
46
   #if ENABLED(BLUETOOTH)
45
   #if ENABLED(BLUETOOTH)

+ 6
- 6
Marlin/Marlin_main.cpp View File

2009
       safe_delay(375);
2009
       safe_delay(375);
2010
     }
2010
     }
2011
 
2011
 
2012
-    FORCE_INLINE void set_bltouch_deployed(const bool &deploy) {
2012
+    void set_bltouch_deployed(const bool deploy) {
2013
       bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
2013
       bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
2014
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2014
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2015
         if (DEBUGGING(LEVELING)) {
2015
         if (DEBUGGING(LEVELING)) {
2284
 
2284
 
2285
         mbl.set_active(enable && mbl.has_mesh());
2285
         mbl.set_active(enable && mbl.has_mesh());
2286
 
2286
 
2287
-        if (enable) planner.unapply_leveling(current_position);
2287
+        if (enable && mbl.has_mesh()) planner.unapply_leveling(current_position);
2288
       }
2288
       }
2289
 
2289
 
2290
     #elif HAS_ABL && !ENABLED(AUTO_BED_LEVELING_UBL)
2290
     #elif HAS_ABL && !ENABLED(AUTO_BED_LEVELING_UBL)
8528
         gcode_G28();
8528
         gcode_G28();
8529
         break;
8529
         break;
8530
 
8530
 
8531
-      #if PLANNER_LEVELING || HAS_ABL
8531
+      #if PLANNER_LEVELING
8532
         case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
8532
         case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
8533
                  // or provides access to the UBL System if enabled.
8533
                  // or provides access to the UBL System if enabled.
8534
           gcode_G29();
8534
           gcode_G29();
9584
     float normalized_dist, end[XYZE];
9584
     float normalized_dist, end[XYZE];
9585
 
9585
 
9586
     // Split at the left/front border of the right/top square
9586
     // Split at the left/front border of the right/top square
9587
-    int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2);
9587
+    const int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2);
9588
     if (cx2 != cx1 && TEST(x_splits, gcx)) {
9588
     if (cx2 != cx1 && TEST(x_splits, gcx)) {
9589
       COPY(end, destination);
9589
       COPY(end, destination);
9590
       destination[X_AXIS] = LOGICAL_X_POSITION(mbl.get_probe_x(gcx));
9590
       destination[X_AXIS] = LOGICAL_X_POSITION(mbl.get_probe_x(gcx));
9647
     float normalized_dist, end[XYZE];
9647
     float normalized_dist, end[XYZE];
9648
 
9648
 
9649
     // Split at the left/front border of the right/top square
9649
     // Split at the left/front border of the right/top square
9650
-    int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2);
9650
+    const int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2);
9651
     if (cx2 != cx1 && TEST(x_splits, gcx)) {
9651
     if (cx2 != cx1 && TEST(x_splits, gcx)) {
9652
       COPY(end, destination);
9652
       COPY(end, destination);
9653
       destination[X_AXIS] = LOGICAL_X_POSITION(bilinear_start[X_AXIS] + ABL_BG_SPACING(X_AXIS) * gcx);
9653
       destination[X_AXIS] = LOGICAL_X_POSITION(bilinear_start[X_AXIS] + ABL_BG_SPACING(X_AXIS) * gcx);
10288
 
10288
 
10289
 float calculate_volumetric_multiplier(float diameter) {
10289
 float calculate_volumetric_multiplier(float diameter) {
10290
   if (!volumetric_enabled || diameter == 0) return 1.0;
10290
   if (!volumetric_enabled || diameter == 0) return 1.0;
10291
-  return 1.0 / (M_PI * diameter * 0.5 * diameter * 0.5);
10291
+  return 1.0 / (M_PI * sq(diameter * 0.5));
10292
 }
10292
 }
10293
 
10293
 
10294
 void calculate_volumetric_multipliers() {
10294
 void calculate_volumetric_multipliers() {

+ 2
- 2
Marlin/mesh_bed_leveling.h View File

87
     }
87
     }
88
 
88
 
89
     int8_t probe_index_x(const float &x) const {
89
     int8_t probe_index_x(const float &x) const {
90
-      int8_t px = (x - (MESH_MIN_X) + (MESH_X_DIST) * 0.5) * (1.0 / (MESH_X_DIST));
90
+      int8_t px = (x - (MESH_MIN_X) + 0.5 * (MESH_X_DIST)) * (1.0 / (MESH_X_DIST));
91
       return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
91
       return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
92
     }
92
     }
93
 
93
 
94
     int8_t probe_index_y(const float &y) const {
94
     int8_t probe_index_y(const float &y) const {
95
-      int8_t py = (y - (MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) * (1.0 / (MESH_Y_DIST));
95
+      int8_t py = (y - (MESH_MIN_Y) + 0.5 * (MESH_Y_DIST)) * (1.0 / (MESH_Y_DIST));
96
       return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
96
       return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
97
     }
97
     }
98
 
98
 

+ 1
- 1
Marlin/ultralcd.cpp View File

860
 
860
 
861
     static void _lcd_mesh_fine_tune(const char* msg) {
861
     static void _lcd_mesh_fine_tune(const char* msg) {
862
       static millis_t next_click = 0;
862
       static millis_t next_click = 0;
863
-      int16_t last_digit, movement;
863
+      int16_t last_digit;
864
       int32_t rounded;
864
       int32_t rounded;
865
 
865
 
866
       defer_return_to_status = true;
866
       defer_return_to_status = true;

Loading…
Cancel
Save