Browse Source

Merge pull request #8945 from thinkyhead/bf2_better_char_lcd

[2.0.x] Display up to 3 extruders on char LCD
Scott Lahteine 6 years ago
parent
commit
8274369522
No account linked to committer's email address
1 changed files with 36 additions and 16 deletions
  1. 36
    16
      Marlin/src/lcd/ultralcd_impl_HD44780.h

+ 36
- 16
Marlin/src/lcd/ultralcd_impl_HD44780.h View File

@@ -78,12 +78,12 @@ extern volatile uint8_t buttons;  //an extended version of the last checked butt
78 78
 
79 79
     #if BUTTON_EXISTS(ENC)
80 80
       // the pause/stop/restart button is connected to BTN_ENC when used
81
-      #define B_ST (EN_C)                              // Map the pause/stop/resume button into its normalized functional name
81
+      #define B_ST (EN_C)                            // Map the pause/stop/resume button into its normalized functional name
82 82
       #undef LCD_CLICKED
83
-      #define LCD_CLICKED (buttons & (B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
83
+      #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
84 84
     #else
85 85
       #undef LCD_CLICKED
86
-      #define LCD_CLICKED (buttons & (B_MI|B_RI))
86
+      #define LCD_CLICKED (buttons&(B_MI|B_RI))
87 87
     #endif
88 88
 
89 89
     // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
@@ -635,7 +635,11 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
635 635
 }
636 636
 
637 637
 FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) {
638
-  const bool isBed = heater < 0;
638
+  #if TEMP_SENSOR_BED
639
+    const bool isBed = heater < 0;
640
+  #else
641
+    constexpr bool isBed = false;
642
+  #endif
639 643
 
640 644
   const float t1 = (isBed ? thermalManager.degBed()       : thermalManager.degHotend(heater)),
641 645
               t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
@@ -735,7 +739,7 @@ static void lcd_implementation_status_screen() {
735 739
     //
736 740
     // Hotend 1 or Bed Temperature
737 741
     //
738
-    #if HOTENDS > 1 || TEMP_SENSOR_BED != 0
742
+    #if HOTENDS > 1 || TEMP_SENSOR_BED
739 743
 
740 744
       lcd.setCursor(8, 0);
741 745
       #if HOTENDS > 1
@@ -746,7 +750,7 @@ static void lcd_implementation_status_screen() {
746 750
         _draw_heater_status(-1, -1, blink);
747 751
       #endif
748 752
 
749
-    #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
753
+    #endif // HOTENDS > 1 || TEMP_SENSOR_BED
750 754
 
751 755
   #else // LCD_WIDTH >= 20
752 756
 
@@ -758,12 +762,17 @@ static void lcd_implementation_status_screen() {
758 762
     //
759 763
     // Hotend 1 or Bed Temperature
760 764
     //
761
-    #if HOTENDS > 1 || TEMP_SENSOR_BED != 0
765
+    #if HOTENDS > 1 || TEMP_SENSOR_BED
762 766
       lcd.setCursor(10, 0);
763 767
       #if HOTENDS > 1
764 768
         _draw_heater_status(1, LCD_STR_THERMOMETER[0], blink);
765 769
       #else
766
-        _draw_heater_status(-1, LCD_BEDTEMP_CHAR, blink);
770
+        _draw_heater_status(-1, (
771
+          #if HAS_LEVELING
772
+            planner.leveling_active && blink ? '_' :
773
+          #endif
774
+          LCD_BEDTEMP_CHAR
775
+        ), blink);
767 776
       #endif
768 777
 
769 778
     #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
@@ -792,14 +801,25 @@ static void lcd_implementation_status_screen() {
792 801
 
793 802
       lcd.setCursor(0, 1);
794 803
 
795
-      #if HOTENDS > 1 && TEMP_SENSOR_BED != 0
804
+      // If the first line has two extruder temps,
805
+      // show more temperatures on the next line
806
+      // instead of 
796 807
 
797
-        // If we both have a 2nd extruder and a heated bed,
798
-        // show the heated bed temp on the left,
799
-        // since the first line is filled with extruder temps
800
-      _draw_heater_status(-1, LCD_BEDTEMP_CHAR, blink);
808
+      #if HOTENDS > 2 || (HOTENDS > 1 && TEMP_SENSOR_BED)
801 809
 
802
-      #else
810
+        #if HOTENDS > 2
811
+          _draw_heater_status(2, LCD_STR_THERMOMETER[0], blink);
812
+          lcd.setCursor(10, 1);
813
+        #endif
814
+
815
+        _draw_heater_status(-1, (
816
+          #if HAS_LEVELING
817
+            planner.leveling_active && blink ? '_' :
818
+          #endif
819
+          LCD_BEDTEMP_CHAR
820
+        ), blink);
821
+
822
+      #else // HOTENDS <= 2 && (HOTENDS <= 1 || !TEMP_SENSOR_BED)
803 823
         // Before homing the axis letters are blinking 'X' <-> '?'.
804 824
         // When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
805 825
         // When everything is ok you see a constant 'X'.
@@ -812,7 +832,7 @@ static void lcd_implementation_status_screen() {
812 832
         _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
813 833
         lcd.print(ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])));
814 834
 
815
-      #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
835
+      #endif // HOTENDS <= 2 && (HOTENDS <= 1 || !TEMP_SENSOR_BED)
816 836
 
817 837
     #endif // LCD_WIDTH >= 20
818 838
 
@@ -820,7 +840,7 @@ static void lcd_implementation_status_screen() {
820 840
     _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
821 841
     lcd.print(ftostr52sp(FIXFLOAT(current_position[Z_AXIS])));
822 842
 
823
-    #if HAS_LEVELING
843
+    #if HAS_LEVELING && !TEMP_SENSOR_BED
824 844
       lcd.write(planner.leveling_active || blink ? '_' : ' ');
825 845
     #endif
826 846
 

Loading…
Cancel
Save