Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable power panic. #2913

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ProjectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
23 changes: 23 additions & 0 deletions include/marlin/Configuration_MINI_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/common/hwio_pindef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/common/power_panic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down