Centralise definition of fonts for DOGM displays

Prework for issue #1448 and #1447

Will merge in when pull request #1457 is in.
This commit is contained in:
AnHardt 2015-02-03 13:10:09 +01:00
parent 65642592ee
commit b1dbd765c6
2 changed files with 21 additions and 10 deletions

View File

@ -51,11 +51,24 @@
#endif #endif
*/ */
#define USE_BIG_EDIT_FONT
#define FONT_STATUSMENU u8g_font_6x9
#define FONT_MENU u8g_font_6x10_marlin
// DOGM parameters (size in pixels) // DOGM parameters (size in pixels)
#define DOG_CHAR_WIDTH 6 #define DOG_CHAR_WIDTH 6
#define DOG_CHAR_HEIGHT 12 #define DOG_CHAR_HEIGHT 12
#define DOG_CHAR_WIDTH_LARGE 9 #ifdef USE_BIG_EDIT_FONT
#define DOG_CHAR_HEIGHT_LARGE 18 #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 #define START_ROW 0
@ -70,8 +83,6 @@
#define LCD_STR_BEDTEMP "\xFE" #define LCD_STR_BEDTEMP "\xFE"
#define LCD_STR_THERMOMETER "\xFF" #define LCD_STR_THERMOMETER "\xFF"
#define FONT_STATUSMENU u8g_font_6x9
int lcd_contrast; int lcd_contrast;
// LCD selection // LCD selection
@ -120,7 +131,7 @@ static void lcd_implementation_init()
u8g.firstPage(); u8g.firstPage();
do { do {
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
u8g.setFont(u8g_font_6x10_marlin); u8g.setFont(FONT_MENU);
#ifndef STRING_SPLASH_LINE2 #ifndef STRING_SPLASH_LINE2
u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1); u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
#else #else
@ -245,7 +256,7 @@ static void lcd_implementation_status_screen() {
u8g.setColorIndex(1); // black on white u8g.setColorIndex(1); // black on white
// Feedrate // Feedrate
u8g.setFont(u8g_font_6x10_marlin); u8g.setFont(FONT_MENU);
u8g.setPrintPos(3,49); u8g.setPrintPos(3,49);
u8g.print(LCD_STR_FEEDRATE[0]); u8g.print(LCD_STR_FEEDRATE[0]);
u8g.setFont(FONT_STATUSMENU); 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)) #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) { 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.setPrintPos(0 * DOG_CHAR_WIDTH_EDIT, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_EDIT) - (1 * DOG_CHAR_HEIGHT_EDIT) - START_ROW );
u8g.setFont(u8g_font_9x18); u8g.setFont(FONT_MENU_EDIT);
lcd_printPGM(pstr); lcd_printPGM(pstr);
u8g.print(':'); 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); u8g.print(value);
} }

View File

@ -1323,7 +1323,7 @@ void lcd_update()
u8g.firstPage(); u8g.firstPage();
do do
{ {
u8g.setFont(u8g_font_6x10_marlin); u8g.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 % 2) 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