Fixed led flickering on update -- configurable time between updates
This commit is contained in:
parent
831b514c0a
commit
196d504fa7
|
@ -181,8 +181,12 @@ void SevenSegmentClock::displaySeperator(char seperatorCharacter) {
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t lastUpdate_ms = 0;
|
||||
|
||||
void SevenSegmentClock::displayTime(int hour, int minute) {
|
||||
char displayText[4];
|
||||
|
||||
if (clockHour != hour || clockMinute != minute || millis()-lastUpdate_ms > TIME_BETWEEN_DISPLAY_UPDATES_ms) {
|
||||
clockHour = hour;
|
||||
clockMinute = minute;
|
||||
Serial.print("SevenSegmentClock: new time "); Serial.print(clockHour); Serial.print(":"); Serial.println(clockMinute);
|
||||
|
@ -196,7 +200,10 @@ void SevenSegmentClock::displayTime(int hour, int minute) {
|
|||
displayDigit(3, displayText[3]);
|
||||
displaySeperator(':');
|
||||
strip->show();
|
||||
Serial.print("Shown: "); Serial.print(displayText[0]); Serial.print(displayText[1]); Serial.print(':'); Serial.print(displayText[2]); Serial.println(displayText[3]);
|
||||
Serial.print("Shown: "); Serial.print(displayText[0]); Serial.print(displayText[1]);
|
||||
Serial.print(':'); Serial.print(displayText[2]); Serial.println(displayText[3]);
|
||||
lastUpdate_ms = millis();
|
||||
}
|
||||
};
|
||||
|
||||
uint32_t SevenSegmentClock::red, SevenSegmentClock::green, SevenSegmentClock::blue, SevenSegmentClock::white, SevenSegmentClock::black;
|
||||
|
|
Loading…
Reference in New Issue