artnet hung, sensors loop, inputs, multivent

This commit is contained in:
2024-01-28 16:19:45 +03:00
parent 1654f05bbe
commit bcae3c9d50

View File

@@ -627,12 +627,14 @@ lan_status lanLoop() {
if (!initializedListeners) if (!initializedListeners)
{ {
setupSyslog(); setupSyslog();
debugSerial<<F("Setup OTA")<<endl;
setupOTA(); setupOTA();
#ifdef _artnet #ifdef _artnet
if (artnet) artnet->begin(); if (artnet) artnet->begin();
#endif #endif
#ifdef IPMODBUS #ifdef IPMODBUS
debugSerial<<F("Setup IPModbus")<<endl;
setupIpmodbus(); setupIpmodbus();
#endif #endif
initializedListeners = true; initializedListeners = true;
@@ -2686,12 +2688,12 @@ void loop_main() {
#if defined(OTA) #if defined(OTA)
yield(); yield();
ArduinoOTA.poll(); if (initializedListeners) ArduinoOTA.poll();
#endif #endif
#ifdef _artnet #ifdef _artnet
yield(); yield();
if (artnet) artnet->read(); ///hung if network not initialized if (artnet && initializedListeners) artnet->read(); ///hung if network not initialized
#endif #endif
#ifdef MDNS_ENABLE #ifdef MDNS_ENABLE
#ifndef WIFI_ENABLE #ifndef WIFI_ENABLE
@@ -2740,7 +2742,7 @@ if (initializedListeners) ipmodbusLoop();
void owIdle(void) { void owIdle(void) {
// timerCtr++; // timerCtr++;
#ifdef _artnet #ifdef _artnet
if (artnet && (lanStatus>=HAVE_IP_ADDRESS)) artnet->read(); if (artnet && initializedListeners && (lanStatus>=HAVE_IP_ADDRESS)) artnet->read();
#endif #endif
wdt_res(); wdt_res();
@@ -2799,7 +2801,7 @@ void modbusIdle(void) {
yield(); yield();
mqttClient.loop(); mqttClient.loop();
#ifdef _artnet #ifdef _artnet
if (artnet) artnet->read(); if (artnet && initializedListeners) artnet->read();
#endif #endif
#if defined(OTA) #if defined(OTA)
yield(); yield();
@@ -2871,9 +2873,10 @@ inputLoopBusy--;
void inputSensorsLoop() { void inputSensorsLoop() {
if (!inputs || inputLoopBusy) return; if (!inputs || inputLoopBusy) return;
//inputLoopBusy++; //inputLoopBusy++;
configLocked++; //configLocked++;
if (isTimeOver(timerSensorCheck,millis(),INTERVAL_CHECK_SENSOR)) if (isTimeOver(timerSensorCheck,millis(),INTERVAL_CHECK_SENSOR))
{ {
configLocked++;
aJsonObject *input = inputs->child; aJsonObject *input = inputs->child;
while (input) { while (input) {
if ((input->type == aJson_Object)) { if ((input->type == aJson_Object)) {
@@ -2885,8 +2888,9 @@ configLocked++;
input = input->next; input = input->next;
} }
timerSensorCheck = millis(); timerSensorCheck = millis();
configLocked--;
} }
configLocked--; //configLocked--;
//inputLoopBusy--; //inputLoopBusy--;
} }