comparison include/ClockSync.h @ 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 55c1e591cb2e
children 8f98b32d0e23
comparison
equal deleted inserted replaced
148:6cd38e261027 149:134bff10e561
3 #include "stats.hpp" 3 #include "stats.hpp"
4 #include "UdpServer.h" 4 #include "UdpServer.h"
5 #include "UdpClient.h" 5 #include "UdpClient.h"
6 #include "Clock.h" 6 #include "Clock.h"
7 #include "VirtualClock.h" 7 #include "VirtualClock.h"
8 #include "Pid.h"
8 #ifdef USE_JUCE 9 #ifdef USE_JUCE
9 #else 10 #else
10 #include <I2c_Codec.h> 11 #include <I2c_Codec.h>
11 extern I2c_Codec* gAudioCodec; 12 extern I2c_Codec* gAudioCodec;
12 #endif /* USE_JUCE */ 13 #endif /* USE_JUCE */
49 char buffer[kSyncMessageLength]; 50 char buffer[kSyncMessageLength];
50 VirtualClock *virtualClock; 51 VirtualClock *virtualClock;
51 void resetTs(); 52 void resetTs();
52 bool areTsValid(); 53 bool areTsValid();
53 void processOffset(double offset); 54 void processOffset(double offset);
55 Pid pid;
54 public: 56 public:
55 ClockSync(){}; 57 ClockSync(){};
56 ClockSync(bool thisIsSlave, int aPort, VirtualClock &aVirtualClock); 58 ClockSync(bool thisIsSlave, int aPort, VirtualClock &aVirtualClock);
57 void init(bool thisIsSlave, int aPort, VirtualClock &aVirtualClock); 59 void init(bool thisIsSlave, int aPort, VirtualClock &aVirtualClock);
58 void* getBuffer(); 60 void* getBuffer();