diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-02-24 14:42:30 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2011-02-24 15:45:41 -0500 |
commit | 4e493c670aaabd8179976621d4b0bf3997fdc814 (patch) | |
tree | febfef70c77381508cbcc19976c5eaf23c35ad09 /libraries/Servo/Servo.cpp | |
parent | 7a5627be405c5f3353f58198ec4437a7e8138dff (diff) | |
download | librambutan-4e493c670aaabd8179976621d4b0bf3997fdc814.tar.gz librambutan-4e493c670aaabd8179976621d4b0bf3997fdc814.zip |
Rewrote Print class.
The old Print class couldn't print uint64 values, and featured
hand-hacked functionality better handled by snprintf(). Redid it
using snprintf(), using "[u]int[8,16,32,64]" types for more clarity,
and eliminated some private methods in favor of auxiliary functions in
Print.cpp.
Breaking compatibility with original implementation in three ways:
- Print::print(double) is now accurate to 6 digits, rather
than 2; this is consistent with the default behavior of the %f
format specifier, and if you're using floating point, it's slow
enough that you probably want the increased accuracy.
- The only bases you can print a number to are 2, 8, 10, and
16. 8, 10, and 16 already have format specifiers, and 2 is an
important special case; others complicate matters unnecessarily.
- Printing numbers in bases other than 10 treats them as
unsigned quantities (i.e., won't print '-' characters). This is
more consistent with C++'s behavior for hexadecimal and octal
literals (e.g., 0xFFFFFFFF has type uint32).
Updated HardwareSerial and USBSerial class documentation to reflect
the new behavior.
Diffstat (limited to 'libraries/Servo/Servo.cpp')
0 files changed, 0 insertions, 0 deletions