From 5a7c0216f7bd6e2c4b6daed2c5e79b9b20a3c195 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Tue, 20 Aug 2019 04:44:17 -0400 Subject: [PATCH] Misc. ExtUI fixes (#14971) --- Marlin/src/lcd/extensible_ui/ui_api.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index c57c0f5014..2f6c685dab 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -60,7 +60,7 @@ #include "../../libs/numtostr.h" #endif -#if DO_SWITCH_EXTRUDER || EITHER(SWITCHING_NOZZLE, PARKING_EXTRUDER) +#if EXTRUDERS > 1 #include "../../module/tool_change.h" #endif @@ -267,8 +267,12 @@ namespace ExtUI { return flags.manual_motion ? destination[axis] : current_position[axis]; } - float getAxisPosition_mm(const extruder_t) { - return flags.manual_motion ? destination[E_AXIS] : current_position[E_AXIS]; + float getAxisPosition_mm(const extruder_t extruder) { + const uint8_t old_tool = active_extruder; + setActiveTool(extruder, true); + const float pos = flags.manual_motion ? destination[E_AXIS] : current_position[E_AXIS]; + setActiveTool(old_tool, true); + return pos; } void setAxisPosition_mm(const float position, const axis_t axis) { @@ -315,6 +319,9 @@ namespace ExtUI { } #endif + constexpr float max_manual_feedrate[XYZE] = MANUAL_FEEDRATE; + setFeedrate_mm_s(max_manual_feedrate[axis]); + if (!flags.manual_motion) set_destination_from_current(); destination[axis] = clamp(position, min, max); flags.manual_motion = true; @@ -323,6 +330,8 @@ namespace ExtUI { void setAxisPosition_mm(const float position, const extruder_t extruder) { setActiveTool(extruder, true); + constexpr float max_manual_feedrate[XYZE] = MANUAL_FEEDRATE; + setFeedrate_mm_s(max_manual_feedrate[E_AXIS]); if (!flags.manual_motion) set_destination_from_current(); destination[E_AXIS] = position; flags.manual_motion = true; @@ -363,9 +372,7 @@ namespace ExtUI { void setActiveTool(const extruder_t extruder, bool no_move) { #if EXTRUDERS > 1 const uint8_t e = extruder - E0; - #if DO_SWITCH_EXTRUDER || EITHER(SWITCHING_NOZZLE, PARKING_EXTRUDER) - if (e != active_extruder) tool_change(e, no_move); - #endif + if (e != active_extruder) tool_change(e, no_move); active_extruder = e; #else UNUSED(extruder);