Skip to content

Commit

Permalink
Merge pull request #166 from BlueAndi/feature/dependency_upgrades
Browse files Browse the repository at this point in the history
Upgrade platform and ArduinoJSON versions
  • Loading branch information
gabryelreyes authored Sep 13, 2024
2 parents c227871 + 692913c commit b9a2235
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 52 deletions.
8 changes: 4 additions & 4 deletions lib/ConvoyFollower/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<JSON_BIRTHMESSAGE_MAX_SIZE> birthDoc;
String birthMessage;
bool isSuccessful = false;
SettingsHandler& settings = SettingsHandler::getInstance();
JsonDocument birthDoc;
String birthMessage;

birthDoc["name"] = settings.getRobotName();

Expand Down
8 changes: 4 additions & 4 deletions lib/ConvoyLeader/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<JSON_BIRTHMESSAGE_MAX_SIZE> birthDoc;
String birthMessage;
bool isSuccessful = false;
SettingsHandler& settings = SettingsHandler::getInstance();
JsonDocument birthDoc;
String birthMessage;

birthDoc["name"] = settings.getRobotName();

Expand Down
26 changes: 13 additions & 13 deletions lib/PlatoonService/src/V2VCommManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ bool V2VCommManager::sendIVS(const int32_t ivs) const
V2VEventType type = V2V_EVENT_IVS;

/* Create JSON document. */
StaticJsonDocument<JSON_DOC_DEFAULT_SIZE> jsonPayload;
String payload;
JsonDocument jsonPayload;
String payload;

jsonPayload["ivs"] = ivs;

Expand Down Expand Up @@ -375,8 +375,8 @@ int32_t V2VCommManager::getPlatoonLength() const
void V2VCommManager::eventCallback(const String& payload)
{
/* Deserialize payload. */
StaticJsonDocument<JSON_DOC_DEFAULT_SIZE> jsonPayload;
DeserializationError error = deserializeJson(jsonPayload, payload.c_str());
JsonDocument jsonPayload;
DeserializationError error = deserializeJson(jsonPayload, payload.c_str());

if (DeserializationError::Ok != error)
{
Expand Down Expand Up @@ -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<uint32_t>();
StaticJsonDocument<JSON_HEARTBEAT_MAX_SIZE> heartbeatDoc;
uint32_t eventDataTimestamp = jsonEventDataTimestamp.as<uint32_t>();
JsonDocument heartbeatDoc;
heartbeatDoc["timestamp"] = eventDataTimestamp;
heartbeatDoc["status"] = m_vehicleStatus;

Expand Down Expand Up @@ -729,9 +729,9 @@ bool V2VCommManager::sendPlatoonHeartbeat()
bool isSuccessful = false;

/* Send platoon heartbeat. */
StaticJsonDocument<JSON_HEARTBEAT_MAX_SIZE> heartbeatDoc;
String heartbeatPayload;
uint32_t timestamp = millis();
JsonDocument heartbeatDoc;
String heartbeatPayload;
uint32_t timestamp = millis();

heartbeatDoc["timestamp"] = timestamp;

Expand Down Expand Up @@ -762,8 +762,8 @@ bool V2VCommManager::publishEvent(const String& topic, V2VEventType type, const
bool isSuccessful = false;

/* Create JSON document. */
StaticJsonDocument<JSON_DOC_DEFAULT_SIZE> jsonPayload;
String payload;
JsonDocument jsonPayload;
String payload;

jsonPayload["id"] = m_vehicleId;
jsonPayload["type"] = type;
Expand Down Expand Up @@ -844,8 +844,8 @@ bool V2VCommManager::sendPlatoonLength(const int32_t length) const
V2VEventType type = V2V_EVENT_IVS;

/* Create JSON document. */
StaticJsonDocument<JSON_DOC_DEFAULT_SIZE> jsonPayload;
String payload;
JsonDocument jsonPayload;
String payload;

jsonPayload["length"] = length;

Expand Down
8 changes: 4 additions & 4 deletions lib/PlatoonService/src/Waypoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ static const uint32_t JSON_DOC_DEFAULT_SIZE = 1024U;

Waypoint* Waypoint::deserialize(const String& serializedWaypoint)
{
Waypoint* waypoint = nullptr;
StaticJsonDocument<JSON_DOC_DEFAULT_SIZE> jsonPayload;
DeserializationError error = deserializeJson(jsonPayload, serializedWaypoint.c_str());
Waypoint* waypoint = nullptr;
JsonDocument jsonPayload;
DeserializationError error = deserializeJson(jsonPayload, serializedWaypoint.c_str());

if (DeserializationError::Ok != error)
{
Expand Down Expand Up @@ -116,7 +116,7 @@ Waypoint* Waypoint::fromJsonObject(const JsonObject& jsonWaypoint)

void Waypoint::serialize(String& serializedWaypoint) const
{
StaticJsonDocument<JSON_DOC_DEFAULT_SIZE> jsonPayload;
JsonDocument jsonPayload;

jsonPayload["X"] = xPos; /* X position [mm]. */
jsonPayload["Y"] = yPos; /* Y position [mm]. */
Expand Down
14 changes: 7 additions & 7 deletions lib/RemoteControl/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ void App::setup()
else
{
/* Setup MQTT Server, Birth and Will messages. */
StaticJsonDocument<JSON_BIRTHMESSAGE_MAX_SIZE> 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);
Expand Down Expand Up @@ -278,8 +278,8 @@ void App::fatalErrorHandler()

void App::cmdTopicCallback(const String& payload)
{
StaticJsonDocument<JSON_DOC_DEFAULT_SIZE> jsonPayload;
DeserializationError error = deserializeJson(jsonPayload, payload.c_str());
JsonDocument jsonPayload;
DeserializationError error = deserializeJson(jsonPayload, payload.c_str());

if (error != DeserializationError::Ok)
{
Expand Down Expand Up @@ -355,8 +355,8 @@ void App::cmdTopicCallback(const String& payload)

void App::motorSpeedsTopicCallback(const String& payload)
{
StaticJsonDocument<JSON_DOC_DEFAULT_SIZE> jsonPayload;
DeserializationError error = deserializeJson(jsonPayload, payload.c_str());
JsonDocument jsonPayload;
DeserializationError error = deserializeJson(jsonPayload, payload.c_str());

if (error != DeserializationError::Ok)
{
Expand Down
10 changes: 5 additions & 5 deletions lib/SensorFusion/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ void App::setup()
else
{
/* Setup MQTT Server, Birth and Will messages. */
StaticJsonDocument<JSON_BIRTHMESSAGE_MAX_SIZE> 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);
Expand Down Expand Up @@ -224,8 +224,8 @@ void App::fatalErrorHandler()

void App::publishSensorFusionPosition()
{
StaticJsonDocument<JSON_DOC_DEFAULT_SIZE> 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();
Expand Down
17 changes: 8 additions & 9 deletions lib/Service/src/SettingsHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@

bool SettingsHandler::loadConfigurationFile(const String& filename)
{
bool isSuccessful = false;
const uint32_t maxBufferSize = 1024U;
StaticJsonDocument<maxBufferSize> 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))
{
Expand Down Expand Up @@ -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<maxDocSize> 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;
Expand Down
12 changes: 6 additions & 6 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -110,7 +110,7 @@ lib_deps =
ArduinoNative
HALTest
Utilities
bblanchon/ArduinoJson @ ^6.21.3
bblanchon/ArduinoJson @ ^7.1.0
MainTestNative
lib_ignore =
HALSim
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 =

; *****************************************************************************
Expand Down

0 comments on commit b9a2235

Please sign in to comment.