Browse Source

Centralise definition of fonts for DOGM displays

Prework for issue #1448 and #1447

Will merge in when pull request #1457 is in.
pull/1/head
AnHardt 10 years ago
parent
commit
b1dbd765c6
  1. 29
      Marlin/dogm_lcd_implementation.h
  2. 2
      Marlin/ultralcd.cpp

29
Marlin/dogm_lcd_implementation.h

@ -51,11 +51,24 @@
#endif
*/
#define USE_BIG_EDIT_FONT
#define FONT_STATUSMENU u8g_font_6x9
#define FONT_MENU u8g_font_6x10_marlin
// DOGM parameters (size in pixels)
#define DOG_CHAR_WIDTH 6
#define DOG_CHAR_HEIGHT 12
#define DOG_CHAR_WIDTH_LARGE 9
#define DOG_CHAR_HEIGHT_LARGE 18
#ifdef USE_BIG_EDIT_FONT
#define FONT_MENU_EDIT u8g_font_9x18
#define DOG_CHAR_WIDTH_EDIT 9
#define DOG_CHAR_HEIGHT_EDIT 18
#define LCD_WIDTH_EDIT 14
#else
#define FONT_MENU_EDIT u8g_font_6x10_marlin
#define DOG_CHAR_WIDTH_EDIT 6
#define DOG_CHAR_HEIGHT_EDIT 12
#define LCD_WIDTH_EDIT 22
#endif
#define START_ROW 0
@ -70,8 +83,6 @@
#define LCD_STR_BEDTEMP "\xFE"
#define LCD_STR_THERMOMETER "\xFF"
#define FONT_STATUSMENU u8g_font_6x9
int lcd_contrast;
// LCD selection
@ -120,7 +131,7 @@ static void lcd_implementation_init()
u8g.firstPage();
do {
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
u8g.setFont(u8g_font_6x10_marlin);
u8g.setFont(FONT_MENU);
#ifndef STRING_SPLASH_LINE2
u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
#else
@ -245,7 +256,7 @@ static void lcd_implementation_status_screen() {
u8g.setColorIndex(1); // black on white
// Feedrate
u8g.setFont(u8g_font_6x10_marlin);
u8g.setFont(FONT_MENU);
u8g.setPrintPos(3,49);
u8g.print(LCD_STR_FEEDRATE[0]);
u8g.setFont(FONT_STATUSMENU);
@ -364,11 +375,11 @@ static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char p
#define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
void lcd_implementation_drawedit(const char* pstr, char* value) {
u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
u8g.setFont(u8g_font_9x18);
u8g.setPrintPos(0 * DOG_CHAR_WIDTH_EDIT, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_EDIT) - (1 * DOG_CHAR_HEIGHT_EDIT) - START_ROW );
u8g.setFont(FONT_MENU_EDIT);
lcd_printPGM(pstr);
u8g.print(':');
u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_EDIT, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_EDIT) - (1 * DOG_CHAR_HEIGHT_EDIT) - START_ROW );
u8g.print(value);
}

2
Marlin/ultralcd.cpp

@ -1323,7 +1323,7 @@ void lcd_update()
u8g.firstPage();
do
{
u8g.setFont(u8g_font_6x10_marlin);
u8g.setFont(FONT_MENU);
u8g.setPrintPos(125,0);
if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
u8g.drawPixel(127,63); // draw alive dot

Loading…
Cancel
Save