Browse Source

Misc. ExtUI fixes (#14971)

InsanityAutomation 6 years ago
parent
commit
5a7c0216f7
1 changed files with 13 additions and 6 deletions
  1. 13
    6
      Marlin/src/lcd/extensible_ui/ui_api.cpp

+ 13
- 6
Marlin/src/lcd/extensible_ui/ui_api.cpp View File

@@ -60,7 +60,7 @@
60 60
   #include "../../libs/numtostr.h"
61 61
 #endif
62 62
 
63
-#if DO_SWITCH_EXTRUDER || EITHER(SWITCHING_NOZZLE, PARKING_EXTRUDER)
63
+#if EXTRUDERS > 1
64 64
   #include "../../module/tool_change.h"
65 65
 #endif
66 66
 
@@ -267,8 +267,12 @@ namespace ExtUI {
267 267
     return flags.manual_motion ? destination[axis] : current_position[axis];
268 268
   }
269 269
 
270
-  float getAxisPosition_mm(const extruder_t) {
271
-    return flags.manual_motion ? destination[E_AXIS] : current_position[E_AXIS];
270
+  float getAxisPosition_mm(const extruder_t extruder) {
271
+    const uint8_t old_tool = active_extruder;
272
+    setActiveTool(extruder, true);
273
+    const float pos = flags.manual_motion ? destination[E_AXIS] : current_position[E_AXIS];
274
+    setActiveTool(old_tool, true);
275
+    return pos;
272 276
   }
273 277
 
274 278
   void setAxisPosition_mm(const float position, const axis_t axis) {
@@ -315,6 +319,9 @@ namespace ExtUI {
315 319
       }
316 320
     #endif
317 321
 
322
+    constexpr float max_manual_feedrate[XYZE] = MANUAL_FEEDRATE;
323
+    setFeedrate_mm_s(max_manual_feedrate[axis]);
324
+
318 325
     if (!flags.manual_motion) set_destination_from_current();
319 326
     destination[axis] = clamp(position, min, max);
320 327
     flags.manual_motion = true;
@@ -323,6 +330,8 @@ namespace ExtUI {
323 330
   void setAxisPosition_mm(const float position, const extruder_t extruder) {
324 331
     setActiveTool(extruder, true);
325 332
 
333
+    constexpr float max_manual_feedrate[XYZE] = MANUAL_FEEDRATE;
334
+    setFeedrate_mm_s(max_manual_feedrate[E_AXIS]);
326 335
     if (!flags.manual_motion) set_destination_from_current();
327 336
     destination[E_AXIS] = position;
328 337
     flags.manual_motion = true;
@@ -363,9 +372,7 @@ namespace ExtUI {
363 372
   void setActiveTool(const extruder_t extruder, bool no_move) {
364 373
     #if EXTRUDERS > 1
365 374
       const uint8_t e = extruder - E0;
366
-      #if DO_SWITCH_EXTRUDER || EITHER(SWITCHING_NOZZLE, PARKING_EXTRUDER)
367
-        if (e != active_extruder) tool_change(e, no_move);
368
-      #endif
375
+      if (e != active_extruder) tool_change(e, no_move);
369 376
       active_extruder = e;
370 377
     #else
371 378
       UNUSED(extruder);

Loading…
Cancel
Save