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
   #include "../../libs/numtostr.h"
60
   #include "../../libs/numtostr.h"
61
 #endif
61
 #endif
62
 
62
 
63
-#if DO_SWITCH_EXTRUDER || EITHER(SWITCHING_NOZZLE, PARKING_EXTRUDER)
63
+#if EXTRUDERS > 1
64
   #include "../../module/tool_change.h"
64
   #include "../../module/tool_change.h"
65
 #endif
65
 #endif
66
 
66
 
267
     return flags.manual_motion ? destination[axis] : current_position[axis];
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
   void setAxisPosition_mm(const float position, const axis_t axis) {
278
   void setAxisPosition_mm(const float position, const axis_t axis) {
315
       }
319
       }
316
     #endif
320
     #endif
317
 
321
 
322
+    constexpr float max_manual_feedrate[XYZE] = MANUAL_FEEDRATE;
323
+    setFeedrate_mm_s(max_manual_feedrate[axis]);
324
+
318
     if (!flags.manual_motion) set_destination_from_current();
325
     if (!flags.manual_motion) set_destination_from_current();
319
     destination[axis] = clamp(position, min, max);
326
     destination[axis] = clamp(position, min, max);
320
     flags.manual_motion = true;
327
     flags.manual_motion = true;
323
   void setAxisPosition_mm(const float position, const extruder_t extruder) {
330
   void setAxisPosition_mm(const float position, const extruder_t extruder) {
324
     setActiveTool(extruder, true);
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
     if (!flags.manual_motion) set_destination_from_current();
335
     if (!flags.manual_motion) set_destination_from_current();
327
     destination[E_AXIS] = position;
336
     destination[E_AXIS] = position;
328
     flags.manual_motion = true;
337
     flags.manual_motion = true;
363
   void setActiveTool(const extruder_t extruder, bool no_move) {
372
   void setActiveTool(const extruder_t extruder, bool no_move) {
364
     #if EXTRUDERS > 1
373
     #if EXTRUDERS > 1
365
       const uint8_t e = extruder - E0;
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
       active_extruder = e;
376
       active_extruder = e;
370
     #else
377
     #else
371
       UNUSED(extruder);
378
       UNUSED(extruder);

Loading…
Cancel
Save