Add power-on/off G-code options (#19837)

Co-authored-by: Chris <chris@chrisnovoa.com>
This commit is contained in:
Scott Lahteine
2020-10-21 15:03:11 -05:00
committed by GitHub
parent 1e4691f02a
commit 7d64de646a
2 changed files with 16 additions and 1 deletions

View File

@ -33,6 +33,10 @@
#include "../module/stepper/indirection.h"
#include "../MarlinCore.h"
#if defined(PSU_POWERUP_GCODE) || defined(PSU_POWEROFF_GCODE)
#include "../gcode/gcode.h"
#endif
#if BOTH(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN)
#include "controllerfan.h"
#endif
@ -107,11 +111,19 @@ void Power::power_on() {
safe_delay(PSU_POWERUP_DELAY);
restore_stepper_drivers();
TERN_(HAS_TRINAMIC_CONFIG, safe_delay(PSU_POWERUP_DELAY));
#ifdef PSU_POWERUP_GCODE
GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWERUP_GCODE));
#endif
}
}
void Power::power_off() {
if (powersupply_on) PSU_PIN_OFF();
if (powersupply_on) {
#ifdef PSU_POWEROFF_GCODE
GcodeSuite::process_subcommands_now_P(PSTR(PSU_POWEROFF_GCODE));
#endif
PSU_PIN_OFF();
}
}
#endif // AUTO_POWER_CONTROL