From bb017038d4594eb1f36d78f9784260d41498dd43 Mon Sep 17 00:00:00 2001 From: Kadah Date: Mon, 7 Sep 2020 01:15:42 -0700 Subject: [PATCH] Fix M166 Gradient Mix for DELTA (#19285) --- Marlin/src/feature/mixing.cpp | 7 ++++++- Marlin/src/gcode/feature/mixing/M166.cpp | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index 7de4eb79ea..b002e9808a 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -180,7 +180,12 @@ void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*= } void Mixer::update_gradient_for_planner_z() { - update_gradient_for_z(planner.get_axis_position_mm(Z_AXIS)); + #if ENABLED(DELTA) + get_cartesian_from_steppers(); + update_gradient_for_z(cartes.z); + #else + update_gradient_for_z(planner.get_axis_position_mm(Z_AXIS)); + #endif } #endif // GRADIENT_MIX diff --git a/Marlin/src/gcode/feature/mixing/M166.cpp b/Marlin/src/gcode/feature/mixing/M166.cpp index 5f2c4f042a..9e071a47ec 100644 --- a/Marlin/src/gcode/feature/mixing/M166.cpp +++ b/Marlin/src/gcode/feature/mixing/M166.cpp @@ -86,7 +86,14 @@ void GcodeSuite::M166() { echo_zt(mixer.gradient.end_vtool, mixer.gradient.end_z); mixer.update_mix_from_gradient(); - SERIAL_ECHOPAIR(" ; Current Z", planner.get_axis_position_mm(Z_AXIS)); + + SERIAL_ECHOPGM(" ; Current Z"); + #if ENABLED(DELTA) + get_cartesian_from_steppers(); + SERIAL_ECHO(cartes.z); + #else + SERIAL_ECHO(planner.get_axis_position_mm(Z_AXIS)); + #endif echo_mix(); }