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,7 +40,6 @@
40 40
 #include "fastio.h"
41 41
 #include "utility.h"
42 42
 
43
-
44 43
 #ifdef USBCON
45 44
   #include "HardwareSerial.h"
46 45
   #if ENABLED(BLUETOOTH)

+ 6
- 6
Marlin/Marlin_main.cpp View File

@@ -2009,7 +2009,7 @@ static void clean_up_after_endstop_or_probe_move() {
2009 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 2013
       bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
2014 2014
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2015 2015
         if (DEBUGGING(LEVELING)) {
@@ -2284,7 +2284,7 @@ static void clean_up_after_endstop_or_probe_move() {
2284 2284
 
2285 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 2290
     #elif HAS_ABL && !ENABLED(AUTO_BED_LEVELING_UBL)
@@ -8528,7 +8528,7 @@ void process_next_command() {
8528 8528
         gcode_G28();
8529 8529
         break;
8530 8530
 
8531
-      #if PLANNER_LEVELING || HAS_ABL
8531
+      #if PLANNER_LEVELING
8532 8532
         case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
8533 8533
                  // or provides access to the UBL System if enabled.
8534 8534
           gcode_G29();
@@ -9584,7 +9584,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
9584 9584
     float normalized_dist, end[XYZE];
9585 9585
 
9586 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 9588
     if (cx2 != cx1 && TEST(x_splits, gcx)) {
9589 9589
       COPY(end, destination);
9590 9590
       destination[X_AXIS] = LOGICAL_X_POSITION(mbl.get_probe_x(gcx));
@@ -9647,7 +9647,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
9647 9647
     float normalized_dist, end[XYZE];
9648 9648
 
9649 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 9651
     if (cx2 != cx1 && TEST(x_splits, gcx)) {
9652 9652
       COPY(end, destination);
9653 9653
       destination[X_AXIS] = LOGICAL_X_POSITION(bilinear_start[X_AXIS] + ABL_BG_SPACING(X_AXIS) * gcx);
@@ -10288,7 +10288,7 @@ void prepare_move_to_destination() {
10288 10288
 
10289 10289
 float calculate_volumetric_multiplier(float diameter) {
10290 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 10294
 void calculate_volumetric_multipliers() {

+ 2
- 2
Marlin/mesh_bed_leveling.h View File

@@ -87,12 +87,12 @@
87 87
     }
88 88
 
89 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 91
       return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
92 92
     }
93 93
 
94 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 96
       return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
97 97
     }
98 98
 

+ 1
- 1
Marlin/ultralcd.cpp View File

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

Loading…
Cancel
Save