1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 21:36:21 +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"
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() {
ui.goto_screen([]{
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),
[]{
card.openAndPrintFile(card.filename);
ui.return_to_status();
ui.reset_status();
}, nullptr,
one_click_print_done();
},
[]{
one_click_print_done();
},
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.
*/
bool CardReader::one_click_check() {
const bool found = selectNewestFile();
const bool found = selectNewestFile(); // Changes the current workDir if found
if (found) {
//SERIAL_ECHO_MSG(" OCP File: ", longest_filename(), "\n");
//ui.init();
one_click_print();
one_click_print(); // Restores workkDir to root (eventually)
}
return found;
}