I've got an ESP32 with an CO2 sensor attached. The Arduino script I'm using is quite old and worked for sending them over LoraWAN to TTN and is stable. I added an Wifi-Client to read data more frequently when an Wifi is near. The data get send over to my server via MQTT. Now after some time the device stops sending; I think it's just a few hours working. (I used libraries)
Now my question - how do I find the problem? I mean it has something to be the memory, doesn't it? The code is quite long so I would prefer to find the actual problem on my own - but how? My idea was to send debug messages by MQTT, hooking up a client to save all the MQTT messages so I can view the last messages the device sent. (I'm not even sure if the device fully stops or just loses connection etc). This whole thing sound like a tedious problem as I'd have to wait a few hours after every code fix I'd have implemented..
Thank for any help!