Display_heatcontrol.ino 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. #ifdef FIRMWARE_VARIANT_HEATCONTROL
  2. uint8_t heatcontrol_display_nextStatusMsg = 0;
  3. void display_update()
  4. {
  5. if (display_showFullscreenMsg)
  6. {
  7. if(display_nextMsgToShow > 0) {
  8. display_showNextMessageAfterTimeout();
  9. }
  10. else {
  11. display_showFullscreenMsg = false;
  12. display_overrideInterval = 0;
  13. display_updateImmediately = true;
  14. }
  15. }
  16. else
  17. {
  18. char _ch_temp[6];
  19. int _tOut = (int)owTemp_out;
  20. display_lastDisplayUpdate = millis();
  21. // LCD line 1
  22. lcd.setCursor(0, 0);
  23. // clear display line
  24. lcd.print(" ");
  25. lcd.setCursor(0, 0);
  26. char _buf[3];
  27. // T Vorlauf
  28. sprintf(_buf, PGMStr_heatc_display_caption_tempFeed);
  29. lcd.print(_buf);
  30. dtostrf(owTemp_feed, 2, 0, _ch_temp);
  31. lcd.print(_ch_temp);
  32. lcd.print(" ");
  33. sprintf(_buf, PGMStr_heatc_display_caption_tempReturn);
  34. lcd.print(_buf);
  35. dtostrf(owTemp_return, 2, 0, _ch_temp);
  36. lcd.print(_ch_temp);
  37. lcd.print(" ");
  38. sprintf(_buf, PGMStr_heatc_display_caption_tempOutside);
  39. lcd.print(_buf);
  40. if(owTemp_out < -9) dtostrf(owTemp_out, 3, 0, _ch_temp);
  41. else if(owTemp_out < 0) dtostrf(owTemp_out, 2, 0, _ch_temp);
  42. else if(owTemp_out < 10) dtostrf(owTemp_out, 1, 0, _ch_temp);
  43. else if(owTemp_out >= 10) dtostrf(owTemp_out, 2, 0, _ch_temp);
  44. else dtostrf(owTemp_out, 3, 0, _ch_temp);
  45. lcd.print(_ch_temp);
  46. // LCD line 2
  47. // display target temperature to line 2, 8 chars length incl space at the end
  48. lcd.setCursor(0, 1);
  49. lcd.print(" ");
  50. lcd.setCursor(0, 1);
  51. if (system_doRestart) {
  52. char _buf[17];
  53. snprintf_P(_buf, 16, PGMStr_display_restarting);
  54. lcd.print(_buf);
  55. }
  56. else if (system_pendingRestart) {
  57. char _buf[17];
  58. snprintf_P(_buf, 16, PGMStr_display_restartQuest);
  59. lcd.print(_buf);
  60. }
  61. // Status Message in Display Row 2
  62. else if (display_showRow2OverlayMsg) {
  63. display_showRow2OverlayMsg = false;
  64. //displayInterval = confDisplay.displayInterval;
  65. display_updateImmediately = true;
  66. }
  67. else if (heatcontrol_state_testmode_active) {
  68. heatcontrol_display_showTestmodeRemaining();
  69. }
  70. else if (heatcontrol_out_heat) {
  71. char _buf[17];
  72. if(confHeatc.useHeatCurve) {
  73. snprintf_P(_buf, 16, PGMStr_heatc_display_heatingUntilTFeed, heatcontrol_currentHeatCurveValue + confHeatc.hystereseOff);
  74. }
  75. else {
  76. snprintf_P(_buf, 16, PGMStr_heatc_display_heating);
  77. }
  78. lcd.print(_buf);
  79. display_addConnectionIcon();
  80. }
  81. else if (heatcontrol_lockTime_startMillis > 0 && heatcontrol_state_pumpBacklash_active) {
  82. heatcontrol_display_showToggling_LockTimeRemaining_pumpBacklash();
  83. }
  84. else if (heatcontrol_lockTime_startMillis > 0) {
  85. heatcontrol_display_showLockTimeRemaining();
  86. }
  87. else if (heatcontrol_lockTemp_active() && heatcontrol_state_pumpBacklash_active) {
  88. heatcontrol_display_showToggling_LockUntilTempFeed_pumpBacklash();
  89. }
  90. else if (heatcontrol_state_pumpBacklash_active) {
  91. heatcontrol_display_showPumpBacklashRemaining();
  92. }
  93. else if (heatcontrol_lockTemp_active()) {
  94. heatcontrol_display_showLockUntilTempFeed();
  95. }
  96. else {
  97. char _buf[17];
  98. // overrule precondition to false if outside temp is above limit
  99. if ( heatcontrol_in_sw_disableControl_heating && heatcontrol_in_sw_disableControl_pump) {
  100. snprintf_P(_buf, 16, PGMStr_heatc_display_disabled_switch_both);
  101. }
  102. else if ( heatcontrol_in_sw_disableControl_heating) {
  103. snprintf_P(_buf, 16, PGMStr_heatc_display_disabled_switch_heat);
  104. }
  105. else if ( heatcontrol_in_sw_disableControl_pump) {
  106. snprintf_P(_buf, 16, PGMStr_heatc_display_disabled_switch_pump);
  107. }
  108. else if (_tOut >= confHeatc.disableAboveTOut) {
  109. snprintf_P(_buf, 16, PGMStr_heatc_display_disabled_outtemp);
  110. }
  111. else {
  112. snprintf_P(_buf, 16, PGMStr_heatc_display_idle_ready);
  113. }
  114. lcd.print(_buf);
  115. display_addConnectionIcon();
  116. }
  117. }
  118. }
  119. void heatcontrol_display_showLockTimeRemaining() {
  120. char _buf[17];
  121. uint8_t _remainingMins = heatcontrol_lockTime_getRemainingMins();
  122. char _space[2];
  123. if(_remainingMins >= 10) {
  124. _space[0] = '\0';
  125. }
  126. else {
  127. _space[0] = ' ';
  128. _space[1] = '\0';
  129. }
  130. snprintf_P(_buf, 16, PGMStr_heatc_display_lockTimeRemaining, _space, _remainingMins);
  131. lcd.print(_buf);
  132. display_addConnectionIcon();
  133. }
  134. void heatcontrol_display_showLockUntilTempFeed() {
  135. char _buf[17];
  136. snprintf_P(_buf, 16, PGMStr_heatc_display_lockUntilTFeed, (heatcontrol_currentHeatCurveValue - confHeatc.hystereseOn - 1));
  137. lcd.print(_buf);
  138. display_addConnectionIcon();
  139. }
  140. void heatcontrol_display_showPumpBacklashRemaining() {
  141. char _buf[17];
  142. uint8_t _remainingMins = heatcontrol_pumpBacklash_getRemainingMins();
  143. char _space[2];
  144. if(_remainingMins >= 10) {
  145. _space[0] = '\0';
  146. }
  147. else {
  148. _space[0] = ' ';
  149. _space[1] = '\0';
  150. }
  151. snprintf_P(_buf, 16, PGMStr_heatc_display_pumpBacklashRemaining, _space, _remainingMins);
  152. lcd.print(_buf);
  153. display_addConnectionIcon();
  154. }
  155. void heatcontrol_display_showTestmodeRemaining() {
  156. //display_enable(); // display stays ON in this mode
  157. display_extendTimeout(); // display stays ON in this mode
  158. char _buf[17];
  159. uint8_t _remainingMins = heatcontrol_testMode_getRemainingMins();
  160. char _space[2];
  161. if(_remainingMins >= 10) {
  162. _space[0] = '\0';
  163. }
  164. else {
  165. _space[0] = ' ';
  166. _space[1] = '\0';
  167. }
  168. snprintf_P(_buf, 16, PGMStr_heatc_display_testModeRemaining, _space, _remainingMins);
  169. lcd.print(_buf);
  170. display_addConnectionIcon();
  171. }
  172. void heatcontrol_display_showToggling_LockTimeRemaining_pumpBacklash() {
  173. if(heatcontrol_display_nextStatusMsg == 0) {
  174. heatcontrol_display_showLockTimeRemaining();
  175. heatcontrol_display_nextStatusMsg++;
  176. }
  177. else {
  178. heatcontrol_display_showPumpBacklashRemaining();
  179. heatcontrol_display_nextStatusMsg = 0;
  180. }
  181. }
  182. void heatcontrol_display_showToggling_LockUntilTempFeed_pumpBacklash() {
  183. if(heatcontrol_display_nextStatusMsg == 0) {
  184. heatcontrol_display_showLockUntilTempFeed();
  185. heatcontrol_display_nextStatusMsg++;
  186. }
  187. else {
  188. heatcontrol_display_showPumpBacklashRemaining();
  189. heatcontrol_display_nextStatusMsg = 0;
  190. }
  191. }
  192. #endif // FIRMWARE_VARIANT_HEATCONTROL