Replace deprecated StaticJsonDocument type
This commit is contained in:
parent
f195bd7417
commit
a74f7d64cf
@ -18,7 +18,7 @@ typedef struct {
|
||||
int connection_attempts;
|
||||
} Config;
|
||||
|
||||
void initialize_config(Config *config, StaticJsonDocument<512> json);
|
||||
void initialize_config(Config *config, JsonDocument json);
|
||||
|
||||
bool load_config_file(const char *file_path, Config *config);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
void initialize_config(Config *config, StaticJsonDocument<512> json) {
|
||||
void initialize_config(Config *config, JsonDocument json) {
|
||||
config->ssid = strdup(json["ssid"]);
|
||||
config->psk = strdup(json["psk"]);
|
||||
config->mqtt_host = strdup(json["mqtt_host"]);
|
||||
@ -19,7 +19,7 @@ bool load_config_file(const char *file_path, Config *config) {
|
||||
File config_file = LittleFS.open(file_path, "r");
|
||||
if (!config_file)
|
||||
return false;
|
||||
StaticJsonDocument<512> json;
|
||||
JsonDocument json;
|
||||
DeserializationError err = deserializeJson(json, config_file);
|
||||
if (err)
|
||||
return false;
|
||||
|
@ -39,7 +39,7 @@ void disconnect_mqtt(PubSubClient &client, const char *topic) {
|
||||
}
|
||||
|
||||
size_t construct_json(float *data, char *buffer, int buffer_size) {
|
||||
StaticJsonDocument<100> json;
|
||||
JsonDocument json;
|
||||
json["temperature"] = data[0];
|
||||
json["humidity"] = data[1];
|
||||
size_t payload_size = serializeJson(json, buffer, buffer_size);
|
||||
|
Loading…
Reference in New Issue
Block a user