Skip to content

Commit ae9b09f

Browse files
committed
menu => screen
1 parent 45ea874 commit ae9b09f

File tree

1 file changed

+56
-56
lines changed

1 file changed

+56
-56
lines changed

Marlin/ultralcd.cpp

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
129129
#endif
130130

131131
// Function pointer to menu functions.
132-
typedef void (*menuFunc_t)();
132+
typedef void (*screenFunc_t)();
133133

134134
// Different types of actions that can be used in menu items.
135135
static void menu_action_back();
136-
static void menu_action_submenu(menuFunc_t data);
136+
static void menu_action_submenu(screenFunc_t data);
137137
static void menu_action_gcode(const char* pgcode);
138-
static void menu_action_function(menuFunc_t data);
138+
static void menu_action_function(screenFunc_t data);
139139
static void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
140140
static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
141141
static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
@@ -145,15 +145,15 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
145145
static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
146146
static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
147147
static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
148-
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc);
149-
static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc);
150-
static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
151-
static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
152-
static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
153-
static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
154-
static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
155-
static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
156-
static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
148+
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
149+
static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, screenFunc_t callbackFunc);
150+
static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
151+
static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
152+
static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
153+
static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
154+
static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
155+
static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
156+
static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, screenFunc_t callbackFunc);
157157

158158
#if ENABLED(SDSUPPORT)
159159
static void lcd_sdcard_menu();
@@ -286,14 +286,14 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
286286
#endif
287287

288288
typedef struct {
289-
menuFunc_t menu_function;
289+
screenFunc_t menu_function;
290290
uint32_t encoder_position;
291291
} menuPosition;
292292

293-
menuFunc_t currentMenu = lcd_status_screen; // pointer to the currently active menu handler
293+
screenFunc_t currentScreen = lcd_status_screen; // pointer to the currently active menu handler
294294

295-
menuPosition menu_history[10];
296-
uint8_t menu_history_depth = 0;
295+
menuPosition screen_history[10];
296+
uint8_t screen_history_depth = 0;
297297

298298
bool ignore_click = false;
299299
bool wait_for_unclick;
@@ -303,49 +303,49 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
303303
const char* editLabel;
304304
void* editValue;
305305
int32_t minEditValue, maxEditValue;
306-
menuFunc_t callbackFunc; // call this after editing
306+
screenFunc_t callbackFunc; // call this after editing
307307

308308
/**
309309
* General function to go directly to a menu
310310
* Remembers the previous position
311311
*/
312-
static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const uint32_t encoder = 0) {
313-
if (currentMenu != menu) {
314-
currentMenu = menu;
312+
static void lcd_goto_screen(screenFunc_t screen, const bool feedback = false, const uint32_t encoder = 0) {
313+
if (currentScreen != screen) {
314+
currentScreen = screen;
315315
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
316316
#if ENABLED(NEWPANEL)
317317
encoderPosition = encoder;
318318
if (feedback) lcd_quick_feedback();
319319
#endif
320-
if (menu == lcd_status_screen) {
320+
if (screen == lcd_status_screen) {
321321
defer_return_to_status = false;
322-
menu_history_depth = 0;
322+
screen_history_depth = 0;
323323
}
324324
#if ENABLED(LCD_PROGRESS_BAR)
325325
// For LCD_PROGRESS_BAR re-initialize custom characters
326-
lcd_set_custom_characters(menu == lcd_status_screen);
326+
lcd_set_custom_characters(screen == lcd_status_screen);
327327
#endif
328328
}
329329
}
330330

331-
static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); }
331+
static void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
332332

333333
inline void lcd_save_previous_menu() {
334-
if (menu_history_depth < COUNT(menu_history)) {
335-
menu_history[menu_history_depth].menu_function = currentMenu;
334+
if (screen_history_depth < COUNT(screen_history)) {
335+
screen_history[screen_history_depth].menu_function = currentScreen;
336336
#if ENABLED(ULTIPANEL)
337-
menu_history[menu_history_depth].encoder_position = encoderPosition;
337+
screen_history[screen_history_depth].encoder_position = encoderPosition;
338338
#endif
339-
++menu_history_depth;
339+
++screen_history_depth;
340340
}
341341
}
342342

343343
static void lcd_goto_previous_menu(bool feedback=false) {
344-
if (menu_history_depth > 0) {
345-
--menu_history_depth;
346-
lcd_goto_menu(menu_history[menu_history_depth].menu_function, feedback
344+
if (screen_history_depth > 0) {
345+
--screen_history_depth;
346+
lcd_goto_screen(screen_history[screen_history_depth].menu_function, feedback
347347
#if ENABLED(ULTIPANEL)
348-
, menu_history[menu_history_depth].encoder_position
348+
, screen_history[screen_history_depth].encoder_position
349349
#endif
350350
);
351351
}
@@ -428,10 +428,10 @@ static void lcd_status_screen() {
428428
}
429429

430430
if (current_click) {
431-
lcd_goto_menu(lcd_main_menu, true);
431+
lcd_goto_screen(lcd_main_menu, true);
432432
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
433433
#if ENABLED(LCD_PROGRESS_BAR) && ENABLED(ULTIPANEL)
434-
currentMenu == lcd_status_screen
434+
currentScreen == lcd_status_screen
435435
#endif
436436
);
437437
#if ENABLED(FILAMENT_LCD_DISPLAY)
@@ -588,11 +588,11 @@ static void lcd_status_screen() {
588588
#if ENABLED(BABYSTEP_XY)
589589
static void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
590590
static void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEPPING_Y)); }
591-
static void lcd_babystep_x() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_x); }
592-
static void lcd_babystep_y() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_y); }
591+
static void lcd_babystep_x() { babysteps_done = 0; lcd_goto_screen(_lcd_babystep_x); }
592+
static void lcd_babystep_y() { babysteps_done = 0; lcd_goto_screen(_lcd_babystep_y); }
593593
#endif
594594
static void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEPPING_Z)); }
595-
static void lcd_babystep_z() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_z); }
595+
static void lcd_babystep_z() { babysteps_done = 0; lcd_goto_screen(_lcd_babystep_z); }
596596

597597
#endif //BABYSTEPPING
598598

@@ -970,7 +970,7 @@ static void lcd_status_screen() {
970970
debounce_click = true; // ignore multiple "clicks" in a row
971971
mbl.set_zigzag_z(_lcd_level_bed_position++, current_position[Z_AXIS]);
972972
if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
973-
lcd_goto_menu(_lcd_level_bed_done, true);
973+
lcd_goto_screen(_lcd_level_bed_done, true);
974974

975975
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
976976
#if MIN_Z_HEIGHT_FOR_HOMING > 0
@@ -990,7 +990,7 @@ static void lcd_status_screen() {
990990
#endif
991991
}
992992
else {
993-
lcd_goto_menu(_lcd_level_goto_next_point, true);
993+
lcd_goto_screen(_lcd_level_goto_next_point, true);
994994
}
995995
}
996996
}
@@ -1031,15 +1031,15 @@ static void lcd_status_screen() {
10311031
*/
10321032
static void _lcd_level_goto_next_point() {
10331033
// Set the menu to display ahead of blocking call
1034-
lcd_goto_menu(_lcd_level_bed_moving);
1034+
lcd_goto_screen(_lcd_level_bed_moving);
10351035

10361036
// _mbl_goto_xy runs the menu loop until the move is done
10371037
int8_t px, py;
10381038
mbl.zigzag(_lcd_level_bed_position, px, py);
10391039
_mbl_goto_xy(mbl.get_probe_x(px), mbl.get_probe_y(py));
10401040

10411041
// After the blocking function returns, change menus
1042-
lcd_goto_menu(_lcd_level_bed_get_z);
1042+
lcd_goto_screen(_lcd_level_bed_get_z);
10431043
}
10441044

10451045
/**
@@ -1052,7 +1052,7 @@ static void lcd_status_screen() {
10521052
_lcd_level_bed_position = 0;
10531053
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
10541054
planner.set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1055-
lcd_goto_menu(_lcd_level_goto_next_point, true);
1055+
lcd_goto_screen(_lcd_level_goto_next_point, true);
10561056
}
10571057
}
10581058

@@ -1069,7 +1069,7 @@ static void lcd_status_screen() {
10691069
#endif
10701070
;
10711071
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
1072-
lcd_goto_menu(_lcd_level_bed_homing_done);
1072+
lcd_goto_screen(_lcd_level_bed_homing_done);
10731073
}
10741074

10751075
/**
@@ -1080,7 +1080,7 @@ static void lcd_status_screen() {
10801080
axis_homed[X_AXIS] = axis_homed[Y_AXIS] = axis_homed[Z_AXIS] = false;
10811081
mbl.reset();
10821082
enqueue_and_echo_commands_P(PSTR("G28"));
1083-
lcd_goto_menu(_lcd_level_bed_homing);
1083+
lcd_goto_screen(_lcd_level_bed_homing);
10841084
}
10851085

10861086
/**
@@ -1868,7 +1868,7 @@ static void lcd_status_screen() {
18681868
* void menu_edit_callback_int3(); // edit int (interactively) with callback on completion
18691869
* static void _menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
18701870
* static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
1871-
* static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callback); // edit int with callback
1871+
* static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, screenFunc_t callback); // edit int with callback
18721872
*
18731873
* You can then use one of the menu macros to present the edit interface:
18741874
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_multiplier, 10, 999)
@@ -1910,11 +1910,11 @@ static void lcd_status_screen() {
19101910
} \
19111911
static void menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
19121912
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
1913-
currentMenu = menu_edit_ ## _name; \
1913+
currentScreen = menu_edit_ ## _name; \
19141914
}\
1915-
static void menu_action_setting_edit_callback_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue, menuFunc_t callback) { \
1915+
static void menu_action_setting_edit_callback_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue, screenFunc_t callback) { \
19161916
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
1917-
currentMenu = menu_edit_callback_ ## _name; \
1917+
currentScreen = menu_edit_callback_ ## _name; \
19181918
callbackFunc = callback; \
19191919
}
19201920
menu_edit_type(int, int3, itostr3, 1);
@@ -1999,9 +1999,9 @@ static void lcd_status_screen() {
19991999
*
20002000
*/
20012001
static void menu_action_back() { lcd_goto_previous_menu(); }
2002-
static void menu_action_submenu(menuFunc_t func) { lcd_save_previous_menu(); lcd_goto_menu(func); }
2002+
static void menu_action_submenu(screenFunc_t func) { lcd_save_previous_menu(); lcd_goto_screen(func); }
20032003
static void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); }
2004-
static void menu_action_function(menuFunc_t func) { (*func)(); }
2004+
static void menu_action_function(screenFunc_t func) { (*func)(); }
20052005

20062006
#if ENABLED(SDSUPPORT)
20072007

@@ -2020,7 +2020,7 @@ static void lcd_status_screen() {
20202020
#endif //SDSUPPORT
20212021

20222022
static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) {UNUSED(pstr); *ptr = !(*ptr); }
2023-
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callback) {
2023+
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callback) {
20242024
menu_action_setting_edit_bool(pstr, ptr);
20252025
(*callback)();
20262026
}
@@ -2180,7 +2180,7 @@ void lcd_update() {
21802180
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
21812181
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
21822182
#if ENABLED(LCD_PROGRESS_BAR) && ENABLED(ULTIPANEL)
2183-
currentMenu == lcd_status_screen
2183+
currentScreen == lcd_status_screen
21842184
#endif
21852185
);
21862186

@@ -2280,7 +2280,7 @@ void lcd_update() {
22802280
static int8_t lcd_status_update_delay = 1; // first update one loop delayed
22812281
if (
22822282
#if ENABLED(ULTIPANEL)
2283-
currentMenu == lcd_status_screen &&
2283+
currentScreen == lcd_status_screen &&
22842284
#endif
22852285
!lcd_status_update_delay--) {
22862286
lcd_status_update_delay = 9;
@@ -2312,14 +2312,14 @@ void lcd_update() {
23122312
u8g.drawPixel(127, 63); // draw alive dot
23132313
u8g.setColorIndex(1); // black on white
23142314
#if ENABLED(ULTIPANEL)
2315-
(*currentMenu)();
2315+
(*currentScreen)();
23162316
#else
23172317
lcd_status_screen();
23182318
#endif
23192319
} while (u8g.nextPage());
23202320
#else
23212321
#if ENABLED(ULTIPANEL)
2322-
(*currentMenu)();
2322+
(*currentScreen)();
23232323
#else
23242324
lcd_status_screen();
23252325
#endif
@@ -2329,7 +2329,7 @@ void lcd_update() {
23292329
#if ENABLED(ULTIPANEL)
23302330

23312331
// Return to Status Screen after a timeout
2332-
if (currentMenu == lcd_status_screen || defer_return_to_status)
2332+
if (currentScreen == lcd_status_screen || defer_return_to_status)
23332333
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
23342334
else if (ELAPSED(ms, return_to_status_ms))
23352335
lcd_return_to_status();

0 commit comments

Comments
 (0)