mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
experimenting with loops
This commit is contained in:
@@ -1655,9 +1655,10 @@ void EMSESP::start() {
|
|||||||
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
|
||||||
@@ -1667,14 +1668,18 @@ void EMSESP::loop() {
|
|||||||
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();
|
||||||
|
|||||||
Reference in New Issue
Block a user