experimenting with loops

This commit is contained in:
proddy
2024-09-01 13:45:01 +02:00
parent 722e7f38fc
commit 94f521e460

View File

@@ -1653,28 +1653,33 @@ void EMSESP::start() {
// main loop calling all services // main loop calling all services
void EMSESP::loop() { void EMSESP::loop() {
esp8266React.loop(); // web services esp8266React.loop(); // web services
system_.loop(); // does LED and checks system health, and syslog service system_.loop(); // does LED and checks system health, and syslog service
bool upload_status = true; // ready for any OTA uploads
// if we're doing an OTA upload, skip everything except from console refresh // if we're doing an OTA upload, skip everything except from console refresh
if (!system_.upload_status()) { if (!system_.upload_isrunning()) {
// service loops // service loops
webLogService.loop(); // log in Web UI webLogService.loop(); // log in Web UI
rxservice_.loop(); // process any incoming Rx telegrams rxservice_.loop(); // process any incoming Rx telegrams
shower_.loop(); // check for shower on/off shower_.loop(); // check for shower on/off
temperaturesensor_.loop(); // read sensor temperatures temperaturesensor_.loop(); // read sensor temperatures
analogsensor_.loop(); // read analog sensor values analogsensor_.loop(); // read analog sensor values
publish_all_loop(); // with HA messages in parts to avoid flooding the mqtt queue publish_all_loop(); // with HA messages in parts to avoid flooding the mqtt queue
mqtt_.loop(); // sends out anything in the MQTT queue mqtt_.loop(); // sends out anything in the MQTT queue
webModulesService.loop(); // loop through the external library modules webModulesService.loop(); // loop through the external library modules
if (system_.PSram() == 0) { if (system_.PSram() == 0) { // run non-async if there is no PSRAM available
webSchedulerService.loop(); // run non-async if there is no PSRAM available webSchedulerService.loop();
} }
// force a query on the EMS devices to fetch latest data at a set interval (1 min) scheduled_fetch_values(); // force a query on the EMS devices to fetch latest data at a set interval (1 min)
scheduled_fetch_values();
} else if (!system_.uploadFirmwareURL()) { // start an upload from a URL. This is blocking. } else if (upload_status) {
system_.upload_status(false); // abort the upload // start an upload from a URL, if it exists. This is blocking.
if (!system_.uploadFirmwareURL()) {
upload_status = false; // abort all other attempts, until reset (after a restart normally)
system_.upload_isrunning(false);
}
} }
uuid::loop(); uuid::loop();