Skip to content

Commit 2756386

Browse files
committed
Fix dtostrf build break on non-AVR
Fixes #20
1 parent 41b4465 commit 2756386

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: ostream_helpers

+6-2
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,13 @@ namespace std{
246246
char buffer[32];
247247
int length;
248248

249-
//length = snprintf(buffer, 32, "%*.*f",static_cast<int>(stream.width()),static_cast<int>(stream.precision()), f);
249+
#ifdef __AVR__
250250
length = strlen(dtostrf(f, static_cast<int>(stream.width()), static_cast<int>(stream.precision()), buffer));
251-
251+
252+
#else
253+
length = snprintf(buffer, 32, "%*.*f",static_cast<int>(stream.width()),static_cast<int>(stream.precision()), f);
254+
#endif
255+
252256
stream.printout(buffer, length);
253257
if(stream.flags() & ios_base::unitbuf){
254258
stream.flush();

0 commit comments

Comments
 (0)