0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-03-26 08:02:52 +00:00

🚸 Fix SD nav after "one click print"

This commit is contained in:
Scott Lahteine 2024-05-26 02:12:22 -05:00
parent 181a57ae9b
commit 4f85f88ae3
2 changed files with 13 additions and 5 deletions

View file

@ -26,6 +26,12 @@
#include "menu.h" #include "menu.h"
static void one_click_print_done() {
card.cdroot(); // Make sure SD card browsing doesn't break!
ui.return_to_status();
ui.reset_status();
}
void one_click_print() { void one_click_print() {
ui.goto_screen([]{ ui.goto_screen([]{
char * const filename = card.longest_filename(); char * const filename = card.longest_filename();
@ -33,9 +39,11 @@ void one_click_print() {
GET_TEXT_F(MSG_BUTTON_PRINT), GET_TEXT_F(MSG_BUTTON_CANCEL), GET_TEXT_F(MSG_BUTTON_PRINT), GET_TEXT_F(MSG_BUTTON_CANCEL),
[]{ []{
card.openAndPrintFile(card.filename); card.openAndPrintFile(card.filename);
ui.return_to_status(); one_click_print_done();
ui.reset_status(); },
}, nullptr, []{
one_click_print_done();
},
GET_TEXT_F(MSG_START_PRINT), filename, F("?") GET_TEXT_F(MSG_START_PRINT), filename, F("?")
); );
}); });

View file

@ -902,11 +902,11 @@ void CardReader::write_command(char * const buf) {
* Select the newest file and ask the user if they want to print it. * Select the newest file and ask the user if they want to print it.
*/ */
bool CardReader::one_click_check() { bool CardReader::one_click_check() {
const bool found = selectNewestFile(); const bool found = selectNewestFile(); // Changes the current workDir if found
if (found) { if (found) {
//SERIAL_ECHO_MSG(" OCP File: ", longest_filename(), "\n"); //SERIAL_ECHO_MSG(" OCP File: ", longest_filename(), "\n");
//ui.init(); //ui.init();
one_click_print(); one_click_print(); // Restores workkDir to root (eventually)
} }
return found; return found;
} }