The Cayenne MQTT mbed Library provides functions to easily connect to the Cayenne IoT project builder.
Fork of Cayenne-MQTT-mbed by
Diff: src/CayenneUtils/CayenneDataArray.h
- Revision:
- 15:1f4d5dbf1928
- Parent:
- 8:aec9cfdd4c8e
- Child:
- 23:1a9aed5e77c9
--- a/src/CayenneUtils/CayenneDataArray.h Tue Nov 01 15:48:52 2016 -0600 +++ b/src/CayenneUtils/CayenneDataArray.h Fri Nov 04 13:25:27 2016 -0600 @@ -289,7 +289,11 @@ */ inline void add(const __FlashStringHelper* unit, const float value) { char str[33]; +#if defined(__AVR__) || defined (ARDUINO_ARCH_ARC32) dtostrf(value, 5, 3, str); +#else + snprintf(str, 33, "%2.3f", value); +#endif add(unit, str); } @@ -300,7 +304,11 @@ */ inline void add(const __FlashStringHelper* unit, const double value) { char str[33]; +#if defined(__AVR__) || defined (ARDUINO_ARCH_ARC32) dtostrf(value, 5, 3, str); +#else + snprintf(str, 33, "%2.3f", value); +#endif add(unit, str); }