Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Adafruit_IO_Arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ bool Adafruit_IO_Feed::send(float value) {
#if defined(ARDUINO_ARCH_AVR)
// Use avrlibc dtostre function on AVR platforms.
dtostre(value, _converted, 10, 0);
#elif defined(ESP8266)
String result = String(value, 2);
result.toCharArray(_converted, sizeof(_converted)-1);
#else
// Otherwise fall back to snprintf on other platforms.
snprintf(_converted, sizeof(_converted)-1, "%f", value);
Expand All @@ -170,6 +173,9 @@ bool Adafruit_IO_Feed::send(double value) {
#if defined(ARDUINO_ARCH_AVR)
// Use avrlibc dtostre function on AVR platforms.
dtostre(value, _converted, 10, 0);
#elif defined(ESP8266)
String result = String(value, 2);
result.toCharArray(_converted, sizeof(_converted)-1);
#else
// Otherwise fall back to snprintf on other platforms.
snprintf(_converted, sizeof(_converted)-1, "%f", value);
Expand Down