-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Hello!
I am facing several compilation errors and deprecation warnings when building my project for ESP32 using PlatformIO and the latest Arduino/ESP32/ArduinoJson libraries. Here are the details:
- ArduinoJson Deprecation Warnings
I get warnings like:
warning: 'DynamicJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations] DynamicJsonDocument wifiDoc(256);
and
warning: 'StaticJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations] StaticJsonDocument<256> jsonCmdReceive;
But when I try to use JsonDocument directly, I get an error:
no instance of constructor "ArduinoJson::V741PB22::JsonDocument::JsonDocument" matches the argument list
So, it is unclear how to migrate to the new API without breaking the code. - LEDC API Errors
I get errors like:
'ledcAttach' was not declared in this scope
and
'suggested alternative: ledcAttachPin'
when using:
ledcAttach(PWMA, freq, ANALOG_WRITE_BITS);.
It seems that the LEDC API has changed between Arduino ESP32 core 2.x.x and 3.x.x, and the documentation is not always clear which version supports which function. - ESP-NOW API Error
I get this error:
'esp_now_recv_info_t' does not name a type; did you mean 'esp_now_peer_info_t'? void OnDataRecv(const esp_now_recv_info_t *info, const unsigned char* incomingData, int len)
It looks like the type esp_now_recv_info_t does not exist in the current ESP32 Arduino core. - General Deprecation Warnings
I also see warnings like:
'bool ArduinoJson::V741PB22::JsonDocument::containsKey(TChar*) const' is deprecated: use doc["key"].is<T>() instead.
and
control reaches end of non-void function [-Wreturn-type]
Environment:
PlatformIO (latest)
ESP32 Arduino core 2.x.x
ArduinoJson 7.x.x
Windows 10
Questions:
What is the correct way to migrate to the new JsonDocument API for both static and dynamic documents?
What is the recommended way to write cross-version compatible code for LEDC (PWM) initialization?
What is the correct function signature for ESP-NOW receive callback in the latest ESP32 Arduino core?
Are there any migration guides or best practices for handling these deprecations and API changes?
Thank you for your help!
Metadata
Metadata
Assignees
Labels
No labels