Skip to content

Commit

Permalink
Introduce save_delay()
Browse files Browse the repository at this point in the history
Introduce save_delay() for long delays what otherwise would cause
watchdog resets
  • Loading branch information
AnHardt committed Jun 15, 2016
1 parent 52ac2a6 commit cec1b16
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Marlin/ultralcd_implementation_hitachi_HD44780.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,15 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
lcd.setCursor(indent, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------" )); lcd.print('\x03');
}

void safe_delay(uint16_t del){
while (del > 50) {
del -= 50;
delay(50);
thermalManager.manage_heater();
}
delay(del);
}

void bootscreen() {
byte top_left[8] = {
B00000,
Expand Down Expand Up @@ -498,7 +507,7 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
if (strlen(STRING) <= LCD_WIDTH) { \
lcd.setCursor((LCD_WIDTH - lcd_strlen_P(PSTR(STRING))) / 2, 3); \
lcd_printPGM(PSTR(STRING)); \
delay(DELAY); \
safe_delay(DELAY); \
} \
else { \
lcd_scroll(0, 3, PSTR(STRING), LCD_WIDTH, DELAY); \
Expand All @@ -516,7 +525,7 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
#ifdef STRING_SPLASH_LINE2
CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 2000);
#else
delay(2000);
safe_delay(2000);
#endif
}
else {
Expand All @@ -541,7 +550,7 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
//
if (LCD_EXTRA_SPACE >= strlen(STRING_SPLASH_LINE2) + 1) {
logo_lines(PSTR(" " STRING_SPLASH_LINE2));
delay(2000);
safe_delay(2000);
}
else {
logo_lines(PSTR(""));
Expand All @@ -552,7 +561,7 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
// Show only the Marlin logo
//
logo_lines(PSTR(""));
delay(2000);
safe_delay(2000);
#endif

}
Expand Down

0 comments on commit cec1b16

Please sign in to comment.