From 578b8fb0c2439788e240aba03d33a1d9d64873e8 Mon Sep 17 00:00:00 2001 From: gabryelreyes Date: Thu, 12 Sep 2024 14:05:33 +0200 Subject: [PATCH 1/2] Upgrade to the latests esp32 platform --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 9a25e568..7343a59c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -33,7 +33,7 @@ check_skip_packages = yes ; Target environment for ZumoComSystem. ; ***************************************************************************** [target:esp32] -platform = espressif32 @ ~6.4.0 +platform = espressif32 @ ~6.8.1 board = esp32doit-devkit-v1 board_build.filesystem = littlefs framework = arduino From 692913ca8f31b52d66a249b4d55df721e42675b1 Mon Sep 17 00:00:00 2001 From: gabryelreyes Date: Thu, 12 Sep 2024 14:05:50 +0200 Subject: [PATCH 2/2] Upgrade ArduinoJson to v7 --- lib/ConvoyFollower/src/App.cpp | 8 +++---- lib/ConvoyLeader/src/App.cpp | 8 +++---- lib/PlatoonService/src/V2VCommManager.cpp | 26 +++++++++++------------ lib/PlatoonService/src/Waypoint.cpp | 8 +++---- lib/RemoteControl/src/App.cpp | 14 ++++++------ lib/SensorFusion/src/App.cpp | 10 ++++----- lib/Service/src/SettingsHandler.cpp | 17 +++++++-------- platformio.ini | 10 ++++----- 8 files changed, 50 insertions(+), 51 deletions(-) diff --git a/lib/ConvoyFollower/src/App.cpp b/lib/ConvoyFollower/src/App.cpp index de7cb2fc..249d603c 100644 --- a/lib/ConvoyFollower/src/App.cpp +++ b/lib/ConvoyFollower/src/App.cpp @@ -276,10 +276,10 @@ void App::fatalErrorHandler() bool App::setupMqttClient() { /* Setup MQTT Server, Birth and Will messages. */ - bool isSuccessful = false; - SettingsHandler& settings = SettingsHandler::getInstance(); - StaticJsonDocument birthDoc; - String birthMessage; + bool isSuccessful = false; + SettingsHandler& settings = SettingsHandler::getInstance(); + JsonDocument birthDoc; + String birthMessage; birthDoc["name"] = settings.getRobotName(); diff --git a/lib/ConvoyLeader/src/App.cpp b/lib/ConvoyLeader/src/App.cpp index 7d7c44a8..8c210585 100644 --- a/lib/ConvoyLeader/src/App.cpp +++ b/lib/ConvoyLeader/src/App.cpp @@ -280,10 +280,10 @@ void App::fatalErrorHandler() bool App::setupMqttClient() { /* Setup MQTT Server, Birth and Will messages. */ - bool isSuccessful = false; - SettingsHandler& settings = SettingsHandler::getInstance(); - StaticJsonDocument birthDoc; - String birthMessage; + bool isSuccessful = false; + SettingsHandler& settings = SettingsHandler::getInstance(); + JsonDocument birthDoc; + String birthMessage; birthDoc["name"] = settings.getRobotName(); diff --git a/lib/PlatoonService/src/V2VCommManager.cpp b/lib/PlatoonService/src/V2VCommManager.cpp index 9872633e..b4897f83 100644 --- a/lib/PlatoonService/src/V2VCommManager.cpp +++ b/lib/PlatoonService/src/V2VCommManager.cpp @@ -302,8 +302,8 @@ bool V2VCommManager::sendIVS(const int32_t ivs) const V2VEventType type = V2V_EVENT_IVS; /* Create JSON document. */ - StaticJsonDocument jsonPayload; - String payload; + JsonDocument jsonPayload; + String payload; jsonPayload["ivs"] = ivs; @@ -375,8 +375,8 @@ int32_t V2VCommManager::getPlatoonLength() const void V2VCommManager::eventCallback(const String& payload) { /* Deserialize payload. */ - StaticJsonDocument jsonPayload; - DeserializationError error = deserializeJson(jsonPayload, payload.c_str()); + JsonDocument jsonPayload; + DeserializationError error = deserializeJson(jsonPayload, payload.c_str()); if (DeserializationError::Ok != error) { @@ -471,8 +471,8 @@ void V2VCommManager::eventCallback(const String& payload) if (false == jsonEventDataTimestamp.isNull()) { /* Timestamp is sent back to acknowledge synchronization. */ - uint32_t eventDataTimestamp = jsonEventDataTimestamp.as(); - StaticJsonDocument heartbeatDoc; + uint32_t eventDataTimestamp = jsonEventDataTimestamp.as(); + JsonDocument heartbeatDoc; heartbeatDoc["timestamp"] = eventDataTimestamp; heartbeatDoc["status"] = m_vehicleStatus; @@ -729,9 +729,9 @@ bool V2VCommManager::sendPlatoonHeartbeat() bool isSuccessful = false; /* Send platoon heartbeat. */ - StaticJsonDocument heartbeatDoc; - String heartbeatPayload; - uint32_t timestamp = millis(); + JsonDocument heartbeatDoc; + String heartbeatPayload; + uint32_t timestamp = millis(); heartbeatDoc["timestamp"] = timestamp; @@ -762,8 +762,8 @@ bool V2VCommManager::publishEvent(const String& topic, V2VEventType type, const bool isSuccessful = false; /* Create JSON document. */ - StaticJsonDocument jsonPayload; - String payload; + JsonDocument jsonPayload; + String payload; jsonPayload["id"] = m_vehicleId; jsonPayload["type"] = type; @@ -844,8 +844,8 @@ bool V2VCommManager::sendPlatoonLength(const int32_t length) const V2VEventType type = V2V_EVENT_IVS; /* Create JSON document. */ - StaticJsonDocument jsonPayload; - String payload; + JsonDocument jsonPayload; + String payload; jsonPayload["length"] = length; diff --git a/lib/PlatoonService/src/Waypoint.cpp b/lib/PlatoonService/src/Waypoint.cpp index ea85b4d5..2848a329 100644 --- a/lib/PlatoonService/src/Waypoint.cpp +++ b/lib/PlatoonService/src/Waypoint.cpp @@ -65,9 +65,9 @@ static const uint32_t JSON_DOC_DEFAULT_SIZE = 1024U; Waypoint* Waypoint::deserialize(const String& serializedWaypoint) { - Waypoint* waypoint = nullptr; - StaticJsonDocument jsonPayload; - DeserializationError error = deserializeJson(jsonPayload, serializedWaypoint.c_str()); + Waypoint* waypoint = nullptr; + JsonDocument jsonPayload; + DeserializationError error = deserializeJson(jsonPayload, serializedWaypoint.c_str()); if (DeserializationError::Ok != error) { @@ -116,7 +116,7 @@ Waypoint* Waypoint::fromJsonObject(const JsonObject& jsonWaypoint) void Waypoint::serialize(String& serializedWaypoint) const { - StaticJsonDocument jsonPayload; + JsonDocument jsonPayload; jsonPayload["X"] = xPos; /* X position [mm]. */ jsonPayload["Y"] = yPos; /* Y position [mm]. */ diff --git a/lib/RemoteControl/src/App.cpp b/lib/RemoteControl/src/App.cpp index e15e3cec..0be94d4a 100644 --- a/lib/RemoteControl/src/App.cpp +++ b/lib/RemoteControl/src/App.cpp @@ -149,9 +149,9 @@ void App::setup() else { /* Setup MQTT Server, Birth and Will messages. */ - StaticJsonDocument birthDoc; - char birthMsgArray[JSON_BIRTHMESSAGE_MAX_SIZE]; - String birthMessage; + JsonDocument birthDoc; + char birthMsgArray[JSON_BIRTHMESSAGE_MAX_SIZE]; + String birthMessage; birthDoc["name"] = settings.getRobotName().c_str(); (void)serializeJson(birthDoc, birthMsgArray); @@ -278,8 +278,8 @@ void App::fatalErrorHandler() void App::cmdTopicCallback(const String& payload) { - StaticJsonDocument jsonPayload; - DeserializationError error = deserializeJson(jsonPayload, payload.c_str()); + JsonDocument jsonPayload; + DeserializationError error = deserializeJson(jsonPayload, payload.c_str()); if (error != DeserializationError::Ok) { @@ -355,8 +355,8 @@ void App::cmdTopicCallback(const String& payload) void App::motorSpeedsTopicCallback(const String& payload) { - StaticJsonDocument jsonPayload; - DeserializationError error = deserializeJson(jsonPayload, payload.c_str()); + JsonDocument jsonPayload; + DeserializationError error = deserializeJson(jsonPayload, payload.c_str()); if (error != DeserializationError::Ok) { diff --git a/lib/SensorFusion/src/App.cpp b/lib/SensorFusion/src/App.cpp index 665af7de..28289403 100644 --- a/lib/SensorFusion/src/App.cpp +++ b/lib/SensorFusion/src/App.cpp @@ -151,9 +151,9 @@ void App::setup() else { /* Setup MQTT Server, Birth and Will messages. */ - StaticJsonDocument birthDoc; - char birthMsgArray[JSON_BIRTHMESSAGE_MAX_SIZE]; - String birthMessage; + JsonDocument birthDoc; + char birthMsgArray[JSON_BIRTHMESSAGE_MAX_SIZE]; + String birthMessage; birthDoc["name"] = settings.getRobotName().c_str(); (void)serializeJson(birthDoc, birthMsgArray); @@ -224,8 +224,8 @@ void App::fatalErrorHandler() void App::publishSensorFusionPosition() { - StaticJsonDocument payloadJson; - char payloadArray[JSON_DOC_DEFAULT_SIZE]; + JsonDocument payloadJson; + char payloadArray[JSON_DOC_DEFAULT_SIZE]; /* Write newest Sensor Fusion Data in JSON String */ IKalmanFilter::PositionData currentPosition = m_sensorFusion.getLatestPosition(); diff --git a/lib/Service/src/SettingsHandler.cpp b/lib/Service/src/SettingsHandler.cpp index 48e36bd0..23d7a4d6 100644 --- a/lib/Service/src/SettingsHandler.cpp +++ b/lib/Service/src/SettingsHandler.cpp @@ -64,10 +64,10 @@ bool SettingsHandler::loadConfigurationFile(const String& filename) { - bool isSuccessful = false; - const uint32_t maxBufferSize = 1024U; - StaticJsonDocument doc; - char buffer[maxBufferSize]; + bool isSuccessful = false; + const uint32_t maxBufferSize = 1024U; + JsonDocument doc; + char buffer[maxBufferSize]; if (0U == m_fileHandler.readFile(filename, buffer, maxBufferSize)) { @@ -180,11 +180,10 @@ bool SettingsHandler::loadConfigurationFile(const String& filename) bool SettingsHandler::saveConfigurationFile(const String& filename) { - bool isSuccessful = false; - const size_t maxDocSize = 1024U; - StaticJsonDocument doc; - size_t jsonBufferSize = 0U; - size_t bytesToWrite = 0U; + bool isSuccessful = false; + JsonDocument doc; + size_t jsonBufferSize = 0U; + size_t bytesToWrite = 0U; doc[ConfigurationKeys::ROBOT_NAME] = m_robotName; doc[ConfigurationKeys::WIFI][ConfigurationKeys::SSID] = m_wifiSSID; diff --git a/platformio.ini b/platformio.ini index 7343a59c..9005aa8d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -110,7 +110,7 @@ lib_deps = ArduinoNative HALTest Utilities - bblanchon/ArduinoJson @ ^6.21.3 + bblanchon/ArduinoJson @ ^7.1.0 MainTestNative lib_ignore = HALSim @@ -128,7 +128,7 @@ lib_deps = Service Utilities gabryelreyes/SerialMuxProt @ ^2.0.0 - bblanchon/ArduinoJson @ ^6.21.3 + bblanchon/ArduinoJson @ ^7.1.0 PlatoonService lib_ignore = ConvoyFollower @@ -145,7 +145,7 @@ lib_deps = Service Utilities gabryelreyes/SerialMuxProt @ ^2.0.0 - bblanchon/ArduinoJson @ ^6.21.3 + bblanchon/ArduinoJson @ ^7.1.0 PlatoonService lib_ignore = ConvoyLeader @@ -162,7 +162,7 @@ lib_deps = Service Utilities gabryelreyes/SerialMuxProt @ ^2.0.0 - bblanchon/ArduinoJson @ ^6.21.3 + bblanchon/ArduinoJson @ ^7.1.0 lib_ignore = ConvoyLeader ConvoyFollower @@ -191,7 +191,7 @@ lib_deps = SensorFusion hideakitai/ArduinoEigen @ ^0.3.0 gabryelreyes/SerialMuxProt @ ^2.0.0 - bblanchon/ArduinoJson @ ^6.21.3 + bblanchon/ArduinoJson @ ^7.1.0 lib_ignore = ; *****************************************************************************