Keep blinking limited to LCD_UPDATE_INTERVAL

2.0.x
Scott Lahteine 9 years ago
parent e0ab06cfae
commit b60ea95adf

@ -304,9 +304,11 @@ static void _draw_heater_status(int x, int heater) {
static void lcd_implementation_status_screen() {
u8g.setColorIndex(1); // black on white
bool blink = lcd_blink();
#if HAS_FAN0
// Symbols menu graphics, animated fan
u8g.drawBitmapP(9, 1, STATUS_SCREENBYTEWIDTH, STATUS_SCREENHEIGHT, (blink % 2) && fanSpeeds[0] ? status_screen0_bmp : status_screen1_bmp);
u8g.drawBitmapP(9, 1, STATUS_SCREENBYTEWIDTH, STATUS_SCREENHEIGHT, blink && fanSpeeds[0] ? status_screen0_bmp : status_screen1_bmp);
#endif
#if ENABLED(SDSUPPORT)
@ -375,12 +377,12 @@ static void lcd_implementation_status_screen() {
#endif
u8g.setColorIndex(0); // white on black
u8g.setPrintPos(2, XYZ_BASELINE);
if (blink & 1)
if (blink)
lcd_printPGM(PSTR("X"));
else {
if (!axis_homed[X_AXIS])
lcd_printPGM(PSTR("?"));
else
else {
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
if (!axis_known_position[X_AXIS])
lcd_printPGM(PSTR(" "));
@ -388,18 +390,19 @@ static void lcd_implementation_status_screen() {
#endif
lcd_printPGM(PSTR("X"));
}
}
u8g.drawPixel(8, XYZ_BASELINE - 5);
u8g.drawPixel(8, XYZ_BASELINE - 3);
u8g.setPrintPos(10, XYZ_BASELINE);
lcd_print(ftostr31ns(current_position[X_AXIS]));
u8g.setPrintPos(43, XYZ_BASELINE);
if (blink & 1)
if (blink)
lcd_printPGM(PSTR("Y"));
else {
if (!axis_homed[Y_AXIS])
lcd_printPGM(PSTR("?"));
else
else {
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
if (!axis_known_position[Y_AXIS])
lcd_printPGM(PSTR(" "));
@ -407,18 +410,19 @@ static void lcd_implementation_status_screen() {
#endif
lcd_printPGM(PSTR("Y"));
}
}
u8g.drawPixel(49, XYZ_BASELINE - 5);
u8g.drawPixel(49, XYZ_BASELINE - 3);
u8g.setPrintPos(51, XYZ_BASELINE);
lcd_print(ftostr31ns(current_position[Y_AXIS]));
u8g.setPrintPos(83, XYZ_BASELINE);
if (blink & 1)
if (blink)
lcd_printPGM(PSTR("Z"));
else {
if (!axis_homed[Z_AXIS])
lcd_printPGM(PSTR("?"));
else
else {
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
if (!axis_known_position[Z_AXIS])
lcd_printPGM(PSTR(" "));
@ -426,6 +430,7 @@ static void lcd_implementation_status_screen() {
#endif
lcd_printPGM(PSTR("Z"));
}
}
u8g.drawPixel(89, XYZ_BASELINE - 5);
u8g.drawPixel(89, XYZ_BASELINE - 3);
u8g.setPrintPos(91, XYZ_BASELINE);

@ -48,8 +48,6 @@
#define ENCODER_DIRECTION_MENUS() ;
#endif
uint8_t blink = 0; // Variable for animation
int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update
bool encoderRateMultiplierEnabled;
@ -1807,6 +1805,16 @@ int lcd_strlen_P(const char* s) {
return j;
}
bool lcd_blink() {
static uint8_t blink = 0;
static millis_t next_blink_ms = 0;
if (millis() >= next_blink_ms) {
blink ^= 0xFF;
next_blink_ms = millis() + LCD_UPDATE_INTERVAL - 50;
}
return blink != 0;
}
/**
* Update the LCD, read encoder buttons, etc.
* - Read button states
@ -1923,25 +1931,23 @@ void lcd_update() {
lcd_status_update_delay--;
}
}
#if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display
if (lcdDrawUpdate) {
blink++; // Variable for animation and alive dot
#if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display
bool blink = lcd_blink();
u8g.firstPage();
do {
lcd_setFont(FONT_MENU);
u8g.setPrintPos(125, 0);
if (blink & 1) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
u8g.setColorIndex(blink ? 1 : 0); // Set color for the alive dot
u8g.drawPixel(127, 63); // draw alive dot
u8g.setColorIndex(1); // black on white
(*currentMenu)();
} while (u8g.nextPage());
}
#else
if (lcdDrawUpdate) {
blink++; // Variable for animation
(*currentMenu)();
}
#endif
}
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
lcd_implementation_update_indicators();
@ -1963,8 +1969,7 @@ void lcd_update() {
#endif // ULTIPANEL
if (lcdDrawUpdate == 2) lcd_implementation_clear();
if (lcdDrawUpdate) lcdDrawUpdate--;
if (lcdDrawUpdate && --lcdDrawUpdate) lcd_implementation_clear();
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
}
}

@ -76,15 +76,13 @@
extern bool cancel_heatup;
extern uint8_t blink; // Variable for animation
#if ENABLED(FILAMENT_LCD_DISPLAY)
extern millis_t previous_lcd_status_ms;
#endif
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
bool lcd_clicked();
void lcd_ignore_click(bool b=true);
bool lcd_blink();
#if ENABLED(NEWPANEL)
#define EN_C (_BV(BLEN_C))

@ -626,6 +626,8 @@ static void lcd_implementation_status_screen() {
#if LCD_HEIGHT > 2
bool blink = lcd_blink();
#if LCD_WIDTH < 20
#if ENABLED(SDSUPPORT)
@ -654,7 +656,7 @@ static void lcd_implementation_status_screen() {
// When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
// When everything is ok you see a constant 'X'.
if (blink & 1)
if (blink)
lcd_printPGM(PSTR("X"));
else {
if (!axis_homed[X_AXIS])
@ -671,7 +673,7 @@ static void lcd_implementation_status_screen() {
lcd.print(ftostr4sign(current_position[X_AXIS]));
lcd_printPGM(PSTR(" "));
if (blink & 1)
if (blink)
lcd_printPGM(PSTR("Y"));
else {
if (!axis_homed[Y_AXIS])
@ -691,7 +693,7 @@ static void lcd_implementation_status_screen() {
#endif // LCD_WIDTH >= 20
lcd.setCursor(LCD_WIDTH - 8, 1);
if (blink & 1)
if (blink)
lcd_printPGM(PSTR("Z"));
else {
if (!axis_homed[Z_AXIS])

Loading…
Cancel
Save