Browse Source

Merge pull request #496 from MStohn/fix-16x2-lcd

Fix: Long menu entries (>14 or >18 chars) caused overrun in hitachi display implementation
ErikZalm 11 years ago
parent
commit
34fb4831a2

+ 2
- 2
Marlin/dogm_lcd_implementation.h View File

@@ -101,11 +101,11 @@ static void lcd_implementation_init()
101 101
 	u8g.setRot90();	// Rotate screen by 90°
102 102
 #endif
103 103
 
104
-#ifdef LCD_SCREEN_ROT_180;
104
+#ifdef LCD_SCREEN_ROT_180
105 105
 	u8g.setRot180();	// Rotate screen by 180°
106 106
 #endif
107 107
 
108
-#ifdef LCD_SCREEN_ROT_270;
108
+#ifdef LCD_SCREEN_ROT_270
109 109
 	u8g.setRot270();	// Rotate screen by 270°
110 110
 #endif
111 111
 

+ 7
- 7
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -503,7 +503,7 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c
503 503
   #endif
504 504
     lcd.setCursor(0, row);
505 505
     lcd.print(pre_char);
506
-    while((c = pgm_read_byte(pstr)) != '\0')
506
+    while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) )
507 507
     {
508 508
         lcd.print(c);
509 509
         pstr++;
@@ -525,7 +525,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const
525 525
   #endif
526 526
     lcd.setCursor(0, row);
527 527
     lcd.print(pre_char);
528
-    while((c = pgm_read_byte(pstr)) != '\0')
528
+    while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) )
529 529
     {
530 530
         lcd.print(c);
531 531
         pstr++;
@@ -547,7 +547,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons
547 547
   #endif
548 548
     lcd.setCursor(0, row);
549 549
     lcd.print(pre_char);
550
-    while((c = pgm_read_byte(pstr)) != '\0')
550
+    while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) )
551 551
     {
552 552
         lcd.print(c);
553 553
         pstr++;
@@ -617,7 +617,7 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char*
617 617
         filename = longFilename;
618 618
         longFilename[LCD_WIDTH-1] = '\0';
619 619
     }
620
-    while((c = *filename) != '\0')
620
+    while( ((c = *filename) != '\0') && (n>0) )
621 621
     {
622 622
         lcd.print(c);
623 623
         filename++;
@@ -637,7 +637,7 @@ static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, co
637 637
         filename = longFilename;
638 638
         longFilename[LCD_WIDTH-1] = '\0';
639 639
     }
640
-    while((c = *filename) != '\0')
640
+    while( ((c = *filename) != '\0') && (n>0) )
641 641
     {
642 642
         lcd.print(c);
643 643
         filename++;
@@ -658,7 +658,7 @@ static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const
658 658
         filename = longFilename;
659 659
         longFilename[LCD_WIDTH-2] = '\0';
660 660
     }
661
-    while((c = *filename) != '\0')
661
+    while( ((c = *filename) != '\0') && (n>0) )
662 662
     {
663 663
         lcd.print(c);
664 664
         filename++;
@@ -679,7 +679,7 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst
679 679
         filename = longFilename;
680 680
         longFilename[LCD_WIDTH-2] = '\0';
681 681
     }
682
-    while((c = *filename) != '\0')
682
+    while( ((c = *filename) != '\0') && (n>0) )
683 683
     {
684 684
         lcd.print(c);
685 685
         filename++;

Loading…
Cancel
Save