I've taken my latest firmware, which has GPS support, photocell Dimmer, and Auto DST, and ported JSGF's Drift Correction into it, for those of you that don't have a GPS but want Auto DST and Drift Correction.
Enjoy!
William
Moderators: adafruit_support_bill, adafruit
#ifdef FEATURE_DRIFTCORR
/* Apply drift correction on the first second of each hour */
// OCR2A = DRIFT_BASELINE + drift_corr; // always apply it (testing) - !!!
if (time_m == 0) {
if (time_s == 0)
OCR2A = DRIFT_BASELINE + drift_corr;
else if (time_s == 1)
OCR2A = DRIFT_BASELINE;
if (time_s <= 1) {
/* wait for update to take effect (should only be a couple of CPU cycles) */
while (ASSR & _BV(OCR2AUB))
;
}
}
#endif
fix_time(); // fix up time values that overflow
fix_time(); // fix up time values that overflow
#ifdef FEATURE_DRIFTCORR
/* Apply drift correction on the first second of each hour */
// OCR2A = DRIFT_BASELINE + drift_corr; // always apply it (testing) - !!!
if (time_m == 0) {
if (time_s == 0)
OCR2A = DRIFT_BASELINE + drift_corr;
else if (time_s == 1)
OCR2A = DRIFT_BASELINE;
if (time_s <= 1) {
/* wait for update to take effect (should only be a couple of CPU cycles) */
while (ASSR & _BV(OCR2AUB))
;
}
}
#endif
Users browsing this forum: mibignistinly and 0 guests