# HG changeset patch # User Daniele Nicolodi # Date 1422552348 -3600 # Node ID a41c872bce489dacda9569bf95caed4f0dccdf87 # Parent cf2e21b81dcf2068aa3bec7b3fbf97959ba78057 Enforce the number of counter channels when writing data to disk diff -r cf2e21b81dcf -r a41c872bce48 FXAnalyse.c --- a/FXAnalyse.c Thu Jan 29 18:24:53 2015 +0100 +++ b/FXAnalyse.c Thu Jan 29 18:25:48 2015 +0100 @@ -455,13 +455,15 @@ } struct datafile datafiles[] = { - DATAFILE("Raw", event.data, 4, PANEL_SAVE_RAW, TRUE), - DATAFILE("DDS", ad9912.frequency, 4, PANEL_SAVE_DDS, FALSE), - DATAFILE("Lo", &Math2, 1, PANEL_SAVE_LO, FALSE), - DATAFILE("Hg", &Math3, 1, PANEL_SAVE_HG, FALSE), - DATAFILE("Sr", &Math4, 1, PANEL_SAVE_SR, FALSE), - DATAFILE("Ex", &Math5, 1, PANEL_SAVE_EXTRA, FALSE), - { NULL, } + // set the counter channels number to zero. it will + // be updated when the configuration file is read + DATAFILE("Raw", event.data, 0, PANEL_SAVE_RAW, TRUE), + DATAFILE("DDS", ad9912.frequency, 4, PANEL_SAVE_DDS, FALSE), + DATAFILE("Lo", &Math2, 1, PANEL_SAVE_LO, FALSE), + DATAFILE("Hg", &Math3, 1, PANEL_SAVE_HG, FALSE), + DATAFILE("Sr", &Math4, 1, PANEL_SAVE_SR, FALSE), + DATAFILE("Ex", &Math5, 1, PANEL_SAVE_EXTRA, FALSE), + { NULL, } }; @@ -562,6 +564,7 @@ int main (int argc, char *argv[]) { int rv; + int nchan; double frequency; char expr[1024]; char host[256]; @@ -583,6 +586,13 @@ IniText configuration = Ini_New(TRUE); Ini_ReadFromFile(configuration, path); + // KK counter channel number + rv = Ini_GetInt(configuration, "KK", "nchan", &nchan); + if (rv < 1) + nchan = 4; + // update number of channels to save to disk + datafiles[0].nchan = nchan; + // data folder rv = Ini_GetStringCopy(configuration, "data", "folder", &datafolder); if (rv > 0) { @@ -607,7 +617,7 @@ logmessage(ERROR, "ad9956 init erorr=%d", -rv); ad9956_set_w(&ad9956, dedrift.fDDS, dedrift.applied); - // ad9912 configuration parameters + // AD9912 configuration parameters rv = Ini_GetStringIntoBuffer(configuration, "AD9912", "host", host, sizeof(host)); if (! rv) return -1; diff -r cf2e21b81dcf -r a41c872bce48 FXAnalyse.ini --- a/FXAnalyse.ini Thu Jan 29 18:24:53 2015 +0100 +++ b/FXAnalyse.ini Thu Jan 29 18:25:48 2015 +0100 @@ -7,10 +7,11 @@ host = 145.238.205.58 [data] -folder = "Z://data-2014/test/" +folder = "C:\\\\data\\test" [KK] port = COM1:115200 +nchan = 4 [Sr data logger] host = 145.238.204.91