From 2bc2485313cbb8908519ec7f4566363c62771dce Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Apr 2016 14:13:23 -0700 Subject: [PATCH 1/8] Update font remarks in Conditionals.h --- Marlin/Conditionals.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index e3a2d7555..c84036fe1 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -218,7 +218,7 @@ #endif #if ENABLED(DOGLCD) - /* Custom characters defined in font font_6x10_marlin_symbols */ + /* Custom characters defined in font dogm_font_data_Marlin_symbols.h / Marlin_symbols.fon */ // \x00 intentionally skipped to avoid problems in strings #define LCD_STR_REFRESH "\x01" #define LCD_STR_FOLDER "\x02" @@ -235,7 +235,7 @@ // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here. #else /* Custom characters defined in the first 8 characters of the LCD */ - #define LCD_STR_BEDTEMP "\x00" // this will have 'unexpected' results when used in a string! + #define LCD_STR_BEDTEMP "\x00" // Print only as a char. This will have 'unexpected' results when used in a string! #define LCD_STR_DEGREE "\x01" #define LCD_STR_THERMOMETER "\x02" #define LCD_STR_UPLEVEL "\x03" From 3613c550fa9a48934515b6a71e2e96fecc3c6d7e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Apr 2016 14:35:26 -0700 Subject: [PATCH 2/8] Rename README file for fonts --- Marlin/fonts/README.fonts | 23 ----------------------- Marlin/fonts/README.md | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 23 deletions(-) delete mode 100644 Marlin/fonts/README.fonts create mode 100644 Marlin/fonts/README.md diff --git a/Marlin/fonts/README.fonts b/Marlin/fonts/README.fonts deleted file mode 100644 index 7ae6e4242..000000000 --- a/Marlin/fonts/README.fonts +++ /dev/null @@ -1,23 +0,0 @@ -The fonts are created with Fony.exe (http://hukka.ncn.fi/?fony) because Fontforge didn't do what I want (probably lack of experience). -In Fony export the fonts to bdf-format. Maybe another one can edit them with Fontforge. -Then run make_fonts.bat what calls bdf2u8g.exe with the needed parameters to produce the .h files. -The .h files must be edited to replace '#include "u8g.h"' with '#include ', replace 'U8G_FONT_SECTION' with 'U8G_SECTION', insert '.progmem.' right behind the first '"' and moved to the main directory. - -How to integrate a new font: -Currently we are limited to 256 symbols per font. We use a menu system with 5 lines, on a display with 64 pixel height. That means we have 12 pixel for a line. To have some space in between the lines we can't use more than 10 pixel height for the symbols. For up to 11 pixel set TALL_FONT_CORRECTION 1 when loading the font. -To fit 22 Symbols on the 128 pixel wide screen, the symbols can't be wider than 5 pixel, for the first 128 symbols. -For the second half of the font we now support up to 11x11 pixel. - - * Get 'Fony.exe' - * Copy one of the existing *.fon files and work with this. - * Change the pixels. Don't change width or height. - * Export as *.bdf - * Use 'bdf2u8g.exe' to produce the *.h file. Examples for the existing fonts are in 'make_fonts.bat' - * Edit the produced .h file to match our needs. See hints in 'README.fonts' or the other 'dogm_font_data_.h' files. - * Make a new entry in the font list in 'dogm_lcd_implementation.h' before the '#else // fall back' - #elif ENABLED(DISPLAY_CHARSET_NEWNAME) - #include "dogm_font_data_yourfont.h" - #define FONT_MENU_NAME YOURFONTNAME - #else // fall-back - * Add your font to the list of permitted fonts in 'language_en.h' - ... || ENABLED(DISPLAY_CHARSET_YOUR_NEW_FONT) ... ) diff --git a/Marlin/fonts/README.md b/Marlin/fonts/README.md new file mode 100644 index 000000000..86e54929b --- /dev/null +++ b/Marlin/fonts/README.md @@ -0,0 +1,30 @@ +The fonts are created with Fony.exe (http://hukka.ncn.fi/?fony) because Fontforge didn't do what I want (probably lack of experience). + +In Fony export the fonts to bdf-format. (Maybe another one can edit them with Fontforge.) Then run `make_fonts.bat` which calls `bdf2u8g.exe` with the parameters needed to produce the `.h` files. The `.h` files must be edited and moved: +- Replace `#include "u8g.h"` with `#include `, +- Replace `U8G_FONT_SECTION` with `U8G_SECTION`, +- Insert `.progmem.` right after the first quote `"`, +- Move the file to the main directory. + +How to integrate a new font: +Currently we are limited to 256 symbols per font. We use a menu system with 5 lines, on a display with 64 pixel height. That means we have 12 pixels per line. So to have any space between the lines we can use no more than 10 pixel height for the symbols. For up to 11 pixels set TALL_FONT_CORRECTION 1 when loading the font. +To fit 22 Symbols on the 128 pixel wide screen, the symbols can't be wider than 5 pixel, for the first 128 symbols. +For the second half of the font we now support up to 11x11 pixel. + +- Get `Fony.exe` from [hukka.ncn.fi](http://hukka.ncn.fi/?fony) +- Copy one of the existing `*.fon` files and use the copy for your work. +- Only change the pixels. Don't change width or height. +- Export as a `*.bdf` file +- Use `bdf2u8g.exe` to produce the `.h` file. Examples for the existing fonts are in `make_fonts.bat`. +- Edit the produced `.h` file to match our needs. Find hints in the `dogm_font_data_.h` files. +- Make a new entry in the font list in `dogm_lcd_implementation.h` before the `#else // fall-back` line: +```cpp + #elif ENABLED(DISPLAY_CHARSET_NEWNAME) + #include "dogm_font_data_yourfont.h" + #define FONT_MENU_NAME YOURFONTNAME + #else // fall-back +``` +- Add your font to the list of permitted fonts in 'language_en.h' +```cpp + ... || ENABLED(DISPLAY_CHARSET_YOUR_NEW_FONT) ... ) +``` \ No newline at end of file From f90a8661cb66acfaef0aac050ea6910d05494ffd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Apr 2016 13:42:11 -0700 Subject: [PATCH 3/8] Uppercase XYZE on Graphical LCD --- Marlin/language_an.h | 8 ++++---- Marlin/language_bg.h | 8 ++++---- Marlin/language_ca.h | 8 ++++---- Marlin/language_cn.h | 8 ++++---- Marlin/language_cz.h | 8 ++++---- Marlin/language_da.h | 8 ++++---- Marlin/language_de.h | 8 ++++---- Marlin/language_en.h | 8 ++++---- Marlin/language_es.h | 8 ++++---- Marlin/language_eu.h | 8 ++++---- Marlin/language_fi.h | 8 ++++---- Marlin/language_fr.h | 8 ++++---- Marlin/language_gl.h | 8 ++++---- Marlin/language_it.h | 8 ++++---- Marlin/language_nl.h | 8 ++++---- Marlin/language_pl.h | 8 ++++---- Marlin/language_pt-br.h | 8 ++++---- Marlin/language_pt-br_utf8.h | 8 ++++---- Marlin/language_pt.h | 8 ++++---- Marlin/language_pt_utf8.h | 8 ++++---- Marlin/language_ru.h | 8 ++++---- 21 files changed, 84 insertions(+), 84 deletions(-) diff --git a/Marlin/language_an.h b/Marlin/language_an.h index ea476d69f..c2d49fb25 100644 --- a/Marlin/language_an.h +++ b/Marlin/language_an.h @@ -93,10 +93,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ves-jerk" #define MSG_VMAX "Vmax" -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "y" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax" diff --git a/Marlin/language_bg.h b/Marlin/language_bg.h index abff7baa7..f44865770 100644 --- a/Marlin/language_bg.h +++ b/Marlin/language_bg.h @@ -94,10 +94,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_ca.h b/Marlin/language_ca.h index 783d08878..95ded7488 100644 --- a/Marlin/language_ca.h +++ b/Marlin/language_ca.h @@ -94,10 +94,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_cn.h b/Marlin/language_cn.h index 95c794afd..487f72356 100644 --- a/Marlin/language_cn.h +++ b/Marlin/language_cn.h @@ -92,10 +92,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_cz.h b/Marlin/language_cz.h index db82d7d97..0dc7f41fe 100644 --- a/Marlin/language_cz.h +++ b/Marlin/language_cz.h @@ -99,10 +99,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_da.h b/Marlin/language_da.h index 4d9b46f2b..04477074d 100644 --- a/Marlin/language_da.h +++ b/Marlin/language_da.h @@ -95,10 +95,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_de.h b/Marlin/language_de.h index a4fba0bf6..06d718c7e 100644 --- a/Marlin/language_de.h +++ b/Marlin/language_de.h @@ -95,10 +95,10 @@ #define MSG_VZ_JERK "V z Ruck" #define MSG_VE_JERK "V e Ruck" #define MSG_VMAX "V max " // space by purpose -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "V min" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "A max " // space by purpose diff --git a/Marlin/language_en.h b/Marlin/language_en.h index c213fb596..18ea1cbdb 100644 --- a/Marlin/language_en.h +++ b/Marlin/language_en.h @@ -272,16 +272,16 @@ #define MSG_VMAX "Vmax " #endif #ifndef MSG_X - #define MSG_X "x" + #define MSG_X "X" #endif #ifndef MSG_Y - #define MSG_Y "y" + #define MSG_Y "Y" #endif #ifndef MSG_Z - #define MSG_Z "z" + #define MSG_Z "Z" #endif #ifndef MSG_E - #define MSG_E "e" + #define MSG_E "E" #endif #ifndef MSG_VMIN #define MSG_VMIN "Vmin" diff --git a/Marlin/language_es.h b/Marlin/language_es.h index 0032de8fd..e54ce3ccc 100644 --- a/Marlin/language_es.h +++ b/Marlin/language_es.h @@ -94,10 +94,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax" -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "Vel. viaje min" #define MSG_AMAX "Acel. max" diff --git a/Marlin/language_eu.h b/Marlin/language_eu.h index 8158d2654..51600f8b4 100644 --- a/Marlin/language_eu.h +++ b/Marlin/language_eu.h @@ -93,10 +93,10 @@ #define MSG_VZ_JERK "Vz-astindua" #define MSG_VE_JERK "Ve-astindua" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_fi.h b/Marlin/language_fi.h index 600a009fe..a1915fd3b 100644 --- a/Marlin/language_fi.h +++ b/Marlin/language_fi.h @@ -93,10 +93,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VLiike min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_fr.h b/Marlin/language_fr.h index acb17ce3f..1b3be6b4e 100644 --- a/Marlin/language_fr.h +++ b/Marlin/language_fr.h @@ -95,10 +95,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax" -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "Vdepl min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_gl.h b/Marlin/language_gl.h index 0921bbf2a..beafa84d5 100644 --- a/Marlin/language_gl.h +++ b/Marlin/language_gl.h @@ -92,10 +92,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_it.h b/Marlin/language_it.h index 247030e9e..59aeb233f 100644 --- a/Marlin/language_it.h +++ b/Marlin/language_it.h @@ -94,10 +94,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_nl.h b/Marlin/language_nl.h index 953cc3342..b24fce3b7 100644 --- a/Marlin/language_nl.h +++ b/Marlin/language_nl.h @@ -93,10 +93,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_pl.h b/Marlin/language_pl.h index 71c873048..c75b38f30 100644 --- a/Marlin/language_pl.h +++ b/Marlin/language_pl.h @@ -93,10 +93,10 @@ #define MSG_VZ_JERK "Zryw Vz" #define MSG_VE_JERK "Zryw Ve" #define MSG_VMAX "Vmax" -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "Vskok min" #define MSG_AMAX "Amax" diff --git a/Marlin/language_pt-br.h b/Marlin/language_pt-br.h index 693a6413d..fc58a06d0 100644 --- a/Marlin/language_pt-br.h +++ b/Marlin/language_pt-br.h @@ -93,10 +93,10 @@ #define MSG_VZ_JERK "jogo VZ" #define MSG_VE_JERK "jogo VE" #define MSG_VMAX " Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_pt-br_utf8.h b/Marlin/language_pt-br_utf8.h index 15a618b65..d08690897 100644 --- a/Marlin/language_pt-br_utf8.h +++ b/Marlin/language_pt-br_utf8.h @@ -93,10 +93,10 @@ #define MSG_VZ_JERK "jogo VZ" #define MSG_VE_JERK "jogo VE" #define MSG_VMAX " Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_pt.h b/Marlin/language_pt.h index 31617ee93..f82dd7bae 100644 --- a/Marlin/language_pt.h +++ b/Marlin/language_pt.h @@ -98,10 +98,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX " Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_pt_utf8.h b/Marlin/language_pt_utf8.h index e94fa323e..c254f720d 100644 --- a/Marlin/language_pt_utf8.h +++ b/Marlin/language_pt_utf8.h @@ -98,10 +98,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX " Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax " diff --git a/Marlin/language_ru.h b/Marlin/language_ru.h index 051c9289a..d20651d1f 100644 --- a/Marlin/language_ru.h +++ b/Marlin/language_ru.h @@ -94,10 +94,10 @@ #define MSG_VZ_JERK "Vz-jerk" #define MSG_VE_JERK "Ve-jerk" #define MSG_VMAX "Vmax " -#define MSG_X "x" -#define MSG_Y "y" -#define MSG_Z "z" -#define MSG_E "e" +#define MSG_X "X" +#define MSG_Y "Y" +#define MSG_Z "Z" +#define MSG_E "E" #define MSG_VMIN "Vmin" #define MSG_VTRAV_MIN "VTrav min" #define MSG_AMAX "Amax" From b281001329ad661464354234f11ea5b4e5fc7d3b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Apr 2016 14:38:00 -0700 Subject: [PATCH 4/8] Use MSG_X, etc., on Hitachi LCD --- Marlin/ultralcd_implementation_hitachi_HD44780.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 6acfdd0ba..3164f45a2 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -693,7 +693,7 @@ static void lcd_implementation_status_screen() { // When everything is ok you see a constant 'X'. if (blink) - lcd_printPGM(PSTR("X")); + lcd_printPGM(PSTR(MSG_X)); else { if (!axis_homed[X_AXIS]) lcd_printPGM(PSTR("?")); @@ -703,14 +703,14 @@ static void lcd_implementation_status_screen() { lcd_printPGM(PSTR(" ")); else #endif - lcd_printPGM(PSTR("X")); + lcd_printPGM(PSTR(MSG_X)); } lcd.print(ftostr4sign(current_position[X_AXIS])); lcd_printPGM(PSTR(" ")); if (blink) - lcd_printPGM(PSTR("Y")); + lcd_printPGM(PSTR(MSG_Y)); else { if (!axis_homed[Y_AXIS]) lcd_printPGM(PSTR("?")); @@ -720,7 +720,7 @@ static void lcd_implementation_status_screen() { lcd_printPGM(PSTR(" ")); else #endif - lcd_printPGM(PSTR("Y")); + lcd_printPGM(PSTR(MSG_Y)); } lcd.print(ftostr4sign(current_position[Y_AXIS])); @@ -730,7 +730,7 @@ static void lcd_implementation_status_screen() { lcd.setCursor(LCD_WIDTH - 8, 1); if (blink) - lcd_printPGM(PSTR("Z")); + lcd_printPGM(PSTR(MSG_Z)); else { if (!axis_homed[Z_AXIS]) lcd_printPGM(PSTR("?")); @@ -740,7 +740,7 @@ static void lcd_implementation_status_screen() { lcd_printPGM(PSTR(" ")); else #endif - lcd_printPGM(PSTR("Z")); + lcd_printPGM(PSTR(MSG_Z)); } lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001)); From fc30aa9d88fb2bee49f0310ba391532f7c42afc9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Apr 2016 14:45:58 -0700 Subject: [PATCH 5/8] Aesthetic and functional improvements for graphical LCD --- Marlin/dogm_lcd_implementation.h | 55 ++++++++++++++------------------ 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index b22a1ed67..5033fbe81 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -279,25 +279,31 @@ static void lcd_implementation_init() { static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop -static void _draw_heater_status(int x, int heater) { +FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) { + int degsize = 6 * (temp >= 100 ? 3 : temp >= 10 ? 2 : 1); // number's pixel width + u8g.setPrintPos(x - (18 - degsize) / 2, y); // move left if shorter + lcd_print(itostr3(temp)); + lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); +} + +FORCE_INLINE void _draw_heater_status(int x, int heater) { bool isBed = heater < 0; - int y = 17 + (isBed ? 1 : 0); lcd_setFont(FONT_STATUSMENU); - u8g.setPrintPos(x, 7); - lcd_print(itostr3(int((heater >= 0 ? degTargetHotend(heater) : degTargetBed()) + 0.5))); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - u8g.setPrintPos(x, 28); - lcd_print(itostr3(int(heater >= 0 ? degHotend(heater) : degBed()) + 0.5)); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - if (heater >= 0 ? !isHeatingHotend(heater) : !isHeatingBed()) { - u8g.drawBox(x+7,y,2,2); + _draw_centered_temp((isBed ? degTargetBed() : degTargetHotend(heater)) + 0.5, x, 7); + + _draw_centered_temp((isBed ? degBed() : degHotend(heater)) + 0.5, x, 28); + + int h = isBed ? 7 : 8, + y = isBed ? 18 : 17; + if (isBed ? isHeatingBed() : isHeatingHotend(heater)) { + u8g.setColorIndex(0); // white on black + u8g.drawBox(x + h, y, 2, 2); + u8g.setColorIndex(1); // black on white } else { - u8g.setColorIndex(0); // white on black - u8g.drawBox(x + 7, y, 2, 2); - u8g.setColorIndex(1); // black on white + u8g.drawBox(x + h, y, 2, 2); } } @@ -340,13 +346,10 @@ static void lcd_implementation_status_screen() { lcd_print(':'); lcd_print(itostr2(time%60)); } - else { - lcd_printPGM(PSTR("--:--")); - } #endif // Extruders - for (int i = 0; i < EXTRUDERS; i++) _draw_heater_status(6 + i * 25, i); + for (int i = 0; i < EXTRUDERS; i++) _draw_heater_status(5 + i * 25, i); // Heatbed if (EXTRUDERS < 4) _draw_heater_status(81, -1); @@ -360,11 +363,7 @@ static void lcd_implementation_status_screen() { lcd_print(itostr3(per)); lcd_print('%'); } - else #endif - { - lcd_printPGM(PSTR("---")); - } // X, Y, Z-Coordinates // Before homing the axis letters are blinking 'X' <-> '?'. @@ -394,10 +393,8 @@ static void lcd_implementation_status_screen() { lcd_printPGM(PSTR(MSG_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])); + lcd_print(ftostr4sign(current_position[X_AXIS])); u8g.setPrintPos(43, XYZ_BASELINE); if (blink) @@ -414,10 +411,8 @@ static void lcd_implementation_status_screen() { lcd_printPGM(PSTR(MSG_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])); + lcd_print(ftostr4sign(current_position[Y_AXIS])); u8g.setPrintPos(83, XYZ_BASELINE); if (blink) @@ -434,23 +429,21 @@ static void lcd_implementation_status_screen() { lcd_printPGM(PSTR(MSG_Z)); } } - u8g.drawPixel(89, XYZ_BASELINE - 5); - u8g.drawPixel(89, XYZ_BASELINE - 3); u8g.setPrintPos(91, XYZ_BASELINE); - lcd_print(ftostr32sp(current_position[Z_AXIS])); + lcd_print(ftostr32sp(current_position[Z_AXIS] + 0.00001)); u8g.setColorIndex(1); // black on white // Feedrate lcd_setFont(FONT_MENU); u8g.setPrintPos(3, 49); lcd_print(LCD_STR_FEEDRATE[0]); + lcd_setFont(FONT_STATUSMENU); u8g.setPrintPos(12, 49); lcd_print(itostr3(feedrate_multiplier)); lcd_print('%'); // Status line - lcd_setFont(FONT_STATUSMENU); #if ENABLED(USE_SMALL_INFOFONT) u8g.setPrintPos(0, 62); #else From 34b17d4a8a9f08cdae108ad983a776b9067f578b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Apr 2016 19:34:59 -0700 Subject: [PATCH 6/8] Reduce heater status code if no bed --- Marlin/dogm_lcd_implementation.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 5033fbe81..ee8bb88dd 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -287,9 +287,11 @@ FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) { } FORCE_INLINE void _draw_heater_status(int x, int heater) { - bool isBed = heater < 0; - - lcd_setFont(FONT_STATUSMENU); + #if HAS_TEMP_BED + bool isBed = heater < 0; + #else + const bool isBed = false; + #endif _draw_centered_temp((isBed ? degTargetBed() : degTargetHotend(heater)) + 0.5, x, 7); @@ -351,8 +353,10 @@ static void lcd_implementation_status_screen() { // Extruders for (int i = 0; i < EXTRUDERS; i++) _draw_heater_status(5 + i * 25, i); - // Heatbed - if (EXTRUDERS < 4) _draw_heater_status(81, -1); + // Heated bed + #if EXTRUDERS < 4 && HAS_TEMP_BED + _draw_heater_status(81, -1); + #endif // Fan lcd_setFont(FONT_STATUSMENU); From 90c97c818577a3d3c245c06b7f25979741a008df Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Apr 2016 19:45:55 -0700 Subject: [PATCH 7/8] Add _draw_axis_label function to reduce source --- Marlin/dogm_lcd_implementation.h | 64 +++++++------------ .../ultralcd_implementation_hitachi_HD44780.h | 61 ++++++------------ 2 files changed, 43 insertions(+), 82 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index ee8bb88dd..3c49ffb8e 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -309,6 +309,23 @@ FORCE_INLINE void _draw_heater_status(int x, int heater) { } } +FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) { + if (blink) + lcd_printPGM(pstr); + else { + if (!axis_homed[axis]) + lcd_printPGM(PSTR("?")); + else { + #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) + if (!axis_known_position[axis]) + lcd_printPGM(PSTR(" ")); + else + #endif + lcd_printPGM(pstr); + } + } +} + static void lcd_implementation_status_screen() { u8g.setColorIndex(1); // black on white @@ -382,59 +399,22 @@ static void lcd_implementation_status_screen() { u8g.drawBox(0, 30, LCD_PIXEL_WIDTH, 9); #endif u8g.setColorIndex(0); // white on black + u8g.setPrintPos(2, XYZ_BASELINE); - if (blink) - lcd_printPGM(PSTR(MSG_X)); - else { - if (!axis_homed[X_AXIS]) - lcd_printPGM(PSTR("?")); - else { - #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - if (!axis_known_position[X_AXIS]) - lcd_printPGM(PSTR(" ")); - else - #endif - lcd_printPGM(PSTR(MSG_X)); - } - } + _draw_axis_label(X_AXIS, PSTR(MSG_X), blink); u8g.setPrintPos(10, XYZ_BASELINE); lcd_print(ftostr4sign(current_position[X_AXIS])); u8g.setPrintPos(43, XYZ_BASELINE); - if (blink) - lcd_printPGM(PSTR(MSG_Y)); - else { - if (!axis_homed[Y_AXIS]) - lcd_printPGM(PSTR("?")); - else { - #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - if (!axis_known_position[Y_AXIS]) - lcd_printPGM(PSTR(" ")); - else - #endif - lcd_printPGM(PSTR(MSG_Y)); - } - } + _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink); u8g.setPrintPos(51, XYZ_BASELINE); lcd_print(ftostr4sign(current_position[Y_AXIS])); u8g.setPrintPos(83, XYZ_BASELINE); - if (blink) - lcd_printPGM(PSTR(MSG_Z)); - else { - if (!axis_homed[Z_AXIS]) - lcd_printPGM(PSTR("?")); - else { - #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - if (!axis_known_position[Z_AXIS]) - lcd_printPGM(PSTR(" ")); - else - #endif - lcd_printPGM(PSTR(MSG_Z)); - } - } + _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink); u8g.setPrintPos(91, XYZ_BASELINE); lcd_print(ftostr32sp(current_position[Z_AXIS] + 0.00001)); + u8g.setColorIndex(1); // black on white // Feedrate diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 3164f45a2..3787db01b 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -569,6 +569,23 @@ unsigned lcd_print(char c) { return charset_mapper(c); } #endif // SHOW_BOOTSCREEN +FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) { + if (blink) + lcd_printPGM(pstr); + else { + if (!axis_homed[axis]) + lcd_printPGM(PSTR("?")); + else { + #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) + if (!axis_known_position[axis]) + lcd_printPGM(PSTR(" ")); + else + #endif + lcd_printPGM(pstr); + } + } +} + /** Possible status screens: 16x2 |000/000 B000/000| @@ -692,36 +709,12 @@ 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) - lcd_printPGM(PSTR(MSG_X)); - else { - if (!axis_homed[X_AXIS]) - lcd_printPGM(PSTR("?")); - else - #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - if (!axis_known_position[X_AXIS]) - lcd_printPGM(PSTR(" ")); - else - #endif - lcd_printPGM(PSTR(MSG_X)); - } - + _draw_axis_label(X_AXIS, PSTR(MSG_X), blink); lcd.print(ftostr4sign(current_position[X_AXIS])); lcd_printPGM(PSTR(" ")); - if (blink) - lcd_printPGM(PSTR(MSG_Y)); - else { - if (!axis_homed[Y_AXIS]) - lcd_printPGM(PSTR("?")); - else - #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - if (!axis_known_position[Y_AXIS]) - lcd_printPGM(PSTR(" ")); - else - #endif - lcd_printPGM(PSTR(MSG_Y)); - } + + _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink); lcd.print(ftostr4sign(current_position[Y_AXIS])); #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 @@ -729,19 +722,7 @@ static void lcd_implementation_status_screen() { #endif // LCD_WIDTH >= 20 lcd.setCursor(LCD_WIDTH - 8, 1); - if (blink) - lcd_printPGM(PSTR(MSG_Z)); - else { - if (!axis_homed[Z_AXIS]) - lcd_printPGM(PSTR("?")); - else - #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - if (!axis_known_position[Z_AXIS]) - lcd_printPGM(PSTR(" ")); - else - #endif - lcd_printPGM(PSTR(MSG_Z)); - } + _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink); lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001)); #endif // LCD_HEIGHT > 2 From 026ae8f2f0dbb810695c658dcab809d83e6b97b8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Apr 2016 19:46:12 -0700 Subject: [PATCH 8/8] Call lcd_setFont only when needed --- Marlin/dogm_lcd_implementation.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 3c49ffb8e..a1281cf7a 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -340,6 +340,9 @@ static void lcd_implementation_status_screen() { #endif ); + // Status Menu Font for SD info, Heater status, Fan, XYZ + lcd_setFont(FONT_STATUSMENU); + #if ENABLED(SDSUPPORT) // SD Card Symbol u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7); @@ -351,8 +354,6 @@ static void lcd_implementation_status_screen() { u8g.drawFrame(54, 49, 73, 4 - (TALL_FONT_CORRECTION)); // SD Card Progress bar and clock - lcd_setFont(FONT_STATUSMENU); - if (IS_SD_PRINTING) { // Progress bar solid part u8g.drawBox(55, 50, (unsigned int)(71.f * card.percentDone() / 100.f), 2 - (TALL_FONT_CORRECTION)); @@ -376,7 +377,6 @@ static void lcd_implementation_status_screen() { #endif // Fan - lcd_setFont(FONT_STATUSMENU); u8g.setPrintPos(104, 27); #if HAS_FAN0 int per = ((fanSpeeds[0] + 1) * 100) / 256; @@ -391,7 +391,6 @@ 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'. #define XYZ_BASELINE 38 - lcd_setFont(FONT_STATUSMENU); #if ENABLED(USE_SMALL_INFOFONT) u8g.drawBox(0, 30, LCD_PIXEL_WIDTH, 10);