Skip to content

Commit

Permalink
Bug fix for showNumber() floating points #15
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonacox committed Feb 21, 2022
1 parent 3f318ba commit 35d1bdb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,11 @@ const uint8_t ANIMATION[16][6] = {

display.showAnimation(ANIMATION, FRAMES(ANIMATION), TIME_MS(10));
```

## v1.4.4
- Bug Fix for showNumber() for floating point numbers where position is greater than zero. Fix for TM1637TinyDisplay and TM1637TinyDisplay6.
```cpp
// showNumber(num, decimal_length, length, pos)
display.showNumber(9.87, 2, 3, 0);
display.showNumber(1.23, 2, 3, 3);
```
2 changes: 1 addition & 1 deletion TM1637TinyDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void TM1637TinyDisplay::showNumber(double num, uint8_t decimal_length, uint8_t l
digits[length-1] = encodeDigit(0);
}
else {
int decimal_pos = length - 1 - decimal_places + pos;
int decimal_pos = length - 1 - decimal_places;
for(int i = length-1; i >= 0; --i) {
uint8_t digit = inum % 10;

Expand Down
2 changes: 1 addition & 1 deletion TM1637TinyDisplay6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ void TM1637TinyDisplay6::showNumber(double num, uint8_t decimal_length, uint8_t
digits[length-1] = encodeDigit(0);
}
else {
int decimal_pos = length - 1 - decimal_places + pos;
int decimal_pos = length - 1 - decimal_places;
for(int i = length-1; i >= 0; --i) {
uint8_t digit = inum % 10;

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=TM1637TinyDisplay
version=1.4.3
version=1.4.4
author=Jason Cox <[email protected]>
maintainer=Jason Cox <[email protected]>
sentence=A simple library to display numbers, text and animation on 4 and 6 digit 7-segment TM1637 based display modules.
Expand Down

0 comments on commit 35d1bdb

Please sign in to comment.