diff --git a/changelog.md b/changelog.md index 557485c0..c4f059a7 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,7 @@ - Added Jlink as programmer to upload sketch #133 - Fixed issue with high speed uart baud ~ 1 Mbps (PR #158 thanks Ureloc) - Add HardwardPWM removePin(), refactor hwpwm.ino sketch +- fix print float with precision > 10 ## 0.9.2 diff --git a/cores/nRF5/Print.cpp b/cores/nRF5/Print.cpp index d2a24cab..de6e1a12 100644 --- a/cores/nRF5/Print.cpp +++ b/cores/nRF5/Print.cpp @@ -229,10 +229,7 @@ size_t Print::printFloat(double number, uint8_t digits) char buf[256]; size_t s=0; - char format[] = "%.0f"; - format[2] += digits; - - s = snprintf(buf, 256, format, number); + s = snprintf(buf, 256, "%.*f", digits, number); s = write(buf, s); return s; }