Apply some general cleanup to code

This commit is contained in:
Scott Lahteine 2017-03-24 00:53:28 -05:00
parent d1e6b0e21a
commit d076c1b604
4 changed files with 9 additions and 10 deletions

View File

@ -40,7 +40,6 @@
#include "fastio.h" #include "fastio.h"
#include "utility.h" #include "utility.h"
#ifdef USBCON #ifdef USBCON
#include "HardwareSerial.h" #include "HardwareSerial.h"
#if ENABLED(BLUETOOTH) #if ENABLED(BLUETOOTH)

View File

@ -2009,7 +2009,7 @@ static void clean_up_after_endstop_or_probe_move() {
safe_delay(375); 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); bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
@ -2284,7 +2284,7 @@ static void clean_up_after_endstop_or_probe_move() {
mbl.set_active(enable && mbl.has_mesh()); 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) #elif HAS_ABL && !ENABLED(AUTO_BED_LEVELING_UBL)
@ -8528,7 +8528,7 @@ void process_next_command() {
gcode_G28(); gcode_G28();
break; break;
#if PLANNER_LEVELING || HAS_ABL #if PLANNER_LEVELING
case 29: // G29 Detailed Z probe, probes the bed at 3 or more points, case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
// or provides access to the UBL System if enabled. // or provides access to the UBL System if enabled.
gcode_G29(); gcode_G29();
@ -9584,7 +9584,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
float normalized_dist, end[XYZE]; float normalized_dist, end[XYZE];
// Split at the left/front border of the right/top square // 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)) { if (cx2 != cx1 && TEST(x_splits, gcx)) {
COPY(end, destination); COPY(end, destination);
destination[X_AXIS] = LOGICAL_X_POSITION(mbl.get_probe_x(gcx)); 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]; float normalized_dist, end[XYZE];
// Split at the left/front border of the right/top square // 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)) { if (cx2 != cx1 && TEST(x_splits, gcx)) {
COPY(end, destination); COPY(end, destination);
destination[X_AXIS] = LOGICAL_X_POSITION(bilinear_start[X_AXIS] + ABL_BG_SPACING(X_AXIS) * gcx); 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) { float calculate_volumetric_multiplier(float diameter) {
if (!volumetric_enabled || diameter == 0) return 1.0; 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() { void calculate_volumetric_multipliers() {

View File

@ -87,12 +87,12 @@
} }
int8_t probe_index_x(const float &x) const { 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; return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
} }
int8_t probe_index_y(const float &y) const { 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; return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
} }

View File

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