-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
ESP32-WROVER-IE-N8R8
lib version ArduinoJson 7
Hi. Can you tell me if the JsonDocument type can be passed to a function by reference? Or how it is correct in general.
I've noticed a memory leak, and maybe it's because I didn't send the json correctly.
void Core::Add_Sys_JSON(JsonDocument &to) {
to["device_id"] = Status.device_id;
to["chip_id"] = ESP.getEfuseMac();
to["model_id"] = MODEL_ID;
to["fw_version"] = FW_VERSION;
to["mac_eth"] = GetMAC(ESP_MAC_ETH);
to["mac_wifi"] = GetMAC(ESP_MAC_WIFI_STA);
}
void addData(JsonDocument &to_write)
{
json["str"] = "test";
Add_Sys_JSON(to_write);
}
JsonDocument json;
json["id"] = 1;
addData(json);