Mercurial > hg > fxanalyse
diff FXAnalyse.c @ 39:2e1b3148d6e6
Add setting to invert the sign of the measured slope on dedrifting
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Fri, 05 Oct 2012 12:53:39 +0200 |
parents | 5e81800fe354 |
children | 50544ecfcfc7 |
line wrap: on
line diff
--- a/FXAnalyse.c Wed Oct 03 15:11:35 2012 +0200 +++ b/FXAnalyse.c Fri Oct 05 12:53:39 2012 +0200 @@ -139,6 +139,7 @@ SLOPE_REFERENCE_HG_CAVITY = 1, }; +int invertSlopeSign = 0; int slopeReference = SLOPE_REFERENCE_MICROWAVE; volatile bool KeepCentering=FALSE; @@ -150,6 +151,8 @@ int DDSFox_Set(DDSParameter *DDS, double Frequency, double Sweeprate) { + printf("DDSFox_Set(Frequency=%g, Sweeprate=%g)\n", Frequency, Sweeprate); + DDS->Frequency = Frequency; DDS->SweepRate = Sweeprate; @@ -1274,11 +1277,16 @@ { Nratio = Nratio + 1; - if (Nratio >= 1) - { + if (Nratio >= 1) { MoyMath2 = MoyMath2 + Moy_Math2slope; } - SlopeMath2 = SlopeMath2 + Slope_Math2slope; + + if (invertSlopeSign) { + SlopeMath2 = SlopeMath2 - Slope_Math2slope; + } else { + SlopeMath2 = SlopeMath2 + Slope_Math2slope; + } + N_Math2slope = 0.0; Math2_slope = 0.0; Moy_Math2slope = 0.0; @@ -1292,8 +1300,6 @@ OnSlopeCancelling = TRUE; - FoxFrequ = DDSFox_ReadFreq(&DDS1xAD9956); - if (Nratio == ratio) { if (FrequCorrec == TRUE) @@ -1305,6 +1311,7 @@ MoyMath2 = 0.0; } + FoxFrequ = DDSFox_ReadFreq(&DDS1xAD9956); SetCtrlVal(MainPanel, PANEL_SLOPETOCANCEL, SlopeMath2); DDSFox_Set(&DDS1xAD9956, FoxFrequ, SlopeMath2); @@ -1440,14 +1447,11 @@ // Special case to handle change of day at next second if ( LocalTime.tm_hour==23 && LocalTime.tm_min==59 && strtod(Sec,NULL)>=58 ) { - printf("Entering change of date substructure\r\n"); - printf("old file : %s %s %s \r\n",Date, Time, LogFileName); Acquiring = FALSE ; do { Delay(5.1); CurrentFileName(LogFileName) ; } while (!GetFileInfo(LogFileName, &OldLogFilePtr)); - printf("new file : %s \r\n\r\n",Date, Time, LogFileName); Acquiring = TRUE ; OldLogFilePtr = 2; } @@ -2586,3 +2590,15 @@ } return 0; } + +int CVICALLBACK CB_InvertSlopeSign (int panel, int control, int event, + void *callbackData, int eventData1, int eventData2) +{ + switch (event) + { + case EVENT_COMMIT: + GetCtrlVal(panel, control, &invertSlopeSign); + break; + } + return 0; +}