🧑💻 Handle PLR in manage_media
This commit is contained in:
parent
aaf5bf0218
commit
fd082df077
|
@ -108,13 +108,18 @@ void PrintJobRecovery::changed() {
|
|||
*
|
||||
* If a saved state exists send 'M1000 S' to initiate job recovery.
|
||||
*/
|
||||
void PrintJobRecovery::check() {
|
||||
bool PrintJobRecovery::check() {
|
||||
//if (!card.isMounted()) card.mount();
|
||||
bool success = false;
|
||||
if (card.isMounted()) {
|
||||
load();
|
||||
if (!valid()) return cancel();
|
||||
queue.inject(F("M1000S"));
|
||||
success = valid();
|
||||
if (!success)
|
||||
cancel();
|
||||
else
|
||||
queue.inject(F("M1000S"));
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -176,11 +176,11 @@ class PrintJobRecovery {
|
|||
static void open(const bool read) { card.openJobRecoveryFile(read); }
|
||||
static void close() { file.close(); }
|
||||
|
||||
static void check();
|
||||
static bool check();
|
||||
static void resume();
|
||||
static void purge();
|
||||
|
||||
static void cancel() { purge(); IF_DISABLED(NO_SD_AUTOSTART, card.autofile_begin()); }
|
||||
static void cancel() { purge(); }
|
||||
|
||||
static void load();
|
||||
static void save(const bool force=ENABLED(SAVE_EACH_CMD_MODE), const float zraise=POWER_LOSS_ZRAISE, const bool raised=false);
|
||||
|
|
|
@ -49,7 +49,7 @@ void GcodeSuite::M413() {
|
|||
if (parser.seen_test('P')) recovery.purge();
|
||||
if (parser.seen_test('D')) recovery.debug(F("M413"));
|
||||
if (parser.seen_test('O')) recovery._outage(true);
|
||||
if (parser.seen_test('C')) recovery.check();
|
||||
if (parser.seen_test('C')) (void)recovery.check();
|
||||
if (parser.seen_test('E')) SERIAL_ECHOF(recovery.exists() ? F("PLR Exists\n") : F("No PLR\n"));
|
||||
if (parser.seen_test('V')) SERIAL_ECHOF(recovery.valid() ? F("Valid\n") : F("Invalid\n"));
|
||||
#endif
|
||||
|
|
|
@ -514,11 +514,13 @@ void CardReader::manage_media() {
|
|||
|
||||
DEBUG_ECHOLNPGM("First mount.");
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.check(); // Check for PLR file. (If not there then call autofile_begin)
|
||||
#elif DISABLED(NO_SD_AUTOSTART)
|
||||
autofile_begin(); // Look for auto0.g on the next loop
|
||||
#endif
|
||||
bool do_auto = true; UNUSED(do_auto);
|
||||
|
||||
// Check for PLR file.
|
||||
TERN_(POWER_LOSS_RECOVERY, if (recovery.check()) do_auto = false);
|
||||
|
||||
// Look for auto0.g on the next idle()
|
||||
IF_DISABLED(NO_SD_AUTOSTART, if (do_auto) autofile_begin());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue