extras/sntp: initialize "cal" properly

Call sdk_system_rtc_clock_cali_proc()
rather than just setting to 1
This commit is contained in:
Jeff Kletsky 2018-02-06 21:57:35 -08:00
parent 5ef8a8348a
commit 43b3df2cdf

View file

@ -26,7 +26,7 @@
#define sntp_base (*((uint64_t*)RTC.SCRATCH))
// Timer value when base was obtained
#define tim_ref (RTC.SCRATCH[2])
// Calibration value
// Calibration value -- ( microseconds / RTC tick ) * 2^12
#define cal (RTC.SCRATCH[3])
#ifdef SNTP_LOGD
@ -61,7 +61,7 @@ void sntp_initialize(const struct timezone *tz) {
}
sntp_base = 0;
// To avoid div by 0 exceptions if requesting time before SNTP config
cal = 1;
cal = sdk_system_rtc_clock_cali_proc();
tim_ref = TIMER_COUNT;
sntp_init();
}