TM1637 icon indicating copy to clipboard operation
TM1637 copied to clipboard

Add support for negative integers with leading zeros and floating point numbers

Open JonathanLindsey opened this issue 1 year ago • 1 comments

This adds support for

  1. Negative integers with leading zeros
  2. Floating point numbers

Notes for floating point numbers

  1. This assumes the display has exactly 4 digits.
  2. 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.
  3. When -1 < num < 1 and leading_zero is false, superfluous leading zeros may be shown. This is documented with a note that this behavior may change in the future.
  4. Implementation does not include length and pos arguments but these can theoretically be added in the future without breaking changes.

JonathanLindsey avatar Oct 23 '23 14:10 JonathanLindsey

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 to showNumberFloatColon(). 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 and LO__ messages.
  • [ ] Support Inf, -Inf, and NaN by displaying _InF, -InF, and nAn_

If you think LO__ or nAn_ should be right justified, let me know.

JonathanLindsey avatar Oct 26 '23 14:10 JonathanLindsey