Move Power Loss Recovery check

This commit is contained in:
Scott Lahteine 2020-04-19 01:11:56 -05:00
parent 2ae00db43e
commit d96c769fd6
3 changed files with 9 additions and 8 deletions

View file

@ -1161,10 +1161,6 @@ void setup() {
SETUP_RUN(est_init()); SETUP_RUN(est_init());
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY)
SETUP_RUN(recovery.check());
#endif
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)
SETUP_RUN(watchdog_init()); // Reinit watchdog after HAL_get_reset_source call SETUP_RUN(watchdog_init()); // Reinit watchdog after HAL_get_reset_source call
#endif #endif

View file

@ -100,10 +100,10 @@ void PrintJobRecovery::changed() {
* If a saved state exists send 'M1000 S' to initiate job recovery. * If a saved state exists send 'M1000 S' to initiate job recovery.
*/ */
void PrintJobRecovery::check() { void PrintJobRecovery::check() {
if (!card.isMounted()) card.mount(); //if (!card.isMounted()) card.mount();
if (card.isMounted()) { if (card.isMounted()) {
load(); load();
if (!valid()) return purge(); if (!valid()) return cancel();
queue.inject_P(PSTR("M1000 S")); queue.inject_P(PSTR("M1000 S"));
} }
} }

View file

@ -408,8 +408,13 @@ void CardReader::manage_media() {
ui.media_changed(old_stat, stat); // Update the UI ui.media_changed(old_stat, stat); // Update the UI
if (stat && old_stat == 2) // First mount? if (stat && old_stat == 2) { // First mount?
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.check();
#else
beginautostart(); // Look for autostart files soon beginautostart(); // Look for autostart files soon
#endif
}
} }
} }