My application sends some data to thingspeak.
After about one hour I usually have a crash.
Tracing the heap memory with this code :
printf("Free Heap before write: %d\n", ESP.getFreeHeap());
ThingSpeak.writeFields(IdTS[ch], APIKey_CH[ch]));
printf("Free Heap after write: %d\n", ESP.getFreeHeap());
Output :
Free Heap before write: 17856
Free Heap after write: 17800
Free Heap before write: 17800
Free Heap after write: 17744
Free Heap before write: 17744
Free Heap after write: 17688
Free Heap before write: 17688
Free Heap after write: 17632
Free Heap before write: 17632
Free Heap after write: 17576
Free Heap before write: 17576
Free Heap after write: 17520
So I loose 56 bytes in the heap at each call of ThingSpeak.writeFields
In my previous version I did not use the ThingSpeak lib, and directly called
client.connect("api.thingspeak.com", 80)
client.print("....")
And I had same kind of crash.
So my feeling is that the issue is in the wifi lib.
Any idea on the subject?
Thanks