diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index c53ebdfbf8382..8e0784f70d767 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -105,6 +105,7 @@ #define STR_ENQUEUEING "enqueueing \"" #define STR_POWERUP "PowerUp" +#define STR_POWEROFF "PowerOff" #define STR_EXTERNAL_RESET " External Reset" #define STR_BROWNOUT_RESET " Brown out Reset" #define STR_WATCHDOG_RESET " Watchdog Reset" @@ -306,6 +307,7 @@ #define STR_Z_PROBE_OFFSET "Z-Probe Offset" #define STR_TEMPERATURE_UNITS "Temperature Units" #define STR_USER_THERMISTORS "User thermistors" +#define STR_DELAYED_POWEROFF "Delayed poweroff" // // Endstop Names used by Endstops::report_states diff --git a/Marlin/src/feature/power.cpp b/Marlin/src/feature/power.cpp index 0e4d5452e4864..c2ed169aa809f 100644 --- a/Marlin/src/feature/power.cpp +++ b/Marlin/src/feature/power.cpp @@ -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 diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index cbb3c85f40caa..6a3788c4a9190 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -107,7 +107,10 @@ void GcodeSuite::M81() { } #endif - if (delayed_power_off) return; + if (delayed_power_off) { + SERIAL_ECHOLNPGM(STR_DELAYED_POWEROFF); + return; + } #if HAS_SUICIDE suicide(); diff --git a/Marlin/src/libs/MAX31865.cpp b/Marlin/src/libs/MAX31865.cpp index 6cc8ffca39903..1cafbe5f170e2 100644 --- a/Marlin/src/libs/MAX31865.cpp +++ b/Marlin/src/libs/MAX31865.cpp @@ -300,14 +300,14 @@ uint16_t MAX31865::readRaw() { enableBias(); nextEventStamp = millis() + 11; // wait at least 11msec before enabling 1shot nextEvent = SETUP_1_SHOT_MODE; - DEBUG_ECHOLN("MAX31865 bias voltage enabled"); + DEBUG_ECHOLNPGM("MAX31865 bias voltage enabled"); break; case SETUP_1_SHOT_MODE: oneShot(); nextEventStamp = millis() + 65; // wait at least 65msec before reading RTD register nextEvent = READ_RTD_REG; - DEBUG_ECHOLN("MAX31865 1 shot mode enabled"); + DEBUG_ECHOLNPGM("MAX31865 1 shot mode enabled"); break; case READ_RTD_REG: { diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 592d585982df7..5fdd37b104151 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -193,7 +193,9 @@ // #if ENABLED(MKS_PWC) #if ENABLED(TFT_LVGL_UI) - #undef PSU_CONTROL + #if ENABLED(PSU_CONTROL) + #error "PSU_CONTROL is incompatible with MKS_PWC plus TFT_LVGL_UI." + #endif #undef MKS_PWC #define SUICIDE_PIN PB2 #define SUICIDE_PIN_STATE LOW diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h index 859529c2c302d..e057e13c25f08 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h @@ -118,7 +118,9 @@ // #if ENABLED(MKS_PWC) #if ENABLED(TFT_LVGL_UI) - #undef PSU_CONTROL + #if ENABLED(PSU_CONTROL) + #error "PSU_CONTROL is incompatible with MKS_PWC plus TFT_LVGL_UI." + #endif #undef MKS_PWC #define SUICIDE_PIN PB2 #define SUICIDE_PIN_STATE LOW diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h index a738a4faa2593..53f207adb7ab8 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h @@ -185,7 +185,9 @@ // #if ENABLED(MKS_PWC) #if ENABLED(TFT_LVGL_UI) - #undef PSU_CONTROL + #if ENABLED(PSU_CONTROL) + #error "PSU_CONTROL is incompatible with MKS_PWC plus TFT_LVGL_UI." + #endif #undef MKS_PWC #define SUICIDE_PIN PG11 #define SUICIDE_PIN_STATE LOW diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h index 2c191946cd525..5b2c1b0f4345f 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h @@ -165,7 +165,9 @@ // #if ENABLED(MKS_PWC) #if ENABLED(TFT_LVGL_UI) - #undef PSU_CONTROL + #if ENABLED(PSU_CONTROL) + #error "PSU_CONTROL is incompatible with MKS_PWC plus TFT_LVGL_UI." + #endif #undef MKS_PWC #define SUICIDE_PIN PB2 #define SUICIDE_PIN_STATE LOW