|
@@ -272,7 +272,7 @@ int fanSpeed = 0;
|
272
|
272
|
|
273
|
273
|
#endif // FWRETRACT
|
274
|
274
|
|
275
|
|
-#ifdef ULTIPANEL
|
|
275
|
+#if defined(ULTIPANEL) && HAS_POWER_SWITCH
|
276
|
276
|
bool powersupply =
|
277
|
277
|
#ifdef PS_DEFAULT_OFF
|
278
|
278
|
false
|
|
@@ -517,7 +517,7 @@ void setup_powerhold()
|
517
|
517
|
OUT_WRITE(SUICIDE_PIN, HIGH);
|
518
|
518
|
#endif
|
519
|
519
|
#if HAS_POWER_SWITCH
|
520
|
|
- #if defined(PS_DEFAULT_OFF)
|
|
520
|
+ #ifdef PS_DEFAULT_OFF
|
521
|
521
|
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
|
522
|
522
|
#else
|
523
|
523
|
OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE);
|
|
@@ -3313,33 +3313,38 @@ inline void gcode_M140() {
|
3313
|
3313
|
#endif
|
3314
|
3314
|
}
|
3315
|
3315
|
|
3316
|
|
- /**
|
3317
|
|
- * M81: Turn off Power Supply
|
3318
|
|
- */
|
3319
|
|
- inline void gcode_M81() {
|
3320
|
|
- disable_heater();
|
|
3316
|
+#endif // HAS_POWER_SWITCH
|
|
3317
|
+
|
|
3318
|
+/**
|
|
3319
|
+ * M81: Turn off Power, including Power Supply, if there is one.
|
|
3320
|
+ *
|
|
3321
|
+ * This code should ALWAYS be available for EMERGENCY SHUTDOWN!
|
|
3322
|
+ */
|
|
3323
|
+inline void gcode_M81() {
|
|
3324
|
+ disable_heater();
|
|
3325
|
+ st_synchronize();
|
|
3326
|
+ disable_e0();
|
|
3327
|
+ disable_e1();
|
|
3328
|
+ disable_e2();
|
|
3329
|
+ disable_e3();
|
|
3330
|
+ finishAndDisableSteppers();
|
|
3331
|
+ fanSpeed = 0;
|
|
3332
|
+ delay(1000); // Wait 1 second before switching off
|
|
3333
|
+ #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
|
3321
|
3334
|
st_synchronize();
|
3322
|
|
- disable_e0();
|
3323
|
|
- disable_e1();
|
3324
|
|
- disable_e2();
|
3325
|
|
- disable_e3();
|
3326
|
|
- finishAndDisableSteppers();
|
3327
|
|
- fanSpeed = 0;
|
3328
|
|
- delay(1000); // Wait 1 second before switching off
|
3329
|
|
- #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
|
3330
|
|
- st_synchronize();
|
3331
|
|
- suicide();
|
3332
|
|
- #elif HAS_POWER_SWITCH
|
3333
|
|
- OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
|
3334
|
|
- #endif
|
3335
|
|
- #ifdef ULTIPANEL
|
|
3335
|
+ suicide();
|
|
3336
|
+ #elif HAS_POWER_SWITCH
|
|
3337
|
+ OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
|
|
3338
|
+ #endif
|
|
3339
|
+ #ifdef ULTIPANEL
|
|
3340
|
+ #if HAS_POWER_SWITCH
|
3336
|
3341
|
powersupply = false;
|
3337
|
|
- LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
|
3338
|
|
- lcd_update();
|
3339
|
3342
|
#endif
|
3340
|
|
- }
|
|
3343
|
+ LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
|
|
3344
|
+ lcd_update();
|
|
3345
|
+ #endif
|
|
3346
|
+}
|
3341
|
3347
|
|
3342
|
|
-#endif // PS_ON_PIN
|
3343
|
3348
|
|
3344
|
3349
|
/**
|
3345
|
3350
|
* M82: Set E codes absolute (default)
|
|
@@ -4874,15 +4879,15 @@ void process_commands() {
|
4874
|
4879
|
#endif //HEATER_2_PIN
|
4875
|
4880
|
#endif //BARICUDA
|
4876
|
4881
|
|
4877
|
|
- #if defined(PS_ON_PIN) && PS_ON_PIN > -1
|
|
4882
|
+ #if HAS_POWER_SWITCH
|
4878
|
4883
|
|
4879
|
4884
|
case 80: // M80 - Turn on Power Supply
|
4880
|
4885
|
gcode_M80();
|
4881
|
4886
|
break;
|
4882
|
4887
|
|
4883
|
|
- #endif // PS_ON_PIN
|
|
4888
|
+ #endif // HAS_POWER_SWITCH
|
4884
|
4889
|
|
4885
|
|
- case 81: // M81 - Turn off Power Supply
|
|
4890
|
+ case 81: // M81 - Turn off Power, including Power Supply, if possible
|
4886
|
4891
|
gcode_M81();
|
4887
|
4892
|
break;
|
4888
|
4893
|
|
|
@@ -5859,19 +5864,17 @@ void kill()
|
5859
|
5864
|
disable_e2();
|
5860
|
5865
|
disable_e3();
|
5861
|
5866
|
|
5862
|
|
-#if defined(PS_ON_PIN) && PS_ON_PIN > -1
|
5863
|
|
- pinMode(PS_ON_PIN,INPUT);
|
5864
|
|
-#endif
|
|
5867
|
+ #if HAS_POWER_SWITCH
|
|
5868
|
+ pinMode(PS_ON_PIN, INPUT);
|
|
5869
|
+ #endif
|
|
5870
|
+
|
5865
|
5871
|
SERIAL_ERROR_START;
|
5866
|
5872
|
SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
|
5867
|
5873
|
LCD_ALERTMESSAGEPGM(MSG_KILLED);
|
5868
|
5874
|
|
5869
|
5875
|
// FMC small patch to update the LCD before ending
|
5870
|
5876
|
sei(); // enable interrupts
|
5871
|
|
- for ( int i=5; i--; lcd_update())
|
5872
|
|
- {
|
5873
|
|
- delay(200);
|
5874
|
|
- }
|
|
5877
|
+ for (int i = 5; i--; lcd_update()) delay(200); // Wait a short time
|
5875
|
5878
|
cli(); // disable interrupts
|
5876
|
5879
|
suicide();
|
5877
|
5880
|
while(1) { /* Intentionally left empty */ } // Wait for reset
|