gavinlyonsrepo / TM1638plus

An Arduino library to drive TM1638 seven segment modules.
https://gavinlyonsrepo.github.io/
GNU General Public License v3.0
79 stars 25 forks source link

displayText may try to write past the display buffer #6

Closed gabormay closed 4 years ago

gabormay commented 4 years ago

There is no guard in displayText against writing past the display size. This is problematic when one has to deal with arbitrary text, where dots can appear at random places. (My use case was to display morse code).

In these cases, it's difficult to figure out how much of the display the text will actually cover on the display. An easy way to work around that is to add some extra spaces at the end of the text but then you run the risk of writing past the display size.

gavinlyonsrepo commented 4 years ago

Hi

Thanks for feedback and pull request. I have created new version with new changes. Please upgrade to version 1.5.0.

Also FYI if you want to use morse code it is also possible to use the "display7Seg" function to set segments individual.

//TEST set segments (pos, (dp)gfedcba) //In this case write -..- X tm.display7Seg(0, 0b01000000); //dash tm.display7Seg(1, 0b10000000); //dot tm.display7Seg(2, 0b10000000); //dot tm.display7Seg(3, 0b10000000); //dash

Regards