Browse Source

MENU_HOLLOW_FRAME for the menu screens

MENU_HOLLOW_FRAME for the menu screens and
some pixel shifting to optimize the look with tall fonts. (cn)
AnHardt 7 years ago
parent
commit
7a9fa78822
2 changed files with 30 additions and 18 deletions
  1. 8
    4
      Marlin/ultralcd.cpp
  2. 22
    14
      Marlin/ultralcd_impl_DOGM.h

+ 8
- 4
Marlin/ultralcd.cpp View File

@@ -215,6 +215,10 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
215 215
     #define ENCODER_PULSES_PER_STEP 1
216 216
   #endif
217 217
 
218
+  #ifndef TALL_FONT_CORRECTION
219
+    #define TALL_FONT_CORRECTION 0
220
+  #endif
221
+
218 222
   /**
219 223
    * START_SCREEN_OR_MENU generates init code for a screen or menu
220 224
    *
@@ -238,7 +242,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
238 242
 
239 243
   #define SCREEN_OR_MENU_LOOP() \
240 244
     int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
241
-    for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT; _lcdLineNr++, _menuLineNr++) { \
245
+    for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT - TALL_FONT_CORRECTION; _lcdLineNr++, _menuLineNr++) { \
242 246
       _thisItemNr = 0
243 247
 
244 248
   /**
@@ -249,7 +253,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
249 253
    *               Scroll as-needed to keep the selected line in view.
250 254
    */
251 255
   #define START_SCREEN() \
252
-    START_SCREEN_OR_MENU(LCD_HEIGHT); \
256
+    START_SCREEN_OR_MENU(LCD_HEIGHT - TALL_FONT_CORRECTION); \
253 257
     encoderTopLine = encoderLine; \
254 258
     bool _skipStatic = false; \
255 259
     SCREEN_OR_MENU_LOOP()
@@ -257,8 +261,8 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
257 261
   #define START_MENU() \
258 262
     START_SCREEN_OR_MENU(1); \
259 263
     NOMORE(encoderTopLine, encoderLine); \
260
-    if (encoderLine >= encoderTopLine + LCD_HEIGHT) { \
261
-      encoderTopLine = encoderLine - (LCD_HEIGHT - 1); \
264
+    if (encoderLine >= encoderTopLine + LCD_HEIGHT - TALL_FONT_CORRECTION) { \
265
+      encoderTopLine = encoderLine - (LCD_HEIGHT - TALL_FONT_CORRECTION - 1); \
262 266
     } \
263 267
     bool _skipStatic = true; \
264 268
     SCREEN_OR_MENU_LOOP()

+ 22
- 14
Marlin/ultralcd_impl_DOGM.h View File

@@ -508,13 +508,14 @@ static void lcd_implementation_status_screen() {
508 508
 
509 509
   // Enable to save many cycles by drawing a hollow frame
510 510
   #define XYZ_HOLLOW_FRAME
511
+  #define MENU_HOLLOW_FRAME
511 512
 
512 513
   #if ENABLED(XYZ_HOLLOW_FRAME)
513 514
     #define XYZ_FRAME_TOP 29
514 515
     #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 3
515 516
   #else
516 517
     #define XYZ_FRAME_TOP 30
517
-    #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 2
518
+    #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1
518 519
   #endif
519 520
 
520 521
   // Before homing the axis letters are blinking 'X' <-> '?'.
@@ -569,13 +570,13 @@ static void lcd_implementation_status_screen() {
569 570
   // Feedrate
570 571
   //
571 572
 
572
-  if (PAGE_CONTAINS(50 - INFO_FONT_HEIGHT, 49)) {
573
+  if (PAGE_CONTAINS(51 - INFO_FONT_HEIGHT, 49)) {
573 574
     lcd_setFont(FONT_MENU);
574
-    u8g.setPrintPos(3, 49);
575
+    u8g.setPrintPos(3, 50);
575 576
     lcd_print(LCD_STR_FEEDRATE[0]);
576 577
 
577 578
     lcd_setFont(FONT_STATUSMENU);
578
-    u8g.setPrintPos(12, 49);
579
+    u8g.setPrintPos(12, 50);
579 580
     lcd_print(itostr3(feedrate_percentage));
580 581
     u8g.print('%');
581 582
   }
@@ -584,7 +585,7 @@ static void lcd_implementation_status_screen() {
584 585
   // Status line
585 586
   //
586 587
 
587
-  #define STATUS_BASELINE (54 + INFO_FONT_HEIGHT)
588
+  #define STATUS_BASELINE (55 + INFO_FONT_HEIGHT)
588 589
 
589 590
   if (PAGE_CONTAINS(STATUS_BASELINE + 1 - INFO_FONT_HEIGHT, STATUS_BASELINE)) {
590 591
     u8g.setPrintPos(0, STATUS_BASELINE);
@@ -613,19 +614,26 @@ static void lcd_implementation_status_screen() {
613 614
   // Set the colors for a menu item based on whether it is selected
614 615
   static void lcd_implementation_mark_as_selected(const uint8_t row, const bool isSelected) {
615 616
 
616
-    row_y1 = row * (DOG_CHAR_HEIGHT) + 1;
617
-    row_y2 = row_y1 + (DOG_CHAR_HEIGHT) - 1;
617
+    row_y1 = row * (DOG_CHAR_HEIGHT + 2 * (TALL_FONT_CORRECTION)) + 1;
618
+    row_y2 = row_y1 + (DOG_CHAR_HEIGHT + 2 * (TALL_FONT_CORRECTION)) - 1;
618 619
 
619
-    if (!PAGE_CONTAINS(row_y1 + 2 - (TALL_FONT_CORRECTION), row_y2 + 2 - (TALL_FONT_CORRECTION))) return;
620
+    if (!PAGE_CONTAINS(row_y1 + 1, row_y1 + 1 + DOG_CHAR_HEIGHT + 2 * (TALL_FONT_CORRECTION))) return;
620 621
 
621 622
     if (isSelected) {
622
-      u8g.setColorIndex(1);  // black on white
623
-      u8g.drawBox(0, row_y1 + 2 - (TALL_FONT_CORRECTION), LCD_PIXEL_WIDTH, DOG_CHAR_HEIGHT);
624
-      u8g.setColorIndex(0);  // following text must be white on black
625
-    }
626
-    else {
627
-      u8g.setColorIndex(1); // unmarked text is black on white
623
+      #if ENABLED(MENU_HOLLOW_FRAME)
624
+        u8g.drawHLine(0, row_y1 + 1, LCD_PIXEL_WIDTH);
625
+        u8g.drawHLine(0, row_y1 + 1 + DOG_CHAR_HEIGHT + 2 * (TALL_FONT_CORRECTION), LCD_PIXEL_WIDTH);
626
+      #else
627
+        u8g.setColorIndex(1); // black on white
628
+        u8g.drawBox(0, row_y1 + 2, LCD_PIXEL_WIDTH, DOG_CHAR_HEIGHT - 1 + 2 * (TALL_FONT_CORRECTION));
629
+        u8g.setColorIndex(0); // white on black
630
+      #endif
628 631
     }
632
+    #if DISABLED(MENU_HOLLOW_FRAME)
633
+      else {
634
+        u8g.setColorIndex(1); // unmarked text is black on white
635
+      }
636
+    #endif
629 637
     u8g.setPrintPos((START_COL) * (DOG_CHAR_WIDTH), row_y2);
630 638
   }
631 639
 

Loading…
Cancel
Save