🐛 Fix conditional M81 suicide (#23549)

This commit is contained in:
John Lagonikas
2022-01-19 10:13:47 +02:00
committed by Scott Lahteine
parent 6f82d1befb
commit 7b4f5108ac
8 changed files with 27 additions and 10 deletions

View File

@ -24,7 +24,9 @@
* power.cpp - power control
*/
#include "../inc/MarlinConfig.h"
#include "../inc/MarlinConfigPre.h"
#if EITHER(PSU_CONTROL, AUTO_POWER_CONTROL)
#include "power.h"
#include "../module/planner.h"
@ -40,8 +42,6 @@
#include "../gcode/gcode.h"
#endif
#if EITHER(PSU_CONTROL, AUTO_POWER_CONTROL)
Power powerManager;
bool Power::psu_on;
@ -97,6 +97,10 @@ void Power::power_on() {
* Processes any PSU_POWEROFF_GCODE and makes a PS_OFF_SOUND if enabled.
*/
void Power::power_off() {
SERIAL_ECHOLNPGM(STR_POWEROFF);
TERN_(HAS_SUICIDE, suicide());
if (!psu_on) return;
#ifdef PSU_POWEROFF_GCODE