Quellcode durchsuchen

Merge pull request #6154 from thinkyhead/rc_fil_sensor_vs_sd

Show Filament Width on LCD when SD is disabled
Scott Lahteine vor 7 Jahren
Ursprung
Commit
af09095f03

+ 4
- 0
Marlin/Conditionals_LCD.h Datei anzeigen

@@ -224,6 +224,10 @@
224 224
     #define LCD_STR_SPECIAL_MAX '\x09'
225 225
     // Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin.
226 226
     // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
227
+
228
+    // Symbol characters
229
+    #define LCD_STR_FILAM_DIA   "\xf8"
230
+    #define LCD_STR_FILAM_MUL   "\xa4"
227 231
   #else
228 232
     /* Custom characters defined in the first 8 characters of the LCD */
229 233
     #define LCD_STR_BEDTEMP     "\x00"  // Print only as a char. This will have 'unexpected' results when used in a string!

+ 3
- 3
Marlin/ultralcd.cpp Datei anzeigen

@@ -47,7 +47,7 @@ extern float zprobe_zoffset;
47 47
 
48 48
 int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
49 49
 
50
-#if ENABLED(FILAMENT_LCD_DISPLAY)
50
+#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
51 51
   millis_t previous_lcd_status_ms = 0;
52 52
 #endif
53 53
 
@@ -547,7 +547,7 @@ void lcd_status_screen() {
547 547
   #if ENABLED(ULTIPANEL)
548 548
 
549 549
     if (lcd_clicked) {
550
-      #if ENABLED(FILAMENT_LCD_DISPLAY)
550
+      #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
551 551
         previous_lcd_status_ms = millis();  // get status message to show up for a while
552 552
       #endif
553 553
       lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
@@ -3456,7 +3456,7 @@ void lcd_finishstatus(bool persist=false) {
3456 3456
   #endif
3457 3457
   lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
3458 3458
 
3459
-  #if ENABLED(FILAMENT_LCD_DISPLAY)
3459
+  #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
3460 3460
     previous_lcd_status_ms = millis();  //get status message to show up for a while
3461 3461
   #endif
3462 3462
 }

+ 1
- 1
Marlin/ultralcd.h Datei anzeigen

@@ -93,7 +93,7 @@
93 93
 
94 94
   #endif
95 95
 
96
-  #if ENABLED(FILAMENT_LCD_DISPLAY)
96
+  #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
97 97
     extern millis_t previous_lcd_status_ms;
98 98
   #endif
99 99
 

+ 30
- 5
Marlin/ultralcd_impl_DOGM.h Datei anzeigen

@@ -535,12 +535,19 @@ static void lcd_implementation_status_screen() {
535 535
   // When everything is ok you see a constant 'X'.
536 536
 
537 537
   static char xstring[5], ystring[5], zstring[7];
538
+  #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
539
+    static char wstring[5], mstring[4];
540
+  #endif
538 541
 
539 542
   // At the first page, regenerate the XYZ strings
540 543
   if (page.page == 0) {
541 544
     strcpy(xstring, ftostr4sign(current_position[X_AXIS]));
542 545
     strcpy(ystring, ftostr4sign(current_position[Y_AXIS]));
543 546
     strcpy(zstring, ftostr52sp(current_position[Z_AXIS] + 0.00001));
547
+    #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
548
+      strcpy(wstring, ftostr12ns(filament_width_meas));
549
+      strcpy(mstring, itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
550
+    #endif
544 551
   }
545 552
 
546 553
   if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) {
@@ -591,6 +598,22 @@ static void lcd_implementation_status_screen() {
591 598
     u8g.setPrintPos(12, 50);
592 599
     lcd_print(itostr3(feedrate_percentage));
593 600
     u8g.print('%');
601
+
602
+    //
603
+    // Filament sensor display if SD is disabled
604
+    //
605
+    #if DISABLED(SDSUPPORT) && ENABLED(FILAMENT_LCD_DISPLAY)
606
+      u8g.setPrintPos(56, 50);
607
+      lcd_print(wstring);
608
+      u8g.setPrintPos(102, 50);
609
+      lcd_print(mstring);
610
+      u8g.print('%');
611
+      lcd_setFont(FONT_MENU);
612
+      u8g.setPrintPos(47, 50);
613
+      lcd_print(LCD_STR_FILAM_DIA);
614
+      u8g.setPrintPos(93, 50);
615
+      lcd_print(LCD_STR_FILAM_MUL);
616
+    #endif
594 617
   }
595 618
 
596 619
   //
@@ -602,19 +625,21 @@ static void lcd_implementation_status_screen() {
602 625
   if (PAGE_CONTAINS(STATUS_BASELINE + 1 - INFO_FONT_HEIGHT, STATUS_BASELINE)) {
603 626
     u8g.setPrintPos(0, STATUS_BASELINE);
604 627
 
605
-    #if DISABLED(FILAMENT_LCD_DISPLAY)
606
-      lcd_print(lcd_status_message);
607
-    #else
628
+    #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
608 629
       if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) {  //Display both Status message line and Filament display on the last line
609 630
         lcd_print(lcd_status_message);
610 631
       }
611 632
       else {
612
-        lcd_printPGM(PSTR("dia:"));
633
+        lcd_printPGM(PSTR(LCD_STR_FILAM_DIA));
634
+        u8g.print(':');
613 635
         lcd_print(ftostr12ns(filament_width_meas));
614
-        lcd_printPGM(PSTR(" factor:"));
636
+        lcd_printPGM(PSTR("  " LCD_STR_FILAM_MUL));
637
+        u8g.print(':');
615 638
         lcd_print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
616 639
         u8g.print('%');
617 640
       }
641
+    #else
642
+      lcd_print(lcd_status_message);
618 643
     #endif
619 644
   }
620 645
 }

+ 7
- 9
Marlin/ultralcd_impl_HD44780.h Datei anzeigen

@@ -396,7 +396,7 @@ void lcd_print(char c) { charset_mapper(c); }
396 396
   void lcd_erase_line(const int line) {
397 397
     lcd.setCursor(0, line);
398 398
     for (uint8_t i = LCD_WIDTH + 1; --i;)
399
-      lcd_print(' ');
399
+      lcd.print(' ');
400 400
   }
401 401
 
402 402
   // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
@@ -775,14 +775,12 @@ static void lcd_implementation_status_screen() {
775 775
 
776 776
   #if ENABLED(LCD_PROGRESS_BAR)
777 777
 
778
-    if (card.isFileOpen()) {
779
-      // Draw the progress bar if the message has shown long enough
780
-      // or if there is no message set.
781
-      if (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])
782
-        return lcd_draw_progress_bar(card.percentDone());
783
-    } //card.isFileOpen
778
+    // Draw the progress bar if the message has shown long enough
779
+    // or if there is no message set.
780
+    if (card.isFileOpen() && ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])
781
+      return lcd_draw_progress_bar(card.percentDone());
784 782
 
785
-  #elif ENABLED(FILAMENT_LCD_DISPLAY)
783
+  #elif ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
786 784
 
787 785
     // Show Filament Diameter and Volumetric Multiplier %
788 786
     // After allowing lcd_status_message to show for 5 seconds
@@ -795,7 +793,7 @@ static void lcd_implementation_status_screen() {
795 793
       return;
796 794
     }
797 795
 
798
-  #endif // FILAMENT_LCD_DISPLAY
796
+  #endif // FILAMENT_LCD_DISPLAY && SDSUPPORT
799 797
 
800 798
   lcd_print(lcd_status_message);
801 799
 }

Laden…
Abbrechen
Speichern