Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonacox committed Nov 19, 2020
2 parents 006ee01 + c6bd886 commit 574c03f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions TM1637TinyDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,16 @@ void TM1637TinyDisplay::showString(const char s[], uint8_t length, uint8_t pos)
switch (strlen(s)) {
case 4:
digits[3] = encodeASCII(s[3]);
// fall through
case 3:
digits[2] = encodeASCII(s[2]);
// fall through
case 2:
digits[1] = encodeASCII(s[1]);
// fall through
case 1:
digits[0] = encodeASCII(s[0]);
// fall through
case 0:
setSegments(digits, length, pos);
}
Expand Down Expand Up @@ -404,12 +408,16 @@ void TM1637TinyDisplay::showString_P(const char s[], uint8_t length, uint8_t pos
switch (strlen_P(s)) {
case 4:
digits[3] = encodeASCII(pgm_read_byte(&s[3]));
// fall through
case 3:
digits[2] = encodeASCII(pgm_read_byte(&s[2]));
// fall through
case 2:
digits[1] = encodeASCII(pgm_read_byte(&s[1]));
// fall through
case 1:
digits[0] = encodeASCII(pgm_read_byte(&s[0]));
// fall through
case 0:
setSegments(digits, length, pos);
}
Expand All @@ -424,7 +432,7 @@ void TM1637TinyDisplay::showString_P(const char s[], uint8_t length, uint8_t pos
setSegments(digits, length, pos);
delay(m_scrollDelay);
}
for (int x = 3; x < strlen_P(s); x++) { // Scroll through string
for (size_t x = 3; x < strlen_P(s); x++) { // Scroll through string
digits[0] = encodeASCII(pgm_read_byte(&s[x - 3]));
digits[1] = encodeASCII(pgm_read_byte(&s[x - 2]));
digits[2] = encodeASCII(pgm_read_byte(&s[x - 1]));
Expand Down Expand Up @@ -487,7 +495,7 @@ void TM1637TinyDisplay::showLevel(unsigned int level, bool horizontal)
void TM1637TinyDisplay::showAnimation(const uint8_t data[][4], unsigned int frames, unsigned int ms)
{
// Animation sequence
for (int x = 0; x < frames; x++) {
for (unsigned int x = 0; x < frames; x++) {
setSegments(data[x]);
delay(ms);
}
Expand All @@ -497,8 +505,8 @@ void TM1637TinyDisplay::showAnimation_P(const uint8_t data[][4], unsigned int fr
{
// Animation sequence for data stored in PROGMEM flash memory
uint8_t digits[4] = {0,0,0,0};
for (int x = 0; x < frames; x++) {
for(int a = 0; a < 4; a++) {
for (unsigned int x = 0; x < frames; x++) {
for(unsigned int a = 0; a < 4; a++) {
digits[a] = pgm_read_byte(&(data[x][a]));
}
setSegments(digits);
Expand Down

0 comments on commit 574c03f

Please sign in to comment.