I am doing a combined DMX & ArtNet receiving unit on an ESP8266 and controlling this through a webserver
DMX works.
Artnet Works.
But if i decide to stop using ArtNet, but the transmitting device keeps sending ArtNet (UDP) packages, the ESP crashes, with what with what i suspect to be a lack of memory.
I do call
UDP.stop();
to release any resources, but somehow that doesn't resolve the issue.
I'm gonna try to just use
UDP.flush();
instead, but shouldn't i just be able to stop listening ?
ALL of the code ? well i seriously doubt that that will help in illustrating the issue since it contains all webpages, ledstrip pattern creation and all sorts of other nonsense that has little to nothing to do with the issue, but i will see if i can create something smaller that can illustrate the problem.
I added UDP.flush() if i am not 'listening' and that resolved the issue,(mind you only in combination with the UDP.stop() that i had added already) then i thought to just change the listening port, but it seems that the UDP packages are received and stored regardless, 'cause that didn't work.
Just to get this clear. The issue only occurs when i keep sending packages to the ESP's IP address which the App i am Using 'Aurora DMX' which is a simple ArtNet DMX controller with in the free version a few contrable channels, but that does send a complete package of 512 channels every second.
Actually by now i am suspecting that any webserver running on an ESP will become 'non-responsive' if i start sending it UDP packages that are not being read, but i will need to verify that with a small test. Thing is that i removed
UDP.begin();
and any other part involved with specific reception, but the problem is there still. I did leave the creation of the object in the code, i will get back to you after some more testing. I do hope that it is restricted to any code that has an UDP object.
Ha found what the issue was. (and what part of the issue i should remain aware of)
Basically there was a 'stray'
UDP.begin(6454);
somewhere in the code, which i found back by accident.
Removing made it possible to remove the
UDP.flush();
from the main loop.
So what to be aware of is simple. If there are UDP packets coming in on an active port, they need to be dealt with or they will at some point fill up the heap, causing memory issues.
so after begin() i will have to either call read(); or flush(); until i call stop();