Skip to content

Commit

Permalink
Fix JSON serialization in “node-wifi-mqtt” again, there was an off-by…
Browse files Browse the repository at this point in the history
…-one-error. Thanks, Giuseppe!
  • Loading branch information
amotl committed Mar 31, 2017
1 parent 34c6ffa commit 9c86aa1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Expand Up @@ -17,6 +17,7 @@ in-progress
- Improve firmwares :ref:`node-wifi-mqtt-homie` and :ref:`node-wifi-mqtt-homie-battery`
- :ref:`node-wifi-mqtt`: Fix JSON serialization: Transmit sensor readings as float values. Thanks, Matthias!
- :ref:`node-wifi-mqtt`: Improve configuration and documentation
- :ref:`node-wifi-mqtt`: Fix JSON serialization again, there was an off-by-one-error. Thanks, Giuseppe!


2017-03-17 0.13.0
Expand Down
8 changes: 4 additions & 4 deletions node-wifi-mqtt/node-wifi-mqtt.ino
Expand Up @@ -365,9 +365,8 @@ void loop() {
getHumidityTemperature();


// Prepare data, build JSON object

StaticJsonBuffer<256> jsonBuffer;
// Build JSON object containing sensor readings
StaticJsonBuffer<512> jsonBuffer;

JsonObject& root = jsonBuffer.createObject();
root["weight"] = String(weightChar).toFloat();
Expand All @@ -384,7 +383,8 @@ void loop() {


// Serialize data
char payload[256];
int json_length = root.measureLength();
char payload[json_length+1];
root.printTo(payload, sizeof(payload));


Expand Down

0 comments on commit 9c86aa1

Please sign in to comment.