Fix SD card reselect when scrolled (#13624)
- Change encoder position to 16-bit integer. - Fix `SD_REPRINT_LAST_SELECTED_FILE` when the screen is scrolled.
This commit is contained in:
@@ -47,10 +47,11 @@ void lcd_sd_updir() {
|
||||
|
||||
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
||||
|
||||
uint32_t last_sdfile_encoderPosition = 0xFFFF;
|
||||
uint16_t sd_encoder_position = 0xFFFF;
|
||||
int8_t sd_top_line, sd_items;
|
||||
|
||||
void MarlinUI::reselect_last_file() {
|
||||
if (last_sdfile_encoderPosition == 0xFFFF) return;
|
||||
if (sd_encoder_position == 0xFFFF) return;
|
||||
//#if HAS_GRAPHICAL_LCD
|
||||
// // This is a hack to force a screen update.
|
||||
// ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);
|
||||
@@ -61,8 +62,8 @@ void lcd_sd_updir() {
|
||||
// ui.drawing_screen = screen_changed = true;
|
||||
//#endif
|
||||
|
||||
goto_screen(menu_sdcard, last_sdfile_encoderPosition);
|
||||
last_sdfile_encoderPosition = 0xFFFF;
|
||||
goto_screen(menu_sdcard, sd_encoder_position, sd_top_line, sd_items);
|
||||
sd_encoder_position = 0xFFFF;
|
||||
|
||||
defer_status_screen();
|
||||
|
||||
@@ -99,7 +100,10 @@ class MenuItem_sdfile {
|
||||
public:
|
||||
static void action(CardReader &theCard) {
|
||||
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
||||
last_sdfile_encoderPosition = ui.encoderPosition; // Save which file was selected for later use
|
||||
// Save menu state for the selected file
|
||||
sd_encoder_position = ui.encoderPosition;
|
||||
sd_top_line = ui.encoderTopLine;
|
||||
sd_items = ui.screen_items;
|
||||
#endif
|
||||
#if ENABLED(SD_MENU_CONFIRM_START)
|
||||
do_print_file = false;
|
||||
|
||||
Reference in New Issue
Block a user