|
@ -3745,22 +3745,45 @@ void kill_screen(const char* lcd_msg) { |
|
|
* "Print from SD" submenu |
|
|
* "Print from SD" submenu |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) |
|
|
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) |
|
|
uint32_t saved_encoderPosition = 0; |
|
|
uint32_t last_sdfile_encoderPosition = 0xFFFF; |
|
|
static millis_t assume_print_finished = 0; |
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
// TODO: Fix the real issue that causes this!
|
|
|
|
|
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; |
|
|
|
|
|
_lcd_synchronize(); |
|
|
|
|
|
safe_delay(50); |
|
|
|
|
|
_lcd_synchronize(); |
|
|
|
|
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; |
|
|
|
|
|
drawing_screen = screen_changed = true; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
lcd_goto_screen(lcd_sdcard_menu, last_sdfile_encoderPosition); |
|
|
|
|
|
defer_return_to_status = true; |
|
|
|
|
|
last_sdfile_encoderPosition == 0xFFFF; |
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DOGLCD) |
|
|
|
|
|
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) |
|
|
#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
|
|
|
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
|
|
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; // have been active for 5 seconds. In this case, restore the previous
|
|
|
encoderPosition = saved_encoderPosition; // encoderPosition to the last selected item.
|
|
|
encoderPosition = last_sdfile_encoderPosition; // encoderPosition to the last selected item.
|
|
|
assume_print_finished = millis() + 5000; |
|
|
assume_print_finished = millis() + 5000; |
|
|
} |
|
|
} |
|
|
saved_encoderPosition = encoderPosition; |
|
|
last_sdfile_encoderPosition = encoderPosition; // needed as a workaround for the 5s timer
|
|
|
defer_return_to_status = true; |
|
|
//defer_return_to_status = true; // already done in lcd_reselect_last_file
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
const uint16_t fileCnt = card.getnrfilenames(); |
|
|
const uint16_t fileCnt = card.getnrfilenames(); |
|
@ -4414,7 +4437,7 @@ void kill_screen(const char* lcd_msg) { |
|
|
|
|
|
|
|
|
void menu_action_sdfile(const char* filename, char* longFilename) { |
|
|
void menu_action_sdfile(const char* filename, char* longFilename) { |
|
|
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) |
|
|
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) |
|
|
saved_encoderPosition = encoderPosition; // Save which file was selected for later use
|
|
|
last_sdfile_encoderPosition = encoderPosition; // Save which file was selected for later use
|
|
|
#endif |
|
|
#endif |
|
|
UNUSED(longFilename); |
|
|
UNUSED(longFilename); |
|
|
card.openAndPrintFile(filename); |
|
|
card.openAndPrintFile(filename); |
|
@ -4722,16 +4745,18 @@ 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 ENABLED(DOGLCD) |
|
|
if ( |
|
|
if ((lcdDrawUpdate || drawing_screen) && (!bbr2 || (bbr2 > max_display_update_time) |
|
|
#if ENABLED(DOGLCD) |
|
|
#if ENABLED(SDSUPPORT) |
|
|
(lcdDrawUpdate || drawing_screen) && ( |
|
|
|| (currentScreen == lcd_sdcard_menu) |
|
|
!bbr2 || (bbr2 > max_display_update_time) |
|
|
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
|
|
|
|| currentScreen == lcd_sdcard_menu |
|
|
|
|
|
#endif |
|
|
|
|
|
) |
|
|
|
|
|
#else |
|
|
|
|
|
lcdDrawUpdate && (!bbr2 || (bbr2 > max_display_update_time)) |
|
|
#endif |
|
|
#endif |
|
|
)) |
|
|
) { |
|
|
#else |
|
|
|
|
|
if (lcdDrawUpdate && (!bbr2 || (bbr2 > max_display_update_time))) |
|
|
|
|
|
#endif |
|
|
|
|
|
{ |
|
|
|
|
|
#if ENABLED(DOGLCD) |
|
|
#if ENABLED(DOGLCD) |
|
|
if (!drawing_screen) |
|
|
if (!drawing_screen) |
|
|
#endif |
|
|
#endif |
|
|