From 6fc7a3a02e706f34890a4c54ec45edaee333be92 Mon Sep 17 00:00:00 2001 From: debsahu Date: Tue, 10 Jul 2018 08:53:01 -0400 Subject: [PATCH] fix https://github.com/toblum/McLighting/issues/206 Correct usage of measureJson() - Fix https://github.com/toblum/McLighting/issues/206 --- Arduino/McLighting/request_handlers.h | 4 ++-- Arduino/McLighting/version.h | 2 +- Arduino/McLighting/version_info.ino | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Arduino/McLighting/request_handlers.h b/Arduino/McLighting/request_handlers.h index 1917812..877ee94 100644 --- a/Arduino/McLighting/request_handlers.h +++ b/Arduino/McLighting/request_handlers.h @@ -953,7 +953,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght for (uint8_t i = 0; i < strip.getModeCount(); i++) { effect_list.add(strip.getModeName(i)); } - char buffer[json.measureJson() + 1]; + char buffer[measureJson(json) + 1]; serializeJson(json, buffer, sizeof(buffer)); mqtt_client.publish(String("homeassistant/light/" + String(HOSTNAME) + "/config").c_str(), buffer, true); #endif @@ -1033,7 +1033,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght for (uint8_t i = 0; i < strip.getModeCount(); i++) { effect_list.add(strip.getModeName(i)); } - char buffer[json.measureJson() + 1]; + char buffer[measureJson(json) + 1]; serializeJson(json, buffer, sizeof(buffer)); DBG_OUTPUT_PORT.println(buffer); amqttClient.publish(String("homeassistant/light/" + String(HOSTNAME) + "/config").c_str(), qospub, true, buffer); diff --git a/Arduino/McLighting/version.h b/Arduino/McLighting/version.h index 0574111..ff7b8d7 100644 --- a/Arduino/McLighting/version.h +++ b/Arduino/McLighting/version.h @@ -1 +1 @@ -#define SKETCH_VERSION "2.1.3" +#define SKETCH_VERSION "2.1.4" diff --git a/Arduino/McLighting/version_info.ino b/Arduino/McLighting/version_info.ino index 4e3d6c1..bf0aa44 100644 --- a/Arduino/McLighting/version_info.ino +++ b/Arduino/McLighting/version_info.ino @@ -12,6 +12,9 @@ * - Added example for static IP * - Added more internal variables to /esp_status * - * 5 Jul 2018 c 2.1.3 + * 5 Jul 2018 v 2.1.3 * - Fixes for ArduinoJson 6.1.0-beta + * + * 10 Jul 2018 v 2.1.4 + * - Fixes measureJson() as pointed in #206 */