Mercurial > hg > fxanalyse
comparison FXAnalyse.c @ 78:3aa1f1c18961
Fix data logging to disc. Shorten file names
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Mon, 17 Dec 2012 11:55:15 +0100 |
parents | 5e0c314528bf |
children | 930acf691aa4 |
comparison
equal
deleted
inserted
replaced
77:87af2fbc2321 | 78:3aa1f1c18961 |
---|---|
207 char filename[FILENAME_MAX]; | 207 char filename[FILENAME_MAX]; |
208 | 208 |
209 // construct filename in the form folder\\id-name.txt | 209 // construct filename in the form folder\\id-name.txt |
210 snprintf(filename, sizeof(filename), "%s\\%s-%s.txt", folder, id, name); | 210 snprintf(filename, sizeof(filename), "%s\\%s-%s.txt", folder, id, name); |
211 | 211 |
212 int fd = OpenFile(name, VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII); | 212 int fd = OpenFile(filename, VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII); |
213 Fmt(line, "%s\t%s\t%f[p3]\t%f[p3]", date, time, utc, value); | 213 Fmt(line, "%s\t%s\t%f[p3]\t%f[p3]", date, time, utc, value); |
214 WriteLine(fd, line, -1); | 214 WriteLine(fd, line, -1); |
215 CloseFile(fd); | 215 CloseFile(fd); |
216 } | 216 } |
217 | 217 |
221 double frequency; | 221 double frequency; |
222 char expr[1024]; | 222 char expr[1024]; |
223 | 223 |
224 if (InitCVIRTE (0, argv, 0) == 0) | 224 if (InitCVIRTE (0, argv, 0) == 0) |
225 return -1; | 225 return -1; |
226 | |
226 if ((MainPanel = LoadPanel (0, "FXAnalyse.uir", PANEL)) < 0) | 227 if ((MainPanel = LoadPanel (0, "FXAnalyse.uir", PANEL)) < 0) |
227 return -1; | 228 return -1; |
228 if ((CalcN1Panel = LoadPanel (0, "FXAnalyse.uir", CALCN1)) < 0) | 229 if ((CalcN1Panel = LoadPanel (0, "FXAnalyse.uir", CALCN1)) < 0) |
229 return -1; | 230 return -1; |
230 if ((CalcN2Panel = LoadPanel (0, "FXAnalyse.uir", CALCN2)) < 0) | 231 if ((CalcN2Panel = LoadPanel (0, "FXAnalyse.uir", CALCN2)) < 0) |
1298 snprintf(id, sizeof(id), "%2s%2s%2s", ShortYear, Month, Day); | 1299 snprintf(id, sizeof(id), "%2s%2s%2s", ShortYear, Month, Day); |
1299 | 1300 |
1300 // write LO frequency (Math2) to disk | 1301 // write LO frequency (Math2) to disk |
1301 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2SAVE, &save); | 1302 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2SAVE, &save); |
1302 if (save) { | 1303 if (save) { |
1303 writeData(DATAFOLDER, "OptCavity", id, Date, Time, utc, Math2); | 1304 writeData(DATAFOLDER, "Lo", id, Date, Time, utc, Math2); |
1304 writeData("C:\\Femto\\Results", "OptCavity", id, Date, Time, utc, Math2); | 1305 writeData("C:\\Femto\\Results", "OptCavity", id, Date, Time, utc, Math2); |
1305 } | 1306 } |
1306 | 1307 |
1307 // write Hg frequency (Math3) to disk | 1308 // write Hg frequency (Math3) to disk |
1308 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH3SAVE, &save); | 1309 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH3SAVE, &save); |
1309 if (save) { | 1310 if (save) { |
1310 writeData(DATAFOLDER, "HgCavity", id, Date, Time, utc, Math3); | 1311 writeData(DATAFOLDER, "Hg", id, Date, Time, utc, Math3); |
1311 writeData("C:\\Femto\\Results", "HgCavity", id, Date, Time, utc, Math3); | 1312 writeData("C:\\Femto\\Results", "HgCavity", id, Date, Time, utc, Math3); |
1312 } | 1313 } |
1313 | 1314 |
1314 // write ExtraMath (Math5) to disk | 1315 // write ExtraMath (Math5) to disk |
1315 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH5SAVE, &save); | 1316 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH5SAVE, &save); |
1316 if (save) { | 1317 if (save) { |
1317 writeData(DATAFOLDER, "ExtraMath", id, Date, Time, utc, Math5); | 1318 writeData(DATAFOLDER, "Ex", id, Date, Time, utc, Math5); |
1318 } | 1319 } |
1319 | 1320 |
1320 // Special case to handle change of day at next second | 1321 // Special case to handle change of day at next second |
1321 if ( LocalTime.tm_hour==23 && LocalTime.tm_min==59 && strtod(Sec,NULL)>=58 ) { | 1322 if ( LocalTime.tm_hour==23 && LocalTime.tm_min==59 && strtod(Sec,NULL)>=58 ) { |
1322 Acquiring = FALSE; | 1323 Acquiring = FALSE; |