mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
rename json sizes
This commit is contained in:
@@ -71,7 +71,7 @@ void WebAPIService::webAPIService(AsyncWebServerRequest * request) {
|
|||||||
id = "-1";
|
id = "-1";
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_DYN);
|
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_MEDIUM_DYN);
|
||||||
JsonObject json = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
@@ -109,9 +109,9 @@ void WebAPIService::webAPIService(AsyncWebServerRequest * request) {
|
|||||||
|
|
||||||
// if we have returned data in JSON format, send this to the WEB
|
// if we have returned data in JSON format, send this to the WEB
|
||||||
if (json.size()) {
|
if (json.size()) {
|
||||||
char buffer[EMSESP_MAX_JSON_SIZE_DYN];
|
std::string buffer;
|
||||||
serializeJsonPretty(doc, buffer);
|
serializeJsonPretty(doc, buffer);
|
||||||
request->send(200, "text/plain", buffer);
|
request->send(200, "text/plain", buffer.c_str());
|
||||||
} else {
|
} else {
|
||||||
request->send(200, "text/plain", ok ? F("OK") : F("Invalid"));
|
request->send(200, "text/plain", ok ? F("OK") : F("Invalid"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void WebDevicesService::scan_devices(AsyncWebServerRequest * request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WebDevicesService::all_devices(AsyncWebServerRequest * request) {
|
void WebDevicesService::all_devices(AsyncWebServerRequest * request) {
|
||||||
AsyncJsonResponse * response = new AsyncJsonResponse(false, EMSESP_MAX_JSON_SIZE_LARGE_DYN);
|
AsyncJsonResponse * response = new AsyncJsonResponse(false, EMSESP_MAX_JSON_SIZE_LARGE);
|
||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
|
|
||||||
JsonArray devices = root.createNestedArray("devices");
|
JsonArray devices = root.createNestedArray("devices");
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void WebStatusService::onStationModeGotIP(const WiFiEventStationModeGotIP & even
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void WebStatusService::webStatusService(AsyncWebServerRequest * request) {
|
void WebStatusService::webStatusService(AsyncWebServerRequest * request) {
|
||||||
AsyncJsonResponse * response = new AsyncJsonResponse(false, MAX_EMSESP_STATUS_SIZE);
|
AsyncJsonResponse * response = new AsyncJsonResponse(false, EMSESP_MAX_JSON_SIZE_LARGE);
|
||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
|
|
||||||
root["status"] = EMSESP::bus_status(); // 0, 1 or 2
|
root["status"] = EMSESP::bus_status(); // 0, 1 or 2
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include <SecurityManager.h>
|
#include <SecurityManager.h>
|
||||||
#include <AsyncMqttClient.h>
|
#include <AsyncMqttClient.h>
|
||||||
|
|
||||||
#define MAX_EMSESP_STATUS_SIZE 1024
|
|
||||||
#define EMSESP_STATUS_SERVICE_PATH "/rest/emsespStatus"
|
#define EMSESP_STATUS_SERVICE_PATH "/rest/emsespStatus"
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ void EMSESPShell::add_console_commands() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_DYN);
|
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_MEDIUM_DYN);
|
||||||
JsonObject json = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|||||||
12
src/emsesp.h
12
src/emsesp.h
@@ -52,12 +52,12 @@
|
|||||||
|
|
||||||
#define WATCH_ID_NONE 0 // no watch id set
|
#define WATCH_ID_NONE 0 // no watch id set
|
||||||
|
|
||||||
#define EMSESP_MAX_JSON_SIZE_HA_CONFIG 384 // for small HA config payloads
|
#define EMSESP_MAX_JSON_SIZE_HA_CONFIG 384 // for small HA config payloads, using StaticJsonDocument
|
||||||
#define EMSESP_MAX_JSON_SIZE_SMALL 256 // for smaller json docs when using StaticJsonDocument
|
#define EMSESP_MAX_JSON_SIZE_SMALL 256 // for smaller json docs, using StaticJsonDocument
|
||||||
#define EMSESP_MAX_JSON_SIZE_MEDIUM 768 // for medium json docs from ems devices, when using StaticJsonDocument
|
#define EMSESP_MAX_JSON_SIZE_MEDIUM 768 // for medium json docs from ems devices, using StaticJsonDocument
|
||||||
#define EMSESP_MAX_JSON_SIZE_LARGE 1024 // for large json docs from ems devices, like boiler or thermostat data. Using StaticJsonDocument
|
#define EMSESP_MAX_JSON_SIZE_LARGE 1024 // for large json docs from ems devices, like boiler or thermostat data, using StaticJsonDocument
|
||||||
#define EMSESP_MAX_JSON_SIZE_DYN 2048 // for large json docs from web. Using DynamicJsonDocument
|
#define EMSESP_MAX_JSON_SIZE_MEDIUM_DYN 1024 // for large json docs, using DynamicJsonDocument
|
||||||
#define EMSESP_MAX_JSON_SIZE_LARGE_DYN 4098 // for very large json docs. Using DynamicJsonDocument
|
#define EMSESP_MAX_JSON_SIZE_LARGE_DYN 2048 // for very large json docs, using DynamicJsonDocument
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user