changeset 24:b838371c7a91

Code cleanup and dead code removal
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Fri, 20 Jul 2012 17:38:15 +0200
parents 65e277fdf01f
children fde495ba28d2
files FXAnalyse.c
diffstat 1 files changed, 109 insertions(+), 259 deletions(-) [+]
line wrap: on
line diff
--- a/FXAnalyse.c	Fri Jul 20 16:50:11 2012 +0200
+++ b/FXAnalyse.c	Fri Jul 20 17:38:15 2012 +0200
@@ -17,17 +17,9 @@
 
 
 #define FXLINELENGTH 123
-#define DDSBESCLOCK (200.e6)	 // 200MHz de clock pour la DDS de Besancon...
-
+#define LOGFILEPATH "C:\\Femto\\Software\\FXQE80"
 
-#define LOGFILEPATH "C:\\Femto\\Software\\FXQE80"		
-#define FREP_NORMAL_FORMULA "(0-15M+DDS-Ch1/200)/12+2M/3"
-#define NUOL_NORMAL_FORMULA "(N*250M-194400G)+N*Math1-8*DDS1"
-#define NUHG_NORMAL_FORMULA "(N*250M-282143G)+N*Math1-(DDS1-Ch2)"
-#define NUSR_NORMAL_FORMULA "(N*250M-429228G)+N*Math1+(DDS2-Ch3)"
-#define NU813_NORMAL_FORMULA "(N*766M-368554G)+N*Math1+000.000M"
-#define NU1064_NORMAL_FORMULA "(N*766M-281630G)+(DDS_1064-Ch4)"
-
+#define DDSBESCLOCK (200.e6)	 // 200MHz de clock pour la DDS de Besancon...
 #define FACTORDDSBES 36*(8/770000)
 
 //==============================================================================
@@ -55,8 +47,8 @@
 char * LogFileName ;
 char ExtraMathFileName[MAX_PATHNAME_LEN] ;
 
-double utc = 0 ;
-double mjd =0 ;
+double utc = 0;
+double mjd = 0;
 
 double Ch1, Ch2, Ch3, Ch4 ; // le type long double est identique au double (8 octets) sous CVI !!! 
 double Math1, Math2, Math3, Math4, Math5; // N est en fait un entier en pratique...
@@ -73,8 +65,6 @@
 volatile bool Acquiring = FALSE ;
 
 long OldLogFilePtr = 0 ;
-
-double NuOpt=0.0;
 double Ndiv=8.0;
 
 ///////////////////
@@ -103,9 +93,7 @@
 double DeltaT_2=20.0, DeltakHz_2=500.0, t1_2=0.0, t2_2=0.0, t3_2=0.0, Frepplus_2=0.0, Frepminus_2=0.0;
 double DeltaT_3=20.0, DeltakHz_3=500.0, t1_3=0.0, t2_3=0.0, t3_3=0.0, Frepplus_3=0.0, Frepminus_3=0.0;
 
-
-int DeltaTMoy_1=3,n_1=0,DeltaTMoy_2=3,n_2=0,DeltaTMoy_3=3,n_3=0;
-double Tmoy_1_1=0.0,Tmoy_2_1=0.0,Tmoy_1_2=0.0,Tmoy_2_2=0.0,Tmoy_1_3=0.0,Tmoy_2_3=0.0; 
+int n_1=0, n_2=0, n_3=0;
 double Frequ_slope_1=0.0,Moy_slope_1=0.0,Slope_slope_1=0.0,Frequ_slope_2=0.0,Moy_slope_2=0.0,Slope_slope_2=0.0,Frequ_slope_3=0.0,Moy_slope_3=0.0,Slope_slope_3=0.0;  
 int N_slope_1=0,N_slope_2=0,N_slope_3=0;
 double  Beat_slope_2=0.0 ,Moy_Beatslope_2=0.0,Slope_Beatslope_2=0.0; 
@@ -123,7 +111,7 @@
 
 double Ch4Plus=0.0,Ch4Minus=0.0;
 
-int NDEJAPASSE=0, nDDSChange=0, nstabilization=0;
+int nDDSChange=0, nstabilization=0;
 
 //////
 //Pour les signes de fb
@@ -148,7 +136,6 @@
 double SlopeMath2=0.0;
 double TimetoSlope=60.0;
 double SlopeMeasuringTimeBegin=0.0;
-char * OnOffMessage="OFF" ;
 
 char DDSFoxName[255] = "DDS Fox Control" ; 
 double DDSFoxClock=200000000;
@@ -164,7 +151,7 @@
 int N_Math2slope=0.0,nstabilisationSlopeMeasuring=0;
 
 double LimitToDelock=5.0;
-double SlopeCorrection=0.0;
+double limitotakoff=70.0;
 
 int ratio=10; //Recentre la frequence tous les ratios
 
@@ -173,7 +160,7 @@
 double MoyMath2 = 0.0, CenterFrequencyCh2 = 0.0;
 volatile bool CenterFrequencyCh2ToDetermine=FALSE;
 
-double limitotakoff=70.0;
+
 
 enum {
 	SLOPE_REFERENCE_MICROWAVE = 0,
@@ -688,8 +675,6 @@
 						Ch3 = 1000*Ch3;
 						Ch4 = 1000*Ch4;
 						
-						NuOpt=N1*(250000000+Math1)-Signe1*8*FrequDDS1 ;
-						
 						SetCtrlVal(MainPanel, PANEL_FREQ1, Ch1) ;
 						SetCtrlVal(MainPanel, PANEL_FREQ2, Ch2) ;
 						SetCtrlVal(MainPanel, PANEL_FREQ3, Ch3) ;  
@@ -704,7 +689,6 @@
 						SetCtrlVal(CalcN3Panel, CALCN3_N, N_3) ;
 						SetCtrlVal(CalcN3Panel, CALCN3_SLOPE, Slope_3) ;
 						SetCtrlVal(MainPanel, PANEL_SLOPETOCANCEL, SlopeMath2);
-						/*SetCtrlVal(MainPanel, PANEL_SLOPECANCELONOFF, OnOffMessage); */
 						SetCtrlVal(MainPanel, PANEL_CENTERFREQUENCY, CenterFrequencyCh2);  
 						SetCtrlVal(MainPanel, PANEL_LED1, SlopeMeasuring); 	   
 						SetCtrlVal(MainPanel, PANEL_LED2, OnSlopeCancelling);
@@ -714,7 +698,6 @@
 						SetCtrlVal(MainPanel,PANEL_MATH1, Math1) ;
 
 						Math2 = mupEval(MathParser2) ;
-						//Math2=NuOpt;
 						SetCtrlVal(MainPanel,PANEL_MATH2, Math2) ;
 						
 						Math3 = mupEval(MathParser3) ;
@@ -1382,7 +1365,6 @@
 									CenterFrequencyCh2ToDetermine = FALSE;
 								}
 
-								OnOffMessage = "ON " ;
 								OnSlopeCancelling = TRUE;
 									
 								FoxFrequ = ReadDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate);
@@ -1451,7 +1433,6 @@
 											LaunchDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,ActualFrequ,ActualSlope,0);
 											
 											SlopeMeasuring = FALSE;
-											OnOffMessage = "OFF " ;
 											N_Math2slope = 0.0;
 											Math2_slope = 0.0;
 											MoyMath2 = 0.0; 
@@ -1500,54 +1481,14 @@
 							
 							
 						}
-						
-						
-						
-						
-						// Now, some special extra functions for some math value which have special 'default' meaning (like nu_Hg and nu_Sr)
-						
-						/*GetPanelAttribute(CalcNHgPanel, ATTR_VISIBLE, &BoxChecked) ;	 // correct name for answer would be more
-						if (BoxChecked) {												 // something like "&PanelOpened" here
-							N_1 = 0;	  // evaluate Math2 for N=0 gives 282143G-/+320M
-							GetCtrlVal(CalcNHgPanel, CALCNHG_TARGET, &Target) ;
-							NCalc = (Target-mupEval(MathParser2))/(Math1+766e6) ;
-							SetCtrlVal(CalcNHgPanel, CALCNHG_NHGCALC,  (double) RoundRealToNearestInteger (NCalc) ) ;
-							SetCtrlVal(CalcNHgPanel, CALCNHG_ERROR, NCalc-RoundRealToNearestInteger (NCalc) ) ; 
-							GetCtrlVal(MainPanel, PANEL_N_HG, &N_1) ; // Set N_1 back to value user defined in main panel 
-							} 
-						
-						GetPanelAttribute(CalcNSrPanel, ATTR_VISIBLE, &BoxChecked) ;	 // correct name for answer would be more
-						if (BoxChecked) {												 // something like "&PanelOpened" here, but I reuse variable name for concision 
-							N2 = 0;	  // evaluate Math3 for N=0 gives 429228G-/+DDS2-/+Ch3
-							GetCtrlVal(CalcNSrPanel, CALCN2_TARGET, &Target) ;
-							NCalc = (Target-mupEval(MathParser3))/(Math1+766e6) ;
-							SetCtrlVal(CalcNSrPanel, CALCN2_NSRCALC,  (double) RoundRealToNearestInteger (NCalc) ) ;
-							SetCtrlVal(CalcNSrPanel, CALCNSR_ERROR, NCalc-RoundRealToNearestInteger (NCalc) ) ; 
-							GetCtrlVal(MainPanel, PANEL_N_SR, &N2) ; // Set N_2 back to value user defined in main panel 
-							}	
-						
-						GetPanelAttribute(CalcN813Panel, ATTR_VISIBLE, &BoxChecked) ;	 // correct name for answer would be more
-						if (BoxChecked) {												 // something like "&PanelOpened" here, but I reuse variable name for concision 
-							N3 = 0;	  // evaluate Math4 for N=0 gives ??????G-/+DDS_813-/+Ch4
-							GetCtrlVal(CalcN813Panel, CALCN83_TARGET, &Target) ;
-							NCalc = (Target-mupEval(MathParser4))/(Math1+766e6) ;
-							SetCtrlVal(CalcN813Panel, CALCN813_N813CALC,  (double) RoundRealToNearestInteger (NCalc) ) ;
-							SetCtrlVal(CalcN813Panel, CALCN813_ERROR, NCalc-RoundRealToNearestInteger (NCalc) ) ; 
-							GetCtrlVal(MainPanel, PANEL_N_813, &N3) ; // Set N3 back to value user defined in main panel 
-							}*/	
 							
 						GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2AUTOSAV, &BoxChecked) ;		   // AutoSave OL
 						if (BoxChecked) {
 							SetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2SAVE, TRUE) ;   // so that it will try to write it (at next block) if it seems reasonnable, even though it was off before
-							}
+						}
 						
 						GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2SAVE, &BoxChecked) ;			   // Save OL (Math2)
 						if (BoxChecked) {
-							/*GetCtrlVal(CalcNHgPanel, CALCNHG_TARGET, &Target) ;
-							if (abs(Math2-Target)>1e4) {	   // write it only if it's vaguely plausible (here outlier>10kHz ie approx 10000sigma but not dedrift applied !!!)
-								SetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2SAVE, FALSE) ;
-								break ; 
-								} ;*/
 							FileOpt = OpenFile("z:\\MeasuresFifi1\\OptCavity.txt", VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII) ;
 							Fmt(ReportString, "%s\t%s\t%f[p3]\t%f[p3]", Date, Time, utc, Math2);
 							WriteLine(FileOpt, ReportString, -1) ;
@@ -1556,21 +1497,16 @@
 							Fmt(ReportString, "%s\t%s\t%f[p3]\t%f[p3]", Date, Time, utc, Math2);
 							WriteLine(FileOpt, ReportString, -1) ;
 							CloseFile(FileOpt) ;
-							}
+						}
 						
 						GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH3AUTOSAV, &BoxChecked) ;		   // AutoSave Hg (Math3)
 						if (BoxChecked) {
 							SetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH3SAVE, TRUE) ;   // so that it will try to write it (at next block) if it seems reasonnable, even though it was off before
-							}
+						}
 						
 						GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH3SAVE, &BoxChecked) ;			   // Save Hg
 						
 						if (BoxChecked) {
-							/*GetCtrlVal(CalcNSrPanel, CALCN3_TARGET, &Target) ;     
-							if (abs(Math3-Target)>1.0e4) {	   // write it only if it's vaguely plausible (here outlier>10kHz ie approx 10000sigma but not dedrift applied !!!)
-								SetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH3SAVE, FALSE) ;	// otherwise uncheck the save box
-								break ; 
-								} ;*/ 
 							FileHg = OpenFile("z:\\MeasuresFifi1\\HgCavity.txt", VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII) ;
 							Fmt(ReportString, "%s\t%s\t%f[p3]\t%f[p3]", Date, Time, utc, Math3);
 							WriteLine(FileHg, ReportString, -1) ;
@@ -1579,8 +1515,7 @@
 							Fmt(ReportString, "%s\t%s\t%f[p3]\t%f[p3]", Date, Time, utc, Math3);
 							WriteLine(FileHg, ReportString, -1) ;
 							CloseFile(FileHg) ;
-							
-							}
+						}
 						
 						GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH5SAVE, &BoxChecked) ;				// Save ExtraMath (Math5)
 						if (BoxChecked) {
@@ -1588,10 +1523,9 @@
 							Fmt(ReportString, "%s\t%s\t%f[p3]\t%f[p7]", Date, Time, utc, Math5);
 							WriteLine(FileExtraMath, ReportString, -1) ;
 							CloseFile(FileExtraMath) ;
-							}
+						}
 						
 						// Special case to handle change of day at next second
-						//if ( LocalTime.tm_hour==23 && LocalTime.tm_min==59 && strtod(Sec,NULL)>59 ) {
 						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);
@@ -1843,19 +1777,33 @@
 int CVICALLBACK CB_ChangeMath (int panel, int control, int event,
 		void *callbackData, int eventData1, int eventData2)
 {
-	
-	char * MathString = "                                                             " ;
-						// should be long enough for any reasonnable math expression...
+	int len;
+	char *string;
 		
 	switch (event)
 	{
 		case EVENT_COMMIT:
-				GetCtrlVal(panel, control, MathString) ;
-				if (control==PANEL_MATHSTRING1) { mupSetExpr(MathParser1, MathString) ; }
-				if (control==PANEL_MATHSTRING2) { mupSetExpr(MathParser2, MathString) ; }
-				if (control==PANEL_MATHSTRING3) { mupSetExpr(MathParser3, MathString) ; }
-				if (control==PANEL_MATHSTRING4) { mupSetExpr(MathParser4, MathString) ; }
-				if (control==PANEL_MATHSTRING5) { mupSetExpr(MathParser5, MathString) ; } 
+			GetCtrlAttribute(panel, control, ATTR_STRING_TEXT_LENGTH, &len);
+			string = (char *)malloc(sizeof(char) * (len + 1));
+			GetCtrlVal(panel, control, string);
+			switch (control) {
+				case PANEL_MATHSTRING1:
+					mupSetExpr(MathParser1, string);
+					break;
+				case PANEL_MATHSTRING2:
+					mupSetExpr(MathParser2, string);
+					break;
+				case PANEL_MATHSTRING3:
+					mupSetExpr(MathParser3, string);
+					break;
+				case PANEL_MATHSTRING4:
+					mupSetExpr(MathParser4, string);
+					break;
+				case PANEL_MATHSTRING5:
+					mupSetExpr(MathParser5, string);
+					break;
+			}
+			free(string);
 			break;
 	}
 	return 0;
@@ -1876,143 +1824,126 @@
 	return 0;
 }
 
+
 int CVICALLBACK CB_OnPlus275k (int panel, int control, int event,
 		void *callbackData, int eventData1, int eventData2)
 {
 	double Frequency ;
 	
 	switch (event)
-		{
+	{
 		case EVENT_COMMIT:
-				GetCtrlVal(MainPanel, PANEL_DDSFREPOUT, &Frequency) ; 
-				Frequency += 275000.0 ;
-				DDSBes_SetFrequency(&DDSBes, Frequency) ;	
-				SetCtrlVal(MainPanel, PANEL_DDSFREPOUT, Frequency) ; 
-				/*SetCtrlVal(MainPanel, PANEL_MATHSTRING1, FREP_NORMAL_FORMULA) ;
-				mupSetExpr(MathParser1, FREP_NORMAL_FORMULA) ;
-				SetCtrlVal(MainPanel, PANEL_MATHSTRING2, NUHG_NORMAL_FORMULA) ;
-				mupSetExpr(MathParser2, NUHG_NORMAL_FORMULA) ;
-				SetCtrlVal(MainPanel, PANEL_MATHSTRING4, NU813_NORMAL_FORMULA) ;
-				mupSetExpr(MathParser4, NU813_NORMAL_FORMULA) ;
-				*/
+			GetCtrlVal(MainPanel, PANEL_DDSFREPOUT, &Frequency);
+			Frequency += 275000.0;
+			DDSBes_SetFrequency(&DDSBes, Frequency);
+			SetCtrlVal(MainPanel, PANEL_DDSFREPOUT, Frequency);
 			break;
-		}
+	}
 	return 0;
 }
 
+
 int CVICALLBACK CB_OnMinus275k (int panel, int control, int event,
 		void *callbackData, int eventData1, int eventData2)
 {
 	double Frequency ;
 
 	switch (event)
-		{
+	{
 		case EVENT_COMMIT:
-			GetCtrlVal(MainPanel, PANEL_DDSFREPOUT, &Frequency) ; 
-			Frequency -= 275000.0 ;
-			DDSBes_SetFrequency(&DDSBes, Frequency) ;	
-			SetCtrlVal(MainPanel, PANEL_DDSFREPOUT, Frequency) ; 
-			/*SetCtrlVal(MainPanel, PANEL_MATHSTRING1, "0") ;
-			mupSetExpr(MathParser1, "0") ;
-			SetCtrlVal(MainPanel, PANEL_MATHSTRING2, "0") ;
-			mupSetExpr(MathParser2, "0") ;
-			SetCtrlVal(MainPanel, PANEL_MATHSTRING4, "0") ;
-			mupSetExpr(MathParser4, "0") ;
-			*/
+			GetCtrlVal(MainPanel, PANEL_DDSFREPOUT, &Frequency);
+			Frequency -= 275000.0;
+			DDSBes_SetFrequency(&DDSBes, Frequency);
+			SetCtrlVal(MainPanel, PANEL_DDSFREPOUT, Frequency);
 			break;
-		}
+	}
 	return 0;
 }
 
+
 int CVICALLBACK CB_OnPlus10k (int panel, int control, int event,
 		void *callbackData, int eventData1, int eventData2)
 {
 	double Frequency ;
 	
 	switch (event)
-		{
+	{
 		case EVENT_COMMIT:
-			if (control==PANEL_PLUS10KDDS1) {
-			GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency) ;
-			Frequency += 10000.0 ;
-			DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency);	
-			SetCtrlVal(MainPanel, PANEL_DDS1, Frequency) ;
-			/*SetCtrlVal(MainPanel, PANEL_MATHSTRING3, NUHG_NORMAL_FORMULA) ;
-			mupSetExpr(MathParser3, NUHG_NORMAL_FORMULA) ;
-			*/
-			}
-			if (control==PANEL_PLUS10KDDS2) {
-			GetCtrlVal(MainPanel, PANEL_DDS2, &Frequency) ;
-			Frequency += 10000.0 ;
-			DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, Frequency);	
-			SetCtrlVal(MainPanel, PANEL_DDS2, Frequency) ;
-			/*SetCtrlVal(MainPanel, PANEL_MATHSTRING3, NUSR_NORMAL_FORMULA) ;
-			mupSetExpr(MathParser3, NUSR_NORMAL_FORMULA) ;
-			*/
-			}
-			if (control==PANEL_PLUS10KDDS3) {
-			GetCtrlVal(MainPanel, PANEL_DDS3, &Frequency) ;
-			Frequency += 10000.0 ;
-			DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, Frequency);	
-			SetCtrlVal(MainPanel, PANEL_DDS3, Frequency) ;
-			}
-			if (control==PANEL_PLUS10KDDS4) {
-			GetCtrlVal(MainPanel, PANEL_DDS4, &Frequency) ;
-			Frequency += 10000.0 ;
-			DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency);	
-			SetCtrlVal(MainPanel, PANEL_DDS4, Frequency) ;
+			switch (control)
+			{
+				case PANEL_PLUS10KDDS1:
+					GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency);
+					Frequency += 10000.0;
+					DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency);	
+					SetCtrlVal(MainPanel, PANEL_DDS1, Frequency);
+					break;
+				case PANEL_PLUS10KDDS2:
+					GetCtrlVal(MainPanel, PANEL_DDS2, &Frequency);
+					Frequency += 10000.0;
+					DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, Frequency);	
+					SetCtrlVal(MainPanel, PANEL_DDS2, Frequency);
+					break;
+				case PANEL_PLUS10KDDS3:
+					GetCtrlVal(MainPanel, PANEL_DDS3, &Frequency);
+					Frequency += 10000.0;
+					DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, Frequency);	
+					SetCtrlVal(MainPanel, PANEL_DDS3, Frequency);
+					break;
+				case PANEL_PLUS10KDDS4:
+					GetCtrlVal(MainPanel, PANEL_DDS4, &Frequency);
+					Frequency += 10000.0;
+					DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency);	
+					SetCtrlVal(MainPanel, PANEL_DDS4, Frequency);
+					break;
 			}
 			break;
-		}
+	}
 	return 0;
 }
 
+
 int CVICALLBACK CB_OnMinus10k (int panel, int control, int event,
 		void *callbackData, int eventData1, int eventData2)
 {
-	double Frequency ;
+	double Frequency;
 	
 	switch (event)
-		{
+	{
 		case EVENT_COMMIT:
-			if (control==PANEL_MINUS10KDDS1) {
-			GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency) ;
-			Frequency -= 10000.0 ;
-			DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency);	
-			SetCtrlVal(MainPanel, PANEL_DDS1, Frequency) ;
-			/*SetCtrlVal(MainPanel, PANEL_MATHSTRING3, NUHG_NORMAL_FORMULA) ;
-			mupSetExpr(MathParser3, NUHG_NORMAL_FORMULA) ;
-			*/
-			}
-			if (control==PANEL_MINUS10KDDS2) {
-			GetCtrlVal(MainPanel, PANEL_DDS2, &Frequency) ;
-			Frequency -= 10000.0 ;
-			DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, Frequency);	
-			SetCtrlVal(MainPanel, PANEL_DDS2, Frequency) ;
-			/*SetCtrlVal(MainPanel, PANEL_MATHSTRING3, NUSR_NORMAL_FORMULA) ;
-			mupSetExpr(MathParser3, NUSR_NORMAL_FORMULA) ;
-			*/
-			}
-			if (control==PANEL_MINUS10KDDS3) {
-			GetCtrlVal(MainPanel, PANEL_DDS3, &Frequency) ;
-			Frequency -= 10000.0 ;
-			DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, Frequency);	
-			SetCtrlVal(MainPanel, PANEL_DDS3, Frequency) ;
-			}
-			if (control==PANEL_MINUS10KDDS4) {
-			GetCtrlVal(MainPanel, PANEL_DDS4, &Frequency) ;
-			Frequency -= 10000.0 ;
-			DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency);	
-			SetCtrlVal(MainPanel, PANEL_DDS4, Frequency) ;
+			switch (control)
+			{
+				case PANEL_MINUS10KDDS1:
+					GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency);
+					Frequency -= 10000.0;
+					DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency);
+					SetCtrlVal(MainPanel, PANEL_DDS1, Frequency);
+					break;
+				case PANEL_MINUS10KDDS2:
+					GetCtrlVal(MainPanel, PANEL_DDS2, &Frequency);
+					Frequency -= 10000.0;
+					DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, Frequency);	
+					SetCtrlVal(MainPanel, PANEL_DDS2, Frequency);
+					break;
+				case PANEL_MINUS10KDDS3:
+					GetCtrlVal(MainPanel, PANEL_DDS3, &Frequency);
+					Frequency -= 10000.0;
+					DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, Frequency);	
+					SetCtrlVal(MainPanel, PANEL_DDS3, Frequency);
+					break;
+				case PANEL_MINUS10KDDS4:
+					GetCtrlVal(MainPanel, PANEL_DDS4, &Frequency);
+					Frequency -= 10000.0;
+					DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency);
+					SetCtrlVal(MainPanel, PANEL_DDS4, Frequency);
+					break;
 			}
 			break;
-		}
+	}
 	return 0;
 }
 
 
 
-
 int CVICALLBACK CB_OnSaveOpt (int panel, int control, int event,
 		void *callbackData, int eventData1, int eventData2)
 {
@@ -2159,82 +2090,6 @@
 	return 0;
 }
 
-/*int CVICALLBACK OnFSRStep (int panel, int control, int event,
-		void *callbackData, int eventData1, int eventData2)
-{
-	double Target, FSR ;
-	
-	switch (event)
-		{
-		case EVENT_COMMIT:
-			if (panel==CalcNHgPanel) {
-				if (control==CALCNHG_MINUSFSR) {
-					GetCtrlVal(CalcNHgPanel, CALCNHG_FSR, &FSR) ;
-					GetCtrlVal(CalcNHgPanel, CALCNHG_TARGET, &Target) ;
-					Target -= FSR ;
-					SetCtrlVal(CalcNHgPanel, CALCNHG_TARGET, Target) ;
-					} 
-				if (control==CALCNHG_PLUSFSR) {
-					GetCtrlVal(CalcNHgPanel, CALCNHG_FSR, &FSR) ;
-					GetCtrlVal(CalcNHgPanel, CALCNHG_TARGET, &Target) ;
-					Target += FSR ;
-					SetCtrlVal(CalcNHgPanel, CALCNHG_TARGET, Target) ;
-					}
-				}   
-			if (panel==CalcNSrPanel) {
-				if (control==CALCNSR_MINUSFSR) {
-					GetCtrlVal(CalcNSrPanel, CALCNSR_FSR, &FSR) ;
-					GetCtrlVal(CalcNSrPanel, CALCNSR_TARGET, &Target) ;
-					Target -= FSR ;
-					SetCtrlVal(CalcNSrPanel, CALCNSR_TARGET, Target) ;
-					}
-				if (control==CALCNSR_PLUSFSR) {
-					GetCtrlVal(CalcNSrPanel, CALCNSR_FSR, &FSR) ;
-					GetCtrlVal(CalcNSrPanel, CALCNSR_TARGET, &Target) ;
-					Target += FSR ;
-					SetCtrlVal(CalcNSrPanel, CALCNSR_TARGET, Target) ;
-					}
-				}
-			break;
-		}
-	return 0;
-} */ 
-
- /*int CVICALLBACK OnExtrapolateTarget (int panel, int control, int event,
-		void *callbackData, int eventData1, int eventData2)
-{
-	bool BoxChecked = FALSE ;  
-	double extrapolFreq = 745967614;
-	time_t utcTime ; 
-	double utc ;
-	
-	switch (event)
-		{
-		case EVENT_COMMIT:
-			GetCtrlVal(CalcNHgPanel, CALCNHG_EXTRAPOLATE, &BoxChecked) ;
-			if (BoxChecked) {
-				SetCtrlAttribute(CalcNHgPanel, CALCNHG_TARGET,     ATTR_DIMMED, TRUE) ;  
-				SetCtrlAttribute(CalcNHgPanel, CALCNHG_OFFSETFREQ, ATTR_DIMMED, TRUE) ;
-				SetCtrlAttribute(CalcNHgPanel, CALCNHG_PLUSFSR,    ATTR_DIMMED, TRUE) ;
-				SetCtrlAttribute(CalcNHgPanel, CALCNHG_MINUSFSR,   ATTR_DIMMED, TRUE) ; 
-				utc = time(&utcTime) ;
-				//extrapolFreq = 746127081 + 0.032*(utc-3491304000) ; // linear data extrapolation with slope from 18/08/2010-12/08/2010 
-				extrapolFreq = 746108328.707542 + 3.144737e-002 * (utc-3490779388.183) - 9.527612e-010 * (utc-3490779388.183) ;  // quad extrapol from fit of data in HgCavity.txt 5/10/2010
-				
-				
-				SetCtrlVal(CalcNHgPanel, CALCNHG_TARGET, extrapolFreq) ;
-				}
-			else {
-				SetCtrlAttribute(CalcNHgPanel, CALCNHG_TARGET,     ATTR_DIMMED, FALSE) ;
-				SetCtrlAttribute(CalcNHgPanel, CALCNHG_OFFSETFREQ, ATTR_DIMMED, FALSE) ;
-				SetCtrlAttribute(CalcNHgPanel, CALCNHG_PLUSFSR,    ATTR_DIMMED, FALSE) ; 
-				SetCtrlAttribute(CalcNHgPanel, CALCNHG_MINUSFSR,   ATTR_DIMMED, FALSE) ; 
-				}
-			break;
-		}
-	return 0;
-}  */
-
 
 int CVICALLBACK OnChooseSaveFile (int panel, int control, int event,
 		void *callbackData, int eventData1, int eventData2)
@@ -2252,10 +2107,6 @@
 }
 
 
-// Changements pour Calcul de N
-
-
-
 int CVICALLBACK CB_OnNCalculus (int panel, int control, int event,
 		void *callbackData, int eventData1, int eventData2)
 {
@@ -2645,7 +2496,6 @@
 								OnSlopeCancelling =FALSE;     }
 						 LaunchDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,ActualFrequ,ActualSlope,0);
 						 SlopeMeasuring=FALSE; 
-						 OnOffMessage="OFF " ;
 						 N_Math2slope=0.0;
 						 Math2_slope=0.0;
 						 Moy_Math2slope=0.0;