Merge pull request #4254 from AnHardt/killscreen

Add a kill-screen
This commit is contained in:
Scott Lahteine 2016-07-09 20:44:42 -07:00 committed by GitHub
commit f9e08b1fcd
6 changed files with 55 additions and 9 deletions

View file

@ -8199,13 +8199,17 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
} }
void kill(const char* lcd_msg) { void kill(const char* lcd_msg) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
lcd_init(); kill_screen(lcd_msg);
lcd_setalertstatuspgm(lcd_msg);
#else #else
UNUSED(lcd_msg); UNUSED(lcd_msg);
#endif #endif
for (int i = 5; i--;) delay(100); // Wait a short time
cli(); // Stop interrupts cli(); // Stop interrupts
thermalManager.disable_all_heaters(); thermalManager.disable_all_heaters();
disable_all_steppers(); disable_all_steppers();
@ -8214,13 +8218,6 @@ void kill(const char* lcd_msg) {
pinMode(PS_ON_PIN, INPUT); pinMode(PS_ON_PIN, INPUT);
#endif #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(); suicide();
while (1) { while (1) {
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)

View file

@ -290,6 +290,16 @@ static void lcd_implementation_init() {
#endif #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 static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) { FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) {

View file

@ -487,6 +487,12 @@
#ifndef MSG_ERR_MINTEMP_BED #ifndef MSG_ERR_MINTEMP_BED
#define MSG_ERR_MINTEMP_BED "Err: MINTEMP BED" #define MSG_ERR_MINTEMP_BED "Err: MINTEMP BED"
#endif #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 #ifndef MSG_END_HOUR
#define MSG_END_HOUR "hours" #define MSG_END_HOUR "hours"
#endif #endif

View file

@ -530,6 +530,24 @@ static void lcd_status_screen() {
#endif //ULTIPANEL #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) #if ENABLED(ULTIPANEL)
inline void line_to_current(AxisEnum axis) { inline void line_to_current(AxisEnum axis) {

View file

@ -40,6 +40,8 @@
void lcd_setalertstatuspgm(const char* message); void lcd_setalertstatuspgm(const char* message);
void lcd_reset_alert_level(); void lcd_reset_alert_level();
bool lcd_detected(void); bool lcd_detected(void);
void lcd_kill_screen();
void kill_screen(const char* lcd_msg);
#if ENABLED(LCD_USE_I2C_BUZZER) #if ENABLED(LCD_USE_I2C_BUZZER)
void lcd_buzz(long duration, uint16_t freq); 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 #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) { FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
if (blink) if (blink)
lcd_printPGM(pstr); lcd_printPGM(pstr);