Skip to content

Commit 4a16193

Browse files
authored
Merge pull request #340 from LeeLeahy2/no-dynamic
Switch from DynamicJsonDocument and StaticJsonDocument to JsonDocument
2 parents e402edc + 44dcf6b commit 4a16193

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Firmware/RTK_Everywhere/menuPP.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ bool pointperfectProvisionDevice()
243243
char versionString[9];
244244
getFirmwareVersion(versionString, sizeof(versionString), false);
245245

246-
StaticJsonDocument<256> pointPerfectAPIPost;
246+
JsonDocument pointPerfectAPIPost;
247247

248248
char tokenString[37] = "\0";
249249
char tokenChar;
@@ -443,10 +443,10 @@ void pointperfectGetToken(char *tokenString)
443443
// Given a prepared JSON blob, pass to the PointPerfect API
444444
// If it passes, keys/values are recorded to settings, ZTP_SUCCESS is returned
445445
// If we fail, a ZTP response is returned
446-
ZtpResponse pointperfectTryZtpToken(StaticJsonDocument<256> &apiPost)
446+
ZtpResponse pointperfectTryZtpToken(JsonDocument &apiPost)
447447
{
448448
#ifdef COMPILE_WIFI
449-
DynamicJsonDocument *jsonZtp = nullptr;
449+
JsonDocument *jsonZtp = nullptr;
450450
char *tempHolderPtr = nullptr;
451451

452452
WiFiClientSecure client;
@@ -526,7 +526,7 @@ ZtpResponse pointperfectTryZtpToken(StaticJsonDocument<256> &apiPost)
526526
{
527527
// Device is now active with ThingStream
528528
// Pull pertinent values from response
529-
jsonZtp = new DynamicJsonDocument(8192);
529+
jsonZtp = new JsonDocument;
530530
if (!jsonZtp)
531531
{
532532
systemPrintln("ERROR - Failed to allocate jsonZtp!\r\n");
@@ -645,7 +645,7 @@ ZtpResponse pointperfectTryZtpToken(StaticJsonDocument<256> &apiPost)
645645
}
646646

647647
// Find thing3 in (*jsonZtp)[thing1][n][thing2]. Return n on success. Return -1 on error / not found.
648-
int findZtpJSONEntry(const char *thing1, const char *thing2, const char *thing3, DynamicJsonDocument *jsonZtp)
648+
int findZtpJSONEntry(const char *thing1, const char *thing2, const char *thing3, JsonDocument *jsonZtp)
649649
{
650650
if (!jsonZtp)
651651
return (-1);
@@ -784,7 +784,7 @@ bool checkPrivateKeyValidity(char *privateKey, int privateKeySize)
784784
int result_code = mbedtls_pk_parse_key(&pk, (unsigned char *)privateKey, privateKeySize + 1, nullptr, 0, mbedtls_ctr_drbg_random, &ctr_drbg);
785785
mbedtls_pk_free(&pk);
786786
mbedtls_ctr_drbg_free(&ctr_drbg);
787-
787+
788788
if (result_code < 0)
789789
{
790790
if (settings.debugPpCertificate)

0 commit comments

Comments
 (0)