s00500 / ESPUI

A simple web user interface library for ESP32 and ESP8266

Home Page:https://valencia.lbsfilm.at/midterm-presentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compatibility with ArduinoJson V7

dewenni opened this issue · comments

Since ArduinoJson 7.0 there are some breaking changes

BREAKING CHANGES

As every major release, ArduinoJson 7 introduces several breaking changes. I added some stubs so that most existing programs > should compile, but I highty recommend you upgrade your code.

JsonDocument

In ArduinoJson 6, you could allocate the memory pool on the stack (with StaticJsonDocument) or in the heap (with DynamicJsonDocument).
In ArduinoJson 7, the memory pool is always allocated in the heap, so StaticJsonDocument and DynamicJsonDocument have been merged into JsonDocument.

// ArduinoJson 6
StaticJsonDocument<256> doc;
// or
DynamicJsonDocument doc(256);

// ArduinoJson 7
JsonDocument doc;

full changelog:
https://github.com/bblanchon/ArduinoJson/blob/9dc43d14f3448a4468382ea11eeb47a257420a8c/CHANGELOG.md

the latest release of ESPUI still uses DynamicJsonDocument which prevents you from using the V7 in your project.

Question to the team: Do we want to migrate to V7 or stay on V6? Do we want to support both (yes it can be done)?

Hm I guess supporting both would be sweet...

Been taking a look at this. For the most part, we can support both. However, V7 removes a feature that I was using to limit the size of the message being generated as a fragment. That section of the code would have to be reworked.

I have made a lot of changes to support V6 and V7. The worst of the changes are driven by the fact that you can no longer limit the size of the structure so I had to add an external mechanism to estimate the size. Not accurate but it looks like it gets the job done.

@s00500
WARNING: While my changes are non-breaking from an ESSPUI user point of view, they ARE rather intrusive. Before commiting the code to main, I would love to have someone test the PIO build for V6 and V7 to make sure I have not broken anything. You can find the code at https://github.com/MartinMueller2003/ESPUI

cool, I can try to get to this next week but I am again pretty busy and out for bussiness travel in the next 2,5 weeks... so not 100% sure if I can make it

No worries. The changes are not going anywhere.