Free heap
After inplementing BearSSL with certificates in a previous PR we were running out of heap on the ESP8266. In larger apps this could cause crashes during ota updates on boot. And when entering config mode(when sending logs to IAS with the local ip address).
To free heap I have rewritten the oldest parts of this library:
config structs for storing device info & wifi creds
the addFields functions and struct
Both are stored in EEPROM and used global vars / arrays during runtime for use in multiple other functions. This was not a problem when this library started as they contained very little. But as functionality was added during time they became quite a load. While only used during boot and not or rarely in the developed app.
As the original libary was built around these structs and functions, quite a lot of code & the boot sequence has changed. This rewrite frees up +/- 10% heap during boot and +/-2% ram for the whole library.
WiFi
As the wifi credentials(3 sets) were stored in the original config struct. This had to be rewritten and I took the opportunity to also address the following issues / wishes:
Static ip options
beter WiFiscan the first time a page is loaded
refactor WiFi functionality into separate files
more durable EEPROM layout which lasts between library updates(changes).
Other fixes
ESP32 fix SPIFFS bug that prevents storing certificates on a fresh device
Fixed missing NEXT_BAUD define which Stabelizes Nextion updates on the ESP8266 by setting the correct speed.
Free heap After inplementing BearSSL with certificates in a previous PR we were running out of heap on the ESP8266. In larger apps this could cause crashes during ota updates on boot. And when entering config mode(when sending logs to IAS with the local ip address).
To free heap I have rewritten the oldest parts of this library:
Both are stored in EEPROM and used global vars / arrays during runtime for use in multiple other functions. This was not a problem when this library started as they contained very little. But as functionality was added during time they became quite a load. While only used during boot and not or rarely in the developed app.
As the original libary was built around these structs and functions, quite a lot of code & the boot sequence has changed. This rewrite frees up +/- 10% heap during boot and +/-2% ram for the whole library.
WiFi As the wifi credentials(3 sets) were stored in the original config struct. This had to be rewritten and I took the opportunity to also address the following issues / wishes:
Other fixes