From 3217da6fa527c25ec83f87df6ac81d38968b4d4d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 23 Jan 2018 13:59:51 -0600 Subject: [PATCH 1/3] Followup patch for TMC stepper init --- Marlin/src/module/stepper_indirection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 696f8eb4c6c100170e6e749c65f6ce0204b412c3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 23 Jan 2018 11:43:38 -0600 Subject: [PATCH 2/3] Include Z Fade in log_machine_info --- Marlin/src/core/utility.cpp | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) 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)"); From e5ca60acf593416ebdca29d60f98c02d3fc1644c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 23 Jan 2018 13:08:46 -0600 Subject: [PATCH 3/3] Patch G29 no_action for A and Q --- Marlin/src/gcode/bedlevel/abl/G29.cpp | 32 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) 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.