Adjust leveling conditionals

This commit is contained in:
Scott Lahteine 2017-05-01 16:13:09 -05:00
parent a64e5659ce
commit ed81e9b3d3
6 changed files with 24 additions and 25 deletions

View File

@ -718,15 +718,14 @@
#endif
/**
* Set ABL options based on the specific type of leveling
* Set granular options based on the specific type of leveling
*/
#define ABL_PLANAR (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT))
#define ABL_GRID (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR))
#define HAS_ABL (ABL_PLANAR || ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL))
#define PLANNER_LEVELING (HAS_ABL || ENABLED(MESH_BED_LEVELING))
#define HAS_LEVELING (HAS_ABL || ENABLED(MESH_BED_LEVELING))
#define PLANNER_LEVELING (ABL_PLANAR || ABL_GRID || ENABLED(MESH_BED_LEVELING))
#define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
#if HAS_PROBING_PROCEDURE
#define PROBE_BED_WIDTH abs(RIGHT_PROBE_BED_POSITION - (LEFT_PROBE_BED_POSITION))
#define PROBE_BED_HEIGHT abs(BACK_PROBE_BED_POSITION - (FRONT_PROBE_BED_POSITION))

View File

@ -324,7 +324,7 @@ float code_value_temp_diff();
linear_fit* lsf_linear_fit(double x[], double y[], double z[], const int);
#endif
#if PLANNER_LEVELING
#if HAS_LEVELING
void reset_bed_level();
#endif

View File

@ -2403,7 +2403,7 @@ static void clean_up_after_endstop_or_probe_move() {
#endif // HAS_BED_PROBE
#if PLANNER_LEVELING
#if HAS_LEVELING
/**
* Turn bed leveling on or off, fixing the current
* position as-needed.
@ -2511,7 +2511,7 @@ static void clean_up_after_endstop_or_probe_move() {
#endif
}
#endif // PLANNER_LEVELING
#endif // HAS_LEVELING
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING)
@ -3747,7 +3747,7 @@ inline void gcode_G28() {
#endif
// Disable the leveling matrix before homing
#if PLANNER_LEVELING
#if HAS_LEVELING
#if ENABLED(AUTO_BED_LEVELING_UBL)
const bool bed_leveling_state_at_entry = ubl.state.active;
#endif
@ -4368,7 +4368,7 @@ void home_all_axes() { gcode_G28(); }
#endif
#if PLANNER_LEVELING
#if HAS_LEVELING
// Jettison bed leveling data
if (code_seen('J')) {
@ -5034,7 +5034,7 @@ void home_all_axes() { gcode_G28(); }
if (!position_is_reachable(pos, true)) return;
// Disable leveling so the planner won't mess with us
#if PLANNER_LEVELING
#if HAS_LEVELING
set_bed_leveling_enabled(false);
#endif
@ -5091,7 +5091,7 @@ void home_all_axes() { gcode_G28(); }
stepper.synchronize();
#if PLANNER_LEVELING
#if HAS_LEVELING
set_bed_leveling_enabled(false);
#endif
@ -7294,7 +7294,7 @@ inline void gcode_M115() {
#endif
// MESH_REPORT (M420 V)
#if PLANNER_LEVELING
#if HAS_LEVELING
SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:1");
#else
SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:0");
@ -8336,7 +8336,7 @@ void quickstop_stepper() {
SYNC_PLAN_POSITION_KINEMATIC();
}
#if PLANNER_LEVELING
#if HAS_LEVELING
/**
* M420: Enable/Disable Bed Leveling and/or set the Z fade height.
*
@ -9857,12 +9857,12 @@ void process_next_command() {
gcode_G28();
break;
#if PLANNER_LEVELING || ENABLED(AUTO_BED_LEVELING_UBL)
#if HAS_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();
break;
#endif // PLANNER_LEVELING
#endif // HAS_LEVELING
#if HAS_BED_PROBE
@ -10363,7 +10363,7 @@ void process_next_command() {
break;
#endif // FILAMENT_WIDTH_SENSOR
#if PLANNER_LEVELING
#if HAS_LEVELING
case 420: // M420: Enable/Disable Bed Leveling
gcode_M420();
break;
@ -10917,7 +10917,7 @@ void get_cartesian_from_steppers() {
*/
void set_current_from_steppers_for_axis(const AxisEnum axis) {
get_cartesian_from_steppers();
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
#if PLANNER_LEVELING
planner.unapply_leveling(cartes);
#endif
if (axis == ALL_AXES)

View File

@ -1071,7 +1071,7 @@ void MarlinSettings::reset() {
#endif
// Applies to all MBL and ABL
#if PLANNER_LEVELING
#if HAS_LEVELING
reset_bed_level();
#endif

View File

@ -530,7 +530,7 @@ void Planner::check_axes_activity() {
#endif
}
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
#if PLANNER_LEVELING
/**
* lx, ly, lz - logical (cartesian, not delta) positions in mm
*/
@ -634,7 +634,7 @@ void Planner::check_axes_activity() {
#endif
}
#endif // PLANNER_LEVELING && !AUTO_BED_LEVELING_UBL
#endif // PLANNER_LEVELING
/**
* Planner::_buffer_line
@ -1434,7 +1434,7 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
}
void Planner::set_position_mm_kinematic(const float position[NUM_AXIS]) {
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
#if PLANNER_LEVELING
float lpos[XYZ] = { position[X_AXIS], position[Y_AXIS], position[Z_AXIS] };
apply_leveling(lpos);
#else

View File

@ -246,7 +246,7 @@ class Planner {
static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
#if PLANNER_LEVELING
#define ARG_X float lx
#define ARG_Y float ly
@ -296,7 +296,7 @@ class Planner {
* extruder - target extruder
*/
static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL) && IS_CARTESIAN
#if PLANNER_LEVELING && IS_CARTESIAN
apply_leveling(lx, ly, lz);
#endif
_buffer_line(lx, ly, lz, e, fr_mm_s, extruder);
@ -312,7 +312,7 @@ class Planner {
* extruder - target extruder
*/
static FORCE_INLINE void buffer_line_kinematic(const float ltarget[XYZE], const float &fr_mm_s, const uint8_t extruder) {
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
#if PLANNER_LEVELING
float lpos[XYZ] = { ltarget[X_AXIS], ltarget[Y_AXIS], ltarget[Z_AXIS] };
apply_leveling(lpos);
#else
@ -336,7 +336,7 @@ class Planner {
* Clears previous speed values.
*/
static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL) && IS_CARTESIAN
#if PLANNER_LEVELING && IS_CARTESIAN
apply_leveling(lx, ly, lz);
#endif
_set_position_mm(lx, ly, lz, e);