mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-25 16:47:29 +08:00
Merge ca7752acc8
into 220cd5a640
This commit is contained in:
commit
9436036855
@ -1782,6 +1782,7 @@
|
||||
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power-loss
|
||||
#if ENABLED(BACKUP_POWER_SUPPLY)
|
||||
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail
|
||||
//#define PLR_REBOOT_TIMEOUT 60 // (seconds) Restart after power loss if UPS never lost power
|
||||
#endif
|
||||
|
||||
// Enable if Z homing is needed for proper recovery. 99.9% of the time this should be disabled!
|
||||
|
@ -952,9 +952,18 @@ void minkill(const bool steppers_off/*=false*/) {
|
||||
|
||||
// Reboot the board
|
||||
hal.reboot();
|
||||
|
||||
#else
|
||||
|
||||
#if defined(PLR_REBOOT_TIMEOUT)
|
||||
if (PrintJobRecovery::outage_counter > 0) {
|
||||
for (uint16_t i = 0; i < PLR_REBOOT_TIMEOUT; i++) {
|
||||
hal.watchdog_refresh();
|
||||
delay(1000);
|
||||
}
|
||||
hal.reboot();
|
||||
}
|
||||
#endif
|
||||
|
||||
for (;;) hal.watchdog_refresh(); // Wait for RESET button or power-cycle
|
||||
|
||||
#endif
|
||||
|
@ -41,6 +41,10 @@ bool PrintJobRecovery::enabled; // Initialized by settings.load
|
||||
celsius_t PrintJobRecovery::bed_temp_threshold; // Initialized by settings.load
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(POWER_LOSS)
|
||||
uint8_t PrintJobRecovery::outage_counter; // = 0
|
||||
#endif
|
||||
|
||||
MediaFile PrintJobRecovery::file;
|
||||
job_recovery_info_t PrintJobRecovery::info;
|
||||
const char PrintJobRecovery::filename[5] = "/PLR";
|
||||
|
@ -210,9 +210,9 @@ class PrintJobRecovery {
|
||||
static void save(const bool force=ENABLED(SAVE_EACH_CMD_MODE), const float zraise=POWER_LOSS_ZRAISE, const bool raised=false);
|
||||
|
||||
#if PIN_EXISTS(POWER_LOSS)
|
||||
static uint8_t outage_counter;
|
||||
static void outage() {
|
||||
static constexpr uint8_t OUTAGE_THRESHOLD = 3;
|
||||
static uint8_t outage_counter = 0;
|
||||
if (enabled && READ(POWER_LOSS_PIN) == POWER_LOSS_STATE) {
|
||||
outage_counter++;
|
||||
if (outage_counter >= OUTAGE_THRESHOLD) _outage();
|
||||
|
Loading…
Reference in New Issue
Block a user