Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: 5_Dragonfly_Cayenne_Sprint_IKS01A1
Fork of Cayenne-MQTT-mbed-MTSAS 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);
}
