changeset 14:783407954cdf

Minor code cleanup
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 16 Jul 2012 13:15:30 +0200
parents e45d6e9544f5
children b2103439b401
files FXAnalyse.c
diffstat 1 files changed, 46 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/FXAnalyse.c	Mon Jul 16 13:04:01 2012 +0200
+++ b/FXAnalyse.c	Mon Jul 16 13:15:30 2012 +0200
@@ -2680,88 +2680,78 @@
 }
 
  
-  int  CVICALLBACK CB_OnResetSlope (int panel, int control, int event, 
-		 void *callbackData, int eventData1, int eventData2)
+int  CVICALLBACK CB_OnResetSlope (int panel, int control, int event, 
+		void *callbackData, int eventData1, int eventData2)
 {
 
-	switch (event)
-		{
+	switch (event) {
 		case EVENT_COMMIT:
-			   if (control==PANEL_RESETSLOPE){ 
-				   
-				     SlopeMath2=0.0; 
-					 CenterFrequencyCh2=0.0;
-					 MoyMath2=0.0;
-					 Nratio=-1;
-					 CenterFrequencyCh2ToDetermine=TRUE ;
-					 OnSlopeCancelling =FALSE; 
-					 LaunchDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate,0);
-			   }
-
+			SlopeMath2 = 0.0; 
+			CenterFrequencyCh2 = 0.0;
+			MoyMath2 = 0.0;
+			Nratio = -1;
+			CenterFrequencyCh2ToDetermine = TRUE ;
+			OnSlopeCancelling = FALSE; 
+			LaunchDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate,0);
 			break;
-			
-		}
+	}
 	return 0;
 }
   
   
-    int  CVICALLBACK CB_ChangeSlopeTime (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)
 {
 
-	switch (event)
-		{
+	switch (event) {
 		case EVENT_COMMIT:
-			   if (control==PANEL_SLOPETIME){ 
-				   
-				     GetCtrlVal(MainPanel, PANEL_SLOPETIME, &TimetoSlope); 
-			   }
-
+			GetCtrlVal(MainPanel, PANEL_SLOPETIME, &TimetoSlope); 
 			break;
-			
-		}
+	}
 	return 0;
 }
 
 
-  int LaunchDDSFOX (char *Name,char *ip,int Port,unsigned int Profil,double Clock,double DeltaT,double Frequency,double Sweeprate,int mode)
+int LaunchDDSFOX (char *Name,char *ip,int Port,unsigned int Profil,double Clock,double DeltaT,double Frequency,double Sweeprate,int mode)
 {
-			  //mode =0 pour normal
-			  //mode =1 pour reset 
+	//mode =0 pour normal
+	//mode =1 pour reset 
+	
 	DDSParameter DDSState;
-			strcpy(DDSState.Name ,Name) ; 
-			DDSState.Profil = Profil ;
-			strcpy(DDSState.ip,ip) ; 
-			DDSState.Port = Port;
-			DDSState.Clock = Clock;
-			DDSState.Delta_T = DeltaT;
-			DDSState.Frequency = Frequency; 
-			DDSState.SweepRate = Sweeprate ; 
-			if (mode ==  1) {  DDS_Initialize (&DDSState) ; }
-			else {	DDS_ReInitialize (&DDSState) ; }
+	
+	strcpy(DDSState.Name, Name); 
+	DDSState.Profil = Profil;
+	strcpy(DDSState.ip, ip); 
+	DDSState.Port = Port;
+	DDSState.Clock = Clock;
+	DDSState.Delta_T = DeltaT;
+	DDSState.Frequency = Frequency; 
+	DDSState.SweepRate = Sweeprate;
+	
+	if (mode ==  1) {
+		DDS_Initialize (&DDSState);
+	} else {
+		DDS_ReInitialize (&DDSState);
+	}
 	
 	return 0;
 }
   
-    double ReadDDSFOX (char *Name,char *ip,int Port,unsigned int Profil,double Clock,double DeltaT,double Frequency,double Sweeprate)
+double ReadDDSFOX (char *Name,char *ip,int Port,unsigned int Profil,double Clock,double DeltaT,double Frequency,double Sweeprate)
 {
 
 	DDSParameter DDSState;
-	double FrequDDSFox;
+
+	strcpy(DDSState.Name, Name);
+	DDSState.Profil = Profil;
+	strcpy(DDSState.ip, ip);
+	DDSState.Port = Port;
+	DDSState.Clock = Clock;
+	DDSState.Delta_T = DeltaT;
+	DDSState.Frequency = Frequency;
+	DDSState.SweepRate = Sweeprate;
 	
-			strcpy(DDSState.Name ,Name) ;
-			DDSState.Profil = Profil ;
-			strcpy(DDSState.ip,ip) ; 
-			DDSState.Port = Port;
-			DDSState.Clock = Clock;
-			DDSState.Delta_T = DeltaT;
-			DDSState.Frequency = Frequency; 
-			DDSState.SweepRate = Sweeprate ; 
-
-			FrequDDSFox=DDSFox_ReadFreq(&DDSState);
-
-	
-	return FrequDDSFox;
+	return DDSFox_ReadFreq(&DDSState);
 }