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:
@@ -48,6 +48,8 @@ const int min_btn = A1;
|
|||||||
bool dot = true;
|
bool dot = true;
|
||||||
uint8_t minutes;
|
uint8_t minutes;
|
||||||
uint8_t hours;
|
uint8_t hours;
|
||||||
|
/* time inaccuracy compensation flag */
|
||||||
|
uint8_t compflag = 0;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -125,6 +127,23 @@ void loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
clock.getTime();
|
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
|
// make blinking dot
|
||||||
if (clock.hour > 0)
|
if (clock.hour > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user