Skip to content

Commit

Permalink
fix print float issue with precision > 10
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Jan 11, 2019
1 parent 1182aca commit 417d119
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions cores/nRF5/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 417d119

Please sign in to comment.