Browse Source

🐛 Fix conditional M81 suicide (#23549)

John Lagonikas 2 years ago
parent
commit
0aea3ae058
No account linked to committer's email address

+ 2
- 0
Marlin/src/core/language.h View File

@@ -105,6 +105,7 @@
105 105
 
106 106
 #define STR_ENQUEUEING                      "enqueueing \""
107 107
 #define STR_POWERUP                         "PowerUp"
108
+#define STR_POWEROFF                        "PowerOff"
108 109
 #define STR_EXTERNAL_RESET                  " External Reset"
109 110
 #define STR_BROWNOUT_RESET                  " Brown out Reset"
110 111
 #define STR_WATCHDOG_RESET                  " Watchdog Reset"
@@ -306,6 +307,7 @@
306 307
 #define STR_Z_PROBE_OFFSET                  "Z-Probe Offset"
307 308
 #define STR_TEMPERATURE_UNITS               "Temperature Units"
308 309
 #define STR_USER_THERMISTORS                "User thermistors"
310
+#define STR_DELAYED_POWEROFF                "Delayed poweroff"
309 311
 
310 312
 //
311 313
 // Endstop Names used by Endstops::report_states

+ 7
- 3
Marlin/src/feature/power.cpp View File

@@ -24,7 +24,9 @@
24 24
  * power.cpp - power control
25 25
  */
26 26
 
27
-#include "../inc/MarlinConfig.h"
27
+#include "../inc/MarlinConfigPre.h"
28
+
29
+#if EITHER(PSU_CONTROL, AUTO_POWER_CONTROL)
28 30
 
29 31
 #include "power.h"
30 32
 #include "../module/planner.h"
@@ -40,8 +42,6 @@
40 42
   #include "../gcode/gcode.h"
41 43
 #endif
42 44
 
43
-#if EITHER(PSU_CONTROL, AUTO_POWER_CONTROL)
44
-
45 45
 Power powerManager;
46 46
 bool Power::psu_on;
47 47
 
@@ -97,6 +97,10 @@ void Power::power_on() {
97 97
  * Processes any PSU_POWEROFF_GCODE and makes a PS_OFF_SOUND if enabled.
98 98
  */
99 99
 void Power::power_off() {
100
+  SERIAL_ECHOLNPGM(STR_POWEROFF);
101
+
102
+  TERN_(HAS_SUICIDE, suicide());
103
+
100 104
   if (!psu_on) return;
101 105
 
102 106
   #ifdef PSU_POWEROFF_GCODE

+ 4
- 1
Marlin/src/gcode/control/M80_M81.cpp View File

@@ -107,7 +107,10 @@ void GcodeSuite::M81() {
107 107
     }
108 108
   #endif
109 109
 
110
-  if (delayed_power_off) return;
110
+  if (delayed_power_off) {
111
+    SERIAL_ECHOLNPGM(STR_DELAYED_POWEROFF);
112
+    return;
113
+  }
111 114
 
112 115
   #if HAS_SUICIDE
113 116
     suicide();

+ 2
- 2
Marlin/src/libs/MAX31865.cpp View File

@@ -300,14 +300,14 @@ uint16_t MAX31865::readRaw() {
300 300
         enableBias();
301 301
         nextEventStamp = millis() + 11; // wait at least 11msec before enabling 1shot
302 302
         nextEvent = SETUP_1_SHOT_MODE;
303
-        DEBUG_ECHOLN("MAX31865 bias voltage enabled");
303
+        DEBUG_ECHOLNPGM("MAX31865 bias voltage enabled");
304 304
         break;
305 305
 
306 306
       case SETUP_1_SHOT_MODE:
307 307
         oneShot();
308 308
         nextEventStamp = millis() + 65; // wait at least 65msec before reading RTD register
309 309
         nextEvent = READ_RTD_REG;
310
-        DEBUG_ECHOLN("MAX31865 1 shot mode enabled");
310
+        DEBUG_ECHOLNPGM("MAX31865 1 shot mode enabled");
311 311
         break;
312 312
 
313 313
       case READ_RTD_REG: {

+ 3
- 1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h View File

@@ -193,7 +193,9 @@
193 193
 //
194 194
 #if ENABLED(MKS_PWC)
195 195
   #if ENABLED(TFT_LVGL_UI)
196
-    #undef PSU_CONTROL
196
+    #if ENABLED(PSU_CONTROL)
197
+      #error "PSU_CONTROL is incompatible with MKS_PWC plus TFT_LVGL_UI."
198
+    #endif
197 199
     #undef MKS_PWC
198 200
     #define SUICIDE_PIN                     PB2
199 201
     #define SUICIDE_PIN_STATE               LOW

+ 3
- 1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h View File

@@ -118,7 +118,9 @@
118 118
 //
119 119
 #if ENABLED(MKS_PWC)
120 120
   #if ENABLED(TFT_LVGL_UI)
121
-    #undef PSU_CONTROL
121
+    #if ENABLED(PSU_CONTROL)
122
+      #error "PSU_CONTROL is incompatible with MKS_PWC plus TFT_LVGL_UI."
123
+    #endif
122 124
     #undef MKS_PWC
123 125
     #define SUICIDE_PIN                     PB2
124 126
     #define SUICIDE_PIN_STATE               LOW

+ 3
- 1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h View File

@@ -185,7 +185,9 @@
185 185
 //
186 186
 #if ENABLED(MKS_PWC)
187 187
   #if ENABLED(TFT_LVGL_UI)
188
-    #undef PSU_CONTROL
188
+    #if ENABLED(PSU_CONTROL)
189
+      #error "PSU_CONTROL is incompatible with MKS_PWC plus TFT_LVGL_UI."
190
+    #endif
189 191
     #undef MKS_PWC
190 192
     #define SUICIDE_PIN                     PG11
191 193
     #define SUICIDE_PIN_STATE               LOW

+ 3
- 1
Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h View File

@@ -165,7 +165,9 @@
165 165
 //
166 166
 #if ENABLED(MKS_PWC)
167 167
   #if ENABLED(TFT_LVGL_UI)
168
-    #undef PSU_CONTROL
168
+    #if ENABLED(PSU_CONTROL)
169
+      #error "PSU_CONTROL is incompatible with MKS_PWC plus TFT_LVGL_UI."
170
+    #endif
169 171
     #undef MKS_PWC
170 172
     #define SUICIDE_PIN                     PB2
171 173
     #define SUICIDE_PIN_STATE               LOW

Loading…
Cancel
Save