|
@@ -54,10 +54,12 @@
|
54
|
54
|
////////////////////////////////////////////
|
55
|
55
|
|
56
|
56
|
// Menu Navigation
|
57
|
|
-int8_t encoderTopLine;
|
|
57
|
+int8_t encoderTopLine, encoderLine, screen_items;
|
|
58
|
+
|
58
|
59
|
typedef struct {
|
59
|
60
|
screenFunc_t menu_function;
|
60
|
61
|
uint32_t encoder_position;
|
|
62
|
+ uint8_t top_line, items;
|
61
|
63
|
} menuPosition;
|
62
|
64
|
menuPosition screen_history[6];
|
63
|
65
|
uint8_t screen_history_depth = 0;
|
|
@@ -80,20 +82,14 @@ bool no_reentry = false;
|
80
|
82
|
void MarlinUI::return_to_status() { goto_screen(status_screen); }
|
81
|
83
|
|
82
|
84
|
void MarlinUI::save_previous_screen() {
|
83
|
|
- if (screen_history_depth < COUNT(screen_history)) {
|
84
|
|
- screen_history[screen_history_depth].menu_function = currentScreen;
|
85
|
|
- screen_history[screen_history_depth].encoder_position = encoderPosition;
|
86
|
|
- ++screen_history_depth;
|
87
|
|
- }
|
|
85
|
+ if (screen_history_depth < COUNT(screen_history))
|
|
86
|
+ screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items };
|
88
|
87
|
}
|
89
|
88
|
|
90
|
89
|
void MarlinUI::goto_previous_screen() {
|
91
|
90
|
if (screen_history_depth > 0) {
|
92
|
|
- --screen_history_depth;
|
93
|
|
- goto_screen(
|
94
|
|
- screen_history[screen_history_depth].menu_function,
|
95
|
|
- screen_history[screen_history_depth].encoder_position
|
96
|
|
- );
|
|
91
|
+ menuPosition &sh = screen_history[--screen_history_depth];
|
|
92
|
+ goto_screen(sh.menu_function, sh.encoder_position, sh.top_line, sh.items);
|
97
|
93
|
}
|
98
|
94
|
else
|
99
|
95
|
return_to_status();
|
|
@@ -197,7 +193,7 @@ bool printer_busy() {
|
197
|
193
|
/**
|
198
|
194
|
* General function to go directly to a screen
|
199
|
195
|
*/
|
200
|
|
-void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) {
|
|
196
|
+void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) {
|
201
|
197
|
if (currentScreen != screen) {
|
202
|
198
|
|
203
|
199
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
@@ -246,6 +242,8 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) {
|
246
|
242
|
|
247
|
243
|
currentScreen = screen;
|
248
|
244
|
encoderPosition = encoder;
|
|
245
|
+ encoderTopLine = top;
|
|
246
|
+ screen_items = items;
|
249
|
247
|
if (screen == status_screen) {
|
250
|
248
|
defer_status_screen(false);
|
251
|
249
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
@@ -314,7 +312,6 @@ void MarlinUI::synchronize(PGM_P const msg/*=NULL*/) {
|
314
|
312
|
* _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
|
315
|
313
|
* screen_items is the total number of items in the menu (after one call)
|
316
|
314
|
*/
|
317
|
|
-int8_t encoderLine, screen_items;
|
318
|
315
|
void scroll_screen(const uint8_t limit, const bool is_menu) {
|
319
|
316
|
ui.encoder_direction_menus();
|
320
|
317
|
ENCODER_RATE_MULTIPLY(false);
|