Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatibility with ArduinoJson V7 #292

Open
dewenni opened this issue Feb 11, 2024 · 6 comments
Open

compatibility with ArduinoJson V7 #292

dewenni opened this issue Feb 11, 2024 · 6 comments
Assignees

Comments

@dewenni
Copy link

dewenni commented Feb 11, 2024

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.

@MartinMueller2003
Copy link
Collaborator

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)?

@s00500
Copy link
Owner

s00500 commented Feb 12, 2024

Hm I guess supporting both would be sweet...

@MartinMueller2003
Copy link
Collaborator

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.

@MartinMueller2003 MartinMueller2003 self-assigned this Mar 27, 2024
@MartinMueller2003
Copy link
Collaborator

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

@s00500
Copy link
Owner

s00500 commented Apr 6, 2024

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

@MartinMueller2003
Copy link
Collaborator

No worries. The changes are not going anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants