123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- #ifdef FIRMWARE_VARIANT_THERMOSTAT
- void display_update()
- {
- if (display_showFullscreenMsg)
- {
- if(display_nextMsgToShow > 0) {
- display_showNextMessageAfterTimeout();
- }
- else {
- display_showFullscreenMsg = false;
- display_overrideInterval = 0;
- display_updateImmediately = true;
- }
- }
- else
- {
- bool _showTemp = false;
- char _ch_temp[6];
- unsigned long _now = millis();
-
- if (confTherm.togglingTempHumAIDisplay)
- {
- char _ch_hum[4];
- char _tempLabel[2];
- if (((_now - outTempHumLastUpdate) < sensors_maxMeasurementAge_outside) && outTempHumLastUpdate != 0 && display_whichTempToDisplay == 1 &&
- ((_now - display_lastDisplayToggle) > (confDisplay.displayInterval * 1000)))
- {
- // outside temp has been updated < 5 min ago, last displayed temp was INSIDE and display interval is overdue
- display_whichTempToDisplay = 2; // 1= I, 2= O
- display_lastDisplayToggle = _now;
- }
- else if (display_whichTempToDisplay != 1 && ((_now - display_lastDisplayToggle) > (confDisplay.displayInterval * 1000)))
- {
- display_whichTempToDisplay = 1; // 1= I, 2= O
- display_lastDisplayToggle = _now;
- }
- display_lastDisplayUpdate = _now;
- if (display_whichTempToDisplay == 2)
- { // 2 = outside temp/hum received via MQTT
- if (outTempHumLastUpdate != 0 && (_now - outTempHumLastUpdate) < sensors_maxMeasurementAge_outside)
- {
- _showTemp = true;
- dtostrf(outTemp, 5, 1, _ch_temp);
- sprintf(_ch_hum, "%2i", outHum);
- strcpy(_tempLabel, confTherm.oTempLabel);
- }
- }
- else
- {
- if (sensor_DHT_lastUpdate != 0 && (_now - sensor_DHT_lastUpdate) < sensors_maxMeasurementAge)
- {
- _showTemp = true;
- dtostrf(sensor_DHT_currTemp, 5, 1, _ch_temp);
- sprintf(_ch_hum, "%2i", sensor_DHT_currHum);
- strcpy(_tempLabel, confTherm.iTempLabel);
- }
- }
- // 12345667890123456
- // =20.0° 35% >22.5°
- // A -10.2° 95% N
- // A 22.2° 95% N
- // A 5.2° 95% N
- // LCD line 1
- // print temperature incl = and ° symbol + humidity to lcd, line 1, first 11 chars
- lcd.setCursor(0, 0);
- if (_showTemp)
- {
- // lcd.write(0x3D); // = Zeichen
- lcd.print(_tempLabel);
- lcd.print(_ch_temp);
- // lcd.write(0xDF); // degree symbol
- lcd.write((uint8_t)3); // °C symbol
- lcd.print(" ");
- if (sensor_DHT_currHum == 0)
- lcd.print("--");
- else if (sensor_DHT_currHum < 10)
- {
- lcd.print(" ");
- lcd.print(_ch_hum);
- }
- else
- {
- lcd.print(_ch_hum);
- }
- lcd.print("%");
- lcd.print(" ");
- }
- else
- {
- lcd.print(" ");
- }
- }
- else
- { // non toggling temperature I + A display without humidity in line 1
- lcd.setCursor(0, 0);
- lcd.print(confTherm.iTempLabel);
- if (sensor_DHT_lastUpdate != 0 && (_now - sensor_DHT_lastUpdate) < sensors_maxMeasurementAge)
- {
- dtostrf(sensor_DHT_currTemp, 5, 1, _ch_temp);
- lcd.print(_ch_temp);
- }
- else
- {
- lcd.print(" --.-");
- }
- lcd.write((uint8_t)3); // °C symbol
- lcd.print(" ");
- if (outTempHumLastUpdate != 0 && (_now - outTempHumLastUpdate) < sensors_maxMeasurementAge_outside)
- {
- lcd.print(" ");
- lcd.print(confTherm.oTempLabel);
- dtostrf(outTemp, 5, 1, _ch_temp);
- lcd.print(_ch_temp);
- lcd.write((uint8_t)3); // °C symbol
- }
- else
- {
- lcd.print(" ");
- }
- }
- thermostat_updateCurrSetTemp();
- char _ch_currSetTemp[6];
- dtostrf(thermostat_currSetTemp, 5, 1, _ch_currSetTemp);
- // LCD line 2
- // display target temperature to line 2, 8 chars length incl space at the end
- lcd.setCursor(0, 1);
- if (system_doRestart) { lcd.print("Restarting... "); }
- else if (system_pendingRestart)
- {
- lcd.print("Restart? ");
- }
- else if (thermostat_heatingMode == 0)
- { // when the heating mode is OFF, do not display target temp - instead show "Heating off" info in line 2
- // 1234567890123456
- lcd.print(" ");
- lcd.setCursor(0, 1);
- lcd.print(confTherm.offMessage);
- // for(int i=strlen(offMessage); i < 14; i++) {
- // lcd.print(" ");
- //}
- display_addConnectionIcon();
- }
- //else if (heatingPause > 0)
- //{ // when heating pause mode is active, do not display target temp - instead show "PAUSE" info in line 2
- // // 1234567890123456
- // lcd.print(" ");
- // lcd.setCursor(0, 1);
- // //lcd.print(confThermAdv.pauseMessage);
- // lcd.print("PAUSE 0:");
- //
- // unsigned int _pauseMin = heatingPause / 60;
- // if(_pauseMin < 10) lcd.print("0");
- // lcd.print(_pauseMin);
- //
- // display_addConnectionIcon();
- //}
- // Status Message in Display Row 2
- else if (display_showRow2OverlayMsg)
- {
- display_showRow2OverlayMsg = false;
- //displayInterval = confDisplay.displayInterval;
- display_updateImmediately = true;
- if (thermostat_pendingPresetToggle)
- {
- thermostat_preset = thermostat_pendingPreset;
- thermostat_updateCurrentPresetName();
- thermostat_pendingPresetToggle = false;
- }
- }
- else
- {
- lcd.write((uint8_t)2); // arrow right symbol
- //lcd.print(">");
- // lcd.print(" ");
- lcd.print(_ch_currSetTemp);
- // lcd.write(0xDF); // degree symbol
- lcd.write((uint8_t)3); // °C symbol
- lcd.print(" ");
- lcd.setCursor(8, 1);
- lcd.print(" ");
- // display status info to line 2 from char 9 -> 8 chars length
- lcd.setCursor(9, 1);
- if (thermostat_preset == 0)
- { // day/normal mode
- lcd.write((uint8_t)1); // sun symbol if mode is day/normal
- }
- else if (thermostat_preset == 1)
- { // night/reduction mode
- lcd.write((uint8_t)0); // moon symbol if mode is night/reduction
- }
- else if (thermostat_preset == 2)
- { // night/reduction mode
- lcd.write((uint8_t)6); // reduction 2 (2 arrows down) symbol if mode is reduction 2
- }
- if (thermostat_heatingPause > 0)
- {
- lcd.createChar(7, display_customCharPause);
- lcd.setCursor(12, 1);
- lcd.write((uint8_t)7); // pause symbol if heating is paused
- }
- else if (thermostat_heatingLockTime > 0)
- {
- lcd.createChar(7, display_customCharLock);
- lcd.setCursor(12, 1);
- lcd.write((uint8_t)7); // lock symbol if heating should run BUT lockout time is active
- }
- else if (thermostat_turnHeatingOn)
- {
- lcd.createChar(7, display_customCharFlame);
- lcd.setCursor(12, 1);
- lcd.write((uint8_t)7); // flame symbol if heating is active
- }
- else
- {
- lcd.setCursor(12, 1);
- lcd.print(" ");
- }
- display_addConnectionIcon();
- }
- }
- }
- #endif // FIRMWARE_VARIANT_THERMOSTAT
|