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
 
78
 
79
     #if BUTTON_EXISTS(ENC)
79
     #if BUTTON_EXISTS(ENC)
80
       // the pause/stop/restart button is connected to BTN_ENC when used
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
       #undef LCD_CLICKED
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
     #else
84
     #else
85
       #undef LCD_CLICKED
85
       #undef LCD_CLICKED
86
-      #define LCD_CLICKED (buttons & (B_MI|B_RI))
86
+      #define LCD_CLICKED (buttons&(B_MI|B_RI))
87
     #endif
87
     #endif
88
 
88
 
89
     // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
89
     // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
635
 }
635
 }
636
 
636
 
637
 FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) {
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
   const float t1 = (isBed ? thermalManager.degBed()       : thermalManager.degHotend(heater)),
644
   const float t1 = (isBed ? thermalManager.degBed()       : thermalManager.degHotend(heater)),
641
               t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
645
               t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
735
     //
739
     //
736
     // Hotend 1 or Bed Temperature
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
       lcd.setCursor(8, 0);
744
       lcd.setCursor(8, 0);
741
       #if HOTENDS > 1
745
       #if HOTENDS > 1
746
         _draw_heater_status(-1, -1, blink);
750
         _draw_heater_status(-1, -1, blink);
747
       #endif
751
       #endif
748
 
752
 
749
-    #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
753
+    #endif // HOTENDS > 1 || TEMP_SENSOR_BED
750
 
754
 
751
   #else // LCD_WIDTH >= 20
755
   #else // LCD_WIDTH >= 20
752
 
756
 
758
     //
762
     //
759
     // Hotend 1 or Bed Temperature
763
     // Hotend 1 or Bed Temperature
760
     //
764
     //
761
-    #if HOTENDS > 1 || TEMP_SENSOR_BED != 0
765
+    #if HOTENDS > 1 || TEMP_SENSOR_BED
762
       lcd.setCursor(10, 0);
766
       lcd.setCursor(10, 0);
763
       #if HOTENDS > 1
767
       #if HOTENDS > 1
764
         _draw_heater_status(1, LCD_STR_THERMOMETER[0], blink);
768
         _draw_heater_status(1, LCD_STR_THERMOMETER[0], blink);
765
       #else
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
       #endif
776
       #endif
768
 
777
 
769
     #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
778
     #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
792
 
801
 
793
       lcd.setCursor(0, 1);
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
         // Before homing the axis letters are blinking 'X' <-> '?'.
823
         // Before homing the axis letters are blinking 'X' <-> '?'.
804
         // When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
824
         // When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
805
         // When everything is ok you see a constant 'X'.
825
         // When everything is ok you see a constant 'X'.
812
         _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
832
         _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
813
         lcd.print(ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])));
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
     #endif // LCD_WIDTH >= 20
837
     #endif // LCD_WIDTH >= 20
818
 
838
 
820
     _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
840
     _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
821
     lcd.print(ftostr52sp(FIXFLOAT(current_position[Z_AXIS])));
841
     lcd.print(ftostr52sp(FIXFLOAT(current_position[Z_AXIS])));
822
 
842
 
823
-    #if HAS_LEVELING
843
+    #if HAS_LEVELING && !TEMP_SENSOR_BED
824
       lcd.write(planner.leveling_active || blink ? '_' : ' ');
844
       lcd.write(planner.leveling_active || blink ? '_' : ' ');
825
     #endif
845
     #endif
826
 
846
 

Loading…
Cancel
Save