comparison FXAnalyse.c @ 42:dcc305411dcc

Cleanup
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Tue, 09 Oct 2012 13:18:31 +0200
parents 50544ecfcfc7
children 39a0f396d778
comparison
equal deleted inserted replaced
41:7fb7eee56b11 42:dcc305411dcc
201 mupDefinePostfixOprt( * pMathParser, "f", &femto, 1); 201 mupDefinePostfixOprt( * pMathParser, "f", &femto, 1);
202 } 202 }
203 203
204 int main (int argc, char *argv[]) 204 int main (int argc, char *argv[])
205 { 205 {
206 //int ThreadId ; // to be used when I will replace timer by thread for counder readout
207
208 double initfreqDDS ; 206 double initfreqDDS ;
209 char * MathString1 = " " ; 207 char * MathString1 = " " ;
210 char * MathString2 = " " ; 208 char * MathString2 = " " ;
211 char * MathString3 = " " ; 209 char * MathString3 = " " ;
212 char * MathString4 = " " ; 210 char * MathString4 = " " ;
1236 SetCtrlVal(MainPanel, PANEL_DDS3, Frequency3) ; 1234 SetCtrlVal(MainPanel, PANEL_DDS3, Frequency3) ;
1237 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency3); 1235 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency3);
1238 Getsign3 = FALSE; 1236 Getsign3 = FALSE;
1239 } 1237 }
1240 } 1238 }
1241 1239
1242 1240 // slope cancelling
1243
1244
1245 /*
1246 * Slope Cancelling
1247 */
1248
1249 if (SlopeMeasuring == TRUE) 1241 if (SlopeMeasuring == TRUE)
1250 { 1242 {
1251 double currentFreq = 0.0; 1243 double currentFreq = 0.0;
1252 1244
1253 /* select reference */ 1245 // select reference
1254 switch (slopeReference) { 1246 switch (slopeReference) {
1255 case SLOPE_REFERENCE_MICROWAVE: 1247 case SLOPE_REFERENCE_MICROWAVE:
1256 currentFreq = Math2; 1248 currentFreq = Math2;
1257 break; 1249 break;
1258 case SLOPE_REFERENCE_HG_CAVITY: 1250 case SLOPE_REFERENCE_HG_CAVITY:
1355 } 1347 }
1356 } 1348 }
1357 } 1349 }
1358 } 1350 }
1359 1351
1360 1352 // re-centering
1361 //// For re-centering
1362
1363 if (KeepCentering) 1353 if (KeepCentering)
1364 { 1354 {
1365 1355
1366 DeltaCh4=275000-Ch4; 1356 DeltaCh4=275000-Ch4;
1367 DeltaCh2=10000-Ch2; 1357 DeltaCh2=10000-Ch2;
2221 } 2211 }
2222 2212
2223 2213
2224 int CVICALLBACK CB_OnFind275K (int panel, int control, int event, 2214 int CVICALLBACK CB_OnFind275K (int panel, int control, int event,
2225 void *callbackData, int eventData1, int eventData2) 2215 void *callbackData, int eventData1, int eventData2)
2226 { 2216 {
2227 2217 double frequency;
2228 2218
2229 double FrequencyToChange,DeltaCh4,DeltaCh2; 2219 switch (event)
2230 2220 {
2231 DeltaCh4=275000-Ch4; 2221 case EVENT_COMMIT:
2232 DeltaCh2=10000-Ch2; 2222 switch (control)
2233 2223 {
2234 switch (event) 2224 case PANEL_FIND275K2:
2235 { 2225 GetCtrlVal(MainPanel, PANEL_DDS2, &frequency);
2236 case EVENT_COMMIT: 2226 frequency = frequency + 275000 - Ch4;
2237 if (control==PANEL_FIND275K2){ 2227 SetCtrlVal(MainPanel, PANEL_DDS2, frequency) ;
2238 GetCtrlVal(MainPanel, PANEL_DDS2, &FrequencyToChange) ; 2228 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency);
2239 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyToChange+DeltaCh4) ; 2229 break;
2240 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyToChange+DeltaCh4);
2241 2230
2242 } 2231 case PANEL_FIND10K3:
2243 2232 GetCtrlVal(MainPanel, PANEL_DDS3, &frequency);
2244 if (control==PANEL_FIND10K3){ 2233 frequency = frequency + 10000 - Ch2;
2245 GetCtrlVal(MainPanel, PANEL_DDS3, &FrequencyToChange) ; 2234 SetCtrlVal(MainPanel, PANEL_DDS3, frequency);
2246 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyToChange+DeltaCh2) ; 2235 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency);
2247 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyToChange+DeltaCh2); 2236 break;
2248 2237 }
2249 } 2238 break;
2250 2239 }
2251 break; 2240 return 0;
2252 2241 }
2253 }
2254 return 0;
2255 }
2256 2242
2257 2243
2258 int CVICALLBACK CB_OnSlopeTime (int panel, int control, int event, 2244 int CVICALLBACK CB_OnSlopeTime (int panel, int control, int event,
2259 void *callbackData, int eventData1, int eventData2) 2245 void *callbackData, int eventData1, int eventData2)
2260 { 2246 {