# HG changeset patch
# User Daniele Nicolodi <daniele.nicolodi@obspm.fr>
# Date 1379420300 -7200
# Node ID 84fb0796936b72d56d5ec9ced48d1abdc7b3b1b8
# Parent  f9fb17fb64cc8e9aa8380f06257a8c5bd56e82f8
Add KK counter measurement interval synchronization to PPS trigger

diff -r f9fb17fb64cc -r 84fb0796936b kk-data-provider.c
--- a/kk-data-provider.c	Thu Sep 12 18:01:49 2013 +0200
+++ b/kk-data-provider.c	Tue Sep 17 14:18:20 2013 +0200
@@ -114,6 +114,18 @@
 		goto error;
 	}
 	
+	/* enable synchronization */
+	rv = FX_Send("\x0F");
+	if (! rv) {
+		SendMessage(mainThreadId, FX_Error());
+		goto error;
+	}
+	rv = FX_Recv(&resp, TIMEOUT);
+	if (! rv) {
+		SendMessage(mainThreadId, FX_Error());
+		goto error;
+	}
+	
 	while (acquiring) {
 		/* receive data from counter */
 		FX_Recv(&resp, TIMEOUT);
@@ -152,6 +164,9 @@
 			if (strcmp(resp + 6, "$2900")) {
 				SendMessage(mainThreadId, "KK Counter: %s", resp);
 			}
+		} else if (strneq(resp, "7F51", 4)) {
+			/* measurement interval synchronized */
+			SendMessage(mainThreadId, "KK Counter measurement interval synchronized");
 		} else {
 			/* send message to the main thread */
 			SendMessage(mainThreadId, "KK Counter: %s", resp);