No hacks needed for SD_REPRINT_LAST_SELECTED_FILE
This commit is contained in:
parent
0b5b03d9dc
commit
5e5a177934
@ -3758,9 +3758,11 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
||||||
uint32_t last_sdfile_encoderPosition = 0;
|
uint32_t last_sdfile_encoderPosition = 0xFFFF;
|
||||||
|
|
||||||
void lcd_reselect_last_file() {
|
void lcd_reselect_last_file() {
|
||||||
|
if (last_sdfile_encoderPosition == 0xFFFF) return;
|
||||||
|
#if ENABLED(DOGLCD)
|
||||||
// Some of this is a hack to force the screen update to work.
|
// Some of this is a hack to force the screen update to work.
|
||||||
// TODO: Fix the real issue that causes this!
|
// TODO: Fix the real issue that causes this!
|
||||||
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
||||||
@ -3769,26 +3771,21 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
_lcd_synchronize();
|
_lcd_synchronize();
|
||||||
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
||||||
drawing_screen = screen_changed = true;
|
drawing_screen = screen_changed = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
lcd_goto_screen(lcd_sdcard_menu, last_sdfile_encoderPosition);
|
lcd_goto_screen(lcd_sdcard_menu, last_sdfile_encoderPosition);
|
||||||
defer_return_to_status = true;
|
defer_return_to_status = true;
|
||||||
|
last_sdfile_encoderPosition = 0xFFFF;
|
||||||
|
|
||||||
|
#if ENABLED(DOGLCD)
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void lcd_sdcard_menu() {
|
void lcd_sdcard_menu() {
|
||||||
ENCODER_DIRECTION_MENUS();
|
ENCODER_DIRECTION_MENUS();
|
||||||
|
|
||||||
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
|
||||||
static millis_t assume_print_finished = 0;
|
|
||||||
if (ELAPSED(millis(), assume_print_finished)) { // if the printer has been busy printing, lcd_sdcard_menu() should not
|
|
||||||
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; // have been active for 5 seconds. In this case, restore the previous
|
|
||||||
encoderPosition = last_sdfile_encoderPosition; // encoderPosition to the last selected item.
|
|
||||||
assume_print_finished = millis() + 5000;
|
|
||||||
}
|
|
||||||
last_sdfile_encoderPosition = encoderPosition; // needed as a workaround for the 5s timer
|
|
||||||
//defer_return_to_status = true; // already done in lcd_reselect_last_file
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const uint16_t fileCnt = card.getnrfilenames();
|
const uint16_t fileCnt = card.getnrfilenames();
|
||||||
START_MENU();
|
START_MENU();
|
||||||
MENU_BACK(MSG_MAIN);
|
MENU_BACK(MSG_MAIN);
|
||||||
@ -4746,18 +4743,13 @@ void lcd_update() {
|
|||||||
// then we want to use 1/2 of the time only.
|
// then we want to use 1/2 of the time only.
|
||||||
uint16_t bbr2 = planner.block_buffer_runtime() >> 1;
|
uint16_t bbr2 = planner.block_buffer_runtime() >> 1;
|
||||||
|
|
||||||
if (
|
|
||||||
#if ENABLED(DOGLCD)
|
#if ENABLED(DOGLCD)
|
||||||
(lcdDrawUpdate || drawing_screen) && (
|
#define IS_DRAWING drawing_screen
|
||||||
!bbr2 || (bbr2 > max_display_update_time)
|
|
||||||
#if ENABLED(SDSUPPORT)
|
|
||||||
|| currentScreen == lcd_sdcard_menu
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
#else
|
#else
|
||||||
lcdDrawUpdate && (!bbr2 || (bbr2 > max_display_update_time))
|
#define IS_DRAWING false
|
||||||
#endif
|
#endif
|
||||||
) {
|
|
||||||
|
if ((lcdDrawUpdate || IS_DRAWING) && (!bbr2 || bbr2 > max_display_update_time)) {
|
||||||
#if ENABLED(DOGLCD)
|
#if ENABLED(DOGLCD)
|
||||||
if (!drawing_screen)
|
if (!drawing_screen)
|
||||||
#endif
|
#endif
|
||||||
@ -4807,12 +4799,7 @@ void lcd_update() {
|
|||||||
|
|
||||||
// Return to Status Screen after a timeout
|
// Return to Status Screen after a timeout
|
||||||
if (currentScreen == lcd_status_screen || defer_return_to_status)
|
if (currentScreen == lcd_status_screen || defer_return_to_status)
|
||||||
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
|
||||||
if (currentScreen != lcd_sdcard_menu) // lcd_sdcard_menu() does not time out if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
|
||||||
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; // When the printer finishes a file, it will wait with the file selected for
|
|
||||||
#else // a re-print.
|
|
||||||
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
||||||
#endif
|
|
||||||
else if (ELAPSED(ms, return_to_status_ms))
|
else if (ELAPSED(ms, return_to_status_ms))
|
||||||
lcd_return_to_status();
|
lcd_return_to_status();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user