@@ -583,16 +583,21 @@ bool _display_need_refresh = true;
583
583
bool _temp_range_need_update = true ;
584
584
585
585
// ------------------------------------------------------------------------------
586
- void drawIco (int16_t x, int16_t y, const char *ico, bool on = true ) {
587
586
#if THERMOSTAT_DISPLAY_ST7735_SUPPORT
588
- uint16_t color;
587
+
588
+ void drawIco (int16_t x, int16_t y, const char *ico, bool on = true ) {
589
589
display.drawBitmap (x, y, (const uint8_t *) ico, 16 , 16 , ((on == true ) ? ST7735_WHITE : ST77XX_BLACK));
590
+ _display_need_refresh = true ;
591
+
590
592
#else
593
+
594
+ void drawIco (int16_t x, int16_t y, const char *ico, bool on = true ) {
591
595
display.drawIco16x16 (x, y, ico, !on); // FIXME
592
- #endif
593
596
_display_need_refresh = true ;
594
597
}
595
598
599
+ #endif
600
+
596
601
// ------------------------------------------------------------------------------
597
602
void display_wifi_status (bool on) {
598
603
_display_wifi_status = on;
@@ -618,32 +623,41 @@ void display_remote_temp_status(bool on) {
618
623
}
619
624
620
625
// ------------------------------------------------------------------------------
626
+ #if THERMOSTAT_DISPLAY_ST7735_SUPPORT
627
+
621
628
void display_temp_range () {
622
629
_temp_range.need_display_update = false ;
623
- #if THERMOSTAT_DISPLAY_ST7735_SUPPORT
624
630
display.fillRect (68 , 0 , ST7735_TFTHEIGHT_160 - 60 , 16 , ST7735_BLACK);
625
631
display.setTextColor (ST77XX_WHITE);
626
632
display.setTextWrap (true );
627
633
display.setCursor (90 , 0 + 13 );
628
634
display.setFont (&Roboto_Thin9pt8b);
629
635
String temp_range = String (_temp_range.min ) + " \xB0 - " + String (_temp_range.max ) + " \xB0 " ;
630
636
display.print (temp_range);
637
+ _display_need_refresh = true ;
638
+ }
639
+
631
640
#else
641
+
642
+ void display_temp_range () {
643
+ _temp_range.need_display_update = false ;
632
644
display.setColor (BLACK);
633
645
display.fillRect (68 , 0 , 60 , 16 );
634
646
display.setColor (WHITE);
635
647
display.setTextAlignment (TEXT_ALIGN_RIGHT);
636
648
display.setFont (ArialMT_Plain_16);
637
649
String temp_range = String (_temp_range.min ) + " °- " + String (_temp_range.max ) + " °" ;
638
650
display.drawString (128 /* x*/ , 0 /* y*/ , temp_range);
639
- #endif
640
651
_display_need_refresh = true ;
641
652
}
642
653
654
+ #endif
655
+
643
656
// ------------------------------------------------------------------------------
657
+ #if THERMOSTAT_DISPLAY_ST7735_SUPPORT
658
+
644
659
void display_remote_temp () {
645
660
_remote_temp.need_display_update = false ;
646
- #if THERMOSTAT_DISPLAY_ST7735_SUPPORT
647
661
display.fillRect (0 , 16 , ST7735_TFTHEIGHT_160, 16 , ST77XX_BLACK);
648
662
649
663
display.setTextColor (ST77XX_WHITE);
@@ -657,8 +671,13 @@ void display_remote_temp() {
657
671
display.setCursor (75 , 16 + 13 );
658
672
String temp_range_vol = String (" = " ) + (_display_remote_temp_status ? String (_remote_temp.temp , 1 ) : String (" ?" )) + " \xB0 " ;
659
673
display.print (temp_range_vol);
660
- // FIXME
674
+ _display_need_refresh = true ;
675
+ }
676
+
661
677
#else
678
+
679
+ void display_remote_temp () {
680
+ _remote_temp.need_display_update = false ;
662
681
display.setColor (BLACK);
663
682
display.fillRect (0 , 16 , 128 , 16 );
664
683
display.setColor (WHITE);
@@ -669,14 +688,16 @@ void display_remote_temp() {
669
688
670
689
String temp_range_vol = String (" = " ) + (_display_remote_temp_status ? String (_remote_temp.temp , 1 ) : String (" ?" )) + " °" ;
671
690
display.drawString (75 , 16 , temp_range_vol);
672
- #endif
673
691
_display_need_refresh = true ;
674
692
}
693
+ #endif
675
694
676
695
// ------------------------------------------------------------------------------
677
- void display_local_temp () {
678
696
#if THERMOSTAT_DISPLAY_ST7735_SUPPORT
697
+
698
+ void display_local_temp () {
679
699
display.fillRect (0 , 32 , ST7735_TFTHEIGHT_160, 16 , ST77XX_BLACK);
700
+
680
701
display.setTextColor (ST77XX_WHITE);
681
702
display.setTextWrap (true );
682
703
display.setFont (&Roboto_Thin9pt8b);
@@ -688,7 +709,12 @@ void display_local_temp() {
688
709
display.setCursor (75 , 32 + 13 );
689
710
String local_temp_vol = String (" = " ) + (getLocalTemperature () != DBL_MIN ? String (getLocalTemperature (), 1 ) : String (" ?" )) + " \xB0 " ;
690
711
display.print (local_temp_vol);
712
+ _display_need_refresh = true ;
713
+ }
714
+
691
715
#else
716
+
717
+ void display_local_temp () {
692
718
display.setColor (BLACK);
693
719
display.fillRect (0 , 32 , 128 , 16 );
694
720
display.setColor (WHITE);
@@ -700,15 +726,16 @@ void display_local_temp() {
700
726
701
727
String local_temp_vol = String (" = " ) + (getLocalTemperature () != DBL_MIN ? String (getLocalTemperature (), 1 ) : String (" ?" )) + " °" ;
702
728
display.drawString (75 , 32 , local_temp_vol);
703
- #endif
704
-
705
729
_display_need_refresh = true ;
706
730
}
731
+ #endif
707
732
708
733
// ------------------------------------------------------------------------------
709
- void display_local_humidity () {
710
734
#if THERMOSTAT_DISPLAY_ST7735_SUPPORT
735
+
736
+ void display_local_humidity () {
711
737
display.fillRect (0 , 48 , ST7735_TFTHEIGHT_160, 16 , ST77XX_BLACK);
738
+
712
739
display.setTextColor (ST77XX_WHITE);
713
740
display.setTextWrap (true );
714
741
@@ -719,7 +746,12 @@ void display_local_humidity() {
719
746
display.setCursor (75 , 48 + 13 );
720
747
String local_hum_vol = String (" = " ) + (getLocalHumidity () != DBL_MIN ? String (getLocalHumidity (), 0 ) : String (" ?" )) + " %" ;
721
748
display.print (local_hum_vol);
749
+ _display_need_refresh = true ;
750
+ }
751
+
722
752
#else
753
+
754
+ void display_local_humidity () {
723
755
display.setColor (BLACK);
724
756
display.fillRect (0 , 48 , 128 , 16 );
725
757
display.setColor (WHITE);
@@ -731,9 +763,9 @@ void display_local_humidity() {
731
763
732
764
String local_hum_vol = String (" = " ) + (getLocalHumidity () != DBL_MIN ? String (getLocalHumidity (), 0 ) : String (" ?" )) + " %" ;
733
765
display.drawString (75 , 48 , local_hum_vol);
734
- #endif
735
766
_display_need_refresh = true ;
736
767
}
768
+ #endif
737
769
738
770
// ------------------------------------------------------------------------------
739
771
void displayOn () {
@@ -754,21 +786,30 @@ void displayOn() {
754
786
// ------------------------------------------------------------------------------
755
787
// Setup
756
788
// ------------------------------------------------------------------------------
757
- void displaySetup () {
758
789
#if THERMOSTAT_DISPLAY_ST7735_SUPPORT
790
+
791
+ void displaySetup () {
759
792
display.initR (INITR_BLACKTAB); // Initialize ST7735R screen
760
793
display.setRotation (1 );
761
794
display.fillScreen (ST77XX_BLACK);
762
795
display.cp437 (true );
796
+
797
+ displayOn ();
798
+
799
+ espurnaRegisterLoop (displayLoop);
800
+ }
801
+
763
802
#else
803
+
804
+ void displaySetup () {
764
805
display.init ();
765
806
display.flipScreenVertically ();
766
- #endif
767
807
768
808
displayOn ();
769
809
770
810
espurnaRegisterLoop (displayLoop);
771
811
}
812
+ #endif
772
813
773
814
// ------------------------------------------------------------------------------
774
815
void displayLoop () {
0 commit comments