Browse Source

Update Marlin/ultralcd_implementation_hitachi_HD44780.h

Use all available characters in narrow LCDs < 20 characters.
mfeherpataky 12 years ago
parent
commit
71ddb8dc60
1 changed files with 23 additions and 4 deletions
  1. 23
    4
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 23
- 4
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -297,7 +297,12 @@ static void lcd_implementation_status_screen()
297 297
 static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
298 298
 {
299 299
     char c;
300
-    uint8_t n = LCD_WIDTH - 1 - 2;
300
+    //Use all characters in narrow LCDs
301
+  #if LCD_WIDTH < 20
302
+    	uint8_t n = LCD_WIDTH - 1 - 1;
303
+    #else
304
+    	uint8_t n = LCD_WIDTH - 1 - 2;
305
+  #endif
301 306
     lcd.setCursor(0, row);
302 307
     lcd.print(pre_char);
303 308
     while((c = pgm_read_byte(pstr)) != '\0')
@@ -314,7 +319,12 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c
314 319
 static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
315 320
 {
316 321
     char c;
317
-    uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data);
322
+    //Use all characters in narrow LCDs
323
+  #if LCD_WIDTH < 20
324
+    	uint8_t n = LCD_WIDTH - 1 - 1;
325
+    #else
326
+    	uint8_t n = LCD_WIDTH - 1 - 2;
327
+  #endif
318 328
     lcd.setCursor(0, row);
319 329
     lcd.print(pre_char);
320 330
     while((c = pgm_read_byte(pstr)) != '\0')
@@ -331,7 +341,12 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const
331 341
 static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data)
332 342
 {
333 343
     char c;
334
-    uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data);
344
+    //Use all characters in narrow LCDs
345
+  #if LCD_WIDTH < 20
346
+    	uint8_t n = LCD_WIDTH - 1 - 1;
347
+    #else
348
+    	uint8_t n = LCD_WIDTH - 1 - 2;
349
+  #endif
335 350
     lcd.setCursor(0, row);
336 351
     lcd.print(pre_char);
337 352
     while((c = pgm_read_byte(pstr)) != '\0')
@@ -366,7 +381,11 @@ void lcd_implementation_drawedit(const char* pstr, char* value)
366 381
     lcd.setCursor(1, 1);
367 382
     lcd_printPGM(pstr);
368 383
     lcd.print(':');
369
-    lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1);
384
+   #if LCD_WIDTH < 20
385
+    	lcd.setCursor(LCD_WIDTH - strlen(value), 1);
386
+    #else
387
+    	lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1);
388
+   #endif
370 389
     lcd.print(value);
371 390
 }
372 391
 static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)

Loading…
Cancel
Save