sntp: calibrate to the ntp times rather than the system function.

The system sdk_system_rtc_clock_cali_proc() is rather noisy, so
this patch calibrates the RTC count to the NTP time responses.

An average of many calls to sdk_system_rtc_clock_cali_proc() is used
for initialization.

The system calibration value is used to limit the calibration value
computed via the ntp times, to 1/16 either way.

A 64 bit RTC counter is implemented, and used in the calculations, but
might be of some use on its own.

The ratio of the ntp time differences and the RTC count differences is
filtered a little to keep the changes relatively stable and to filter
the jitter.
This commit is contained in:
iosen 2016-07-02 00:35:59 +10:00
parent 15964efc0f
commit b1f7a0493f
3 changed files with 128 additions and 74 deletions

View file

@ -20,12 +20,10 @@
// https://www.kernel.org/pub/software/scm/git/docs/git-update-index.html
//
#error "You need to enter your wifi credentials in this file and follow the instructions here to keep the password safe from Github commits."
#ifndef __SSID_CONFIG_H__
#define __SSID_CONFIG_H__
#define WIFI_SSID "mywifissid"
#define WIFI_PASS "my secret password"
#define WIFI_SSID "BigPond8481"
#define WIFI_PASS "01234567890000000123456789000000"
#endif // __SSID_CONFIG_H__