use new SIZES

This commit is contained in:
Proddy
2023-01-05 15:11:34 +01:00
parent 132acaf758
commit a51bc276b5
5 changed files with 9 additions and 8 deletions

View File

@@ -101,7 +101,7 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject & input) {
}
// output json buffer
size_t buffer = EMSESP_JSON_SIZE_XXLARGE_DYN;
size_t buffer = EMSESP_JSON_SIZE_XXXLARGE;
auto * response = new PrettyAsyncJsonResponse(false, buffer);
while (!response->getSize()) {
delete response;

View File

@@ -178,7 +178,7 @@ void WebCustomizationService::reset_customization(AsyncWebServerRequest * reques
// send back a list of devices used in the customization web page
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();
// list is already sorted by device type
@@ -201,7 +201,7 @@ void WebCustomizationService::devices(AsyncWebServerRequest * request) {
// send back list of device entities
void WebCustomizationService::device_entities(AsyncWebServerRequest * request, JsonVariant & json) {
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);
while (!response->getSize()) {
delete response;

View File

@@ -70,7 +70,7 @@ void WebDataService::scan_devices(AsyncWebServerRequest * request) {
// this is used in the dashboard and contains all ems device information
// /coreData endpoint
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();
// list is already sorted by device type
@@ -105,7 +105,7 @@ void WebDataService::core_data(AsyncWebServerRequest * request) {
// /sensorData endpoint
// the "sensors" and "analogs" are arrays and must exist
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();
// dallas sensors
@@ -166,7 +166,7 @@ void WebDataService::sensor_data(AsyncWebServerRequest * request) {
// Compresses the JSON using MsgPack https://msgpack.org/index.html
void WebDataService::device_data(AsyncWebServerRequest * request, JsonVariant & json) {
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);
while (!response->getSize()) {
delete response;

View File

@@ -185,6 +185,7 @@ char * WebLogService::messagetime(char * out, const uint64_t t, const size_t buf
// send to web eventsource
void WebLogService::transmit(const QueuedLogMessage & message) {
// TODO use StaticJsonDocument ?
auto jsonDocument = DynamicJsonDocument(EMSESP_JSON_SIZE_MEDIUM);
JsonObject logEvent = jsonDocument.to<JsonObject>();
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
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();
JsonArray log = root.createNestedArray("events");

View File

@@ -120,7 +120,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
}
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();
root["status"] = EMSESP::bus_status(); // 0, 1 or 2