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
 static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
297
 static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
298
 {
298
 {
299
     char c;
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
     lcd.setCursor(0, row);
306
     lcd.setCursor(0, row);
302
     lcd.print(pre_char);
307
     lcd.print(pre_char);
303
     while((c = pgm_read_byte(pstr)) != '\0')
308
     while((c = pgm_read_byte(pstr)) != '\0')
314
 static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
319
 static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
315
 {
320
 {
316
     char c;
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
     lcd.setCursor(0, row);
328
     lcd.setCursor(0, row);
319
     lcd.print(pre_char);
329
     lcd.print(pre_char);
320
     while((c = pgm_read_byte(pstr)) != '\0')
330
     while((c = pgm_read_byte(pstr)) != '\0')
331
 static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data)
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
     char c;
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
     lcd.setCursor(0, row);
350
     lcd.setCursor(0, row);
336
     lcd.print(pre_char);
351
     lcd.print(pre_char);
337
     while((c = pgm_read_byte(pstr)) != '\0')
352
     while((c = pgm_read_byte(pstr)) != '\0')
366
     lcd.setCursor(1, 1);
381
     lcd.setCursor(1, 1);
367
     lcd_printPGM(pstr);
382
     lcd_printPGM(pstr);
368
     lcd.print(':');
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
     lcd.print(value);
389
     lcd.print(value);
371
 }
390
 }
372
 static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
391
 static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)

Loading…
Cancel
Save