mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
use new SIZES
This commit is contained in:
@@ -101,7 +101,7 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject & input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// output json buffer
|
// output json buffer
|
||||||
size_t buffer = EMSESP_JSON_SIZE_XXLARGE_DYN;
|
size_t buffer = EMSESP_JSON_SIZE_XXXLARGE;
|
||||||
auto * response = new PrettyAsyncJsonResponse(false, buffer);
|
auto * response = new PrettyAsyncJsonResponse(false, buffer);
|
||||||
while (!response->getSize()) {
|
while (!response->getSize()) {
|
||||||
delete response;
|
delete response;
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ void WebCustomizationService::reset_customization(AsyncWebServerRequest * reques
|
|||||||
|
|
||||||
// send back a list of devices used in the customization web page
|
// send back a list of devices used in the customization web page
|
||||||
void WebCustomizationService::devices(AsyncWebServerRequest * request) {
|
void WebCustomizationService::devices(AsyncWebServerRequest * request) {
|
||||||
auto * response = new AsyncJsonResponse(false, EMSESP_JSON_SIZE_LARGE_DYN);
|
auto * response = new AsyncJsonResponse(false, EMSESP_JSON_SIZE_XLARGE);
|
||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
|
|
||||||
// list is already sorted by device type
|
// list is already sorted by device type
|
||||||
@@ -201,7 +201,7 @@ void WebCustomizationService::devices(AsyncWebServerRequest * request) {
|
|||||||
// send back list of device entities
|
// send back list of device entities
|
||||||
void WebCustomizationService::device_entities(AsyncWebServerRequest * request, JsonVariant & json) {
|
void WebCustomizationService::device_entities(AsyncWebServerRequest * request, JsonVariant & json) {
|
||||||
if (json.is<JsonObject>()) {
|
if (json.is<JsonObject>()) {
|
||||||
size_t buffer = EMSESP_JSON_SIZE_XXXLARGE_DYN;
|
size_t buffer = EMSESP_JSON_SIZE_XXXXLARGE;
|
||||||
auto * response = new MsgpackAsyncJsonResponse(true, buffer);
|
auto * response = new MsgpackAsyncJsonResponse(true, buffer);
|
||||||
while (!response->getSize()) {
|
while (!response->getSize()) {
|
||||||
delete response;
|
delete response;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void WebDataService::scan_devices(AsyncWebServerRequest * request) {
|
|||||||
// this is used in the dashboard and contains all ems device information
|
// this is used in the dashboard and contains all ems device information
|
||||||
// /coreData endpoint
|
// /coreData endpoint
|
||||||
void WebDataService::core_data(AsyncWebServerRequest * request) {
|
void WebDataService::core_data(AsyncWebServerRequest * request) {
|
||||||
auto * response = new AsyncJsonResponse(false, EMSESP_JSON_SIZE_XLARGE_DYN);
|
auto * response = new AsyncJsonResponse(false, EMSESP_JSON_SIZE_XXLARGE);
|
||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
|
|
||||||
// list is already sorted by device type
|
// list is already sorted by device type
|
||||||
@@ -105,7 +105,7 @@ void WebDataService::core_data(AsyncWebServerRequest * request) {
|
|||||||
// /sensorData endpoint
|
// /sensorData endpoint
|
||||||
// the "sensors" and "analogs" are arrays and must exist
|
// the "sensors" and "analogs" are arrays and must exist
|
||||||
void WebDataService::sensor_data(AsyncWebServerRequest * request) {
|
void WebDataService::sensor_data(AsyncWebServerRequest * request) {
|
||||||
auto * response = new AsyncJsonResponse(false, EMSESP_JSON_SIZE_XLARGE_DYN);
|
auto * response = new AsyncJsonResponse(false, EMSESP_JSON_SIZE_XXLARGE);
|
||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
|
|
||||||
// dallas sensors
|
// dallas sensors
|
||||||
@@ -166,7 +166,7 @@ void WebDataService::sensor_data(AsyncWebServerRequest * request) {
|
|||||||
// Compresses the JSON using MsgPack https://msgpack.org/index.html
|
// Compresses the JSON using MsgPack https://msgpack.org/index.html
|
||||||
void WebDataService::device_data(AsyncWebServerRequest * request, JsonVariant & json) {
|
void WebDataService::device_data(AsyncWebServerRequest * request, JsonVariant & json) {
|
||||||
if (json.is<JsonObject>()) {
|
if (json.is<JsonObject>()) {
|
||||||
size_t buffer = EMSESP_JSON_SIZE_XXXLARGE_DYN;
|
size_t buffer = EMSESP_JSON_SIZE_XXXXLARGE;
|
||||||
auto * response = new MsgpackAsyncJsonResponse(false, buffer);
|
auto * response = new MsgpackAsyncJsonResponse(false, buffer);
|
||||||
while (!response->getSize()) {
|
while (!response->getSize()) {
|
||||||
delete response;
|
delete response;
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ char * WebLogService::messagetime(char * out, const uint64_t t, const size_t buf
|
|||||||
|
|
||||||
// send to web eventsource
|
// send to web eventsource
|
||||||
void WebLogService::transmit(const QueuedLogMessage & message) {
|
void WebLogService::transmit(const QueuedLogMessage & message) {
|
||||||
|
// TODO use StaticJsonDocument ?
|
||||||
auto jsonDocument = DynamicJsonDocument(EMSESP_JSON_SIZE_MEDIUM);
|
auto jsonDocument = DynamicJsonDocument(EMSESP_JSON_SIZE_MEDIUM);
|
||||||
JsonObject logEvent = jsonDocument.to<JsonObject>();
|
JsonObject logEvent = jsonDocument.to<JsonObject>();
|
||||||
char time_string[25];
|
char time_string[25];
|
||||||
@@ -206,7 +207,7 @@ void WebLogService::transmit(const QueuedLogMessage & message) {
|
|||||||
|
|
||||||
// send the complete log buffer to the API, not filtering on log level
|
// send the complete log buffer to the API, not filtering on log level
|
||||||
void WebLogService::fetchLog(AsyncWebServerRequest * request) {
|
void WebLogService::fetchLog(AsyncWebServerRequest * request) {
|
||||||
auto * response = new MsgpackAsyncJsonResponse(false, EMSESP_JSON_SIZE_LARGE_DYN + 192 * log_messages_.size());
|
auto * response = new MsgpackAsyncJsonResponse(false, EMSESP_JSON_SIZE_XLARGE + 192 * log_messages_.size());
|
||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
JsonArray log = root.createNestedArray("events");
|
JsonArray log = root.createNestedArray("events");
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WebStatusService::webStatusService(AsyncWebServerRequest * request) {
|
void WebStatusService::webStatusService(AsyncWebServerRequest * request) {
|
||||||
auto * response = new AsyncJsonResponse(false, EMSESP_JSON_SIZE_MEDIUM_DYN);
|
auto * response = new AsyncJsonResponse(false, EMSESP_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
|
||||||
|
|||||||
Reference in New Issue
Block a user