🐛 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

@ -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

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

View File

@ -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();

View File

@ -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: {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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