comparison kk-data-provider.c @ 120:84fb0796936b

Add KK counter measurement interval synchronization to PPS trigger
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Tue, 17 Sep 2013 14:18:20 +0200
parents 4f1f353e84f5
children 4ff3e468ab5f
comparison
equal deleted inserted replaced
119:f9fb17fb64cc 120:84fb0796936b
112 if (! rv) { 112 if (! rv) {
113 SendMessage(mainThreadId, FX_Error()); 113 SendMessage(mainThreadId, FX_Error());
114 goto error; 114 goto error;
115 } 115 }
116 116
117 /* enable synchronization */
118 rv = FX_Send("\x0F");
119 if (! rv) {
120 SendMessage(mainThreadId, FX_Error());
121 goto error;
122 }
123 rv = FX_Recv(&resp, TIMEOUT);
124 if (! rv) {
125 SendMessage(mainThreadId, FX_Error());
126 goto error;
127 }
128
117 while (acquiring) { 129 while (acquiring) {
118 /* receive data from counter */ 130 /* receive data from counter */
119 FX_Recv(&resp, TIMEOUT); 131 FX_Recv(&resp, TIMEOUT);
120 if (! resp) { 132 if (! resp) {
121 SendMessage(mainThreadId, FX_Error()); 133 SendMessage(mainThreadId, FX_Error());
150 /* undocumented packet. it probably reports the header for 162 /* undocumented packet. it probably reports the header for
151 subsequent data packets. match it against expected value */ 163 subsequent data packets. match it against expected value */
152 if (strcmp(resp + 6, "$2900")) { 164 if (strcmp(resp + 6, "$2900")) {
153 SendMessage(mainThreadId, "KK Counter: %s", resp); 165 SendMessage(mainThreadId, "KK Counter: %s", resp);
154 } 166 }
167 } else if (strneq(resp, "7F51", 4)) {
168 /* measurement interval synchronized */
169 SendMessage(mainThreadId, "KK Counter measurement interval synchronized");
155 } else { 170 } else {
156 /* send message to the main thread */ 171 /* send message to the main thread */
157 SendMessage(mainThreadId, "KK Counter: %s", resp); 172 SendMessage(mainThreadId, "KK Counter: %s", resp);
158 } 173 }
159 } 174 }