btidey wrote:I think it is also a good idea to include at least a short delay in the loop to ensure that the foreground is not going flat out. E.g. include a delay(10); in the loop.
I was going to suggest the same thing, however I noticed you mentioned you initially had NodeMCU flashed - many people have found this to be not very stable, myself included. I have purchased many devices that had NodeMCU preloaded, and had all sorts of stability issues, but once I did a full flash with an SDK based firmware (either a full Arduino flash or native SDK) they were rock solid.