diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 28c6fb058c..81d491d7e3 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -6081,7 +6081,7 @@ inline void gcode_M17() { stepper.synchronize(); } - #if ENABLED(ULTIPANEL) && defined(ADVANCED_PAUSE_EXTRUDE_LENGTH) && ADVANCED_PAUSE_EXTRUDE_LENGTH > 0 + #if ENABLED(ULTIPANEL) && ADVANCED_PAUSE_EXTRUDE_LENGTH > 0 float extrude_length = initial_extrude_length; @@ -7675,7 +7675,7 @@ inline void gcode_M18_M84() { if (parser.seen('X')) disable_X(); if (parser.seen('Y')) disable_Y(); if (parser.seen('Z')) disable_Z(); - #if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN // Only enable on boards that have seperate ENABLE_PINS + #if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN // Only enable on boards that have separate ENABLE_PINS if (parser.seen('E')) disable_e_steppers(); #endif } diff --git a/Marlin/mesh_bed_leveling.h b/Marlin/mesh_bed_leveling.h index 41ba2677c1..f7b701bf28 100644 --- a/Marlin/mesh_bed_leveling.h +++ b/Marlin/mesh_bed_leveling.h @@ -94,8 +94,8 @@ } static float calc_z0(const float &a0, const float &a1, const float &z1, const float &a2, const float &z2) { - const float delta_z = (z2 - z1) / (a2 - a1); - const float delta_a = a0 - a1; + const float delta_z = (z2 - z1) / (a2 - a1), + delta_a = a0 - a1; return z1 + delta_a * delta_z; } diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index a755db5767..537f334606 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -534,10 +534,10 @@ void Planner::check_axes_activity() { if (!ubl.state.active) return; #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) // if z_fade_height enabled (nonzero) and raw_z above it, no leveling required - if ((planner.z_fade_height) && (planner.z_fade_height <= RAW_Z_POSITION(lz))) return; + if (planner.z_fade_height && planner.z_fade_height <= RAW_Z_POSITION(lz)) return; lz += ubl.state.z_offset + ubl.get_z_correction(lx, ly) * ubl.fade_scaling_factor_for_z(lz); #else // no fade - lz += ubl.state.z_offset + ubl.get_z_correction(lx,ly); + lz += ubl.state.z_offset + ubl.get_z_correction(lx, ly); #endif // FADE #endif // UBL @@ -598,10 +598,10 @@ void Planner::check_axes_activity() { if (ubl.state.active) { - const float z_physical = RAW_Z_POSITION(logical[Z_AXIS]); - const float z_ublmesh = ubl.get_z_correction(logical[X_AXIS], logical[Y_AXIS]); - const float z_virtual = z_physical - ubl.state.z_offset - z_ublmesh; - float z_logical = LOGICAL_Z_POSITION(z_virtual); + const float z_physical = RAW_Z_POSITION(logical[Z_AXIS]), + z_correct = ubl.get_z_correction(logical[X_AXIS], logical[Y_AXIS]), + z_virtual = z_physical - ubl.state.z_offset - z_correct; + float z_logical = LOGICAL_Z_POSITION(z_virtual); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) @@ -614,10 +614,10 @@ void Planner::check_axes_activity() { // so L=(P-O-M)/(1-M/H) for L= planner.z_fade_height) z_logical = LOGICAL_Z_POSITION(z_physical - ubl.state.z_offset); + else + z_logical /= 1.0 - z_correct * planner.inverse_z_fade_height; } #endif // ENABLE_LEVELING_FADE_HEIGHT diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 61f8ee7e9b..f7c75cc3dc 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1018,8 +1018,8 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(AUTO_BED_LEVELING_UBL) - float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5 decimal places. So we keep a - // seperate value that doesn't lose precision. + float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5 decimal places. So we keep a + // separate value that doesn't lose precision. static int ubl_encoderPosition = 0; static void _lcd_mesh_fine_tune(const char* msg) {