Mercurial > hg > fxanalyse
diff FXAnalyse.c @ 174:d96f0b04f7fe
Make DDS addres configurable in configuration file. Modernize AD9912 driver.
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Fri, 21 Feb 2014 18:37:32 +0100 |
parents | a4fcebb5941b |
children | 03dcca7e5ba4 |
line wrap: on
line diff
--- a/FXAnalyse.c Mon Feb 17 18:39:36 2014 +0100 +++ b/FXAnalyse.c Fri Feb 21 18:37:32 2014 +0100 @@ -358,6 +358,7 @@ mupDefineVar(parser, "Sign2", &Sign2); mupDefineVar(parser, "Sign3", &Sign3); mupDefineVar(parser, "Ndiv", &Ndiv); + mupDefinePostfixOprt(parser, "P", &Peta, 1); mupDefinePostfixOprt(parser, "T", &Tera, 1); mupDefinePostfixOprt(parser, "G", &Giga, 1); @@ -383,6 +384,9 @@ int rv; double frequency; char expr[1024]; + char host[256]; + int port; + double clock; if ((MainPanel = LoadPanel (0, "FXAnalyse.uir", PANEL)) < 0) return -1; @@ -402,16 +406,15 @@ // data folder rv = Ini_GetStringCopy(configuration, "data", "folder", &datafolder); - if (rv <= 0) { + if (rv > 0) { + logmessage(INFO, "writing data files in %s", datafolder); + } else { logmessage(ERROR, "data folder not configured in %s", path); // do not allow to start the acquisition SetCtrlAttribute(MainPanel, PANEL_STARTBUTTON, ATTR_DIMMED, TRUE); } - // get AD9956 configuration parameters - char host[256]; - int port; - double clock; + // AD9956 configuration parameters rv = Ini_GetStringIntoBuffer(configuration, "AD9956", "host", host, sizeof(host)); if (! rv) return -1; @@ -422,16 +425,19 @@ if (! rv) return -1; - // dispose configuration - Ini_Dispose(configuration); - - // Sr data logger - sr_datalogger_init(&datalogger); - // dedrift DDS DDSFox_Initialize(&DDS1xAD9956, host, port, dedrift.freq0); - // initialize 4x AD9959 DDS box + // AD9912 configuration parameters + rv = Ini_GetStringIntoBuffer(configuration, "AD9912", "host", host, sizeof(host)); + if (! rv) + return -1; + rv = Ini_GetDouble(configuration, "AD9912", "clock", &clock); + if (! rv) + return -1; + + // initialize 4x AD9912 DDS box + DDS4xAD9912_Init(&DDS4xAD9912, host, clock); DDS4xAD9912_Reset(&DDS4xAD9912); GetCtrlVal(MainPanel, PANEL_DDS1, &frequency); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, frequency); @@ -442,6 +448,12 @@ GetCtrlVal(MainPanel, PANEL_DDS4, &frequency); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); + // dispose configuration + Ini_Dispose(configuration); + + // Sr data logger + sr_datalogger_init(&datalogger); + GetCtrlVal(MainPanel, PANEL_N1CHOICE, &N1); GetCtrlVal(MainPanel, PANEL_N2CHOICE, &N2); GetCtrlVal(MainPanel, PANEL_N3CHOICE, &N3);