Misc. ExtUI fixes (#14971)

This commit is contained in:
InsanityAutomation 2019-08-20 04:44:17 -04:00 committed by Scott Lahteine
parent 6039893981
commit 5a7c0216f7

View File

@ -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
active_extruder = e;
#else
UNUSED(extruder);