12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- void checkMillis() {
- if ( (millis() - lastRun) > 100 ) {
- lastRun = millis();
- every100ms();
- }
- }
- void every100ms() {
- if (count100ms < 10) count100ms++;
- else {
- count100ms = 0;
- everySecond();
- }
- //checkSaveConfigTriggered();
- }
- void everySecond() {
- if (countSeconds < 60) countSeconds++;
- else {
- countSeconds = 0;
- everyMinute();
- }
-
- handleDisplayTimeout();
- checkValuesChanged();
- if (countMeasureInterval < measureInterval) countMeasureInterval++;
- else {
- countMeasureInterval = 0;
- measureTempHum();
- thermostat();
- }
- if (countDisplayInterval < displayInterval) countDisplayInterval++;
- else {
- countDisplayInterval = 0;
- updateDisplay();
- }
- if (doRestart) ESP.restart();
- if ( (millis() - pendingRestart_lastMillis) > 3000 ) pendingRestart = false;
- // if ( preset != pendingPreset) {
- // if ( (millis() - pendingPreset_millis) > pendingPreset_timeout ) {
- // preset = pendingPreset;
- // }
- // }
- }
- void everyMinute() {
- updateUptime();
- buildUptimeString();
- if(mqtt_enable) {
- mqttPublishConnectMsg();
- mqttPublishStatus();
- if(mqtt_enable_heartbeat) mqttPublishHeartbeat();
- publishCurrentSensorValues();
- publishCurrentThermostatValues();
- }
- // if(WifiInApMode) {
- // if( (millis() - WifiApModeStartedAt) > WIFI_AP_MODE_TIMEOUT ) {
- //
- // }
- // }
- // Serial.print("WiFi Status: ");
- // Serial.println(WiFi.status());
- }
|