Merge pull request #14710 from pkkrusty/patch-4

Add seconds to MAX7219 DisplayClock command
This commit is contained in:
Theo Arends 2022-02-05 09:20:06 +01:00 committed by GitHub
commit 58289a59f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 17 deletions

View File

@ -979,6 +979,7 @@ void TM1637ShowTime()
{
uint8_t hr = RtcTime.hour;
uint8_t mn = RtcTime.minute;
uint8_t sc = RtcTime.second;
// uint8_t hr = 1;
// uint8_t mn = 0;
char z = ' ';
@ -994,22 +995,9 @@ void TM1637ShowTime()
hr = 12;
}
char tm[5];
if (hr < 10)
{
if (mn < 10)
snprintf(tm, sizeof(tm), PSTR("%c%d0%d"), z, hr, mn);
else
snprintf(tm, sizeof(tm), PSTR("%c%d%d"), z, hr, mn);
}
else
{
if (mn < 10)
snprintf(tm, sizeof(tm), PSTR("%d0%d"), hr, mn);
else
snprintf(tm, sizeof(tm), PSTR("%d%d"), hr, mn);
}
char tm[9];
snprintf_P(tm, sizeof(tm), PSTR("%c%d%02d%02d"), z, hr, mn, sc);
if (TM1637 == TM1637Data.display_type)
{
uint8_t rawBytes[1];
@ -1035,7 +1023,8 @@ void TM1637ShowTime()
{
for (uint32_t i = 0; i < 4; i++)
{
if ((millis() % 1000) > 500 && (i == 1))
//if ((millis() % 1000) > 500 && (i == 3))
if ((i == 1) || (i == 3))
displayMAX7219ASCIIwDot(i, tm[i]);
else
displayMAX7219ASCII(i, tm[i]);