diff --git a/TM1637TinyDisplay.cpp b/TM1637TinyDisplay.cpp index a1f2f5c..4023067 100644 --- a/TM1637TinyDisplay.cpp +++ b/TM1637TinyDisplay.cpp @@ -352,7 +352,7 @@ void TM1637TinyDisplay::showNumberBaseEx(int8_t base, uint16_t num, uint8_t dots setSegments(digits, length, pos); } -void TM1637TinyDisplay::showString(const char s[], uint8_t length, uint8_t pos) +void TM1637TinyDisplay::showString(const char s[], uint8_t length, uint8_t pos, uint8_t dots = 0) { // digits[MAXDIGITS] output array to render memset(digits,0,sizeof(digits)); @@ -362,6 +362,9 @@ void TM1637TinyDisplay::showString(const char s[], uint8_t length, uint8_t pos) for (int x = 0; x < strlen(s); x++) { digits[x] = encodeASCII(s[x]); } + if(dots != 0) { + showDots(dots, digits); + } setSegments(digits, length, pos); } // Scrolling Display @@ -400,7 +403,7 @@ void TM1637TinyDisplay::showString(const char s[], uint8_t length, uint8_t pos) } } -void TM1637TinyDisplay::showString_P(const char s[], uint8_t length, uint8_t pos) +void TM1637TinyDisplay::showString_P(const char s[], uint8_t length, uint8_t pos, uint8_t dots = 0) { // digits[MAXDIGITS] output array to render memset(digits,0,sizeof(digits)); @@ -410,6 +413,9 @@ void TM1637TinyDisplay::showString_P(const char s[], uint8_t length, uint8_t pos for (int x = 0; x < strlen_P(s); x++) { digits[x] = encodeASCII(pgm_read_byte(&s[x])); } + if(dots != 0) { + showDots(dots, digits); + } setSegments(digits, length, pos); } else { diff --git a/TM1637TinyDisplay.h b/TM1637TinyDisplay.h index c4b7e87..46717d4 100644 --- a/TM1637TinyDisplay.h +++ b/TM1637TinyDisplay.h @@ -270,8 +270,20 @@ class TM1637TinyDisplay { //! @param scrollDelay The delay, in microseconds to wait before scrolling to next frame //! @param length The number of digits to set. //! @param pos The position of the most significant digit (0 - leftmost, 3 - rightmost) - //! The _P function is for reading PROGMEM read-only flash memory space instead of RAM - void showString(const char s[], uint8_t length = MAXDIGITS, uint8_t pos = 0); + //! @param dots Dot/Colon enable. The argument is a bitmask, with each bit corresponding to a dot + //! between the digits (or colon mark, as implemented by each module). i.e. + //! For displays with dots between each digit: + //! * 0.000 (0b10000000) + //! * 00.00 (0b01000000) + //! * 000.0 (0b00100000) + //! * 0000. (0b00010000) + //! * 0.0.0.0 (0b11100000) + //! For displays with just a colon: + //! * 00:00 (0b01000000) + //! For displays with dots and colons colon: + //! * 0.0:0.0 (0b11100000) + //! See showString_P function for reading PROGMEM read-only flash memory space instead of RAM + void showString(const char s[], uint8_t length = MAXDIGITS, uint8_t pos = 0, uint8_t dots = 0); //! Display a string (PROGMEM space) //! @@ -282,8 +294,20 @@ class TM1637TinyDisplay { //! @param scrollDelay The delay, in microseconds to wait before scrolling to next frame //! @param length The number of digits to set. //! @param pos The position of the most significant digit (0 - leftmost, 3 - rightmost) - //! The _P function is for reading PROGMEM read-only flash memory space instead of RAM - void showString_P(const char s[], uint8_t length = MAXDIGITS, uint8_t pos = 0); + //! @param dots Dot/Colon enable. The argument is a bitmask, with each bit corresponding to a dot + //! between the digits (or colon mark, as implemented by each module). i.e. + //! For displays with dots between each digit: + //! * 0.000 (0b10000000) + //! * 00.00 (0b01000000) + //! * 000.0 (0b00100000) + //! * 0000. (0b00010000) + //! * 0.0.0.0 (0b11100000) + //! For displays with just a colon: + //! * 00:00 (0b01000000) + //! For displays with dots and colons colon: + //! * 0.0:0.0 (0b11100000) + //! This function is for reading PROGMEM read-only flash memory space instead of RAM + void showString_P(const char s[], uint8_t length = MAXDIGITS, uint8_t pos = 0, , uint8_t dots = 0); //! Display a Level Indicator (both orientations) //!