TM1637
TM1637 copied to clipboard
Add support for negative integers with leading zeros and floating point numbers
This adds support for
- Negative integers with leading zeros
- Floating point numbers
Notes for floating point numbers
- This assumes the display has exactly 4 digits.
- Only supports use of the colon (not decimal points) for now. Implementation theoretically allows for decimal points to be added later without breaking changes. - I can't get the displays I bought to show decimal points.
- When
-1 < num < 1
andleading_zero
is false, superfluous leading zeros may be shown. This is documented with a note that this behavior may change in the future. - Implementation does not include
length
andpos
arguments but these can theoretically be added in the future without breaking changes.
There are some things I want to change/fix before this gets merged.
- [x] Instead of passing the
DecimalType
enum as an argument, I'll change the function name toshowNumberFloatColon()
. This is less typing for the user. - [x] Fix an integer overflow bug causing floating point numbers like 700 to get messed up in the current implementation.
- [ ] "Support" numbers that are too high or low to fit on a 4 segment display by showing
HIGH
andLO__
messages. - [ ] Support Inf, -Inf, and NaN by displaying
_InF
,-InF
, andnAn_
If you think LO__
or nAn_
should be right justified, let me know.