Skip to content

Commit 417d119

Browse files
committed
fix print float issue with precision > 10
1 parent 1182aca commit 417d119

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Added Jlink as programmer to upload sketch #133
1010
- Fixed issue with high speed uart baud ~ 1 Mbps (PR #158 thanks Ureloc)
1111
- Add HardwardPWM removePin(), refactor hwpwm.ino sketch
12+
- fix print float with precision > 10
1213

1314
## 0.9.2
1415

cores/nRF5/Print.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,7 @@ size_t Print::printFloat(double number, uint8_t digits)
229229
char buf[256];
230230
size_t s=0;
231231

232-
char format[] = "%.0f";
233-
format[2] += digits;
234-
235-
s = snprintf(buf, 256, format, number);
232+
s = snprintf(buf, 256, "%.*f", digits, number);
236233
s = write(buf, s);
237234
return s;
238235
}

0 commit comments

Comments
 (0)