Mercurial > hg > beaglert
comparison core/ClockSyncThread.cpp @ 141:44d07fa9bd03 ClockSync
Ultra-basic feedback for clock sync works^CIssues: response time of the IIR filter is too slow, requires PID and better filtering algorithm.
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 14 Sep 2015 15:42:11 +0100 |
parents | 4e2dd3eb1d28 |
children | 134bff10e561 |
comparison
equal
deleted
inserted
replaced
140:5edc6d0713ef | 141:44d07fa9bd03 |
---|---|
37 } | 37 } |
38 | 38 |
39 #ifdef USE_JUCE | 39 #ifdef USE_JUCE |
40 #else | 40 #else |
41 void ClockSyncThread::startThread(){ | 41 void ClockSyncThread::startThread(){ |
42 printf("starting\n"); | |
43 BeagleRT_scheduleAuxiliaryTask(clockSyncTask); | 42 BeagleRT_scheduleAuxiliaryTask(clockSyncTask); |
44 printf("started\n"); | |
45 } | 43 } |
46 void ClockSyncThread::stopThread(){ | 44 void ClockSyncThread::stopThread(){ |
47 threadIsExiting=true; | 45 threadIsExiting=true; |
48 } | 46 } |
49 bool ClockSyncThread::threadShouldExit(){ | 47 bool ClockSyncThread::threadShouldExit(){ |
54 void ClockSyncThread::setVirtualClock(VirtualClock &aVirtualClock){ | 52 void ClockSyncThread::setVirtualClock(VirtualClock &aVirtualClock){ |
55 virtualClock=&aVirtualClock; | 53 virtualClock=&aVirtualClock; |
56 }; | 54 }; |
57 | 55 |
58 void ClockSyncThread::run(){ | 56 void ClockSyncThread::run(){ |
57 printf("var=["); | |
59 while(!threadShouldExit()){ | 58 while(!threadShouldExit()){ |
60 clockSync.sendReceiveLoop(); | 59 clockSync.sendReceiveLoop(); |
61 // double now=virtualClock->getNow(); | 60 // double now=virtualClock->getNow(); |
62 // printf("th(end+1)=%f;\n", now); | 61 // printf("th(end+1)=%f;\n", now); |
63 // printf("act(end+1)=%lld;\n", Clock::getTimeUs()); | 62 // printf("act(end+1)=%lld;\n", Clock::getTimeUs()); |
64 } | 63 } |
65 printf("Thread is not running \n"); | 64 printf("];\n"); |
65 // printf("Thread is not running \n"); | |
66 } | 66 } |