# HG changeset patch # User Daniele Nicolodi # Date 1349434419 -7200 # Node ID 2e1b3148d6e651a00c10f4c5cdbbb2da69b858df # Parent 537ca522c8b143c3e0761f2a93097b3c7026a20d Add setting to invert the sign of the measured slope on dedrifting diff -r 537ca522c8b1 -r 2e1b3148d6e6 FXAnalyse.c --- 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; +} diff -r 537ca522c8b1 -r 2e1b3148d6e6 FXAnalyse.h --- a/FXAnalyse.h Wed Oct 03 15:11:35 2012 +0200 +++ b/FXAnalyse.h Fri Oct 05 12:53:39 2012 +0200 @@ -174,6 +174,7 @@ #define PANEL_LED2 120 /* control type: LED, callback function: (none) */ #define PANEL_SLOPE_REFERENCE 121 /* control type: ring, callback function: CB_OnSlopeReference */ #define PANEL_ESTIMATE_N3 122 /* control type: command, callback function: CB_OnEstimateN */ +#define PANEL_INVERT_SLOPE_SIGN 123 /* control type: radioButton, callback function: CB_InvertSlopeSign */ /* Menu Bars, Menus, and Menu Items: */ @@ -188,6 +189,7 @@ int CVICALLBACK CB_ChangeMath(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_ChangeN(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_ChangeSlopeTime(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); +int CVICALLBACK CB_InvertSlopeSign(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_OnAcceptN(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_OnAllanPlot(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_OnAutoSaveHg(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); diff -r 537ca522c8b1 -r 2e1b3148d6e6 FXAnalyse.uir Binary file FXAnalyse.uir has changed