diff --git a/simpleclock.ino b/simpleclock.ino index 49a12f8..f3ee3c9 100644 --- a/simpleclock.ino +++ b/simpleclock.ino @@ -48,6 +48,8 @@ const int min_btn = A1; bool dot = true; uint8_t minutes; uint8_t hours; +/* time inaccuracy compensation flag */ +uint8_t compflag = 0; void setup() { @@ -125,6 +127,23 @@ void loop() } clock.getTime(); + /* + * Let's implement time compenstion for individual rtc module time + * charachteristics. In in my case quartz resonator as inaccurate as + * +/- about 5-8 seconds per 24 hours, maybe its require more EMI + * sheilding? + */ + + if ((clock.hour == 21) and (clock.minute == 21) and (clock.second == 21) and (compflag == 0)) { + clock.second = 14; + clock.fillByHMS(clock.hour,clock.minute,clock.second); + clock.setTime(); + compflag = 1; + } + + if ((clock.hour == 21) and (clock.minute == 21) and (clock.second == 23) and (compflag == 1)) { + compflag = 0; + } // make blinking dot if (clock.hour > 0)