sending float values using virtualWrite shows "-" on the dashboard
hixfield opened this issue · 2 comments
hixfield commented
I am using wemos d1 mini, and arduino ide (version .13).
Consider the following code:
float temperature = g_temperature.getTemp();
itoa(temperature, g_szTemp, 10);
Cayenne.virtualWrite(3, temperature, TYPE_TEMPERATURE, UNIT_CELSIUS);
Cayenne.virtualWrite(4, g_szTemp, TYPE_TEMPERATURE, UNIT_CELSIUS);
Cayenne.virtualWrite(5, int(temperature), TYPE_TEMPERATURE, UNIT_CELSIUS);
this produces the following result in the dashboard:
sending of the string and int values works as expected, but sending of the float value does not work.
If I use celsiusWrite its the same issue.
Please note that sprintf("%2.3f") does not work on arduino, printf-ing floats is not supported, maybe this could the problem?
jburhenn commented
Yeah, that was the problem. I've converted it to use dtostrf for float and double conversions. That code is checked in. Thanks for submitting that issue.
hixfield commented
confirmed it is working now. Thanks for the fast update :)