File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 335335 //#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80
336336 //#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power
337337
338+ //#define PSU_POWERUP_GCODE "M355 S1" // G-code to run after power-on (e.g., case light on)
339+ //#define PSU_POWEROFF_GCODE "M355 S0" // G-code to run before power-off (e.g., case light off)
340+
338341 //#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin
339342 #if ENABLED (AUTO_POWER_CONTROL )
340343 #define AUTO_POWER_FANS // Turn on PSU if fans need power
Original file line number Diff line number Diff line change 3333#include " ../module/stepper/indirection.h"
3434#include " ../MarlinCore.h"
3535
36+ #if defined(PSU_POWERUP_GCODE) || defined(PSU_POWEROFF_GCODE)
37+ #include " ../gcode/gcode.h"
38+ #endif
39+
3640#if BOTH(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN)
3741 #include " controllerfan.h"
3842#endif
@@ -107,11 +111,19 @@ void Power::power_on() {
107111 safe_delay (PSU_POWERUP_DELAY);
108112 restore_stepper_drivers ();
109113 TERN_ (HAS_TRINAMIC_CONFIG, safe_delay (PSU_POWERUP_DELAY));
114+ #ifdef PSU_POWERUP_GCODE
115+ GcodeSuite::process_subcommands_now_P (PSTR (PSU_POWERUP_GCODE));
116+ #endif
110117 }
111118}
112119
113120void Power::power_off () {
114- if (powersupply_on) PSU_PIN_OFF ();
121+ if (powersupply_on) {
122+ #ifdef PSU_POWEROFF_GCODE
123+ GcodeSuite::process_subcommands_now_P (PSTR (PSU_POWEROFF_GCODE));
124+ #endif
125+ PSU_PIN_OFF ();
126+ }
115127}
116128
117129#endif // AUTO_POWER_CONTROL
You can’t perform that action at this time.
0 commit comments