diff FXAnalyse.c @ 97:675cb8d5e8a7

Write raw counters data to disk
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Tue, 26 Mar 2013 18:18:38 +0100
parents 4102fe614df2
children 29b1aa89a34c
line wrap: on
line diff
--- a/FXAnalyse.c	Tue Mar 26 18:17:18 2013 +0100
+++ b/FXAnalyse.c	Tue Mar 26 18:18:38 2013 +0100
@@ -268,6 +268,20 @@
 	CloseFile(fd);
 }
 
+void writeData4(const char *folder, const char *name, const char *id, 
+		const char *timestr, double utc, double v1, double v2, double v3, double v4)
+{
+	char line[1024];
+	char filename[FILENAME_MAX];
+	
+	// construct filename in the form folder\\id-name.txt
+	snprintf(filename, sizeof(filename), "%s\\%s-%s.txt", folder, id, name);
+	
+	int fd = OpenFile(filename, VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII);
+	Fmt(line, "%s\t%f[p3]\t%f[p3]\t%f[p3]\t%f[p3]\t%f[p3]", timestr, utc, v1, v2, v3, v4);
+	WriteLine(fd, line, -1);
+	CloseFile(fd);
+}
 
 void CVICALLBACK DataAvailableCB (CmtTSQHandle queueHandle, unsigned int event,
 		int value, void *callbackData);
@@ -1309,6 +1323,12 @@
 				
 				int save;
 				
+				// write counter data to disk
+				GetCtrlVal(MainPanel, PANEL_SAVE_RAW_DATA, &save);
+				if (save) {
+					writeData4(DATAFOLDER, "Raw", id, timestr, utc, Ch1, Ch2, Ch3, Ch4);
+				}
+				
 				// write LO frequency (Math2) to disk
 				GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2SAVE, &save);
 				if (save) {