Added power off timeout

This commit is contained in:
Stefan Altheimer 2020-11-01 18:19:17 +01:00
parent 12e8861a1c
commit c9891be599
3 changed files with 7 additions and 0 deletions

View file

@ -338,6 +338,8 @@
//#define PSU_POWERUP_GCODE "M355 S1" // G-code to run after power-on (e.g., case light on) //#define PSU_POWERUP_GCODE "M355 S1" // G-code to run after power-on (e.g., case light on)
//#define PSU_POWEROFF_GCODE "M355 S0" // G-code to run before power-off (e.g., case light off) //#define PSU_POWEROFF_GCODE "M355 S0" // G-code to run before power-off (e.g., case light off)
//#define POWER_OFF_TIMEOUT 30 // (s) Delay for the shutoff of the PSU; for example used to let a cooling-fan run after print is finished
//#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin //#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin
#if ENABLED(AUTO_POWER_CONTROL) #if ENABLED(AUTO_POWER_CONTROL)
#define AUTO_POWER_FANS // Turn on PSU if fans need power #define AUTO_POWER_FANS // Turn on PSU if fans need power

View file

@ -122,6 +122,7 @@ void Power::power_off() {
#ifdef PSU_POWEROFF_GCODE #ifdef PSU_POWEROFF_GCODE
GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWEROFF_GCODE)); GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWEROFF_GCODE));
#endif #endif
safe_delay(SEC_TO_MS(POWER_OFF_TIMEOUT));
PSU_PIN_OFF(); PSU_PIN_OFF();
} }
} }

View file

@ -420,6 +420,10 @@
#define PSU_POWERUP_DELAY 250 #define PSU_POWERUP_DELAY 250
#endif #endif
#if !defined(POWER_OFF_TIMEOUT) && ENABLED(PSU_CONTROL)
#define POWER_OFF_TIMEOUT 0
#endif
/** /**
* Temp Sensor defines * Temp Sensor defines
*/ */