Skip to content

Commit 50bb654

Browse files
committed
Revert move menu string optimization
🐛 Fix Axis Homing (#24425) 🐛 Fix Manual Move axis selection (#24404) 🎨 Simplify move menus with substitution (975c8f4)
1 parent 48e4863 commit 50bb654

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

Marlin/src/lcd/menu/menu_motion.cpp

+37-11
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
// "Motion" > "Move Axis" submenu
5151
//
5252

53-
void lcd_move_axis(const AxisEnum axis) {
53+
// TODO: Use substitution here with MSG_MOVE_N
54+
55+
static void _lcd_move_xyz(FSTR_P const name, const AxisEnum axis) {
5456
if (ui.use_click()) return ui.goto_previous_screen_no_defer();
5557
if (ui.encoderPosition && !ui.manual_move.processing) {
5658
// Get motion limit from software endstops, if any
@@ -77,15 +79,37 @@ void lcd_move_axis(const AxisEnum axis) {
7779
const float pos = ui.manual_move.axis_value(axis);
7880
if (parser.using_inch_units()) {
7981
const float imp_pos = LINEAR_UNIT(pos);
80-
MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_MOVE_N), ftostr63(imp_pos));
82+
MenuEditItemBase::draw_edit_screen(name, ftostr63(imp_pos));
8183
}
8284
else
83-
MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_MOVE_N), ui.manual_move.menu_scale >= 0.1f ? (LARGE_AREA_TEST ? ftostr51sign(pos) : ftostr41sign(pos)) : ftostr63(pos));
85+
MenuEditItemBase::draw_edit_screen(name, ui.manual_move.menu_scale >= 0.1f ? (LARGE_AREA_TEST ? ftostr51sign(pos) : ftostr41sign(pos)) : ftostr63(pos));
8486
}
8587
}
86-
87-
// Move Z easy accessor
88-
void lcd_move_z() { lcd_move_axis(Z_AXIS); }
88+
void lcd_move_x() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_X), X_AXIS); }
89+
#if HAS_Y_AXIS
90+
void lcd_move_y() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_Y), Y_AXIS); }
91+
#endif
92+
#if HAS_Z_AXIS
93+
void lcd_move_z() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_Z), Z_AXIS); }
94+
#endif
95+
#if HAS_I_AXIS
96+
void lcd_move_i() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_I), I_AXIS); }
97+
#endif
98+
#if HAS_J_AXIS
99+
void lcd_move_j() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_J), J_AXIS); }
100+
#endif
101+
#if HAS_K_AXIS
102+
void lcd_move_k() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_K), K_AXIS); }
103+
#endif
104+
#if HAS_U_AXIS
105+
void lcd_move_u() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_U), U_AXIS); }
106+
#endif
107+
#if HAS_V_AXIS
108+
void lcd_move_v() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_V), V_AXIS); }
109+
#endif
110+
#if HAS_W_AXIS
111+
void lcd_move_w() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_W), W_AXIS); }
112+
#endif
89113

90114
#if E_MANUAL
91115

@@ -142,11 +166,13 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int
142166
ui.manual_move.screen_ptr = func;
143167
START_MENU();
144168
if (LCD_HEIGHT >= 4) {
145-
if (axis < NUM_AXES)
146-
STATIC_ITEM_N(axis, MSG_MOVE_N, SS_DEFAULT|SS_INVERT);
147-
else {
148-
TERN_(MANUAL_E_MOVES_RELATIVE, ui.manual_move.e_origin = current_position.e);
149-
STATIC_ITEM_N(eindex, MSG_MOVE_EN, SS_DEFAULT|SS_INVERT);
169+
switch (axis) {
170+
#define _CASE_MOVE(N) case N##_AXIS: STATIC_ITEM_N(N##_AXIS, MSG_MOVE_N, SS_DEFAULT|SS_INVERT); break;
171+
MAIN_AXIS_MAP(_CASE_MOVE)
172+
default:
173+
TERN_(MANUAL_E_MOVES_RELATIVE, ui.manual_move.e_origin = current_position.e);
174+
STATIC_ITEM(MSG_MOVE_E, SS_DEFAULT|SS_INVERT);
175+
break;
150176
}
151177
}
152178

0 commit comments

Comments
 (0)