Browse Source

blink for char-lcds

Implement and test blinking for char-lcds

# Conflicts:
#	Marlin/ultralcd_implementation_hitachi_HD44780.h
solved
pull/1/head
AnHardt 9 years ago
parent
commit
e736779d7e
  1. 6
      Marlin/dogm_lcd_implementation.h
  2. 8
      Marlin/ultralcd.cpp
  3. 14
      Marlin/ultralcd_implementation_hitachi_HD44780.h

6
Marlin/dogm_lcd_implementation.h

@ -352,7 +352,7 @@ static void lcd_implementation_status_screen() {
u8g.drawPixel(8, XYZ_BASELINE - 5); u8g.drawPixel(8, XYZ_BASELINE - 5);
u8g.drawPixel(8, XYZ_BASELINE - 3); u8g.drawPixel(8, XYZ_BASELINE - 3);
u8g.setPrintPos(10, XYZ_BASELINE); u8g.setPrintPos(10, XYZ_BASELINE);
if (axis_known_position[X_AXIS]) if (axis_known_position[X_AXIS] || (blink & 1))
lcd_print(ftostr31ns(current_position[X_AXIS])); lcd_print(ftostr31ns(current_position[X_AXIS]));
else else
lcd_printPGM(PSTR("---")); lcd_printPGM(PSTR("---"));
@ -361,7 +361,7 @@ static void lcd_implementation_status_screen() {
u8g.drawPixel(49, XYZ_BASELINE - 5); u8g.drawPixel(49, XYZ_BASELINE - 5);
u8g.drawPixel(49, XYZ_BASELINE - 3); u8g.drawPixel(49, XYZ_BASELINE - 3);
u8g.setPrintPos(51, XYZ_BASELINE); u8g.setPrintPos(51, XYZ_BASELINE);
if (axis_known_position[Y_AXIS]) if (axis_known_position[Y_AXIS] || (blink & 1))
lcd_print(ftostr31ns(current_position[Y_AXIS])); lcd_print(ftostr31ns(current_position[Y_AXIS]));
else else
lcd_printPGM(PSTR("---")); lcd_printPGM(PSTR("---"));
@ -370,7 +370,7 @@ static void lcd_implementation_status_screen() {
u8g.drawPixel(89, XYZ_BASELINE - 5); u8g.drawPixel(89, XYZ_BASELINE - 5);
u8g.drawPixel(89, XYZ_BASELINE - 3); u8g.drawPixel(89, XYZ_BASELINE - 3);
u8g.setPrintPos(91, XYZ_BASELINE); u8g.setPrintPos(91, XYZ_BASELINE);
if (axis_known_position[Z_AXIS]) if (axis_known_position[Z_AXIS] || (blink & 1))
lcd_print(ftostr32sp(current_position[Z_AXIS])); lcd_print(ftostr32sp(current_position[Z_AXIS]));
else else
lcd_printPGM(PSTR("---.--")); lcd_printPGM(PSTR("---.--"));

8
Marlin/ultralcd.cpp

@ -1732,20 +1732,22 @@ void lcd_update() {
} }
#if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display #if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display
if (lcdDrawUpdate) { if (lcdDrawUpdate) {
blink++; // Variable for fan animation and alive dot blink++; // Variable for animation and alive dot
u8g.firstPage(); u8g.firstPage();
do { do {
lcd_setFont(FONT_MENU); lcd_setFont(FONT_MENU);
u8g.setPrintPos(125, 0); u8g.setPrintPos(125, 0);
if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot if (blink & 1) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
u8g.drawPixel(127, 63); // draw alive dot u8g.drawPixel(127, 63); // draw alive dot
u8g.setColorIndex(1); // black on white u8g.setColorIndex(1); // black on white
(*currentMenu)(); (*currentMenu)();
} while (u8g.nextPage()); } while (u8g.nextPage());
} }
#else #else
if (lcdDrawUpdate) if (lcdDrawUpdate) {
blink++; // Variable for animation
(*currentMenu)(); (*currentMenu)();
}
#endif #endif
#if ENABLED(LCD_HAS_STATUS_INDICATORS) #if ENABLED(LCD_HAS_STATUS_INDICATORS)

14
Marlin/ultralcd_implementation_hitachi_HD44780.h

@ -3,14 +3,10 @@
/** /**
* Implementation of the LCD display routines for a Hitachi HD44780 display. These are common LCD character displays. * Implementation of the LCD display routines for a Hitachi HD44780 display. These are common LCD character displays.
* When selecting the Russian language, a slightly different LCD implementation is used to handle UTF8 characters.
**/ **/
//#if DISABLED(REPRAPWORLD_KEYPAD) static unsigned char blink = 0; // Variable for animation
// extern volatile uint8_t buttons; //the last checked buttons in a bit array. extern volatile uint8_t buttons; //an extended version of the last checked buttons in a bit array.
//#else
extern volatile uint8_t buttons; //an extended version of the last checked buttons in a bit array.
//#endif
//////////////////////////////////// ////////////////////////////////////
// Setup button and encode mappings for each panel (into 'buttons' variable // Setup button and encode mappings for each panel (into 'buttons' variable
@ -621,13 +617,13 @@ static void lcd_implementation_status_screen() {
#else #else
lcd.print('X'); lcd.print('X');
if (axis_known_position[X_AXIS]) if (axis_known_position[X_AXIS] || (blink & 1))
lcd.print(ftostr4sign(current_position[X_AXIS])); lcd.print(ftostr4sign(current_position[X_AXIS]));
else else
lcd_printPGM(PSTR(" ---")); lcd_printPGM(PSTR(" ---"));
lcd_printPGM(PSTR(" Y")); lcd_printPGM(PSTR(" Y"));
if (axis_known_position[Y_AXIS]) if (axis_known_position[Y_AXIS] || (blink & 1))
lcd.print(ftostr4sign(current_position[Y_AXIS])); lcd.print(ftostr4sign(current_position[Y_AXIS]));
else else
lcd_printPGM(PSTR(" ---")); lcd_printPGM(PSTR(" ---"));
@ -638,7 +634,7 @@ static void lcd_implementation_status_screen() {
lcd.setCursor(LCD_WIDTH - 8, 1); lcd.setCursor(LCD_WIDTH - 8, 1);
lcd_printPGM(PSTR("Z ")); lcd_printPGM(PSTR("Z "));
if (axis_known_position[Z_AXIS]) if (axis_known_position[Z_AXIS] || (blink & 1))
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001)); lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
else else
lcd_printPGM(PSTR("---.--")); lcd_printPGM(PSTR("---.--"));

Loading…
Cancel
Save