Keep blinking limited to LCD_UPDATE_INTERVAL
This commit is contained in:
parent
e0ab06cfae
commit
b60ea95adf
|
@ -304,9 +304,11 @@ static void _draw_heater_status(int x, int heater) {
|
||||||
static void lcd_implementation_status_screen() {
|
static void lcd_implementation_status_screen() {
|
||||||
u8g.setColorIndex(1); // black on white
|
u8g.setColorIndex(1); // black on white
|
||||||
|
|
||||||
|
bool blink = lcd_blink();
|
||||||
|
|
||||||
#if HAS_FAN0
|
#if HAS_FAN0
|
||||||
// Symbols menu graphics, animated fan
|
// 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
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
|
@ -375,18 +377,19 @@ static void lcd_implementation_status_screen() {
|
||||||
#endif
|
#endif
|
||||||
u8g.setColorIndex(0); // white on black
|
u8g.setColorIndex(0); // white on black
|
||||||
u8g.setPrintPos(2, XYZ_BASELINE);
|
u8g.setPrintPos(2, XYZ_BASELINE);
|
||||||
if (blink & 1)
|
if (blink)
|
||||||
lcd_printPGM(PSTR("X"));
|
lcd_printPGM(PSTR("X"));
|
||||||
else {
|
else {
|
||||||
if (!axis_homed[X_AXIS])
|
if (!axis_homed[X_AXIS])
|
||||||
lcd_printPGM(PSTR("?"));
|
lcd_printPGM(PSTR("?"));
|
||||||
else
|
else {
|
||||||
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
|
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
|
||||||
if (!axis_known_position[X_AXIS])
|
if (!axis_known_position[X_AXIS])
|
||||||
lcd_printPGM(PSTR(" "));
|
lcd_printPGM(PSTR(" "));
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
lcd_printPGM(PSTR("X"));
|
lcd_printPGM(PSTR("X"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
u8g.drawPixel(8, XYZ_BASELINE - 5);
|
u8g.drawPixel(8, XYZ_BASELINE - 5);
|
||||||
u8g.drawPixel(8, XYZ_BASELINE - 3);
|
u8g.drawPixel(8, XYZ_BASELINE - 3);
|
||||||
|
@ -394,18 +397,19 @@ static void lcd_implementation_status_screen() {
|
||||||
lcd_print(ftostr31ns(current_position[X_AXIS]));
|
lcd_print(ftostr31ns(current_position[X_AXIS]));
|
||||||
|
|
||||||
u8g.setPrintPos(43, XYZ_BASELINE);
|
u8g.setPrintPos(43, XYZ_BASELINE);
|
||||||
if (blink & 1)
|
if (blink)
|
||||||
lcd_printPGM(PSTR("Y"));
|
lcd_printPGM(PSTR("Y"));
|
||||||
else {
|
else {
|
||||||
if (!axis_homed[Y_AXIS])
|
if (!axis_homed[Y_AXIS])
|
||||||
lcd_printPGM(PSTR("?"));
|
lcd_printPGM(PSTR("?"));
|
||||||
else
|
else {
|
||||||
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
|
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
|
||||||
if (!axis_known_position[Y_AXIS])
|
if (!axis_known_position[Y_AXIS])
|
||||||
lcd_printPGM(PSTR(" "));
|
lcd_printPGM(PSTR(" "));
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
lcd_printPGM(PSTR("Y"));
|
lcd_printPGM(PSTR("Y"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
u8g.drawPixel(49, XYZ_BASELINE - 5);
|
u8g.drawPixel(49, XYZ_BASELINE - 5);
|
||||||
u8g.drawPixel(49, XYZ_BASELINE - 3);
|
u8g.drawPixel(49, XYZ_BASELINE - 3);
|
||||||
|
@ -413,18 +417,19 @@ static void lcd_implementation_status_screen() {
|
||||||
lcd_print(ftostr31ns(current_position[Y_AXIS]));
|
lcd_print(ftostr31ns(current_position[Y_AXIS]));
|
||||||
|
|
||||||
u8g.setPrintPos(83, XYZ_BASELINE);
|
u8g.setPrintPos(83, XYZ_BASELINE);
|
||||||
if (blink & 1)
|
if (blink)
|
||||||
lcd_printPGM(PSTR("Z"));
|
lcd_printPGM(PSTR("Z"));
|
||||||
else {
|
else {
|
||||||
if (!axis_homed[Z_AXIS])
|
if (!axis_homed[Z_AXIS])
|
||||||
lcd_printPGM(PSTR("?"));
|
lcd_printPGM(PSTR("?"));
|
||||||
else
|
else {
|
||||||
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
|
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
|
||||||
if (!axis_known_position[Z_AXIS])
|
if (!axis_known_position[Z_AXIS])
|
||||||
lcd_printPGM(PSTR(" "));
|
lcd_printPGM(PSTR(" "));
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
lcd_printPGM(PSTR("Z"));
|
lcd_printPGM(PSTR("Z"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
u8g.drawPixel(89, XYZ_BASELINE - 5);
|
u8g.drawPixel(89, XYZ_BASELINE - 5);
|
||||||
u8g.drawPixel(89, XYZ_BASELINE - 3);
|
u8g.drawPixel(89, XYZ_BASELINE - 3);
|
||||||
|
|
|
@ -48,8 +48,6 @@
|
||||||
#define ENCODER_DIRECTION_MENUS() ;
|
#define ENCODER_DIRECTION_MENUS() ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t blink = 0; // Variable for animation
|
|
||||||
|
|
||||||
int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update
|
int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update
|
||||||
|
|
||||||
bool encoderRateMultiplierEnabled;
|
bool encoderRateMultiplierEnabled;
|
||||||
|
@ -1807,6 +1805,16 @@ int lcd_strlen_P(const char* s) {
|
||||||
return j;
|
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.
|
* Update the LCD, read encoder buttons, etc.
|
||||||
* - Read button states
|
* - Read button states
|
||||||
|
@ -1923,25 +1931,23 @@ void lcd_update() {
|
||||||
lcd_status_update_delay--;
|
lcd_status_update_delay--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display
|
|
||||||
if (lcdDrawUpdate) {
|
if (lcdDrawUpdate) {
|
||||||
blink++; // Variable for animation and alive dot
|
#if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display
|
||||||
u8g.firstPage();
|
bool blink = lcd_blink();
|
||||||
do {
|
u8g.firstPage();
|
||||||
lcd_setFont(FONT_MENU);
|
do {
|
||||||
u8g.setPrintPos(125, 0);
|
lcd_setFont(FONT_MENU);
|
||||||
if (blink & 1) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
|
u8g.setPrintPos(125, 0);
|
||||||
u8g.drawPixel(127, 63); // draw alive dot
|
u8g.setColorIndex(blink ? 1 : 0); // Set color for the alive dot
|
||||||
u8g.setColorIndex(1); // black on white
|
u8g.drawPixel(127, 63); // draw alive dot
|
||||||
(*currentMenu)();
|
u8g.setColorIndex(1); // black on white
|
||||||
} while (u8g.nextPage());
|
(*currentMenu)();
|
||||||
}
|
} while (u8g.nextPage());
|
||||||
#else
|
#else
|
||||||
if (lcdDrawUpdate) {
|
|
||||||
blink++; // Variable for animation
|
|
||||||
(*currentMenu)();
|
(*currentMenu)();
|
||||||
}
|
#endif
|
||||||
#endif
|
}
|
||||||
|
|
||||||
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
|
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
|
||||||
lcd_implementation_update_indicators();
|
lcd_implementation_update_indicators();
|
||||||
|
@ -1963,8 +1969,7 @@ void lcd_update() {
|
||||||
|
|
||||||
#endif // ULTIPANEL
|
#endif // ULTIPANEL
|
||||||
|
|
||||||
if (lcdDrawUpdate == 2) lcd_implementation_clear();
|
if (lcdDrawUpdate && --lcdDrawUpdate) lcd_implementation_clear();
|
||||||
if (lcdDrawUpdate) lcdDrawUpdate--;
|
|
||||||
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
|
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,15 +76,13 @@
|
||||||
|
|
||||||
extern bool cancel_heatup;
|
extern bool cancel_heatup;
|
||||||
|
|
||||||
extern uint8_t blink; // Variable for animation
|
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
||||||
extern millis_t previous_lcd_status_ms;
|
extern millis_t previous_lcd_status_ms;
|
||||||
#endif
|
#endif
|
||||||
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
|
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
|
||||||
bool lcd_clicked();
|
bool lcd_clicked();
|
||||||
|
|
||||||
void lcd_ignore_click(bool b=true);
|
void lcd_ignore_click(bool b=true);
|
||||||
|
bool lcd_blink();
|
||||||
|
|
||||||
#if ENABLED(NEWPANEL)
|
#if ENABLED(NEWPANEL)
|
||||||
#define EN_C (_BV(BLEN_C))
|
#define EN_C (_BV(BLEN_C))
|
||||||
|
|
|
@ -626,6 +626,8 @@ static void lcd_implementation_status_screen() {
|
||||||
|
|
||||||
#if LCD_HEIGHT > 2
|
#if LCD_HEIGHT > 2
|
||||||
|
|
||||||
|
bool blink = lcd_blink();
|
||||||
|
|
||||||
#if LCD_WIDTH < 20
|
#if LCD_WIDTH < 20
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#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 axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
|
||||||
// When everything is ok you see a constant 'X'.
|
// When everything is ok you see a constant 'X'.
|
||||||
|
|
||||||
if (blink & 1)
|
if (blink)
|
||||||
lcd_printPGM(PSTR("X"));
|
lcd_printPGM(PSTR("X"));
|
||||||
else {
|
else {
|
||||||
if (!axis_homed[X_AXIS])
|
if (!axis_homed[X_AXIS])
|
||||||
|
@ -671,7 +673,7 @@ static void lcd_implementation_status_screen() {
|
||||||
lcd.print(ftostr4sign(current_position[X_AXIS]));
|
lcd.print(ftostr4sign(current_position[X_AXIS]));
|
||||||
|
|
||||||
lcd_printPGM(PSTR(" "));
|
lcd_printPGM(PSTR(" "));
|
||||||
if (blink & 1)
|
if (blink)
|
||||||
lcd_printPGM(PSTR("Y"));
|
lcd_printPGM(PSTR("Y"));
|
||||||
else {
|
else {
|
||||||
if (!axis_homed[Y_AXIS])
|
if (!axis_homed[Y_AXIS])
|
||||||
|
@ -691,7 +693,7 @@ static void lcd_implementation_status_screen() {
|
||||||
#endif // LCD_WIDTH >= 20
|
#endif // LCD_WIDTH >= 20
|
||||||
|
|
||||||
lcd.setCursor(LCD_WIDTH - 8, 1);
|
lcd.setCursor(LCD_WIDTH - 8, 1);
|
||||||
if (blink & 1)
|
if (blink)
|
||||||
lcd_printPGM(PSTR("Z"));
|
lcd_printPGM(PSTR("Z"));
|
||||||
else {
|
else {
|
||||||
if (!axis_homed[Z_AXIS])
|
if (!axis_homed[Z_AXIS])
|
||||||
|
|
Loading…
Reference in a new issue