🐛 Fix Manual Move axis selection (#24404)

This commit is contained in:
Scott Lahteine
2022-06-26 05:47:18 -05:00
parent b46191715d
commit d8545551fe
9 changed files with 46 additions and 62 deletions

View File

@@ -137,12 +137,16 @@ typedef bool (*statusResetFunc_t)();
static xyze_pos_t all_axes_destination;
#endif
public:
static screenFunc_t screen_ptr;
static float menu_scale;
#if IS_KINEMATIC
static float offset;
#endif
#if ENABLED(MANUAL_E_MOVES_RELATIVE)
static float e_origin;
#endif
template <typename T>
void set_destination(const T& dest) {
static void set_destination(const T& dest) {
#if IS_KINEMATIC
// Moves are segmented, so the entire move is not submitted at once.
// Using a separate variable prevents corrupting the in-progress move.
@@ -153,10 +157,10 @@ typedef bool (*statusResetFunc_t)();
current_position.set(dest);
#endif
}
float axis_value(const AxisEnum axis) {
static float axis_value(const AxisEnum axis) {
return NATIVE_TO_LOGICAL(processing ? destination[axis] : SUM_TERN(IS_KINEMATIC, current_position[axis], offset), axis);
}
bool apply_diff(const AxisEnum axis, const_float_t diff, const_float_t min, const_float_t max) {
static bool apply_diff(const AxisEnum axis, const_float_t diff, const_float_t min, const_float_t max) {
#if IS_KINEMATIC
float &valref = offset;
const float rmin = min - current_position[axis], rmax = max - current_position[axis];
@@ -166,12 +170,7 @@ typedef bool (*statusResetFunc_t)();
#endif
valref += diff;
const float pre = valref;
if (min != max) {
if (diff < 0)
NOLESS(valref, rmin);
else
NOMORE(valref, rmax);
}
if (min != max) { if (diff < 0) NOLESS(valref, rmin); else NOMORE(valref, rmax); }
return pre != valref;
}
#if IS_KINEMATIC
@@ -552,6 +551,7 @@ public:
// Manual Movement
static ManualMove manual_move;
static bool can_show_slider() { return !external_control && currentScreen != manual_move.screen_ptr; }
// Select Screen (modal NO/YES style dialog)
static bool selection;