50
50
// "Motion" > "Move Axis" submenu
51
51
//
52
52
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) {
54
56
if (ui.use_click ()) return ui.goto_previous_screen_no_defer ();
55
57
if (ui.encoderPosition && !ui.manual_move .processing ) {
56
58
// Get motion limit from software endstops, if any
@@ -77,15 +79,37 @@ void lcd_move_axis(const AxisEnum axis) {
77
79
const float pos = ui.manual_move .axis_value (axis);
78
80
if (parser.using_inch_units ()) {
79
81
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));
81
83
}
82
84
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));
84
86
}
85
87
}
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
89
113
90
114
#if E_MANUAL
91
115
@@ -142,11 +166,13 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int
142
166
ui.manual_move .screen_ptr = func;
143
167
START_MENU ();
144
168
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 ;
150
176
}
151
177
}
152
178
0 commit comments