diff options
author | fishsoupisgood <github@madingley.org> | 2019-02-21 13:18:34 +0000 |
---|---|---|
committer | fishsoupisgood <github@madingley.org> | 2019-02-21 13:18:34 +0000 |
commit | e761edee5e8ef7106fc8080fc386447e7956be71 (patch) | |
tree | bba377795294a958501ee3ebbcb30d2064a80c13 /app/pll.c | |
parent | c93861c733ced9c6659241cea69c7feed56afcce (diff) | |
download | clock-e761edee5e8ef7106fc8080fc386447e7956be71.tar.gz clock-e761edee5e8ef7106fc8080fc386447e7956be71.tar.bz2 clock-e761edee5e8ef7106fc8080fc386447e7956be71.zip |
add edge magic
Diffstat (limited to 'app/pll.c')
-rw-r--r-- | app/pll.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -2,8 +2,8 @@ #define JUMP_THRESH 0.1 #define JUMP_TICKS 30 -#define FEEDBACK 0.001 -#define WARM_UP 3 +#define FEEDBACK 0.01 +#define WARM_UP 30 static int64_t offset; @@ -47,15 +47,12 @@ static void modify_pll_freq (uint64_t now, int d) phase = now - pd2; } + void pll_dispatch (uint64_t happy, uint64_t edge, const char *src) { double f; int64_t pd; - if (warming_up) { - warming_up--; - return; - } #if 0 @@ -78,12 +75,23 @@ void pll_dispatch (uint64_t happy, uint64_t edge, const char *src) #endif +if ((!gps_last_happy) && (!dcf77_last_happy) && (!msf_last_happy)) return; + if (happy < gps_last_happy) return; if (happy < dcf77_last_happy) return; if (happy < msf_last_happy) return; + if (warming_up) { + warming_up--; + return; + } + +printf("EDGE %08x%08x\r\n", + (uint32_t) (edge >>32), + (uint32_t) (edge & 0xffffffff)); + { int diff, hf; |