ESP32 stability fix + remove DMX

This commit is contained in:
2020-07-15 02:11:43 +03:00
parent 10a9bb119d
commit 3b8d085b29
7 changed files with 53 additions and 14 deletions

View File

@@ -1,13 +1,15 @@
-DWIFI_ENABLE -DWIFI_ENABLE
#-DDMX_DISABLE -DDMX_DISABLE
# - exeption in DMX.update/begin
#-DSPILED_DISABLE #-DSPILED_DISABLE
#-DAC_DISABLE #-DAC_DISABLE
#-DSYSLOG_ENABLE - udp errors
-DMODBUS_DISABLE -DMODBUS_DISABLE
#-DMBUS_DISABLE
-DCOUNTER_DISABLE -DCOUNTER_DISABLE
#-DSYSLOG_ENABLE - udp errors
-DOTA -DOTA
#-DMCP23017 -DMCP23017
-DMODBUS_TX_PIN=13 -DMODBUS_TX_PIN=13
#-DARTNET_ENABLE - udp rx errors (( #-DARTNET_ENABLE - udp rx errors ((
-DUSE_1W_PIN=16 #-DUSE_1W_PIN=16
-DW5500_CS_PIN=15 #-DW5500_CS_PIN=15

View File

@@ -1,2 +0,0 @@
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
-DAVR_DMXOUT_PIN=18

View File

@@ -0,0 +1,14 @@
#-DMODBUS_DIMMER_PARAM=SERIAL_8E1
#-DAVR_DMXOUT_PIN=18
-DDMX_DISABLE
-DMODBUS_DISABLE
-DMBUS_DISABLE
#-DOWIRE_DISABLE
-DDHT_DISABLE
-DCOUNTER_DISABLE
-DNO_HOMIE
-DCSSHDC_DISABLE
-DSPILED_DISABLE
-DAC_DISABLE
-DSYSLOG_ENABLE

Binary file not shown.

View File

@@ -907,7 +907,7 @@ bool send = isNotRetainingStatus() ;
if (!suffixCode && defaultSuffixCode) if (!suffixCode && defaultSuffixCode)
suffixCode = defaultSuffixCode; suffixCode = defaultSuffixCode;
yield();
debugSerial<<F("RAM=")<<freeRam()<<F(" Item=")<<itemArr->name<<F(" Sub=")<<subItem<<F(" Suff=")<<suffixCode<<F(" Cmd=")<<cmd<<F(" Par=("); debugSerial<<F("RAM=")<<freeRam()<<F(" Item=")<<itemArr->name<<F(" Sub=")<<subItem<<F(" Suff=")<<suffixCode<<F(" Cmd=")<<cmd<<F(" Par=(");
if (!itemArr) return -1; if (!itemArr) return -1;

View File

@@ -199,6 +199,7 @@ while (configLocked)
if (isNotRetainingStatus()) pollingLoop(); if (isNotRetainingStatus()) pollingLoop();
thermoLoop(); thermoLoop();
inputLoop(); inputLoop();
yield();
} }
//Stoping the channels //Stoping the channels
@@ -209,7 +210,7 @@ while (items && item)
{ {
Item it(item->name); Item it(item->name);
if (it.isValid()) it.Stop(); if (it.isValid()) it.Stop();
yield();
} }
item = item->next; item = item->next;
@@ -246,7 +247,7 @@ void mqttCallback(char *topic, byte *payload, unsigned int length) {
payload[length] = 0; payload[length] = 0;
int fr = freeRam(); int fr = freeRam();
if (fr < 250) { if (fr < 250) {
debugSerial<<F("OOM!"); errorSerial<<F("OutOfMemory!")<<endl;
return; return;
} }
LED.flash(ledBLUE); LED.flash(ledBLUE);
@@ -558,6 +559,7 @@ void onMQTTConnect(){
strncat_P(topic,format_P,sizeof(topic)); strncat_P(topic,format_P,sizeof(topic));
mqttClient.publish(topic,format,true); mqttClient.publish(topic,format,true);
} }
yield();
item = item->next; item = item->next;
} //if } //if
//strncpy_P(topic, outprefix, sizeof(topic)); //strncpy_P(topic, outprefix, sizeof(topic));
@@ -737,6 +739,7 @@ void onInitialStateInitLAN() {
delay(500); delay(500);
wifi_connection_wait -= 500; wifi_connection_wait -= 500;
debugSerial<<"."; debugSerial<<".";
yield();
} }
wifiInitialized = true; //??? wifiInitialized = true; //???
} }
@@ -973,6 +976,7 @@ configLocked++;
SetAddr(item->name, addr); SetAddr(item->name, addr);
owAdd(addr); owAdd(addr);
} }
yield();
item = item->next; item = item->next;
} }
} }
@@ -1013,6 +1017,7 @@ configLocked++;
break; break;
} //switch } //switch
} //isValid } //isValid
yield();
item = item->next; item = item->next;
} //if } //if
pollingItem = items->child; pollingItem = items->child;
@@ -1762,29 +1767,34 @@ void loop_main() {
#if defined(M5STACK) #if defined(M5STACK)
// Initialize the M5Stack object // Initialize the M5Stack object
yield();
M5.update(); M5.update();
#endif #endif
wdt_res(); wdt_res();
yield();
cmdPoll(); cmdPoll();
if (lanLoop() > HAVE_IP_ADDRESS) { if (lanLoop() > HAVE_IP_ADDRESS) {
mqttClient.loop(); mqttClient.loop();
#if defined(OTA) #if defined(OTA)
yield();
ArduinoOTA.poll(); ArduinoOTA.poll();
#endif #endif
#ifdef _artnet #ifdef _artnet
yield();
if (artnet) artnet->read(); ///hung if (artnet) artnet->read(); ///hung
#endif #endif
} }
#ifdef _owire #ifdef _owire
yield();
if (owReady && owArr) owLoop(); if (owReady && owArr) owLoop();
#endif #endif
#ifdef _dmxin #ifdef _dmxin
// unsigned long lastpacket = DMXSerial.noDataSince(); yield();
DMXCheck(); DMXCheck();
#endif #endif
@@ -1793,14 +1803,16 @@ void loop_main() {
if (isNotRetainingStatus()) pollingLoop(); if (isNotRetainingStatus()) pollingLoop();
// #endif // #endif
//#ifdef _owire //#ifdef _owire
yield();
thermoLoop(); thermoLoop();
//#endif //#endif
} }
yield();
inputLoop(); inputLoop();
#if defined (_espdmx) #if defined (_espdmx)
yield();
dmxout.update(); dmxout.update();
#endif #endif
@@ -1815,16 +1827,19 @@ void owIdle(void) {
return; return;
#ifdef _dmxin #ifdef _dmxin
yield();
DMXCheck(); DMXCheck();
#endif #endif
#if defined (_espdmx) #if defined (_espdmx)
yield();
dmxout.update(); dmxout.update();
#endif #endif
} }
void ethernetIdle(void){ void ethernetIdle(void){
ethernetIdleCount++; ethernetIdleCount++;
wdt_res(); wdt_res();
yield();
inputLoop(); inputLoop();
ethernetIdleCount--; ethernetIdleCount--;
}; };
@@ -1832,10 +1847,12 @@ ethernetIdleCount--;
void modbusIdle(void) { void modbusIdle(void) {
wdt_res(); wdt_res();
if (lanLoop() > 1) { if (lanLoop() > 1) {
yield();
mqttClient.loop(); mqttClient.loop();
#ifdef _artnet #ifdef _artnet
if (artnet) artnet->read(); if (artnet) artnet->read();
#endif #endif
yield();
inputLoop(); inputLoop();
} }
@@ -1861,6 +1878,7 @@ configLocked++;
Input in(input); Input in(input);
in.Poll(CHECK_INPUT); in.Poll(CHECK_INPUT);
} }
yield();
input = input->next; input = input->next;
} }
nextInputCheck = millis() + INTERVAL_CHECK_INPUT; nextInputCheck = millis() + INTERVAL_CHECK_INPUT;
@@ -1873,6 +1891,7 @@ configLocked++;
Input in(input); Input in(input);
in.Poll(CHECK_SENSOR); in.Poll(CHECK_SENSOR);
} }
yield();
input = input->next; input = input->next;
} }
nextSensorCheck = millis() + INTERVAL_CHECK_SENSOR; nextSensorCheck = millis() + INTERVAL_CHECK_SENSOR;
@@ -1889,6 +1908,7 @@ configLocked++;
Input in(input); Input in(input);
in.setup(); in.setup();
} }
yield();
input = input->next; input = input->next;
} }
configLocked--; configLocked--;
@@ -1906,6 +1926,7 @@ if (items) {
if (it.isValid()) { if (it.isValid()) {
it.Poll(POLLING_FAST); it.Poll(POLLING_FAST);
} //isValid } //isValid
yield();
item = item->next; item = item->next;
} //if } //if
} }
@@ -1925,6 +1946,7 @@ configLocked--;
} }
}//if }//if
if (!pollingItem) return; //Config was re-readed if (!pollingItem) return; //Config was re-readed
yield();
pollingItem = pollingItem->next; pollingItem = pollingItem->next;
if (!pollingItem) { if (!pollingItem) {
pollingItem = items->child; pollingItem = items->child;

View File

@@ -37,7 +37,7 @@ default_envs =
; esp8266-wifi ; esp8266-wifi
; ESP-32 ; ESP-32
esp32-wifi ; esp32-wifi
; M5Stack core (ESP32 based) ; M5Stack core (ESP32 based)
; m5stack ; m5stack
@@ -170,13 +170,15 @@ lib_deps =
[env:esp32-wifi] [env:esp32-wifi]
platform = espressif32 platform = espressif32
framework = arduino framework = arduino
monitor_filters = esp32_exception_decoder
build_type = debug
;board = pico32 ;board = pico32
board = esp32-evb board = esp32-evb
upload_speed = 115200 upload_speed = 115200
build_flags = !python get_build_flags.py esp32-wifi build_flags = !python get_build_flags.py esp32-wifi
lib_ignore = lib_ignore =
;COMMENT/UNCOMMENT next line for software 1-wire driver on/off ;COMMENT/UNCOMMENT next line for software 1-wire driver on/off
DS2482_OneWire ;DS2482_OneWire
DmxSimple DmxSimple
DMXSerial DMXSerial
DmxDue DmxDue
@@ -329,6 +331,7 @@ lib_deps =
platform = atmelavr platform = atmelavr
board = megaatmega2560 board = megaatmega2560
;upload_port = net:192.168.88.31:23 ;upload_port = net:192.168.88.31:23
upload_port = net:192.168.88.2:23000
framework = arduino framework = arduino
build_flags = !python get_build_flags.py mega2560slim-5100 build_flags = !python get_build_flags.py mega2560slim-5100
lib_ignore = lib_ignore =