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:
- 6:82e142a864ad
- Parent:
- 1:90dccf306268
- Child:
- 8:aec9cfdd4c8e
--- a/src/CayenneUtils/CayenneDataArray.h Fri Oct 07 22:44:16 2016 +0000 +++ b/src/CayenneUtils/CayenneDataArray.h Tue Oct 25 16:19:29 2016 -0600 @@ -289,7 +289,11 @@ */ inline void add(const __FlashStringHelper* unit, const float value) { char str[33]; - dtostrf(value, 5, 3, str); +#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]; - dtostrf(value, 5, 3, str); +#if defined(__AVR__) || defined (ARDUINO_ARCH_ARC32) + dtostrf(value, 5, 3, str); +#else + snprintf(str, 33, "%2.3f", value); +#endif add(unit, str); }