From d076c1b604fe3ae39dc9749c30f14d140b55073f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Mar 2017 00:53:28 -0500 Subject: [PATCH] Apply some general cleanup to code --- Marlin/Marlin.h | 1 - Marlin/Marlin_main.cpp | 12 ++++++------ Marlin/mesh_bed_leveling.h | 4 ++-- Marlin/ultralcd.cpp | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 869439817..24777e420 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -40,7 +40,6 @@ #include "fastio.h" #include "utility.h" - #ifdef USBCON #include "HardwareSerial.h" #if ENABLED(BLUETOOTH) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 049d50198..5edf898a8 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2009,7 +2009,7 @@ static void clean_up_after_endstop_or_probe_move() { safe_delay(375); } - FORCE_INLINE void set_bltouch_deployed(const bool &deploy) { + void set_bltouch_deployed(const bool deploy) { bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW); #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { @@ -2284,7 +2284,7 @@ static void clean_up_after_endstop_or_probe_move() { mbl.set_active(enable && mbl.has_mesh()); - if (enable) planner.unapply_leveling(current_position); + if (enable && mbl.has_mesh()) planner.unapply_leveling(current_position); } #elif HAS_ABL && !ENABLED(AUTO_BED_LEVELING_UBL) @@ -8528,7 +8528,7 @@ void process_next_command() { gcode_G28(); break; - #if PLANNER_LEVELING || HAS_ABL + #if PLANNER_LEVELING case 29: // G29 Detailed Z probe, probes the bed at 3 or more points, // or provides access to the UBL System if enabled. gcode_G29(); @@ -9584,7 +9584,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { float normalized_dist, end[XYZE]; // Split at the left/front border of the right/top square - int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2); + const int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2); if (cx2 != cx1 && TEST(x_splits, gcx)) { COPY(end, destination); 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) { float normalized_dist, end[XYZE]; // Split at the left/front border of the right/top square - int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2); + const int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2); if (cx2 != cx1 && TEST(x_splits, gcx)) { COPY(end, destination); 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() { float calculate_volumetric_multiplier(float diameter) { if (!volumetric_enabled || diameter == 0) return 1.0; - return 1.0 / (M_PI * diameter * 0.5 * diameter * 0.5); + return 1.0 / (M_PI * sq(diameter * 0.5)); } void calculate_volumetric_multipliers() { diff --git a/Marlin/mesh_bed_leveling.h b/Marlin/mesh_bed_leveling.h index 2f5758818..fd0d1d7b1 100644 --- a/Marlin/mesh_bed_leveling.h +++ b/Marlin/mesh_bed_leveling.h @@ -87,12 +87,12 @@ } int8_t probe_index_x(const float &x) const { - int8_t px = (x - (MESH_MIN_X) + (MESH_X_DIST) * 0.5) * (1.0 / (MESH_X_DIST)); + int8_t px = (x - (MESH_MIN_X) + 0.5 * (MESH_X_DIST)) * (1.0 / (MESH_X_DIST)); return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1; } int8_t probe_index_y(const float &y) const { - int8_t py = (y - (MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) * (1.0 / (MESH_Y_DIST)); + int8_t py = (y - (MESH_MIN_Y) + 0.5 * (MESH_Y_DIST)) * (1.0 / (MESH_Y_DIST)); return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1; } diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 7a8905987..08c82dc28 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -860,7 +860,7 @@ void kill_screen(const char* lcd_msg) { static void _lcd_mesh_fine_tune(const char* msg) { static millis_t next_click = 0; - int16_t last_digit, movement; + int16_t last_digit; int32_t rounded; defer_return_to_status = true;