diff --git a/ProjectOptions.cmake b/ProjectOptions.cmake index 971a1dceb6..fa296a703e 100644 --- a/ProjectOptions.cmake +++ b/ProjectOptions.cmake @@ -171,7 +171,7 @@ message(STATUS "Resources: ${RESOURCES}") set(PRINTERS_WITH_FILAMENT_SENSOR_BINARY "MINI") set(PRINTERS_WITH_INIT_TRINAMIC_FROM_MARLIN_ONLY "MINI") set(PRINTERS_WITH_ADVANCED_PAUSE "MINI") -set(PRINTERS_WITH_POWER_PANIC) +set(PRINTERS_WITH_POWER_PANIC "MINI") set(PRINTERS_WITH_SELFTEST "MINI") set(PRINTERS_WITH_RESOURCES "MINI") set(PRINTERS_WITH_BOWDEN_EXTRUDER "MINI") diff --git a/include/marlin/Configuration_MINI_adv.h b/include/marlin/Configuration_MINI_adv.h index 2f09b3c59a..732c0a7fc6 100644 --- a/include/marlin/Configuration_MINI_adv.h +++ b/include/marlin/Configuration_MINI_adv.h @@ -1714,6 +1714,29 @@ #define AXIS_MEASURE_STALL_GUARD 130 #define AXIS_MEASURE_CRASH_PERIOD 210 + /** + * Recovery from power failure. This is a distinct implementation from + * POWER_LOSS_RECOVERY specific to Prusa printers. + */ + #define POWER_PANIC + + #ifdef POWER_PANIC + #define POWER_PANIC_Z_LIFT_CYCLES 4 // 4xFullStep cycles = ~0.64mm + #define POWER_PANIC_MAX_BED_DIFF 10 // Maximum bed temperature (C) difference for auto-recovery + + // Milliseconds to wait on hold before auto-restarting during short power failures + #define POWER_PANIC_HOLD_RST_MS 5000 + + // TODO: currently arbitrary, needs to include optimal feedrates too + #define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking + #define POWER_PANIC_X_FEEDRATE 200 // (mm/s, running at POWER_PANIC_X_CURRENT) + + #define POWER_PANIC_Z_CURRENT 350 // (mA) RMS current _after_ alignment + #define POWER_PANIC_Z_FEEDRATE 50 // (mm/s, running at default current) + + #define POWER_PANIC_E_CURRENT 300 // (mA) RMS current + #endif + /** * TMC2130, TMC2160, TMC2660, TMC5130, and TMC5160 only * Use StallGuard2 to sense an obstacle and trigger an endstop. diff --git a/src/common/hwio_pindef.h b/src/common/hwio_pindef.h index c2be954a2b..4a4b785e23 100644 --- a/src/common/hwio_pindef.h +++ b/src/common/hwio_pindef.h @@ -165,7 +165,8 @@ MACRO_FUNCTION(buddy::hw::InputPin, jogWheelENC, buddy::hw::IoPort::E COMMA buddy::hw::IoPin::p12, IMode::input COMMA Pull::up, buddy::hw::noHandler) \ MACRO_FUNCTION(buddy::hw::InputPin, fanPrintTach, buddy::hw::IoPort::E COMMA buddy::hw::IoPin::p10, IMode::input COMMA Pull::up, buddy::hw::noHandler) \ MACRO_FUNCTION(buddy::hw::InputPin, fanHeatBreakTach, buddy::hw::IoPort::E COMMA buddy::hw::IoPin::p14, IMode::input COMMA Pull::up, buddy::hw::noHandler) \ - MACRO_FUNCTION(buddy::hw::OutputPin, extFlashCs, buddy::hw::IoPort::D COMMA buddy::hw::IoPin::p7, Pin::State::high COMMA OMode::pushPull COMMA OSpeed::high, buddy::hw::noHandler) + MACRO_FUNCTION(buddy::hw::OutputPin, extFlashCs, buddy::hw::IoPort::D COMMA buddy::hw::IoPin::p7, Pin::State::high COMMA OMode::pushPull COMMA OSpeed::high, buddy::hw::noHandler) \ + MACRO_FUNCTION(buddy::hw::InterruptPin, acFault, buddy::hw::IoPort::A COMMA buddy::hw::IoPin::p3, IMode::IT_falling COMMA Pull::none COMMA configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY COMMA 0, power_panic::ac_fault_isr) #else #error "Unknown board." #endif diff --git a/src/common/power_panic.cpp b/src/common/power_panic.cpp index f234ec78b4..67ef028e4f 100644 --- a/src/common/power_panic.cpp +++ b/src/common/power_panic.cpp @@ -902,7 +902,6 @@ void ac_fault_isr() { // heaters are *already* disabled via HW, but stop temperature and fan regulation too thermalManager.disable_all_heaters(); thermalManager.zero_fan_speeds(); - thermalManager.suspend_heatbreak_fan(2000); // stop & disable endstops media_print_quick_stop(MEDIA_PRINT_UNDEF_POSITION);