`volatile float` serialized as `int`
Created by: aleshark87
With the last update of the library, i get floats variable serialized as ints variable. I'm using a ESP32.
This is the code you need:
volatile float distance;
volatile int state;
StaticJsonDocument<128> doc;
doc["type"] = "data";
doc["state"] = state;
Serial.println(distance);
doc["distance"] = distance;
serializeJson(doc, msg);
doc.clear();
Serial.println(msg);
From the prints i get: 5.74 {"type":"data","state":2,"distance":5}
I don't get this issue using a non volatile variable. Bye