From 6292d9e8155fd7372fa2019881c270911763dd34 Mon Sep 17 00:00:00 2001 From: Richard Wackerbarth Date: Wed, 5 Aug 2015 07:12:26 -0500 Subject: [PATCH] Rename ENABLE_AUTO_BED_LEVELING MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the introduction of the #if ENABLED(…) reads better than --- Marlin/Conditionals.h | 4 +- Marlin/Configuration.h | 11 ++-- Marlin/Marlin.h | 4 +- Marlin/Marlin_main.cpp | 54 +++++++++---------- Marlin/SanityCheck.h | 14 ++--- Marlin/configuration_store.cpp | 8 +-- Marlin/configurator/config/Configuration.h | 11 ++-- .../Felix/Configuration.h | 11 ++-- .../Felix/Configuration_DUAL.h | 12 +++-- .../Hephestos/Configuration.h | 12 +++-- .../K8200/Configuration.h | 11 ++-- .../RepRapWorld/Megatronics/Configuration.h | 12 +++-- .../RigidBot/Configuration.h | 11 ++-- .../SCARA/Configuration.h | 11 ++-- .../WITBOX/Configuration.h | 11 ++-- .../adafruit/ST7565/Configuration.h | 12 +++-- .../delta/biv2.5/Configuration.h | 11 ++-- .../delta/generic/Configuration.h | 12 +++-- .../delta/kossel_mini/Configuration.h | 12 +++-- .../delta/kossel_pro/Configuration.h | 12 +++-- .../makibox/Configuration.h | 11 ++-- .../tvrrug/Round2/Configuration.h | 12 +++-- Marlin/planner.cpp | 20 +++---- Marlin/planner.h | 8 +-- Marlin/ultralcd.cpp | 4 +- Marlin/vector_3.cpp | 4 +- Marlin/vector_3.h | 4 +- 27 files changed, 173 insertions(+), 146 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 665ff45b31..29659feb81 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -279,7 +279,7 @@ /** * Auto Bed Leveling */ - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) // Boundaries for probing based on set limits #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER)) #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER)) @@ -287,7 +287,7 @@ #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER)) #endif - #define SERVO_LEVELING (defined(ENABLE_AUTO_BED_LEVELING) && defined(Z_ENDSTOP_SERVO_NR)) + #define SERVO_LEVELING (defined(AUTO_BED_LEVELING_FEATURE) && defined(Z_ENDSTOP_SERVO_NR)) /** * Sled Options diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 772683877d..bc972625b8 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -442,10 +442,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // @section bedlevel -//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line). -#define Z_MIN_PROBE_REPEATABILITY_TEST // If not commented out, Z probe repeatability test will be included if auto bed leveling is enabled. +//#define AUTO_BED_LEVELING_FEATURE // Delete the comment to enable (remove // at the start of the line) +//#define DEBUG_LEVELING_FEATURE +#define Z_MIN_PROBE_REPEATABILITY_TEST // If not commented out, Z-Probe Repeatability test will be included if Auto Bed Leveling is Enabled. -#if ENABLED(ENABLE_AUTO_BED_LEVELING) +#if ENABLED(AUTO_BED_LEVELING_FEATURE) // There are 2 different ways to specify probing locations: // @@ -557,7 +558,7 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define Z_MIN_PROBE_ENDSTOP -#endif // ENABLE_AUTO_BED_LEVELING +#endif // AUTO_BED_LEVELING_FEATURE // @section homing @@ -608,7 +609,7 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // Custom M code points #define CUSTOM_M_CODES #if ENABLED(CUSTOM_M_CODES) - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 #define Z_PROBE_OFFSET_RANGE_MIN -20 #define Z_PROBE_OFFSET_RANGE_MAX 20 diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 4c6ef0adb9..33487c869e 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -268,7 +268,7 @@ extern bool axis_known_position[3]; // axis[n].is_known extern float delta_diagonal_rod; extern float delta_segments_per_second; void recalc_delta_settings(float radius, float diagonal_rod); - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) extern int delta_grid_spacing[2]; void adjust_delta(float cartesian[3]); #endif @@ -282,7 +282,7 @@ extern bool axis_known_position[3]; // axis[n].is_known extern float z_endstop_adj; #endif -#if ENABLED(ENABLE_AUTO_BED_LEVELING) +#if ENABLED(AUTO_BED_LEVELING_FEATURE) extern float zprobe_zoffset; #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 88c5bfc8d4..ea4b2fd212 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -29,12 +29,12 @@ #include "Marlin.h" -#if ENABLED(ENABLE_AUTO_BED_LEVELING) +#if ENABLED(AUTO_BED_LEVELING_FEATURE) #include "vector_3.h" #if ENABLED(AUTO_BED_LEVELING_GRID) #include "qr_solve.h" #endif -#endif // ENABLE_AUTO_BED_LEVELING +#endif // AUTO_BED_LEVELING_FEATURE #if ENABLED(MESH_BED_LEVELING) #include "mesh_bed_leveling.h" @@ -288,7 +288,7 @@ static uint8_t target_extruder; bool no_wait_for_cooling = true; bool target_direction; -#if ENABLED(ENABLE_AUTO_BED_LEVELING) +#if ENABLED(AUTO_BED_LEVELING_FEATURE) int xy_travel_speed = XY_TRAVEL_SPEED; float zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER; #endif @@ -366,7 +366,7 @@ bool target_direction; float delta_diagonal_rod = DELTA_DIAGONAL_ROD; float delta_diagonal_rod_2 = sq(delta_diagonal_rod); float delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND; - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) int delta_grid_spacing[2] = { 0, 0 }; float bed_level[AUTO_BED_LEVELING_GRID_POINTS][AUTO_BED_LEVELING_GRID_POINTS]; #endif @@ -1095,7 +1095,7 @@ static void set_axis_is_at_home(AxisEnum axis) { min_pos[axis] = base_min_pos(axis) + home_offset[axis]; max_pos[axis] = base_max_pos(axis) + home_offset[axis]; - #if ENABLED(ENABLE_AUTO_BED_LEVELING) && Z_HOME_DIR < 0 + #if ENABLED(AUTO_BED_LEVELING_FEATURE) && Z_HOME_DIR < 0 if (axis == Z_AXIS) current_position[Z_AXIS] -= zprobe_zoffset; #endif } @@ -1146,7 +1146,7 @@ static void setup_for_endstop_move() { enable_endstops(true); } -#if ENABLED(ENABLE_AUTO_BED_LEVELING) +#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(DELTA) /** @@ -1604,7 +1604,7 @@ static void setup_for_endstop_move() { #endif -#endif // ENABLE_AUTO_BED_LEVELING +#endif // AUTO_BED_LEVELING_FEATURE #if ENABLED(Z_PROBE_SLED) @@ -2000,7 +2000,7 @@ inline void gcode_G28() { st_synchronize(); // For auto bed leveling, clear the level matrix - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) plan_bed_level_matrix.set_to_identity(); #if ENABLED(DELTA) reset_bed_level(); @@ -2395,7 +2395,7 @@ inline void gcode_G28() { } // switch(state) } -#elif ENABLED(ENABLE_AUTO_BED_LEVELING) +#elif ENABLED(AUTO_BED_LEVELING_FEATURE) void out_of_range_error(const char *p_edge) { SERIAL_PROTOCOLPGM("?Probe "); @@ -2839,7 +2839,7 @@ inline void gcode_G28() { #endif //!Z_PROBE_SLED -#endif //ENABLE_AUTO_BED_LEVELING +#endif //AUTO_BED_LEVELING_FEATURE /** * G92: Set current position to given X Y Z E @@ -3116,7 +3116,7 @@ inline void gcode_M42() { } // code_seen('S') } -#if ENABLED(ENABLE_AUTO_BED_LEVELING) && ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) +#if ENABLED(AUTO_BED_LEVELING_FEATURE) && ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) // This is redundant since the SanityCheck.h already checks for a valid Z_MIN_PROBE_PIN, but here for clarity. #if ENABLED(Z_MIN_PROBE_ENDSTOP) @@ -3366,7 +3366,7 @@ inline void gcode_M42() { SERIAL_EOL; SERIAL_EOL; } -#endif // ENABLE_AUTO_BED_LEVELING && Z_MIN_PROBE_REPEATABILITY_TEST +#endif // AUTO_BED_LEVELING_FEATURE && Z_MIN_PROBE_REPEATABILITY_TEST /** * M104: Set hot end temperature @@ -4585,7 +4585,7 @@ inline void gcode_M303() { */ inline void gcode_M400() { st_synchronize(); } -#if ENABLED(ENABLE_AUTO_BED_LEVELING) && DISABLED(Z_PROBE_SLED) && (HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY)) +#if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(Z_PROBE_SLED) && (HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY)) /** * M401: Engage Z Servo endstop if available @@ -4607,7 +4607,7 @@ inline void gcode_M400() { st_synchronize(); } stow_z_probe(false); } -#endif // ENABLE_AUTO_BED_LEVELING && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED +#endif // AUTO_BED_LEVELING_FEATURE && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED #if ENABLED(FILAMENT_SENSOR) @@ -5282,13 +5282,13 @@ void process_next_command() { gcode_G28(); break; - #if ENABLED(ENABLE_AUTO_BED_LEVELING) || ENABLED(MESH_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING) case 29: // G29 Detailed Z probe, probes the bed at 3 or more points. gcode_G29(); break; #endif - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) #if DISABLED(Z_PROBE_SLED) @@ -5305,7 +5305,7 @@ void process_next_command() { #endif // Z_PROBE_SLED - #endif // ENABLE_AUTO_BED_LEVELING + #endif // AUTO_BED_LEVELING_FEATURE case 90: // G90 relative_mode = false; @@ -5377,11 +5377,11 @@ void process_next_command() { gcode_M42(); break; - #if ENABLED(ENABLE_AUTO_BED_LEVELING) && ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) && ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) case 48: // M48 Z probe repeatability gcode_M48(); break; - #endif // ENABLE_AUTO_BED_LEVELING && Z_MIN_PROBE_REPEATABILITY_TEST + #endif // AUTO_BED_LEVELING_FEATURE && Z_MIN_PROBE_REPEATABILITY_TEST #if ENABLED(M100_FREE_MEMORY_WATCHER) case 100: @@ -5650,14 +5650,14 @@ void process_next_command() { gcode_M400(); break; - #if ENABLED(ENABLE_AUTO_BED_LEVELING) && (HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY)) && DISABLED(Z_PROBE_SLED) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) && (HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY)) && DISABLED(Z_PROBE_SLED) case 401: gcode_M401(); break; case 402: gcode_M402(); break; - #endif // ENABLE_AUTO_BED_LEVELING && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED + #endif // AUTO_BED_LEVELING_FEATURE && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED #if ENABLED(FILAMENT_SENSOR) case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width @@ -5799,7 +5799,7 @@ void clamp_to_software_endstops(float target[3]) { NOLESS(target[Y_AXIS], min_pos[Y_AXIS]); float negative_z_offset = 0; - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) if (zprobe_zoffset < 0) negative_z_offset += zprobe_zoffset; if (home_offset[Z_AXIS] < 0) negative_z_offset += home_offset[Z_AXIS]; #endif @@ -5849,7 +5849,7 @@ void clamp_to_software_endstops(float target[3]) { */ } - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) // Adjust print surface height by linear interpolation over the bed_level array. void adjust_delta(float cartesian[3]) { @@ -5889,7 +5889,7 @@ void clamp_to_software_endstops(float target[3]) { SERIAL_ECHOPGM(" offset="); SERIAL_ECHOLN(offset); */ } - #endif // ENABLE_AUTO_BED_LEVELING + #endif // AUTO_BED_LEVELING_FEATURE #endif // DELTA @@ -6008,7 +6008,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_ calculate_delta(target); - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) adjust_delta(target); #endif @@ -6236,7 +6236,7 @@ void plan_arc( #if ENABLED(DELTA) || ENABLED(SCARA) calculate_delta(arc_target); - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) adjust_delta(arc_target); #endif plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder); @@ -6248,7 +6248,7 @@ void plan_arc( // Ensure last segment arrives at target location. #if ENABLED(DELTA) || ENABLED(SCARA) calculate_delta(target); - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) adjust_delta(target); #endif plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder); diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index bf8dc1752f..8c9f8341fb 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -116,8 +116,8 @@ #if ENABLED(DELTA) #error MESH_BED_LEVELING does not yet support DELTA printers. #endif - #if ENABLED(ENABLE_AUTO_BED_LEVELING) - #error Select ENABLE_AUTO_BED_LEVELING or MESH_BED_LEVELING, not both. + #if ENABLED(AUTO_BED_LEVELING_FEATURE) + #error Select AUTO_BED_LEVELING_FEATURE or MESH_BED_LEVELING, not both. #endif #if MESH_NUM_X_POINTS > 7 || MESH_NUM_Y_POINTS > 7 #error MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS need to be less than 8. @@ -127,7 +127,7 @@ /** * Auto Bed Leveling */ - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) /** * Require a Z min pin @@ -137,7 +137,7 @@ #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) #error You must have a Z min or Z probe endstop to enable Z_MIN_PROBE_REPEATABILITY_TEST. #else - #error ENABLE_AUTO_BED_LEVELING requires a Z min or Z probe endstop. Z_MIN_PIN or Z_MIN_PROBE_PIN must point to a valid hardware pin. + #error AUTO_BED_LEVELING_FEATURE requires a Z_MIN or Z_PROBE endstop. Z_MIN_PIN or Z_MIN_PROBE_PIN must point to a valid hardware pin. #endif #endif #endif @@ -207,7 +207,7 @@ #endif // !AUTO_BED_LEVELING_GRID - #endif // ENABLE_AUTO_BED_LEVELING + #endif // AUTO_BED_LEVELING_FEATURE /** * ULTIPANEL encoder @@ -221,7 +221,7 @@ */ #if ENABLED(DELTA) - #if ENABLED(ENABLE_AUTO_BED_LEVELING) + #if ENABLED(AUTO_BED_LEVELING_FEATURE) #if DISABLED(AUTO_BED_LEVELING_GRID) #error Only AUTO_BED_LEVELING_GRID is supported with DELTA. @@ -362,6 +362,8 @@ #error CUSTOM_MENDEL_NAME is now CUSTOM_MACHINE_NAME. Please update your configuration. #elif defined(HAS_AUTOMATIC_VERSIONING) #error HAS_AUTOMATIC_VERSIONING deprecated - use USE_AUTOMATIC_VERSIONING instead + #elif defined(ENABLE_AUTO_BED_LEVELING) + #error ENABLE_AUTO_BED_LEVELING deprecated - use AUTO_BED_LEVELING_FEATURE instead #endif #endif //SANITYCHECK_H diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index b1f757e0a3..edb2d97a2d 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -171,7 +171,7 @@ void Config_StoreSettings() { for (uint8_t q=0; q #include "Marlin.h" -#if ENABLED(ENABLE_AUTO_BED_LEVELING) +#if ENABLED(AUTO_BED_LEVELING_FEATURE) #include "vector_3.h" vector_3::vector_3() : x(0), y(0), z(0) { } @@ -134,5 +134,5 @@ void matrix_3x3::debug(const char title[]) { } } -#endif // ENABLE_AUTO_BED_LEVELING +#endif // AUTO_BED_LEVELING_FEATURE diff --git a/Marlin/vector_3.h b/Marlin/vector_3.h index 1c91e8b347..5aba350007 100644 --- a/Marlin/vector_3.h +++ b/Marlin/vector_3.h @@ -19,7 +19,7 @@ #ifndef VECTOR_3_H #define VECTOR_3_H -#if ENABLED(ENABLE_AUTO_BED_LEVELING) +#if ENABLED(AUTO_BED_LEVELING_FEATURE) class matrix_3x3; struct vector_3 @@ -57,6 +57,6 @@ struct matrix_3x3 void apply_rotation_xyz(matrix_3x3 rotationMatrix, float &x, float& y, float& z); -#endif // ENABLE_AUTO_BED_LEVELING +#endif // AUTO_BED_LEVELING_FEATURE #endif // VECTOR_3_H