Add POWER_OFF_DELAY option (#19987)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
44f689320b
commit
170ba87648
@ -344,9 +344,10 @@
|
|||||||
#define AUTO_POWER_E_FANS
|
#define AUTO_POWER_E_FANS
|
||||||
#define AUTO_POWER_CONTROLLERFAN
|
#define AUTO_POWER_CONTROLLERFAN
|
||||||
#define AUTO_POWER_CHAMBER_FAN
|
#define AUTO_POWER_CHAMBER_FAN
|
||||||
//#define AUTO_POWER_E_TEMP 50 // (°C) Turn on PSU over this temperature
|
//#define AUTO_POWER_E_TEMP 50 // (°C) Turn on PSU if any extruder is over this temperature
|
||||||
//#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU over this temperature
|
//#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU if the chamber is over this temperature
|
||||||
#define POWER_TIMEOUT 30
|
#define POWER_TIMEOUT 30 // (s) Turn off power if the machine is idle for this duration
|
||||||
|
//#define POWER_OFF_DELAY 60 // (s) Delay of poweroff after M81 command. Useful to let fans run for extra time.
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -94,9 +94,11 @@ extern bool wait_for_heatup;
|
|||||||
#if ENABLED(AUTO_POWER_CONTROL)
|
#if ENABLED(AUTO_POWER_CONTROL)
|
||||||
#define PSU_ON() powerManager.power_on()
|
#define PSU_ON() powerManager.power_on()
|
||||||
#define PSU_OFF() powerManager.power_off()
|
#define PSU_OFF() powerManager.power_off()
|
||||||
|
#define PSU_OFF_SOON() powerManager.power_off_soon()
|
||||||
#else
|
#else
|
||||||
#define PSU_ON() PSU_PIN_ON()
|
#define PSU_ON() PSU_PIN_ON()
|
||||||
#define PSU_OFF() PSU_PIN_OFF()
|
#define PSU_OFF() PSU_PIN_OFF()
|
||||||
|
#define PSU_OFF_SOON PSU_OFF
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -126,4 +126,12 @@ void Power::power_off() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Power::power_off_soon() {
|
||||||
|
#if POWER_OFF_DELAY
|
||||||
|
lastPowerOn = millis() - SEC_TO_MS(POWER_TIMEOUT) + SEC_TO_MS(POWER_OFF_DELAY);
|
||||||
|
#else
|
||||||
|
power_off();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif // AUTO_POWER_CONTROL
|
#endif // AUTO_POWER_CONTROL
|
||||||
|
@ -32,6 +32,7 @@ class Power {
|
|||||||
static void check();
|
static void check();
|
||||||
static void power_on();
|
static void power_on();
|
||||||
static void power_off();
|
static void power_off();
|
||||||
|
static void power_off_soon();
|
||||||
private:
|
private:
|
||||||
static millis_t lastPowerOn;
|
static millis_t lastPowerOn;
|
||||||
static bool is_power_needed();
|
static bool is_power_needed();
|
||||||
|
@ -105,7 +105,7 @@ void GcodeSuite::M81() {
|
|||||||
#if HAS_SUICIDE
|
#if HAS_SUICIDE
|
||||||
suicide();
|
suicide();
|
||||||
#elif ENABLED(PSU_CONTROL)
|
#elif ENABLED(PSU_CONTROL)
|
||||||
PSU_OFF();
|
PSU_OFF_SOON();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " STR_OFF "."));
|
LCD_MESSAGEPGM_P(PSTR(MACHINE_NAME " " STR_OFF "."));
|
||||||
|
@ -416,9 +416,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(PSU_POWERUP_DELAY) && ENABLED(PSU_CONTROL)
|
#if ENABLED(PSU_CONTROL)
|
||||||
|
#ifndef PSU_POWERUP_DELAY
|
||||||
#define PSU_POWERUP_DELAY 250
|
#define PSU_POWERUP_DELAY 250
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef POWER_OFF_DELAY
|
||||||
|
#define POWER_OFF_DELAY 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temp Sensor defines
|
* Temp Sensor defines
|
||||||
|
@ -3016,9 +3016,9 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
|||||||
#error "PSU_CONTROL requires PSU_ACTIVE_STATE to be defined as 'HIGH' or 'LOW'."
|
#error "PSU_CONTROL requires PSU_ACTIVE_STATE to be defined as 'HIGH' or 'LOW'."
|
||||||
#elif !PIN_EXISTS(PS_ON)
|
#elif !PIN_EXISTS(PS_ON)
|
||||||
#error "PSU_CONTROL requires PS_ON_PIN."
|
#error "PSU_CONTROL requires PS_ON_PIN."
|
||||||
|
#elif POWER_OFF_DELAY < 0
|
||||||
|
#error "POWER_OFF_DELAY must be a positive value."
|
||||||
#endif
|
#endif
|
||||||
#elif ENABLED(AUTO_POWER_CONTROL)
|
|
||||||
#error "AUTO_POWER_CONTROL requires PSU_CONTROL."
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_CUTTER
|
#if HAS_CUTTER
|
||||||
|
Loading…
Reference in New Issue
Block a user