Mercurial > hg > fxanalyse
diff FXAnalyse.c @ 123:35861fe64d14
Allow to set dedrift DDS central frequency. Add option to double applied slope.
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Thu, 12 Dec 2013 17:21:15 +0100 |
parents | bdd3ec3c212e |
children | bdfc61a8ebee |
line wrap: on
line diff
--- a/FXAnalyse.c Thu Dec 12 16:44:24 2013 +0100 +++ b/FXAnalyse.c Thu Dec 12 17:21:15 2013 +0100 @@ -18,7 +18,6 @@ #define SR_LOGGER_IP "145.238.204.91" #define DATAFOLDER "Z:\\Measures-2013" -#define DEDRIFT_DDS_FREQUENCY 70000000.0 #define FREP_STEP_SIZE 50000.0 // number of channels read @@ -121,11 +120,13 @@ // slope cancelling +double dedrift_DDS_freq = 70e6; int SlopeMeasuring = FALSE; int StopSlopeCancellingOnUnlocked = TRUE; double TimetoSlope = 60.0; double SlopeMeasuringTimeBegin = 0.0; double appliedSlope = 0.0; // currently applied frequency dedrifiting slope +int slopeX2 = FALSE; double limitotakoff=70.0; @@ -350,7 +351,7 @@ DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); // initialyze 1x AD9956 DDS box - DDSFox_Initialize(&DDS1xAD9956, "145.238.205.58", 6665, DEDRIFT_DDS_FREQUENCY); + DDSFox_Initialize(&DDS1xAD9956, "145.238.205.58", 6665, dedrift_DDS_freq); Ch1 = Ch2 = Ch3 = Ch4 = 0.0; @@ -1289,7 +1290,7 @@ SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, appliedSlope); } if (! KeepFrequ) { - DDSFox_Set(&DDS1xAD9956, DEDRIFT_DDS_FREQUENCY, appliedSlope); + DDSFox_Set(&DDS1xAD9956, dedrift_DDS_freq, appliedSlope); } stat_zero(&freq); @@ -1335,7 +1336,10 @@ } SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, appliedSlope); - DDSFox_SetSweepRate(&DDS1xAD9956, appliedSlope); + if (slopeX2) + DDSFox_SetSweepRate(&DDS1xAD9956, appliedSlope * 2.0); + else + DDSFox_SetSweepRate(&DDS1xAD9956, appliedSlope); logmsg("Slope correction update (%+6g) %6g", freq.slope, appliedSlope); @@ -2019,7 +2023,7 @@ SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, appliedSlope); } if (! KeepFrequ) { - DDSFox_Set(&DDS1xAD9956, DEDRIFT_DDS_FREQUENCY, appliedSlope); + DDSFox_Set(&DDS1xAD9956, dedrift_DDS_freq, appliedSlope); } stat_zero(&freq); SetCtrlVal(panel, PANEL_SLOPE_MEASURED, freq.slope); @@ -2044,7 +2048,7 @@ CenterFrequencyCh2ToDetermine = TRUE ; appliedSlope = 0.0; SetCtrlVal(panel, PANEL_SLOPE_APPLIED, appliedSlope); - DDSFox_Set(&DDS1xAD9956, DEDRIFT_DDS_FREQUENCY, appliedSlope); + DDSFox_Set(&DDS1xAD9956, dedrift_DDS_freq, appliedSlope); logmsg("Reset slope measurement"); break; } @@ -2272,7 +2276,7 @@ DDSFox_Reset(&DDS1xAD9956); DDSFox_SetProfile(&DDS1xAD9956); DDSFox_SetDiv(&DDS1xAD9956, 1); - DDSFox_Set(&DDS1xAD9956, DEDRIFT_DDS_FREQUENCY, appliedSlope); + DDSFox_Set(&DDS1xAD9956, dedrift_DDS_freq, appliedSlope); break; } return 0; @@ -2316,3 +2320,28 @@ } return 0; } + +int CVICALLBACK CB_SlopeX2 (int panel, int control, int event, + void *callbackData, int eventData1, int eventData2) +{ + switch (event) + { + case EVENT_COMMIT: + GetCtrlVal(panel, control, &slopeX2); + break; + } + return 0; +} + +int CVICALLBACK CB_DedriftDDSFreq (int panel, int control, int event, + void *callbackData, int eventData1, int eventData2) +{ + switch (event) + { + case EVENT_COMMIT: + GetCtrlVal(panel, control, &dedrift_DDS_freq); + DDSFox_Set(&DDS1xAD9956, dedrift_DDS_freq, appliedSlope); + break; + } + return 0; +}