Mercurial > hg > beaglert
diff core/ClockSyncThread.cpp @ 149:134bff10e561 ClockSync
Added simple one-variable one-measurement Kalman filter, Pid controller(which output is not used). Virtual clock is now much more precise and reactive for period. Still it is lagging behind a bit on the overall offset.
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 21 Sep 2015 03:12:21 +0100 |
parents | 44d07fa9bd03 |
children | 8f98b32d0e23 |
line wrap: on
line diff
--- a/core/ClockSyncThread.cpp Mon Sep 21 03:11:32 2015 +0100 +++ b/core/ClockSyncThread.cpp Mon Sep 21 03:12:21 2015 +0100 @@ -52,11 +52,21 @@ void ClockSyncThread::setVirtualClock(VirtualClock &aVirtualClock){ virtualClock=&aVirtualClock; }; - +#ifndef USE_JUCE +extern I2c_Codec* gAudioCodec; +#endif void ClockSyncThread::run(){ - printf("var=["); + printf("variable=["); while(!threadShouldExit()){ + static int count = 0; clockSync.sendReceiveLoop(); +#ifndef USE_JUCE +// if (count == 300){ +// printf("0 0 0\n"); +// gAudioCodec->setAudioSamplingRate(44101); +// } +#endif + count++; // double now=virtualClock->getNow(); // printf("th(end+1)=%f;\n", now); // printf("act(end+1)=%lld;\n", Clock::getTimeUs());