1

Implement software time inaccuracy compensation hack

32768 Hz quartz chrystal resonator tends to be a bit inaccurate giving
about 5-10 seconds per day time skew
This commit is contained in:
eleksir
2019-04-20 12:04:05 +03:00
parent f46a294535
commit 825c3096f2

View File

@@ -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)