mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
change json package size, min 384, max 1024 for static, 2048 for dynamic
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
- change syslog settings without reboot
|
||||
- HA-config split in smaller blocks
|
||||
- commands `fetch` and `publish [ha]` as call
|
||||
- mqtt json package size
|
||||
|
||||
### Removed
|
||||
- old scripts
|
||||
|
||||
@@ -71,7 +71,7 @@ void WebAPIService::webAPIService(AsyncWebServerRequest * request) {
|
||||
id = "-1";
|
||||
}
|
||||
|
||||
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_DYN);
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
bool ok = false;
|
||||
|
||||
@@ -101,7 +101,7 @@ void WebAPIService::webAPIService(AsyncWebServerRequest * request) {
|
||||
ok ? PSTR("OK") : PSTR("Invalid"));
|
||||
EMSESP::logger().info(debug.c_str());
|
||||
if (json.size()) {
|
||||
char buffer2[EMSESP_MAX_JSON_SIZE_LARGE];
|
||||
char buffer2[EMSESP_MAX_JSON_SIZE_DYN];
|
||||
serializeJson(doc, buffer2);
|
||||
EMSESP::logger().info("json (max 255 chars): %s", buffer2);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ void WebAPIService::webAPIService(AsyncWebServerRequest * request) {
|
||||
// if we have returned data in JSON format, send this to the WEB
|
||||
if (json.size()) {
|
||||
doc.shrinkToFit();
|
||||
char buffer[EMSESP_MAX_JSON_SIZE_LARGE];
|
||||
char buffer[EMSESP_MAX_JSON_SIZE_DYN];
|
||||
serializeJsonPretty(doc, buffer);
|
||||
request->send(200, "text/plain", buffer);
|
||||
} else {
|
||||
|
||||
@@ -38,11 +38,10 @@
|
||||
|
||||
using uuid::console::Shell;
|
||||
|
||||
#define EMSESP_MAX_JSON_SIZE_SMALL 256 // for smaller json docs when using StaticJsonDocument
|
||||
#define EMSESP_MAX_JSON_SIZE_MEDIUM 768 // for smaller json docs from ems devices, when using StaticJsonDocument
|
||||
// #define EMSESP_MAX_JSON_SIZE_LARGE 2048 // for large json docs from ems devices, like boiler or thermostat data. Using DynamicJsonDocument
|
||||
// mqtt does not publish larger than 1570 on esp8266, boiler message is split and now smaller
|
||||
#define EMSESP_MAX_JSON_SIZE_LARGE 1536 // for large json docs from ems devices, like boiler or thermostat data. Using StaticJsonDocument
|
||||
#define EMSESP_MAX_JSON_SIZE_SMALL 384 // for smaller json docs when using StaticJsonDocument
|
||||
#define EMSESP_MAX_JSON_SIZE_MEDIUM 768 // for medium json docs from ems devices, when 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
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user