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
 }
8199
 }
8200
 
8200
 
8201
 void kill(const char* lcd_msg) {
8201
 void kill(const char* lcd_msg) {
8202
+  SERIAL_ERROR_START;
8203
+  SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
8204
+
8202
   #if ENABLED(ULTRA_LCD)
8205
   #if ENABLED(ULTRA_LCD)
8203
-    lcd_init();
8204
-    lcd_setalertstatuspgm(lcd_msg);
8206
+    kill_screen(lcd_msg);
8205
   #else
8207
   #else
8206
     UNUSED(lcd_msg);
8208
     UNUSED(lcd_msg);
8207
   #endif
8209
   #endif
8208
 
8210
 
8211
+  for (int i = 5; i--;) delay(100); // Wait a short time
8212
+
8209
   cli(); // Stop interrupts
8213
   cli(); // Stop interrupts
8210
   thermalManager.disable_all_heaters();
8214
   thermalManager.disable_all_heaters();
8211
   disable_all_steppers();
8215
   disable_all_steppers();
8214
     pinMode(PS_ON_PIN, INPUT);
8218
     pinMode(PS_ON_PIN, INPUT);
8215
   #endif
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
   suicide();
8221
   suicide();
8225
   while (1) {
8222
   while (1) {
8226
     #if ENABLED(USE_WATCHDOG)
8223
     #if ENABLED(USE_WATCHDOG)

+ 10
- 0
Marlin/dogm_lcd_implementation.h View File

290
   #endif
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
 static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
303
 static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
294
 
304
 
295
 FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) {
305
 FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) {

+ 6
- 0
Marlin/language_en.h View File

487
 #ifndef MSG_ERR_MINTEMP_BED
487
 #ifndef MSG_ERR_MINTEMP_BED
488
   #define MSG_ERR_MINTEMP_BED                 "Err: MINTEMP BED"
488
   #define MSG_ERR_MINTEMP_BED                 "Err: MINTEMP BED"
489
 #endif
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
 #ifndef MSG_END_HOUR
496
 #ifndef MSG_END_HOUR
491
   #define MSG_END_HOUR                        "hours"
497
   #define MSG_END_HOUR                        "hours"
492
 #endif
498
 #endif

+ 18
- 0
Marlin/ultralcd.cpp View File

530
   #endif //ULTIPANEL
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
 #if ENABLED(ULTIPANEL)
551
 #if ENABLED(ULTIPANEL)
534
 
552
 
535
   inline void line_to_current(AxisEnum axis) {
553
   inline void line_to_current(AxisEnum axis) {

+ 2
- 0
Marlin/ultralcd.h View File

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

+ 13
- 0
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

572
 
572
 
573
 #endif // SHOW_BOOTSCREEN
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
 FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
588
 FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
576
   if (blink)
589
   if (blink)
577
     lcd_printPGM(pstr);
590
     lcd_printPGM(pstr);

Loading…
Cancel
Save