Add a kill-screen

This commit is contained in:
AnHardt 2016-07-10 04:50:45 +02:00
parent c23dd7eefc
commit faac2bcfdb
6 changed files with 55 additions and 9 deletions

View file

@ -8265,13 +8265,17 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
}
void kill(const char* lcd_msg) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
#if ENABLED(ULTRA_LCD)
lcd_init();
lcd_setalertstatuspgm(lcd_msg);
kill_screen(lcd_msg);
#else
UNUSED(lcd_msg);
#endif
for (int i = 5; i--;) delay(100); // Wait a short time
cli(); // Stop interrupts
thermalManager.disable_all_heaters();
disable_all_steppers();
@ -8280,13 +8284,6 @@ void kill(const char* lcd_msg) {
pinMode(PS_ON_PIN, INPUT);
#endif
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
// FMC small patch to update the LCD before ending
sei(); // enable interrupts
for (int i = 5; i--; lcd_update()) delay(200); // Wait a short time
cli(); // disable interrupts
suicide();
while (1) {
#if ENABLED(USE_WATCHDOG)

View file

@ -290,6 +290,16 @@ static void lcd_implementation_init() {
#endif
}
void lcd_kill_screen() {
lcd_setFont(FONT_MENU);
u8g.setPrintPos(0, u8g.getHeight()/4*1);
lcd_print(lcd_status_message);
u8g.setPrintPos(0, u8g.getHeight()/4*2);
lcd_printPGM(PSTR(MSG_HALTED));
u8g.setPrintPos(0, u8g.getHeight()/4*3);
lcd_printPGM(PSTR(MSG_PLEASE_RESET));
}
static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) {

View file

@ -487,6 +487,12 @@
#ifndef MSG_ERR_MINTEMP_BED
#define MSG_ERR_MINTEMP_BED "Err: MINTEMP BED"
#endif
#ifndef MSG_HALTED
#define MSG_HALTED "PRINTER HALTED"
#endif
#ifndef MSG_PLEASE_RESET
#define MSG_PLEASE_RESET "Please reset"
#endif
#ifndef MSG_END_HOUR
#define MSG_END_HOUR "hours"
#endif

View file

@ -530,6 +530,24 @@ static void lcd_status_screen() {
#endif //ULTIPANEL
}
/**
*
* draw the kill screen
*
*/
void kill_screen(const char* lcd_msg) {
lcd_init();
lcd_setalertstatuspgm(lcd_msg);
#if ENABLED(DOGLCD)
u8g.firstPage();
do {
lcd_kill_screen();
} while (u8g.nextPage());
#else
lcd_kill_screen();
#endif
}
#if ENABLED(ULTIPANEL)
inline void line_to_current(AxisEnum axis) {

View file

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

View file

@ -572,6 +572,19 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
#endif // SHOW_BOOTSCREEN
void lcd_kill_screen() {
lcd.setCursor(0, 0);
lcd_print(lcd_status_message);
#if LCD_HEIGHT < 4
lcd.setCursor(0, 2);
#else
lcd.setCursor(0, 2);
lcd_printPGM(PSTR(MSG_HALTED));
lcd.setCursor(0, 3);
#endif
lcd_printPGM(PSTR(MSG_PLEASE_RESET));
}
FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
if (blink)
lcd_printPGM(pstr);