Added clock-halt handling and improved display.

This commit is contained in:
Dirk Jahnke
2018-11-14 11:12:36 +01:00
parent 9292826f72
commit 708aeb2e72
6 changed files with 51 additions and 17 deletions

View File

@@ -53,6 +53,7 @@ void Fastclock::loop(void) {
msPerModelSecond = 500;
}
if (newTimeTick - lastTimeTickUsed < MIN_TIME_ms_BETWEEN_CLOCK_UPDATES) return;
if (halted) { lastTimeTickUsed = newTimeTick; return; }
int fastclockTimeAdvance = (newTimeTick - lastTimeTickUsed) * 1000 / msPerModelSecond;
oldMinute = minute;
@@ -72,4 +73,9 @@ void Fastclock::loop(void) {
void Fastclock::begin(void) {
lastTimeTickUsed = millis();
Serial.print("*** Setting up Fastclock, init lastSentTimeTick="); Serial.println(lastTimeTickUsed);
// following setters do not change anything, but they update the display as well
setClockSpeed(msPerModelSecond);
display->setClockHalted(halted);
display->setTime(hour, minute);
}