Chat freely about anything...

User avatar
By MikeyMoMo
#71599 I found out that memory really is limited in the ESP8266. I have read about not using Strings and using char[] stuff so I switched over. Not everything likes them so there was some converting back and forth although the data is exactly the same in memory. A good language would allow one to treat a string of data bytes as a string of data bytes. But, after all, I am writing in C/C++. Can't expect much from a language written to teach programming (badly) in schools. Too bad if got out into the wild!

So I put in a 5000 byte char array. When I tried ti use it, I started getting exception(9)'s. So I had to rewrite my web server to start creating web page bits less than 1000 bytes at a time and use client.print to output it. client.print is slow if you use it a lot but if you have a buffering routine to catch it and wait and only put it out when needed, it is not so bad. So I rewrote all of the routines to call the buffer-up routine and now I am working and I just got 5K of heap back for the effort. So, I guess it was worth it.

As soon as I saw the "low memory" warning, I started getting the exception 9. There was no waiting like with an UNO.

So I am learning to work without String as much as possible and use char[] for handling strings. As I said, sometimes you have to convert back and forth since some routines don't like one or the other. Learn those little tricks and you are on the way.

One note. I read a web page about using itoa or ltoa for making String's compatible with strcat but it is not necessary almost any time. I will upload the latest code in a day or two when I am happy it is stable and has no rough edges. See the result at static28.iliketheinternet.com or static29.iliketheinternet.com . The code is conditionally compiled to put out either 1 or 2 graphs for inside only or inside and outside temps.

Source code will be on www.iliketheinternet.com in a few days. Actually, code is there now but this updated code will replace it soon.