From 774a6e81995b23c383bbc2fdcb5f6f5c014043f2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 27 Oct 2018 13:07:03 -0500 Subject: [PATCH] Drop TALL_FONT_CORRECTION --- Marlin/src/lcd/dogm/status_screen_DOGM.h | 18 +++++++++--------- Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp | 15 +++++---------- Marlin/src/lcd/language/language_zh_CN.h | 2 -- Marlin/src/lcd/language/language_zh_TW.h | 2 -- Marlin/src/lcd/menu/menu.cpp | 9 ++------- Marlin/src/lcd/menu/menu.h | 4 ++-- Marlin/src/lcd/ultralcd.h | 4 ++-- 7 files changed, 20 insertions(+), 34 deletions(-) diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.h b/Marlin/src/lcd/dogm/status_screen_DOGM.h index 264b1fbd7e..22f7ab9d7a 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.h +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.h @@ -285,15 +285,15 @@ void lcd_impl_status_screen_0() { // // SD Card Symbol // - if (card.isFileOpen() && PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) { + if (card.isFileOpen() && PAGE_CONTAINS(42, 51)) { // Upper box - u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7); // 42-48 (or 41-47) + u8g.drawBox(42, 42, 8, 7); // 42-48 (or 41-47) // Right edge - u8g.drawBox(50, 44 - (TALL_FONT_CORRECTION), 2, 5); // 44-48 (or 43-47) + u8g.drawBox(50, 44, 2, 5); // 44-48 (or 43-47) // Bottom hollow box - u8g.drawFrame(42, 49 - (TALL_FONT_CORRECTION), 10, 4); // 49-52 (or 48-51) + u8g.drawFrame(42, 49, 10, 4); // 49-52 (or 48-51) // Corner pixel - u8g.drawPixel(50, 43 - (TALL_FONT_CORRECTION)); // 43 (or 42) + u8g.drawPixel(50, 43); // 43 (or 42) } #endif // SDSUPPORT @@ -304,10 +304,10 @@ void lcd_impl_status_screen_0() { #define PROGRESS_BAR_X 54 #define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X) - if (PAGE_CONTAINS(49, 52 - (TALL_FONT_CORRECTION))) // 49-52 (or 49-51) + if (PAGE_CONTAINS(49, 52)) // 49-52 (or 49-51) u8g.drawFrame( PROGRESS_BAR_X, 49, - PROGRESS_BAR_WIDTH, 4 - (TALL_FONT_CORRECTION) + PROGRESS_BAR_WIDTH, 4 ); #if DISABLED(LCD_SET_PROGRESS_MANUALLY) @@ -320,10 +320,10 @@ void lcd_impl_status_screen_0() { // Progress bar solid part // - if (PAGE_CONTAINS(50, 51 - (TALL_FONT_CORRECTION))) // 50-51 (or just 50) + if (PAGE_CONTAINS(50, 51)) // 50-51 (or just 50) u8g.drawBox( PROGRESS_BAR_X + 1, 50, - (uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress_bar_percent * 0.01), 2 - (TALL_FONT_CORRECTION) + (uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress_bar_percent * 0.01), 2 ); // diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp index 24071c8da8..3e91cbde71 100644 --- a/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp @@ -96,10 +96,6 @@ #define DOG_CHAR_HEIGHT_EDIT DOG_CHAR_HEIGHT #endif -#ifndef TALL_FONT_CORRECTION - #define TALL_FONT_CORRECTION 0 -#endif - #define START_COL 0 U8G_CLASS u8g(U8G_PARAM); @@ -294,13 +290,12 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop #if ENABLED(ULTIPANEL) uint8_t row_y1, row_y2; - uint8_t constexpr row_height = DOG_CHAR_HEIGHT + 2 * (TALL_FONT_CORRECTION); #if ENABLED(ADVANCED_PAUSE_FEATURE) void lcd_implementation_hotend_status(const uint8_t row, const uint8_t extruder) { - row_y1 = row * row_height + 1; - row_y2 = row_y1 + row_height - 1; + row_y1 = row * (DOG_CHAR_HEIGHT) + 1; + row_y2 = row_y1 + DOG_CHAR_HEIGHT - 1; if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return; @@ -319,8 +314,8 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop // Set the colors for a menu item based on whether it is selected static bool mark_as_selected(const uint8_t row, const bool isSelected) { - row_y1 = row * row_height + 1; - row_y2 = row_y1 + row_height - 1; + row_y1 = row * (DOG_CHAR_HEIGHT) + 1; + row_y2 = row_y1 + DOG_CHAR_HEIGHT - 1; if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return false; @@ -330,7 +325,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop u8g.drawHLine(0, row_y2 + 2, LCD_PIXEL_WIDTH); #else u8g.setColorIndex(1); // black on white - u8g.drawBox(0, row_y1 + 2, LCD_PIXEL_WIDTH, row_height - 1); + u8g.drawBox(0, row_y1 + 2, LCD_PIXEL_WIDTH, DOG_CHAR_HEIGHT - 1); u8g.setColorIndex(0); // white on black #endif } diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index 3ed8005949..16c932032b 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -30,8 +30,6 @@ #ifndef LANGUAGE_ZH_CN_H #define LANGUAGE_ZH_CN_H -//#define TALL_FONT_CORRECTION (1) - #define CHARSIZE 3 #define WELCOME_MSG MACHINE_NAME _UxGT("已就绪.") //" ready." diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 3ae7f70212..ff2d690650 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -30,8 +30,6 @@ #ifndef LANGUAGE_ZH_TW_H #define LANGUAGE_ZH_TW_H -//#define TALL_FONT_CORRECTION (1) - #define CHARSIZE 3 #define WELCOME_MSG MACHINE_NAME _UxGT("已就緒.") //" ready." diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 07f5ff2702..c712325289 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -101,12 +101,7 @@ bool liveEdit; float raw_Ki, raw_Kd; // place-holders for Ki and Kd edits #endif -#ifndef TALL_FONT_CORRECTION - #define TALL_FONT_CORRECTION 0 -#endif - bool no_reentry = false; -constexpr int8_t menu_bottom = LCD_HEIGHT - (TALL_FONT_CORRECTION); // Initialized by settings.load() int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2]; @@ -478,8 +473,8 @@ void scroll_screen(const uint8_t limit, const bool is_menu) { } if (is_menu) { NOMORE(encoderTopLine, encoderLine); - if (encoderLine >= encoderTopLine + menu_bottom) - encoderTopLine = encoderLine - menu_bottom + 1; + if (encoderLine >= encoderTopLine + LCD_HEIGHT) + encoderTopLine = encoderLine - LCD_HEIGHT + 1; } else encoderTopLine = encoderLine; diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index b032545cd7..9297110243 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -179,7 +179,7 @@ void menu_action_setting_edit_callback_bool(PGM_P pstr, bool* ptr, screenFunc_t */ #define SCREEN_OR_MENU_LOOP() \ int8_t _menuLineNr = encoderTopLine, _thisItemNr; \ - for (int8_t _lcdLineNr = 0; _lcdLineNr < menu_bottom; _lcdLineNr++, _menuLineNr++) { \ + for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT; _lcdLineNr++, _menuLineNr++) { \ _thisItemNr = 0 /** @@ -190,7 +190,7 @@ void menu_action_setting_edit_callback_bool(PGM_P pstr, bool* ptr, screenFunc_t * Scroll as-needed to keep the selected line in view. */ #define START_SCREEN() \ - scroll_screen(menu_bottom, false); \ + scroll_screen(LCD_HEIGHT, false); \ bool _skipStatic = false; \ SCREEN_OR_MENU_LOOP() diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index 9d0197b27e..67f9e05b7c 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -210,8 +210,8 @@ #endif #if ENABLED(DOGLCD) - #define SETCURSOR(col, row) lcd_moveto(col * (DOG_CHAR_WIDTH), (row + 1) * row_height) - #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - len * (DOG_CHAR_WIDTH), (row + 1) * row_height) + #define SETCURSOR(col, row) lcd_moveto(col * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT)) + #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - len * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT)) #else #define SETCURSOR(col, row) lcd_moveto(col, row) #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - len, row)