Browse Source

Cleanup formatting in hitachi & dogm lcd

Scott Lahteine 10 years ago
parent
commit
756bb5e268
2 changed files with 137 additions and 123 deletions
  1. 14
    14
      Marlin/dogm_lcd_implementation.h
  2. 123
    109
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 14
- 14
Marlin/dogm_lcd_implementation.h View File

37
 
37
 
38
 // save 3120 bytes of PROGMEM by commenting out #define USE_BIG_EDIT_FONT
38
 // save 3120 bytes of PROGMEM by commenting out #define USE_BIG_EDIT_FONT
39
 // we don't have a big font for Cyrillic, Kana
39
 // we don't have a big font for Cyrillic, Kana
40
-#if defined( MAPPER_C2C3 ) || defined( MAPPER_NON )
41
-//  #define USE_BIG_EDIT_FONT
40
+#if defined(MAPPER_C2C3) || defined(MAPPER_NON)
41
+  //#define USE_BIG_EDIT_FONT
42
 #endif
42
 #endif
43
 
43
 
44
 // If you have spare 2300Byte of progmem and want to use a 
44
 // If you have spare 2300Byte of progmem and want to use a 
126
 
126
 
127
 // LCD selection
127
 // LCD selection
128
 #ifdef U8GLIB_ST7920
128
 #ifdef U8GLIB_ST7920
129
-//U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
130
-U8GLIB_ST7920_128X64_RRD u8g(0);
129
+  //U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
130
+  U8GLIB_ST7920_128X64_RRD u8g(0);
131
 #elif defined(MAKRPANEL)
131
 #elif defined(MAKRPANEL)
132
-// The MaKrPanel display, ST7565 controller as well
133
-U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
132
+  // The MaKrPanel display, ST7565 controller as well
133
+  U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
134
 #elif defined(VIKI2) || defined(miniVIKI)
134
 #elif defined(VIKI2) || defined(miniVIKI)
135
-// Mini Viki and Viki 2.0 LCD, ST7565 controller as well
136
-U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
135
+  // Mini Viki and Viki 2.0 LCD, ST7565 controller as well
136
+  U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
137
 #else
137
 #else
138
-// for regular DOGM128 display with HW-SPI
139
-U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);  // HW-SPI Com: CS, A0
138
+  // for regular DOGM128 display with HW-SPI
139
+  U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);  // HW-SPI Com: CS, A0
140
 #endif
140
 #endif
141
 
141
 
142
 #include "utf_mapper.h"
142
 #include "utf_mapper.h"
188
 
188
 
189
 static bool show_splashscreen = true;
189
 static bool show_splashscreen = true;
190
 
190
 
191
-static void lcd_implementation_init()
192
-{
191
+static void lcd_implementation_init() {
192
+
193
   #ifdef LCD_PIN_BL // Enable LCD backlight
193
   #ifdef LCD_PIN_BL // Enable LCD backlight
194
     pinMode(LCD_PIN_BL, OUTPUT);
194
     pinMode(LCD_PIN_BL, OUTPUT);
195
 	  digitalWrite(LCD_PIN_BL, HIGH);
195
 	  digitalWrite(LCD_PIN_BL, HIGH);
359
   // Status line
359
   // Status line
360
   lcd_setFont(FONT_STATUSMENU);
360
   lcd_setFont(FONT_STATUSMENU);
361
   #ifdef USE_SMALL_INFOFONT
361
   #ifdef USE_SMALL_INFOFONT
362
-  u8g.setPrintPos(0,62);
362
+    u8g.setPrintPos(0,62);
363
   #else
363
   #else
364
-  u8g.setPrintPos(0,63);
364
+    u8g.setPrintPos(0,63);
365
   #endif
365
   #endif
366
   #ifndef FILAMENT_LCD_DISPLAY
366
   #ifndef FILAMENT_LCD_DISPLAY
367
     lcd_print(lcd_status_message);
367
     lcd_print(lcd_status_message);

+ 123
- 109
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

443
 
443
 
444
 20x4   |01234567890123456789|
444
 20x4   |01234567890123456789|
445
        |T000/000D B000/000D |
445
        |T000/000D B000/000D |
446
-       |X+000.0 Y+000.0 Z+000.0|
446
+       |X000  Y000   Z000.00|
447
        |F100%  SD100% T--:--|
447
        |F100%  SD100% T--:--|
448
        |Status line.........|
448
        |Status line.........|
449
 
449
 
453
        |F100%  SD100% T--:--|
453
        |F100%  SD100% T--:--|
454
        |Status line.........|
454
        |Status line.........|
455
 */
455
 */
456
-static void lcd_implementation_status_screen()
457
-{
458
-    int tHotend=int(degHotend(0) + 0.5);
459
-    int tTarget=int(degTargetHotend(0) + 0.5);
456
+static void lcd_implementation_status_screen() {
457
+  int tHotend = int(degHotend(0) + 0.5);
458
+  int tTarget = int(degTargetHotend(0) + 0.5);
459
+
460
+  #if LCD_WIDTH < 20
460
 
461
 
461
-#if LCD_WIDTH < 20
462
     lcd.setCursor(0, 0);
462
     lcd.setCursor(0, 0);
463
     lcd.print(itostr3(tHotend));
463
     lcd.print(itostr3(tHotend));
464
     lcd.print('/');
464
     lcd.print('/');
465
     lcd.print(itostr3left(tTarget));
465
     lcd.print(itostr3left(tTarget));
466
 
466
 
467
-# if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
468
-    //If we have an 2nd extruder or heated bed, show that in the top right corner
469
-    lcd.setCursor(8, 0);
470
-#  if EXTRUDERS > 1
471
-    tHotend = int(degHotend(1) + 0.5);
472
-    tTarget = int(degTargetHotend(1) + 0.5);
473
-    lcd.print(LCD_STR_THERMOMETER[0]);
474
-#  else//Heated bed
475
-    tHotend=int(degBed() + 0.5);
476
-    tTarget=int(degTargetBed() + 0.5);
477
-    lcd.print(LCD_STR_BEDTEMP[0]);
478
-#  endif
479
-    lcd.print(itostr3(tHotend));
480
-    lcd.print('/');
481
-    lcd.print(itostr3left(tTarget));
482
-# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
467
+    #if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
468
+
469
+      // If we have an 2nd extruder or heated bed, show that in the top right corner
470
+      lcd.setCursor(8, 0);
471
+      #if EXTRUDERS > 1
472
+        tHotend = int(degHotend(1) + 0.5);
473
+        tTarget = int(degTargetHotend(1) + 0.5);
474
+        lcd.print(LCD_STR_THERMOMETER[0]);
475
+      #else // Heated bed
476
+        tHotend = int(degBed() + 0.5);
477
+        tTarget = int(degTargetBed() + 0.5);
478
+        lcd.print(LCD_STR_BEDTEMP[0]);
479
+      #endif
480
+      lcd.print(itostr3(tHotend));
481
+      lcd.print('/');
482
+      lcd.print(itostr3left(tTarget));
483
+
484
+    #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
485
+
486
+  #else // LCD_WIDTH > 19
483
 
487
 
484
-#else//LCD_WIDTH > 19
485
     lcd.setCursor(0, 0);
488
     lcd.setCursor(0, 0);
486
     lcd.print(LCD_STR_THERMOMETER[0]);
489
     lcd.print(LCD_STR_THERMOMETER[0]);
487
     lcd.print(itostr3(tHotend));
490
     lcd.print(itostr3(tHotend));
488
     lcd.print('/');
491
     lcd.print('/');
489
     lcd.print(itostr3left(tTarget));
492
     lcd.print(itostr3left(tTarget));
490
     lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
493
     lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
491
-    if (tTarget < 10)
492
-        lcd.print(' ');
493
-
494
-# if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
495
-    //If we have an 2nd extruder or heated bed, show that in the top right corner
496
-    lcd.setCursor(10, 0);
497
-#  if EXTRUDERS > 1
498
-    tHotend = int(degHotend(1) + 0.5);
499
-    tTarget = int(degTargetHotend(1) + 0.5);
500
-    lcd.print(LCD_STR_THERMOMETER[0]);
501
-#  else//Heated bed
502
-    tHotend=int(degBed() + 0.5);
503
-    tTarget=int(degTargetBed() + 0.5);
504
-    lcd.print(LCD_STR_BEDTEMP[0]);
505
-#  endif
506
-    lcd.print(itostr3(tHotend));
507
-    lcd.print('/');
508
-    lcd.print(itostr3left(tTarget));
509
-    lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
510
-    if (tTarget < 10)
511
-        lcd.print(' ');
512
-# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
513
-#endif//LCD_WIDTH > 19
514
-
515
-#if LCD_HEIGHT > 2
516
-//Lines 2 for 4 line LCD
517
-# if LCD_WIDTH < 20
518
-#  ifdef SDSUPPORT
519
-    lcd.setCursor(0, 2);
520
-    lcd_printPGM(PSTR("SD"));
521
-    if (IS_SD_PRINTING)
522
-        lcd.print(itostr3(card.percentDone()));
523
-    else
524
-        lcd_printPGM(PSTR("---"));
525
-    lcd.print('%');
526
-#  endif//SDSUPPORT
527
-# else//LCD_WIDTH > 19
528
-#  if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
529
-    //If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
530
-    tHotend=int(degBed() + 0.5);
531
-    tTarget=int(degTargetBed() + 0.5);
532
-
533
-    lcd.setCursor(0, 1);
534
-    lcd.print(LCD_STR_BEDTEMP[0]);
535
-    lcd.print(itostr3(tHotend));
536
-    lcd.print('/');
537
-    lcd.print(itostr3left(tTarget));
538
-    lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
539
-    if (tTarget < 10)
540
-        lcd.print(' ');
541
-#  else
542
-    lcd.setCursor(0,1);
543
-    lcd.print('X');
544
-    lcd.print(ftostr3(current_position[X_AXIS]));
545
-    lcd_printPGM(PSTR(" Y"));
546
-    lcd.print(ftostr3(current_position[Y_AXIS]));
547
-#  endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
548
-# endif//LCD_WIDTH > 19
494
+    if (tTarget < 10) lcd.print(' ');
495
+
496
+    #if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
497
+      // If we have an 2nd extruder or heated bed, show that in the top right corner
498
+      lcd.setCursor(10, 0);
499
+      #if EXTRUDERS > 1
500
+        tHotend = int(degHotend(1) + 0.5);
501
+        tTarget = int(degTargetHotend(1) + 0.5);
502
+        lcd.print(LCD_STR_THERMOMETER[0]);
503
+      #else // Heated bed
504
+        tHotend = int(degBed() + 0.5);
505
+        tTarget = int(degTargetBed() + 0.5);
506
+        lcd.print(LCD_STR_BEDTEMP[0]);
507
+      #endif
508
+      lcd.print(itostr3(tHotend));
509
+      lcd.print('/');
510
+      lcd.print(itostr3left(tTarget));
511
+      lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
512
+      if (tTarget < 10) lcd.print(' ');
513
+
514
+    #endif  // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
515
+
516
+  #endif // LCD_WIDTH > 19
517
+
518
+  #if LCD_HEIGHT > 2
519
+    // Lines 2 for 4 line LCD
520
+    #if LCD_WIDTH < 20
521
+      #ifdef SDSUPPORT
522
+        lcd.setCursor(0, 2);
523
+        lcd_printPGM(PSTR("SD"));
524
+        if (IS_SD_PRINTING)
525
+          lcd.print(itostr3(card.percentDone()));
526
+        else
527
+          lcd_printPGM(PSTR("---"));
528
+          lcd.print('%');
529
+      #endif // SDSUPPORT
530
+
531
+    #else // LCD_WIDTH > 19
532
+
533
+      #if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
534
+        // If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
535
+        tHotend = int(degBed() + 0.5);
536
+        tTarget = int(degTargetBed() + 0.5);
537
+
538
+        lcd.setCursor(0, 1);
539
+        lcd.print(LCD_STR_BEDTEMP[0]);
540
+        lcd.print(itostr3(tHotend));
541
+        lcd.print('/');
542
+        lcd.print(itostr3left(tTarget));
543
+        lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
544
+        if (tTarget < 10) lcd.print(' ');
545
+      #else
546
+        lcd.setCursor(0,1);
547
+        lcd.print('X');
548
+        lcd.print(ftostr3(current_position[X_AXIS]));
549
+        lcd_printPGM(PSTR("  Y"));
550
+        lcd.print(ftostr3(current_position[Y_AXIS]));
551
+      #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
552
+
553
+    #endif // LCD_WIDTH > 19
554
+
549
     lcd.setCursor(LCD_WIDTH - 8, 1);
555
     lcd.setCursor(LCD_WIDTH - 8, 1);
550
     lcd.print('Z');
556
     lcd.print('Z');
551
     lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
557
     lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
552
-#endif//LCD_HEIGHT > 2
553
 
558
 
554
-#if LCD_HEIGHT > 3
559
+  #endif // LCD_HEIGHT > 2
560
+
561
+  #if LCD_HEIGHT > 3
562
+
555
     lcd.setCursor(0, 2);
563
     lcd.setCursor(0, 2);
556
     lcd.print(LCD_STR_FEEDRATE[0]);
564
     lcd.print(LCD_STR_FEEDRATE[0]);
557
     lcd.print(itostr3(feedmultiply));
565
     lcd.print(itostr3(feedmultiply));
558
     lcd.print('%');
566
     lcd.print('%');
559
-# if LCD_WIDTH > 19
560
-#  ifdef SDSUPPORT
561
-    lcd.setCursor(7, 2);
562
-    lcd_printPGM(PSTR("SD"));
563
-    if (IS_SD_PRINTING)
567
+
568
+    #if LCD_WIDTH > 19 && defined(SDSUPPORT)
569
+
570
+      lcd.setCursor(7, 2);
571
+      lcd_printPGM(PSTR("SD"));
572
+      if (IS_SD_PRINTING)
564
         lcd.print(itostr3(card.percentDone()));
573
         lcd.print(itostr3(card.percentDone()));
565
-    else
574
+      else
566
         lcd_printPGM(PSTR("---"));
575
         lcd_printPGM(PSTR("---"));
567
-    lcd.print('%');
568
-#  endif//SDSUPPORT
569
-# endif//LCD_WIDTH > 19
576
+      lcd.print('%');
577
+
578
+    #endif // LCD_WIDTH > 19 && SDSUPPORT
579
+
570
     lcd.setCursor(LCD_WIDTH - 6, 2);
580
     lcd.setCursor(LCD_WIDTH - 6, 2);
571
     lcd.print(LCD_STR_CLOCK[0]);
581
     lcd.print(LCD_STR_CLOCK[0]);
572
-    if(starttime != 0)
573
-    {
574
-        uint16_t time = millis()/60000 - starttime/60000;
575
-        lcd.print(itostr2(time/60));
576
-        lcd.print(':');
577
-        lcd.print(itostr2(time%60));
578
-    }else{
579
-        lcd_printPGM(PSTR("--:--"));
582
+    if (starttime != 0) {
583
+      uint16_t time = millis()/60000 - starttime/60000;
584
+      lcd.print(itostr2(time/60));
585
+      lcd.print(':');
586
+      lcd.print(itostr2(time%60));
580
     }
587
     }
581
-#endif
588
+    else {
589
+      lcd_printPGM(PSTR("--:--"));
590
+    }
591
+
592
+  #endif // LCD_HEIGHT > 3
593
+
594
+  /**
595
+   * Display Progress Bar, Filament display, and/or Status Message on the last line
596
+   */
582
 
597
 
583
-  // Status message line at the bottom
584
   lcd.setCursor(0, LCD_HEIGHT - 1);
598
   lcd.setCursor(0, LCD_HEIGHT - 1);
585
 
599
 
586
   #ifdef LCD_PROGRESS_BAR
600
   #ifdef LCD_PROGRESS_BAR
587
 
601
 
588
     if (card.isFileOpen()) {
602
     if (card.isFileOpen()) {
589
-      uint16_t mil = millis(), diff = mil - progressBarTick;
590
-      if (diff >= PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
603
+      if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
591
         // draw the progress bar
604
         // draw the progress bar
592
         int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
605
         int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
593
           cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
606
           cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
605
       }
618
       }
606
     } //card.isFileOpen
619
     } //card.isFileOpen
607
 
620
 
608
-  #endif //LCD_PROGRESS_BAR
621
+  #elif defined(FILAMENT_LCD_DISPLAY)
609
 
622
 
610
-  //Display both Status message line and Filament display on the last line
611
-  #ifdef FILAMENT_LCD_DISPLAY
612
-    if (message_millis + 5000 <= millis()) {  //display any status for the first 5 sec after screen is initiated
623
+    // Show Filament Diameter and Volumetric Multiplier %
624
+    // After allowing lcd_status_message to show for 5 seconds
625
+    if (millis() >= message_millis + 5000) {
613
       lcd_printPGM(PSTR("Dia "));
626
       lcd_printPGM(PSTR("Dia "));
614
       lcd.print(ftostr12ns(filament_width_meas));
627
       lcd.print(ftostr12ns(filament_width_meas));
615
       lcd_printPGM(PSTR(" V"));
628
       lcd_printPGM(PSTR(" V"));
617
   	  lcd.print('%');
630
   	  lcd.print('%');
618
   	  return;
631
   	  return;
619
     }
632
     }
620
-  #endif //FILAMENT_LCD_DISPLAY
633
+
634
+  #endif // FILAMENT_LCD_DISPLAY
621
 
635
 
622
   lcd_print(lcd_status_message);
636
   lcd_print(lcd_status_message);
623
 }
637
 }

Loading…
Cancel
Save