File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ in-progress
1717- Improve firmwares :ref: `node-wifi-mqtt-homie ` and :ref: `node-wifi-mqtt-homie-battery `
1818- :ref: `node-wifi-mqtt `: Fix JSON serialization: Transmit sensor readings as float values. Thanks, Matthias!
1919- :ref: `node-wifi-mqtt `: Improve configuration and documentation
20+ - :ref: `node-wifi-mqtt `: Fix JSON serialization again, there was an off-by-one-error. Thanks, Giuseppe!
2021
2122
22232017-03-17 0.13.0
Original file line number Diff line number Diff line change @@ -365,9 +365,8 @@ void loop() {
365365 getHumidityTemperature ();
366366
367367
368- // Prepare data, build JSON object
369-
370- StaticJsonBuffer<256 > jsonBuffer;
368+ // Build JSON object containing sensor readings
369+ StaticJsonBuffer<512 > jsonBuffer;
371370
372371 JsonObject& root = jsonBuffer.createObject ();
373372 root[" weight" ] = String (weightChar).toFloat ();
@@ -384,7 +383,8 @@ void loop() {
384383
385384
386385 // Serialize data
387- char payload[256 ];
386+ int json_length = root.measureLength ();
387+ char payload[json_length+1 ];
388388 root.printTo (payload, sizeof (payload));
389389
390390
You can’t perform that action at this time.
0 commit comments