diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index d44cd1ab9b..3a566a16e7 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -335,6 +335,10 @@ void safe_delay(millis_t ms) { #endif if (planner.leveling_active) { SERIAL_ECHOLNPGM(" (enabled)"); + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + if (planner.z_fade_height) + SERIAL_ECHOLNPAIR("Z Fade: ", planner.z_fade_height); + #endif #if ABL_PLANAR const float diff[XYZ] = { stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS], @@ -350,10 +354,21 @@ void safe_delay(millis_t ms) { SERIAL_ECHOPGM(" Z"); if (diff[Z_AXIS] > 0) SERIAL_CHAR('+'); SERIAL_ECHO(diff[Z_AXIS]); - #elif ENABLED(AUTO_BED_LEVELING_UBL) - SERIAL_ECHOPAIR("UBL Adjustment Z", stepper.get_axis_position_mm(Z_AXIS) - current_position[Z_AXIS]); - #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - SERIAL_ECHOPAIR("ABL Adjustment Z", bilinear_z_offset(current_position)); + #else + #if ENABLED(AUTO_BED_LEVELING_UBL) + SERIAL_ECHOPGM("UBL Adjustment Z"); + const float rz = ubl.get_z_correction(current_position[X_AXIS], current_position[Y_AXIS]); + #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) + SERIAL_ECHOPGM("ABL Adjustment Z"); + const float rz = bilinear_z_offset(current_position); + #endif + SERIAL_ECHO(ftostr43sign(rz, '+')); + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + if (planner.z_fade_height) { + SERIAL_ECHOPAIR(" (", ftostr43sign(rz * planner.fade_scaling_factor_for_z(current_position[Z_AXIS]), '+')); + SERIAL_CHAR(')'); + } + #endif #endif } else @@ -365,10 +380,16 @@ void safe_delay(millis_t ms) { SERIAL_ECHOPGM("Mesh Bed Leveling"); if (planner.leveling_active) { - float rz = current_position[Z_AXIS]; - planner.apply_leveling(current_position[X_AXIS], current_position[Y_AXIS], rz); SERIAL_ECHOLNPGM(" (enabled)"); - SERIAL_ECHOPAIR("MBL Adjustment Z", rz); + SERIAL_ECHOPAIR("MBL Adjustment Z", ftostr43sign(mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS], 1.0), '+')); + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + if (planner.z_fade_height) { + SERIAL_ECHOPAIR(" (", ftostr43sign( + mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS], planner.fade_scaling_factor_for_z(current_position[Z_AXIS])), '+' + )); + SERIAL_CHAR(')'); + } + #endif } else SERIAL_ECHOPGM(" (disabled)"); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 88336d1e42..e4269579fd 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -132,32 +132,40 @@ */ void GcodeSuite::G29() { + #if ENABLED(DEBUG_LEVELING_FEATURE) || ENABLED(PROBE_MANUALLY) + const bool seenQ = parser.seen('Q'); + #else + constexpr bool seenQ = false; + #endif + // G29 Q is also available if debugging #if ENABLED(DEBUG_LEVELING_FEATURE) - const bool query = parser.seen('Q'); const uint8_t old_debug_flags = marlin_debug_flags; - if (query) marlin_debug_flags |= DEBUG_LEVELING; + if (seenQ) marlin_debug_flags |= DEBUG_LEVELING; if (DEBUGGING(LEVELING)) { DEBUG_POS(">>> G29", current_position); log_machine_info(); } marlin_debug_flags = old_debug_flags; #if DISABLED(PROBE_MANUALLY) - if (query) return; + if (seenQ) return; #endif #endif #if ENABLED(PROBE_MANUALLY) - const bool seenA = parser.seen('A'), seenQ = parser.seen('Q'), no_action = seenA || seenQ; + const bool seenA = parser.seen('A'); + #else + constexpr bool seenA = false; #endif - #if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY) - const bool faux = parser.boolval('C'); - #elif ENABLED(PROBE_MANUALLY) - const bool faux = no_action; - #else - bool constexpr faux = false; - #endif + const bool no_action = seenA || seenQ, + faux = + #if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY) + parser.boolval('C') + #else + no_action + #endif + ; // Don't allow auto-leveling without homing first if (axis_unhomed_error()) return; @@ -388,7 +396,7 @@ void GcodeSuite::G29() { // Disable auto bed leveling during G29. // Be formal so G29 can be done successively without G28. - set_bed_leveling_enabled(false); + if (!no_action) set_bed_leveling_enabled(false); #if HAS_BED_PROBE // Deploy the probe. Probe will raise if needed. diff --git a/Marlin/src/module/stepper_indirection.cpp b/Marlin/src/module/stepper_indirection.cpp index 4efd406ea5..4e685da74e 100644 --- a/Marlin/src/module/stepper_indirection.cpp +++ b/Marlin/src/module/stepper_indirection.cpp @@ -258,7 +258,7 @@ #define _TMC2208_DEFINE_HARDWARE(ST) TMC2208Stepper stepper##ST(&ST##_HARDWARE_SERIAL) #define _TMC2208_DEFINE_SOFTWARE(ST) SoftwareSerial ST##_HARDWARE_SERIAL = SoftwareSerial(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN); \ - TMC2208Stepper stepper##ST(&stepper##ST##_serial, ST##_SERIAL_RX_PIN > -1) + TMC2208Stepper stepper##ST(&ST##_HARDWARE_SERIAL, ST##_SERIAL_RX_PIN > -1) // Stepper objects of TMC2208 steppers used #if ENABLED(X_IS_TMC2208)