Mercurial > hg > fxanalyse
diff FXAnalyse.c @ 32:3ea9fb26ecdf
Fix N1 measurement code after cleanup
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Wed, 03 Oct 2012 11:20:48 +0200 |
parents | 56095062acd4 |
children | 09ed37e1da04 |
line wrap: on
line diff
--- a/FXAnalyse.c Tue Oct 02 19:13:20 2012 +0200 +++ b/FXAnalyse.c Wed Oct 03 11:20:48 2012 +0200 @@ -90,9 +90,9 @@ int settling = 0; -volatile bool Measuring_1 = FALSE,Step1_1 = FALSE,Step2_1 = FALSE,Step3_1 = FALSE, Measuring_2 = FALSE,Step1_2 = FALSE,Step2_2 = FALSE,Step3_2 = FALSE; -volatile bool Measuring_3 = FALSE,Step1_3 = FALSE,Step2_3 = FALSE,Step3_3 = FALSE; -volatile bool TimetoBegin=FALSE; +int Measuring_1 = FALSE; +bool Measuring_2 = FALSE, Step1_2 = FALSE, Step2_2 = FALSE, Step3_2 = FALSE; +int Measuring_3 = FALSE; double FrequDDS1=110000000.0, FrequDDS2=15300000.0, FrequDDS3=150400000.0, FrequDDS4=110000000.0; double Slope_1=0.0,Slope_2=0.0,Slope_3=0.0,Beatslope_2=0.0; @@ -802,6 +802,7 @@ if ((utc - t1_1) > SlopeTime1) { Slope_1 = Slope_slope_1; Ch4Slope = Slope_Ch4slope_1; + SetCtrlVal(CalcN1Panel, CALCN1_SLOPE, Slope_1); N_slope_1 = 0; Frequ_slope_1 = 0.0; @@ -833,8 +834,10 @@ break; } - double fDDS2 = FrequencyDDSBesInit + 275000 - Ch4; - SetCtrlVal(MainPanel, PANEL_DDS2, fDDS2) ; + double fDDS2; + GetCtrlVal(MainPanel, PANEL_DDS2, &fDDS2); + fDDS2 += 275000 - Ch4; + SetCtrlVal(MainPanel, PANEL_DDS2, fDDS2); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); // allow counter to settle @@ -844,7 +847,6 @@ Measuring_1 += 1; break; - case N_MEASUREMENT_FREP_PLUS: // frep positive step @@ -898,15 +900,17 @@ Ch4Minus = Ch4Minus / n_1; n_1 = 0; + // compute N1 + N_1 = Signe1 * (2*Ndiv * DeltakHz_1 * 1000)/(Frepminus_1 - Frepplus_1 - Slope_1 * (t3_1 - t2_1)); + SetCtrlVal(CalcN1Panel, CALCN1_N, N_1); + t1_1 = 0.0; t2_1 = 0.0; t3_1 = 0.0; Frepminus_1 = 0.0; Frepplus_1 = 0.0; - // compute N1 - N_1 = Signe1 * (2*Ndiv * DeltakHz_1 * 1000)/(Frepminus_1 - Frepplus_1 - Slope_1 * (t3_1 - t2_1)); - + // back to nominal frep DDS4xAD9912_FrequencyRampe(&DDS4xAD9912, 1, FrequDDS1-DeltakHz_1*1000,FrequDDS1, Step1/Ndiv ); SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); @@ -2104,10 +2108,7 @@ if (PanelIsVisible) HidePanel(CalcN1Panel); - Measuring_1=FALSE; - Step1_1=FALSE ; - Step2_1=FALSE ; - Step3_1=FALSE ; + Measuring_1 = FALSE; Frepminus_1=0.0; Frepplus_1=0.0; t1_1=0.0;