Browse Source

Merge pull request #4254 from AnHardt/killscreen

Add a kill-screen
Scott Lahteine 8 years ago
parent
commit
f9e08b1fcd

+ 6
- 9
Marlin/Marlin_main.cpp View File

@@ -8199,13 +8199,17 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
8199 8199
 }
8200 8200
 
8201 8201
 void kill(const char* lcd_msg) {
8202
+  SERIAL_ERROR_START;
8203
+  SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
8204
+
8202 8205
   #if ENABLED(ULTRA_LCD)
8203
-    lcd_init();
8204
-    lcd_setalertstatuspgm(lcd_msg);
8206
+    kill_screen(lcd_msg);
8205 8207
   #else
8206 8208
     UNUSED(lcd_msg);
8207 8209
   #endif
8208 8210
 
8211
+  for (int i = 5; i--;) delay(100); // Wait a short time
8212
+
8209 8213
   cli(); // Stop interrupts
8210 8214
   thermalManager.disable_all_heaters();
8211 8215
   disable_all_steppers();
@@ -8214,13 +8218,6 @@ void kill(const char* lcd_msg) {
8214 8218
     pinMode(PS_ON_PIN, INPUT);
8215 8219
   #endif
8216 8220
 
8217
-  SERIAL_ERROR_START;
8218
-  SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
8219
-
8220
-  // FMC small patch to update the LCD before ending
8221
-  sei();   // enable interrupts
8222
-  for (int i = 5; i--; lcd_update()) delay(200); // Wait a short time
8223
-  cli();   // disable interrupts
8224 8221
   suicide();
8225 8222
   while (1) {
8226 8223
     #if ENABLED(USE_WATCHDOG)

+ 10
- 0
Marlin/dogm_lcd_implementation.h View File

@@ -290,6 +290,16 @@ static void lcd_implementation_init() {
290 290
   #endif
291 291
 }
292 292
 
293
+void lcd_kill_screen() {
294
+  lcd_setFont(FONT_MENU);
295
+  u8g.setPrintPos(0, u8g.getHeight()/4*1);
296
+  lcd_print(lcd_status_message);
297
+  u8g.setPrintPos(0, u8g.getHeight()/4*2);
298
+  lcd_printPGM(PSTR(MSG_HALTED));
299
+  u8g.setPrintPos(0, u8g.getHeight()/4*3);
300
+  lcd_printPGM(PSTR(MSG_PLEASE_RESET));
301
+}
302
+
293 303
 static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
294 304
 
295 305
 FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) {

+ 6
- 0
Marlin/language_en.h View File

@@ -487,6 +487,12 @@
487 487
 #ifndef MSG_ERR_MINTEMP_BED
488 488
   #define MSG_ERR_MINTEMP_BED                 "Err: MINTEMP BED"
489 489
 #endif
490
+#ifndef MSG_HALTED
491
+  #define MSG_HALTED                          "PRINTER HALTED"
492
+#endif
493
+#ifndef MSG_PLEASE_RESET
494
+  #define MSG_PLEASE_RESET                    "Please reset"
495
+#endif
490 496
 #ifndef MSG_END_HOUR
491 497
   #define MSG_END_HOUR                        "hours"
492 498
 #endif

+ 18
- 0
Marlin/ultralcd.cpp View File

@@ -530,6 +530,24 @@ static void lcd_status_screen() {
530 530
   #endif //ULTIPANEL
531 531
 }
532 532
 
533
+/**
534
+ *
535
+ * draw the kill screen
536
+ *
537
+ */
538
+void kill_screen(const char* lcd_msg) {
539
+  lcd_init();
540
+  lcd_setalertstatuspgm(lcd_msg);
541
+  #if ENABLED(DOGLCD)
542
+    u8g.firstPage();
543
+    do {
544
+      lcd_kill_screen();
545
+    } while (u8g.nextPage());
546
+  #else
547
+    lcd_kill_screen();
548
+  #endif
549
+}
550
+
533 551
 #if ENABLED(ULTIPANEL)
534 552
 
535 553
   inline void line_to_current(AxisEnum axis) {

+ 2
- 0
Marlin/ultralcd.h View File

@@ -40,6 +40,8 @@
40 40
   void lcd_setalertstatuspgm(const char* message);
41 41
   void lcd_reset_alert_level();
42 42
   bool lcd_detected(void);
43
+  void lcd_kill_screen();
44
+  void kill_screen(const char* lcd_msg);
43 45
 
44 46
   #if ENABLED(LCD_USE_I2C_BUZZER)
45 47
     void lcd_buzz(long duration, uint16_t freq);

+ 13
- 0
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -572,6 +572,19 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
572 572
 
573 573
 #endif // SHOW_BOOTSCREEN
574 574
 
575
+void lcd_kill_screen() {
576
+  lcd.setCursor(0, 0);
577
+  lcd_print(lcd_status_message);
578
+  #if LCD_HEIGHT < 4
579
+    lcd.setCursor(0, 2);
580
+  #else
581
+    lcd.setCursor(0, 2);
582
+    lcd_printPGM(PSTR(MSG_HALTED));
583
+    lcd.setCursor(0, 3);
584
+  #endif
585
+  lcd_printPGM(PSTR(MSG_PLEASE_RESET));
586
+}
587
+
575 588
 FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
576 589
   if (blink)
577 590
     lcd_printPGM(pstr);

Loading…
Cancel
Save