Mercurial > hg > fxanalyse
annotate FXAnalyse.c @ 37:5e81800fe354
Cleanup
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Wed, 03 Oct 2012 15:05:45 +0200 |
parents | 914e0f16b19a |
children | 2e1b3148d6e6 |
rev | line source |
---|---|
0 | 1 #include <utility.h> |
2 #include <ansi_c.h> | |
3 #include <cvirte.h> | |
4 #include <userint.h> | |
5 #include <formatio.h> | |
6 #include <string.h> | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
7 #include <future.h> |
0 | 8 |
9 #include "YLCStuff.h" | |
10 #include "FXAnalyse.h" | |
11 #include "Plot.h" | |
12 #include "Allan.h" | |
13 #include "DDSBes.h" | |
14 #include "DDS4xAD9912.h" | |
15 #include "DDS_Fox.h" | |
16 #include "muParserDLL.h" | |
17 | |
18 #define FXLINELENGTH 123 | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
19 #define LOGFILEPATH "C:\\Femto\\Software\\FXQE80" |
0 | 20 |
29
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
21 #define DEDRIFT_DDS_FREQUENCY 70000000 |
0 | 22 |
37 | 23 // panel handling stuff |
0 | 24 static PanelHandle MainPanel ; |
25 static PanelHandle CalcN1Panel ; | |
26 static PanelHandle CalcN2Panel ; | |
27 static PanelHandle CalcN3Panel ; | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
28 static PanelHandle EstimateN3Panel; |
0 | 29 |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
30 char LogFileName[MAX_PATHNAME_LEN]; |
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
31 char ExtraMathFileName[MAX_PATHNAME_LEN]; |
0 | 32 |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
33 double utc = 0; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
34 double mjd = 0; |
0 | 35 |
37 | 36 double Ch1, Ch2, Ch3, Ch4; |
37 double Math1, Math2, Math3, Math4, Math5; | |
38 double N1, N2, N3, N4; | |
0 | 39 |
40 Plot_Data PlotCh1, PlotCh2, PlotCh3, PlotCh4, PlotMath1, PlotMath2, PlotMath3, PlotMath4, PlotMath5 ; | |
41 Allan_Data AllanCh1, AllanCh2, AllanCh3, AllanCh4, AllanMath1, AllanMath2, AllanMath3, AllanMath4, AllanMath5 ; | |
42 | |
29
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
43 // 1xAD9956 DDS box |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
44 DDSParameter DDS1xAD9956; |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
45 // 4xAD9912 DDS box |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
46 DDS4xAD9912_Data DDS4xAD9912; |
0 | 47 |
37 | 48 muParserHandle_t MathParser1, MathParser2, MathParser3, MathParser4, MathParser5; |
0 | 49 |
37 | 50 int Acquiring = FALSE; |
0 | 51 |
37 | 52 long OldLogFilePtr = 0; |
53 double Ndiv = 8.0; | |
0 | 54 |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
55 enum { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
56 N_MEASUREMENT_STEP_0, |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
57 N_MEASUREMENT_STEP_1, |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
58 N_MEASUREMENT_STEP_2, |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
59 N_MEASUREMENT_STEP_3, |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
60 N_MEASUREMENT_STEP_4, |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
61 }; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
62 |
26
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
63 enum { |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
64 N_MEASUREMENT_NONE, |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
65 N_MEASUREMENT_INIT, |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
66 N_MEASUREMENT_SLOPE, |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
67 N_MEASUREMENT_ADJUST_FREQ_PLUS, |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
68 N_MEASUREMENT_FREP_PLUS, |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
69 N_MEASUREMENT_ADJUST_FREQ_MINUS, |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
70 N_MEASUREMENT_FREP_MINUS, |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
71 }; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
72 |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
73 int settling = 0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
74 |
32
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
75 int Measuring_1 = FALSE; |
37 | 76 int Measuring_2 = FALSE, Step1_2 = FALSE, Step2_2 = FALSE, Step3_2 = FALSE; |
32
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
77 int Measuring_3 = FALSE; |
0 | 78 |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
79 double FrequDDS1=110000000.0, FrequDDS2=15300000.0, FrequDDS3=150400000.0, FrequDDS4=110000000.0; |
0 | 80 double Slope_1=0.0,Slope_2=0.0,Slope_3=0.0,Beatslope_2=0.0; |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
81 double SlopeTime1=40.0, SlopeTime2=40.0; SlopeTime3=40.0; |
0 | 82 |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
83 double N_1=0.0, N_2=0.0, N_3=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
84 double DeltaT_1=20.0, DeltakHz_1=500.0, t1_1=0.0, t2_1=0.0, t3_1=0.0, Frepplus_1=0.0, Frepminus_1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
85 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; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
86 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; |
0 | 87 |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
88 int n_1=0, n_2=0, n_3=0; |
0 | 89 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; |
90 int N_slope_1=0,N_slope_2=0,N_slope_3=0; | |
91 double Beat_slope_2=0.0 ,Moy_Beatslope_2=0.0,Slope_Beatslope_2=0.0; | |
92 double Ch4_slope=0.0,Moy_Ch4slope_1=0.0,Slope_Ch4slope_1=0.0,Ch4Slope=0.0; | |
93 | |
94 double FrequencyDDSBes=0.0,FrequencyDDSBesInit=0.0; | |
95 double FrequencyDDS3=0.0,FrequencyDDS3Init=0.0; | |
96 double DDSBesChanged1=FALSE,DDSBesChanged2=FALSE; | |
97 | |
98 double DeltaDDS3=0.0,Delta10K_Plus=0.0,Delta10K_Minus=0.0; | |
99 double Nu1=0.0, Nu2= 200000-147000+282143746.557455e6; | |
100 | |
101 double Step1=800000.0,Step2=800000.0; | |
102 | |
103 double Ch4Plus=0.0,Ch4Minus=0.0; | |
104 | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
105 int nDDSChange=0, nstabilization=0; |
0 | 106 |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
107 double Frequencystep1=10000.0, tbegin1=0.0, Frepbefore1=0.0, Frequency1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
108 double Frequencystep2=10.0, tbegin2=0.0, Frepbefore2=0.0, Ch2before=0.0, Frequency2=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
109 double Frequencystep3=100000.0, tbegin3=0.0, Frepbefore3=0.0, Frequency3=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
110 |
0 | 111 volatile bool Getsign1=FALSE,Getsign2=FALSE,Getsign3=FALSE; |
112 double Signe1=1.0,Signe2=1.0,Signe3=0.0; | |
113 | |
37 | 114 // slope cancelling |
0 | 115 |
37 | 116 int SlopeMeasuring = FALSE; |
117 int AutoStopSlopeCancellingIfDelock = TRUE; | |
118 int OnSlopeCancelling = FALSE; | |
119 double SlopeMath2 = 0.0; // currently applied frequency dedrifiting slope | |
120 double TimetoSlope = 60.0; | |
121 double SlopeMeasuringTimeBegin = 0.0; | |
0 | 122 |
123 double Slope_Math2slope=0.0,Math2_slope=0.0,Moy_Math2slope=0.0; | |
124 int N_Math2slope=0.0,nstabilisationSlopeMeasuring=0; | |
125 | |
126 double LimitToDelock=5.0; | |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
127 double SlopeCorrection=0.0; |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
128 double limitotakoff=70.0; |
0 | 129 |
130 int ratio=10; //Recentre la frequence tous les ratios | |
131 | |
37 | 132 int FrequCorrec = FALSE, KeepFrequ = TRUE, KeepSlope = TRUE; |
133 int Nratio = -1; | |
1 | 134 double MoyMath2 = 0.0, CenterFrequencyCh2 = 0.0; |
37 | 135 int CenterFrequencyCh2ToDetermine = FALSE; |
0 | 136 |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
137 enum { |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
138 SLOPE_REFERENCE_MICROWAVE = 0, |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
139 SLOPE_REFERENCE_HG_CAVITY = 1, |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
140 }; |
0 | 141 |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
142 int slopeReference = SLOPE_REFERENCE_MICROWAVE; |
0 | 143 |
144 volatile bool KeepCentering=FALSE; | |
145 double Timetorecenter275K=3600.0*10; | |
146 double Timetorecenter10K=3600.0*3; | |
147 double CenteringTimeBegin275K=0.0; | |
148 double CenteringTimeBegin10K=0.0; | |
149 | |
150 | |
29
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
151 int DDSFox_Set(DDSParameter *DDS, double Frequency, double Sweeprate) |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
152 { |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
153 DDS->Frequency = Frequency; |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
154 DDS->SweepRate = Sweeprate; |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
155 |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
156 DDSFox_SetFreq(DDS); |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
157 DDSFox_SetDf(DDS); |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
158 |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
159 return 0; |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
160 } |
0 | 161 |
162 | |
163 void initMathParser(muParserHandle_t * pMathParser) | |
164 { | |
165 (* pMathParser) = mupCreate() ; // Math parser number 1, normally used for frep | |
166 mupDefineOprtChars( * pMathParser, "abcdefghijklmnopqrstuvwxyzµ" | |
167 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
168 "+-*^/?<>=#!$%&|~'_"); | |
169 mupDefineVar( * pMathParser, "UTC", &utc); | |
170 mupDefineVar( * pMathParser, "MJD", &mjd); | |
171 mupDefineVar( * pMathParser, "Ch1", &Ch1); | |
172 mupDefineVar( * pMathParser, "Ch2", &Ch2); | |
173 mupDefineVar( * pMathParser, "Ch3", &Ch3); | |
174 mupDefineVar( * pMathParser, "Ch4", &Ch4); | |
175 mupDefineVar( * pMathParser, "DDS1", &(DDS4xAD9912.Frequency1)); | |
176 mupDefineVar( * pMathParser, "DDS2", &(DDS4xAD9912.Frequency2)); | |
177 mupDefineVar( * pMathParser, "DDS3", &(DDS4xAD9912.Frequency3)); | |
178 mupDefineVar( * pMathParser, "DDS4", &(DDS4xAD9912.Frequency4)); | |
179 mupDefineVar( * pMathParser, "N1", &N1); | |
180 mupDefineVar( * pMathParser, "N2", &N2); | |
181 mupDefineVar( * pMathParser, "N3", &N3); | |
182 mupDefineVar( * pMathParser, "Nu1", &Nu1); | |
183 mupDefineVar( * pMathParser, "Nu2", &Nu2); | |
184 mupDefineVar( * pMathParser, "DeltaDDS3", &DeltaDDS3); | |
185 mupDefineVar( * pMathParser, "Signe1", &Signe1); | |
186 mupDefineVar( * pMathParser, "Signe2", &Signe2); | |
187 mupDefineVar( * pMathParser, "Ndiv", &Ndiv); | |
188 mupDefinePostfixOprt( * pMathParser, "P", &Peta , 1); | |
189 mupDefinePostfixOprt( * pMathParser, "T", &Tera , 1); | |
190 mupDefinePostfixOprt( * pMathParser, "G", &Giga , 1); | |
191 mupDefinePostfixOprt( * pMathParser, "M", &Mega , 1); | |
192 mupDefinePostfixOprt( * pMathParser, "k", &kilo , 1); | |
193 mupDefinePostfixOprt( * pMathParser, "m", &milli, 1); | |
194 mupDefinePostfixOprt( * pMathParser, "u", µ, 1); | |
195 mupDefinePostfixOprt( * pMathParser, "µ", µ, 1); | |
196 mupDefinePostfixOprt( * pMathParser, "n_1", &nano, 1); | |
197 mupDefinePostfixOprt( * pMathParser, "p", &pico, 1); | |
198 mupDefinePostfixOprt( * pMathParser, "f", &femto, 1); | |
199 } | |
200 | |
201 int main (int argc, char *argv[]) | |
202 { | |
203 //int ThreadId ; // to be used when I will replace timer by thread for counder readout | |
204 | |
205 double initfreqDDS ; | |
206 char * MathString1 = " " ; | |
207 char * MathString2 = " " ; | |
208 char * MathString3 = " " ; | |
209 char * MathString4 = " " ; | |
210 char * MathString5 = " " ; | |
211 | |
212 if (InitCVIRTE (0, argv, 0) == 0) | |
213 return -1; /* out of memory */ | |
214 if ((MainPanel = LoadPanel (0, "FXAnalyse.uir", PANEL)) < 0) | |
215 return -1; | |
216 if ((CalcN1Panel = LoadPanel (0, "FXAnalyse.uir", CALCN1)) < 0) | |
217 return -1; | |
218 if ((CalcN2Panel = LoadPanel (0, "FXAnalyse.uir", CALCN2)) < 0) | |
219 return -1; | |
220 if ((CalcN3Panel = LoadPanel (0, "FXAnalyse.uir", CALCN3)) < 0) | |
221 return -1; | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
222 if ((EstimateN3Panel = LoadPanel (MainPanel, "FXAnalyse.uir", ESTIMATEN3)) < 0) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
223 return -1; |
0 | 224 |
225 DisplayPanel (MainPanel); | |
226 | |
29
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
227 // initialize 4x AD9959 DDS box |
0 | 228 DDS4xAD9912_Reset(&DDS4xAD9912) ; |
229 GetCtrlVal(MainPanel, PANEL_DDS1, &initfreqDDS) ; | |
230 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, initfreqDDS) ; | |
231 GetCtrlVal(MainPanel, PANEL_DDS2, &initfreqDDS) ; | |
232 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, initfreqDDS) ; | |
233 GetCtrlVal(MainPanel, PANEL_DDS3, &initfreqDDS) ; | |
234 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, initfreqDDS) ; | |
235 GetCtrlVal(MainPanel, PANEL_DDS4, &initfreqDDS) ; | |
236 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, initfreqDDS) ; | |
237 | |
29
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
238 // initialyze 1x AD9956 DDS box |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
239 strcpy(DDS1xAD9956.ip, "145.238.205.58"); |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
240 DDS1xAD9956.Port = 6665; |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
241 DDS1xAD9956.Profil = 7; // configuration profile: single freq=0, sweep=7 |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
242 DDS1xAD9956.Clock = 200000000; |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
243 DDS1xAD9956.Frequency = DEDRIFT_DDS_FREQUENCY; |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
244 DDS1xAD9956.Delta_T = 0.01; |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
245 DDS1xAD9956.SweepRate = 0.0; |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
246 DDS_Initialize(&DDS1xAD9956); |
0 | 247 |
248 // Initialize the 5 (separate) math parsers for frep, Nu_Hg, Nu_Sr, N3 and ExtraMath | |
249 | |
250 Ch1=0.0 ; Ch2=0.0 ; Ch3=0.0 ; Ch4=0.0 ; | |
251 GetCtrlVal(MainPanel, PANEL_N1CHOICE, &N1) ; | |
252 GetCtrlVal(MainPanel, PANEL_N2CHOICE, &N2) ; | |
253 | |
254 GetCtrlVal(MainPanel, PANEL_N3CHOICE, &N3) ; | |
255 | |
28
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
256 initMathParser(&MathParser1); |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
257 GetCtrlVal(MainPanel, PANEL_MATHSTRING1, MathString1); |
0 | 258 mupSetExpr(MathParser1, MathString1); |
259 | |
260 initMathParser(&MathParser2) ; | |
261 mupDefineVar( MathParser2, "Math1", &Math1); | |
262 mupDefineVar( MathParser2, "DDS", &(DDS4xAD9912.Frequency1)); | |
263 GetCtrlVal(MainPanel, PANEL_MATHSTRING2, MathString2) ; | |
264 mupSetExpr(MathParser2, MathString2); | |
265 | |
266 initMathParser(&MathParser3) ; | |
267 mupDefineVar( MathParser3, "Math1", &Math1); | |
268 mupDefineVar( MathParser3, "Math2", &Math2); | |
269 mupDefineVar( MathParser3, "DDS", &(DDS4xAD9912.Frequency2)); | |
270 GetCtrlVal(MainPanel, PANEL_MATHSTRING3, MathString3) ; | |
271 mupSetExpr(MathParser3, MathString3); | |
272 | |
273 initMathParser(&MathParser4) ; | |
274 mupDefineVar( MathParser4, "Math1", &Math1); | |
275 mupDefineVar( MathParser4, "Math2", &Math2); | |
276 mupDefineVar( MathParser4, "Math3", &Math3); | |
277 GetCtrlVal(MainPanel, PANEL_MATHSTRING4, MathString4) ; | |
278 mupSetExpr(MathParser4, MathString4); | |
279 | |
280 initMathParser(&MathParser5) ; | |
281 mupDefineVar( MathParser5, "Math1", &Math1); | |
282 mupDefineVar( MathParser5, "Math2", &Math2); | |
283 mupDefineVar( MathParser5, "Math3", &Math3); | |
284 mupDefineVar( MathParser5, "Math4", &Math4); | |
285 GetCtrlVal(MainPanel, PANEL_MATHSTRING5, MathString5) ; | |
286 mupSetExpr(MathParser5, MathString5); | |
287 | |
288 | |
289 RunUserInterface (); | |
290 | |
291 // Stops everything at the end | |
292 | |
293 DiscardPanel (MainPanel); | |
294 return 0; | |
295 } | |
296 | |
297 | |
298 void OnCloseViewPanel(int panel){ | |
299 | |
300 if (panel==PlotCh1.PlotPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_FREQ1PLOT, FALSE) ; } ; | |
301 if (panel==PlotCh2.PlotPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_FREQ2PLOT, FALSE) ; } ; | |
302 if (panel==PlotCh3.PlotPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_FREQ3PLOT, FALSE) ; } ; | |
303 if (panel==PlotCh4.PlotPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_FREQ4PLOT, FALSE) ; } ; | |
304 if (panel==PlotMath1.PlotPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_MATH1PLOT, FALSE) ; } ; | |
305 if (panel==PlotMath2.PlotPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_MATH2PLOT, FALSE) ; } ; | |
306 if (panel==PlotMath3.PlotPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_MATH3PLOT, FALSE) ; } ; | |
307 if (panel==PlotMath4.PlotPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_MATH4PLOT, FALSE) ; } ; | |
308 if (panel==PlotMath5.PlotPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_MATH5PLOT, FALSE) ; } ; | |
309 | |
310 if (panel==AllanCh1.AllanPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_FREQ1ALLAN, FALSE) ; } ; | |
311 if (panel==AllanCh2.AllanPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_FREQ2ALLAN, FALSE) ; } ; | |
312 if (panel==AllanCh3.AllanPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_FREQ3ALLAN, FALSE) ; } ; | |
313 if (panel==AllanCh4.AllanPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_FREQ4ALLAN, FALSE) ; } ; | |
314 if (panel==AllanMath1.AllanPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_MATH1ALLAN, FALSE) ; } ; | |
315 if (panel==AllanMath2.AllanPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_MATH2ALLAN, FALSE) ; } ; | |
316 if (panel==AllanMath3.AllanPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_MATH3ALLAN, FALSE) ; } ; | |
317 if (panel==AllanMath4.AllanPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_MATH4ALLAN, FALSE) ; } ; | |
318 if (panel==AllanMath5.AllanPanel) { SetCtrlVal(MainPanel,PANEL_CHECKBOX_MATH5ALLAN, FALSE) ; } ; | |
319 | |
320 return ; | |
321 } | |
322 | |
323 | |
324 | |
325 | |
326 | |
327 int CVICALLBACK QuitCallback (int panel, int control, int event, | |
328 void *callbackData, int eventData1, int eventData2) | |
329 { | |
330 switch (event) | |
331 { | |
332 case EVENT_COMMIT: | |
333 QuitUserInterface (0); | |
334 mupRelease(MathParser1); | |
335 mupRelease(MathParser2); | |
336 mupRelease(MathParser3); | |
337 mupRelease(MathParser4); | |
338 mupRelease(MathParser5); | |
339 break; | |
340 case EVENT_RIGHT_CLICK: | |
341 | |
342 break; | |
343 } | |
344 return 0; | |
345 } | |
346 | |
347 int CVICALLBACK CB_OnEventMain(int panel, int event, void *callbackData, int eventData1, int eventData2) | |
348 { | |
349 int ActiveControl ; | |
350 int StepIndex ; | |
351 double Step ; | |
352 | |
353 switch (event) { | |
354 case EVENT_CLOSE: | |
355 QuitUserInterface (0); | |
356 mupRelease(MathParser1); | |
357 mupRelease(MathParser2); | |
358 mupRelease(MathParser3); | |
359 break; | |
360 case EVENT_KEYPRESS: | |
361 switch (eventData1) // ie the code of the key which has been stroke | |
362 { | |
363 case VAL_RIGHT_ARROW_VKEY : | |
364 ActiveControl = GetActiveCtrl(panel); | |
365 if (ActiveControl==PANEL_DDS1 || ActiveControl==PANEL_DDS1STEP) { | |
366 GetCtrlIndex(MainPanel, PANEL_DDS1STEP, &StepIndex); | |
367 if (StepIndex<14){ | |
368 SetCtrlIndex(MainPanel, PANEL_DDS1STEP, ++StepIndex) ; | |
369 GetCtrlVal(MainPanel, PANEL_DDS1STEP, &Step); | |
370 SetCtrlAttribute(MainPanel, PANEL_DDS1, ATTR_INCR_VALUE, Step) ; | |
371 }; | |
372 }; | |
373 if (ActiveControl==PANEL_DDS2 || ActiveControl==PANEL_DDS2STEP) { | |
374 GetCtrlIndex(MainPanel, PANEL_DDS2STEP, &StepIndex); | |
375 if (StepIndex<14){ | |
376 SetCtrlIndex(MainPanel, PANEL_DDS2STEP, ++StepIndex) ; | |
377 GetCtrlVal(MainPanel, PANEL_DDS2STEP, &Step); | |
378 SetCtrlAttribute(MainPanel, PANEL_DDS2, ATTR_INCR_VALUE, Step) ; | |
379 }; | |
380 }; | |
381 if (ActiveControl==PANEL_DDS3|| ActiveControl==PANEL_DDS3STEP) { | |
382 GetCtrlIndex(MainPanel, PANEL_DDS3STEP, &StepIndex); | |
383 if (StepIndex<14){ | |
384 SetCtrlIndex(MainPanel, PANEL_DDS3STEP, ++StepIndex) ; | |
385 GetCtrlVal(MainPanel, PANEL_DDS3STEP, &Step); | |
386 SetCtrlAttribute(MainPanel, PANEL_DDS3, ATTR_INCR_VALUE, Step) ; | |
387 }; | |
388 }; | |
389 if (ActiveControl==PANEL_DDS4|| ActiveControl==PANEL_DDS4STEP) { | |
390 GetCtrlIndex(MainPanel, PANEL_DDS4STEP, &StepIndex); | |
391 if (StepIndex<14){ | |
392 SetCtrlIndex(MainPanel, PANEL_DDS4STEP, ++StepIndex) ; | |
393 GetCtrlVal(MainPanel, PANEL_DDS4STEP, &Step); | |
394 SetCtrlAttribute(MainPanel, PANEL_DDS4, ATTR_INCR_VALUE, Step) ; | |
395 }; | |
396 }; | |
397 break; | |
398 case VAL_LEFT_ARROW_VKEY : | |
399 ActiveControl = GetActiveCtrl(panel); | |
400 if (ActiveControl==PANEL_DDS1 || ActiveControl==PANEL_DDS1STEP) { | |
401 GetCtrlIndex(MainPanel, PANEL_DDS1STEP, &StepIndex); | |
402 if (StepIndex>0){ | |
403 SetCtrlIndex(MainPanel, PANEL_DDS1STEP, --StepIndex) ; | |
404 GetCtrlVal(MainPanel, PANEL_DDS1STEP, &Step); | |
405 SetCtrlAttribute(MainPanel, PANEL_DDS1, ATTR_INCR_VALUE, Step) ; | |
406 }; | |
407 }; | |
408 if (ActiveControl==PANEL_DDS2 || ActiveControl==PANEL_DDS2STEP) { | |
409 GetCtrlIndex(MainPanel, PANEL_DDS2STEP, &StepIndex); | |
410 if (StepIndex>0){ | |
411 SetCtrlIndex(MainPanel, PANEL_DDS2STEP, --StepIndex) ; | |
412 GetCtrlVal(MainPanel, PANEL_DDS2STEP, &Step); | |
413 SetCtrlAttribute(MainPanel, PANEL_DDS2, ATTR_INCR_VALUE, Step) ; | |
414 }; | |
415 }; | |
416 if (ActiveControl==PANEL_DDS3 || ActiveControl==PANEL_DDS3STEP) { | |
417 GetCtrlIndex(MainPanel, PANEL_DDS3STEP, &StepIndex); | |
418 if (StepIndex>0){ | |
419 SetCtrlIndex(MainPanel, PANEL_DDS3STEP, --StepIndex) ; | |
420 GetCtrlVal(MainPanel, PANEL_DDS3STEP, &Step); | |
421 SetCtrlAttribute(MainPanel, PANEL_DDS3, ATTR_INCR_VALUE, Step) ; | |
422 }; | |
423 }; | |
424 if (ActiveControl==PANEL_DDS4 || ActiveControl==PANEL_DDS4STEP) { | |
425 GetCtrlIndex(MainPanel, PANEL_DDS4STEP, &StepIndex); | |
426 if (StepIndex>0){ | |
427 SetCtrlIndex(MainPanel, PANEL_DDS4STEP, --StepIndex) ; | |
428 GetCtrlVal(MainPanel, PANEL_DDS4STEP, &Step); | |
429 SetCtrlAttribute(MainPanel, PANEL_DDS4, ATTR_INCR_VALUE, Step) ; | |
430 }; | |
431 }; | |
432 break; | |
433 case VAL_F2_VKEY : | |
434 SetActiveCtrl(MainPanel, PANEL_DDS1); | |
435 break; | |
436 case VAL_F3_VKEY : | |
437 SetActiveCtrl(MainPanel, PANEL_DDS2); | |
438 break; | |
439 case VAL_F4_VKEY : | |
440 SetActiveCtrl(MainPanel, PANEL_DDS3); | |
441 break; | |
442 case VAL_F5_VKEY : | |
443 SetActiveCtrl(MainPanel, PANEL_DDS4); | |
444 break; | |
445 }; | |
446 break; | |
447 | |
448 } | |
449 return 0; | |
450 } | |
451 | |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
452 |
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
453 void CurrentFileName(char *fname) |
0 | 454 { |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
455 char day[3], month[3], year[3]; |
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
456 char *date = DateStr(); |
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
457 Scan(date, "%s>%s[w2]-%s[w2]-20%s[w2]", month, day, year); |
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
458 Fmt(fname, "%s<%s\\%s%s%s_Frequ.txt", LOGFILEPATH, year, month, day); |
0 | 459 } |
460 | |
461 | |
462 int CVICALLBACK CB_OnStart (int panel, int control, int event, | |
463 void *callbackData, int eventData1, int eventData2) | |
464 { | |
465 switch (event) | |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
466 { |
0 | 467 case EVENT_COMMIT: |
468 if (Acquiring) { | |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
469 PlotCh1.IndexPoint = 0; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
470 PlotCh2.IndexPoint = 0; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
471 PlotCh3.IndexPoint = 0; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
472 PlotCh4.IndexPoint = 0; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
473 PlotMath1.IndexPoint = 0; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
474 PlotMath2.IndexPoint = 0; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
475 PlotMath3.IndexPoint = 0; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
476 PlotMath4.IndexPoint = 0; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
477 PlotMath5.IndexPoint = 0; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
478 Allan_Reset(&AllanCh1); |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
479 Allan_Reset(&AllanCh2); |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
480 Allan_Reset(&AllanCh3); |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
481 Allan_Reset(&AllanCh4); |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
482 Allan_Reset(&AllanMath1); |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
483 Allan_Reset(&AllanMath2); |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
484 Allan_Reset(&AllanMath3); |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
485 Allan_Reset(&AllanMath4); |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
486 Allan_Reset(&AllanMath5); |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
487 } |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
488 Acquiring = TRUE; |
0 | 489 SetCtrlAttribute(MainPanel, PANEL_STARTBUTTON, ATTR_LABEL_TEXT, "__RESET"); |
490 | |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
491 CurrentFileName(LogFileName); |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
492 GetFileInfo(LogFileName, &OldLogFilePtr); |
0 | 493 OldLogFilePtr -= OldLogFilePtr%FXLINELENGTH + FXLINELENGTH - 2; |
494 break; | |
495 } | |
496 return 0; | |
497 } | |
498 | |
499 int CVICALLBACK CB_OnStop (int panel, int control, int event, | |
500 void *callbackData, int eventData1, int eventData2) | |
501 { | |
502 switch (event) | |
503 { | |
504 case EVENT_COMMIT: | |
505 Acquiring = FALSE ; | |
506 SetCtrlAttribute(MainPanel, PANEL_STARTBUTTON, ATTR_LABEL_TEXT, "__START"); | |
507 break; | |
508 case EVENT_RIGHT_CLICK: | |
509 | |
510 break; | |
511 } | |
512 return 0; | |
513 } | |
514 | |
515 int CVICALLBACK CB_OnTimer (int panel, int control, int event, | |
516 void *callbackData, int eventData1, int eventData2) | |
517 { | |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
518 int LogFile, FileOpt, FileHg, FileExtraMath; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
519 long LogFileSize; |
0 | 520 char LineBuffer[FXLINELENGTH+10] = "\r\n_1 "; |
521 | |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
522 char TimeTag[] = "100103 000000.000"; // K+K time tag meaning here 2010 january the 3rd at 00:00:00.000 |
0 | 523 char Date[] = "03/01/2010" ; |
524 char Time[] = "00:00:00.000" ; | |
525 char Year[] = "2010"; | |
526 char ShortYear[] = "10"; // the last 2 digits of calendar year only | |
527 char Month[] = "01"; | |
528 char Day[] = "03"; | |
529 char Hour[] = "00"; | |
530 char Min[] = "00" ; | |
531 char Sec[] = "00.000"; | |
532 struct tm LocalTime ; | |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
533 time_t utcTime; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
534 char * ReportString = "dd.mm.yy\t00:00:00\t3481610838.000\t0000000000000.00000000"; |
0 | 535 |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
536 int BoxChecked = FALSE; |
0 | 537 |
538 double FoxFrequ=0.0; | |
539 | |
540 double FrequencyToChange=0.0; | |
541 double DeltaCh2=0.0; | |
542 double DeltaCh4=0.0; | |
543 | |
544 switch (event) | |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
545 { |
0 | 546 case EVENT_TIMER_TICK: |
547 switch(Acquiring) | |
548 { | |
549 case TRUE: | |
550 | |
551 GetFileInfo(LogFileName, &LogFileSize) ; | |
552 | |
553 if (LogFileSize > OldLogFilePtr+2*FXLINELENGTH-2) { // if a complete newline has been written | |
554 | |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
555 SuspendTimerCallbacks() ; |
0 | 556 |
557 // Open Log file and get to the beginning of newly completed line | |
558 LogFile = OpenFile(LogFileName, VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_ASCII) ; | |
559 OldLogFilePtr += FXLINELENGTH; | |
560 SetFilePtr(LogFile, OldLogFilePtr, 0) ; | |
561 | |
562 // return the last complete string from the log file and scan it for date and time information | |
563 | |
564 // first, the time tag, and store it in various formats | |
565 ReadFile(LogFile, TimeTag, 17); | |
566 | |
567 CopyBytes(Date,0,TimeTag,4,2); | |
568 CopyBytes(Date,3,TimeTag,2,2); | |
569 CopyBytes(Date,8,TimeTag,0,2); | |
570 CopyBytes(Time,0,TimeTag,7,2); | |
571 CopyBytes(Time,3,TimeTag,9,2); | |
572 CopyBytes(Time,6,TimeTag,11,6); | |
573 SetCtrlVal(MainPanel, PANEL_DATE, Date) ; | |
574 SetCtrlVal(MainPanel, PANEL_TIME, Time) ; | |
575 | |
576 CopyBytes(Year,2,TimeTag,0,2); // first 2 bytes of year string remains "20" | |
577 CopyBytes(ShortYear,0,TimeTag,0,2); | |
578 CopyBytes(Month,0,TimeTag,2,2); | |
579 CopyBytes(Day,0,TimeTag,4,2); | |
580 CopyBytes(Hour,0,TimeTag,7,2); | |
581 CopyBytes(Min,0,TimeTag,9,2); | |
582 CopyBytes(Sec,0,TimeTag,11,6); | |
583 Fmt(&LocalTime.tm_year, "%d<%s", Year); | |
584 Fmt(&LocalTime.tm_mon, "%d<%s", Month); | |
585 Fmt(&LocalTime.tm_mday, "%d<%s", Day); | |
586 Fmt(&LocalTime.tm_hour, "%d<%s", Hour); | |
587 Fmt(&LocalTime.tm_min, "%d<%s", Min); | |
588 Fmt(&LocalTime.tm_sec, "%d<%s", "00"); // special case to handle non integer number of UTC seconds | |
589 LocalTime.tm_hour += 0; | |
590 LocalTime.tm_min -= 0; | |
591 LocalTime.tm_sec -= 0; | |
592 LocalTime.tm_mon -= 1 ; // january is month 0 for tm struct | |
593 LocalTime.tm_year -= 1900 ; // year is number of years since 1900 for tm struct | |
594 LocalTime.tm_isdst = -1; // daylight saving flag MUST be set to -1 (unallocated is bugging and +1 is making 1 hour error in summer) | |
595 utcTime = mktime (&LocalTime); | |
596 utc = (double) utcTime + strtod(Sec,NULL) ; | |
597 mjd=utc/86400.; //nb de jours depuis l'origine d'UTC (01/01/1900 à 00h00 GMT) | |
598 mjd+=15020; //date MJD de la date origine d'UTC | |
599 SetCtrlVal(MainPanel, PANEL_UTC, utc); | |
600 SetCtrlVal(MainPanel, PANEL_MJD, mjd); | |
601 | |
602 // scan the line for counters's channels information | |
603 | |
604 ReadLine(LogFile, LineBuffer, FXLINELENGTH+9) ; | |
605 CloseFile(LogFile); | |
606 | |
607 Scan(LineBuffer, "%f%f%f%f", &Ch1, &Ch2, &Ch3, &Ch4) ; | |
608 Ch1 = 1000*Ch1; | |
609 Ch2 = 1000*Ch2; | |
610 Ch3 = 1000*Ch3; | |
611 Ch4 = 1000*Ch4; | |
612 | |
613 SetCtrlVal(MainPanel, PANEL_FREQ1, Ch1) ; | |
614 SetCtrlVal(MainPanel, PANEL_FREQ2, Ch2) ; | |
615 SetCtrlVal(MainPanel, PANEL_FREQ3, Ch3) ; | |
616 SetCtrlVal(MainPanel, PANEL_FREQ4, Ch4) ; | |
617 SetCtrlVal(MainPanel, PANEL_SIGN1, Signe1); | |
618 SetCtrlVal(MainPanel, PANEL_SIGN2, Signe2); | |
619 SetCtrlVal(MainPanel, PANEL_SIGN3, Signe3); | |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
620 SetCtrlVal(CalcN2Panel, CALCN2_N, N_2); |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
621 SetCtrlVal(CalcN2Panel, CALCN2_SLOPE, Beatslope_2); |
0 | 622 SetCtrlVal(MainPanel, PANEL_CENTERFREQUENCY, CenterFrequencyCh2); |
623 SetCtrlVal(MainPanel, PANEL_LED1, SlopeMeasuring); | |
624 SetCtrlVal(MainPanel, PANEL_LED2, OnSlopeCancelling); | |
625 // Treat data | |
626 | |
627 Math1 = mupEval(MathParser1) ; | |
628 SetCtrlVal(MainPanel,PANEL_MATH1, Math1) ; | |
629 | |
630 Math2 = mupEval(MathParser2) ; | |
631 SetCtrlVal(MainPanel,PANEL_MATH2, Math2) ; | |
632 | |
633 Math3 = mupEval(MathParser3) ; | |
634 SetCtrlVal(MainPanel,PANEL_MATH3, Math3) ; | |
635 | |
636 Math4 = mupEval(MathParser4) ; | |
637 SetCtrlVal(MainPanel,PANEL_MATH4, Math4) ; | |
638 | |
639 Math5 = mupEval(MathParser5) ; | |
640 SetCtrlVal(MainPanel,PANEL_MATH5, Math5) ; | |
641 | |
642 // Plot Data and calculus if required | |
643 | |
644 GetCtrlVal(MainPanel, PANEL_CHECKBOX_FREQ1PLOT, &BoxChecked) ; | |
645 if (BoxChecked) { | |
646 Plot_AddFrequency(&PlotCh1, Ch1) ; | |
647 } | |
648 GetCtrlVal(MainPanel, PANEL_CHECKBOX_FREQ1ALLAN, &BoxChecked) ; | |
649 if (BoxChecked) { | |
650 Allan_AddFrequency(&AllanCh1, Ch1) ; | |
651 } | |
652 | |
653 GetCtrlVal(MainPanel, PANEL_CHECKBOX_FREQ2PLOT, &BoxChecked) ; | |
654 if (BoxChecked) { | |
655 Plot_AddFrequency(&PlotCh2, Ch2) ; | |
656 } | |
657 GetCtrlVal(MainPanel, PANEL_CHECKBOX_FREQ2ALLAN, &BoxChecked) ; | |
658 if (BoxChecked) { | |
659 Allan_AddFrequency(&AllanCh2, Ch2) ; | |
660 } | |
661 | |
662 GetCtrlVal(MainPanel, PANEL_CHECKBOX_FREQ3PLOT, &BoxChecked) ; | |
663 if (BoxChecked) { | |
664 Plot_AddFrequency(&PlotCh3, Ch3) ; | |
665 } | |
666 GetCtrlVal(MainPanel, PANEL_CHECKBOX_FREQ3ALLAN, &BoxChecked) ; | |
667 if (BoxChecked) { | |
668 Allan_AddFrequency(&AllanCh3, Ch3) ; | |
669 } | |
670 | |
671 GetCtrlVal(MainPanel, PANEL_CHECKBOX_FREQ4PLOT, &BoxChecked) ; | |
672 if (BoxChecked) { | |
673 Plot_AddFrequency(&PlotCh4, Ch4) ; | |
674 } | |
675 GetCtrlVal(MainPanel, PANEL_CHECKBOX_FREQ4ALLAN, &BoxChecked) ; | |
676 if (BoxChecked) { | |
677 Allan_AddFrequency(&AllanCh4, Ch4) ; | |
678 } | |
679 | |
680 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH1PLOT, &BoxChecked) ; | |
681 if (BoxChecked) { | |
682 Plot_AddFrequency(&PlotMath1, Math1) ; | |
683 } | |
684 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH1ALLAN, &BoxChecked) ; | |
685 if (BoxChecked) { | |
686 Allan_AddFrequency(&AllanMath1, Math1) ; | |
687 } | |
688 | |
689 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2PLOT, &BoxChecked) ; | |
690 if (BoxChecked) { | |
691 Plot_AddFrequency(&PlotMath2, Math2) ; | |
692 } | |
693 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2ALLAN, &BoxChecked) ; | |
694 if (BoxChecked) { | |
695 Allan_AddFrequency(&AllanMath2, Math2) ; | |
696 } | |
697 | |
698 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH3PLOT, &BoxChecked) ; | |
699 if (BoxChecked) { | |
700 Plot_AddFrequency(&PlotMath3, Math3) ; | |
701 } | |
702 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH3ALLAN, &BoxChecked) ; | |
703 if (BoxChecked) { | |
704 Allan_AddFrequency(&AllanMath3, Math3) ; | |
705 } | |
706 | |
707 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH4PLOT, &BoxChecked) ; | |
708 if (BoxChecked) { | |
709 Plot_AddFrequency(&PlotMath4, Math4) ; | |
710 } | |
711 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH4ALLAN, &BoxChecked) ; | |
712 if (BoxChecked) { | |
713 Allan_AddFrequency(&AllanMath4, Math4) ; | |
714 } | |
715 | |
716 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH5PLOT, &BoxChecked) ; | |
717 if (BoxChecked) { | |
718 Plot_AddFrequency(&PlotMath5, Math5) ; | |
719 } | |
720 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH5ALLAN, &BoxChecked) ; | |
721 if (BoxChecked) { | |
722 Allan_AddFrequency(&AllanMath5, Math5) ; | |
723 } | |
26
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
724 |
0 | 725 // Calcul de N |
726 | |
26
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
727 switch (Measuring_1) { |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
728 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
729 case N_MEASUREMENT_NONE: |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
730 // not measuring |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
731 break; |
0 | 732 |
26
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
733 case N_MEASUREMENT_INIT: |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
734 // initialization step |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
735 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
736 // set DDS1 to nominal frequency |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
737 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
738 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
739 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
740 GetCtrlVal(MainPanel, PANEL_DDS2, &FrequencyDDSBesInit); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
741 t2_1 = t3_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
742 t1_1 = utc; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
743 Frequ_slope_1 = Math1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
744 Moy_slope_1 = Frequ_slope_1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
745 Ch4_slope = Ch4; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
746 Moy_Ch4slope_1 = Ch4_slope; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
747 N_slope_1 = 1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
748 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
749 // next step |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
750 Measuring_1 += 1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
751 break; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
752 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
753 case N_MEASUREMENT_SLOPE: |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
754 // slope measurement |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
755 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
756 N_slope_1 = N_slope_1 + 1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
757 Frequ_slope_1 = Math1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
758 Ch4_slope = Ch4; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
759 Moy_slope_1 = ((N_slope_1-1)*Moy_slope_1 + Frequ_slope_1)/N_slope_1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
760 Moy_Ch4slope_1 = ((N_slope_1-1)*Moy_Ch4slope_1 + Ch4_slope)/N_slope_1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
761 Slope_slope_1 = (Slope_slope_1*(N_slope_1-2) + 6*(Frequ_slope_1-Moy_slope_1)/N_slope_1)/(N_slope_1+1); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
762 Slope_Ch4slope_1 = (Slope_Ch4slope_1*(N_slope_1-2) + 6*(Ch4_slope-Moy_Ch4slope_1)/N_slope_1)/(N_slope_1+1); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
763 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
764 if ((utc - t1_1) > SlopeTime1) { |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
765 Slope_1 = Slope_slope_1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
766 Ch4Slope = Slope_Ch4slope_1; |
32
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
767 SetCtrlVal(CalcN1Panel, CALCN1_SLOPE, Slope_1); |
26
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
768 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
769 N_slope_1 = 0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
770 Frequ_slope_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
771 Moy_slope_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
772 Slope_slope_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
773 Ch4_slope = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
774 Moy_Ch4slope_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
775 Slope_Ch4slope_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
776 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
777 // frep positive step |
27
419db63a9949
Remove two global variables
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
26
diff
changeset
|
778 DDS4xAD9912_FrequencyRampe(&DDS4xAD9912,1, FrequDDS1,(FrequDDS1+DeltakHz_1*1000), Step1/Ndiv); |
26
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
779 SetCtrlVal(MainPanel, PANEL_DDS1, (FrequDDS1+DeltakHz_1*1000)); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
780 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, (FrequDDS1+DeltakHz_1*1000)); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
781 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
782 // allow counter to settle |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
783 settling = 3; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
784 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
785 // next step |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
786 Measuring_1 += 1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
787 } |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
788 break; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
789 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
790 case N_MEASUREMENT_ADJUST_FREQ_PLUS: |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
791 case N_MEASUREMENT_ADJUST_FREQ_MINUS: |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
792 // adjust DDS frequency to keep beatnote within the bandpass filter |
0 | 793 |
26
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
794 if (settling > 0) { |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
795 settling--; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
796 break; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
797 } |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
798 |
32
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
799 double fDDS2; |
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
800 GetCtrlVal(MainPanel, PANEL_DDS2, &fDDS2); |
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
801 fDDS2 += 275000 - Ch4; |
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
802 SetCtrlVal(MainPanel, PANEL_DDS2, fDDS2); |
26
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
803 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
804 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
805 // allow counter to settle |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
806 settling = 3; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
807 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
808 // next step |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
809 Measuring_1 += 1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
810 break; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
811 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
812 case N_MEASUREMENT_FREP_PLUS: |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
813 // frep positive step |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
814 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
815 if (settling > 0) { |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
816 settling--; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
817 break; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
818 } |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
819 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
820 if (t2_1 == 0.0) |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
821 t2_1 = utc; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
822 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
823 Frepplus_1 = Frepplus_1 + Math1 - Slope_1 * (utc - t2_1); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
824 Ch4Plus = Ch4Plus + Ch4 - Ch4Slope * (utc - t2_1); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
825 n_1 += 1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
826 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
827 if ((utc - t2_1) > DeltaT_1) { |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
828 Frepplus_1 = Frepplus_1 / n_1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
829 Ch4Plus = Ch4Plus / n_1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
830 n_1 = 0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
831 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
832 // frep negative step |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
833 DDS4xAD9912_FrequencyRampe(&DDS4xAD9912,1, (FrequDDS1+DeltakHz_1*1000),(FrequDDS1-DeltakHz_1*1000), Step1/Ndiv); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
834 SetCtrlVal(MainPanel, PANEL_DDS1, (FrequDDS1-DeltakHz_1*1000)); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
835 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, (FrequDDS1-DeltakHz_1*1000)); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
836 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
837 // allow counter to settle |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
838 settling = 3; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
839 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
840 // next step |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
841 Measuring_1 += 1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
842 } |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
843 break; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
844 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
845 case N_MEASUREMENT_FREP_MINUS: |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
846 // frep negative step |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
847 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
848 if (settling > 0) { |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
849 settling--; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
850 break; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
851 } |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
852 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
853 if (t3_1 == 0.0) |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
854 t3_1 = utc; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
855 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
856 Frepminus_1 = Frepminus_1 + Math1 - Slope_1 * (utc - t3_1); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
857 Ch4Minus = Ch4Minus + Ch4 - Ch4Slope * (utc - t3_1); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
858 n_1 += 1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
859 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
860 if ((utc - t3_1) > DeltaT_1) { |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
861 Frepminus_1 = Frepminus_1 / n_1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
862 Ch4Minus = Ch4Minus / n_1; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
863 n_1 = 0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
864 |
32
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
865 // compute N1 |
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
866 N_1 = Signe1 * (2*Ndiv * DeltakHz_1 * 1000)/(Frepminus_1 - Frepplus_1 - Slope_1 * (t3_1 - t2_1)); |
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
867 SetCtrlVal(CalcN1Panel, CALCN1_N, N_1); |
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
868 |
26
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
869 t1_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
870 t2_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
871 t3_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
872 Frepminus_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
873 Frepplus_1 = 0.0; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
874 |
32
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
875 // back to nominal frep |
26
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
876 DDS4xAD9912_FrequencyRampe(&DDS4xAD9912, 1, FrequDDS1-DeltakHz_1*1000,FrequDDS1, Step1/Ndiv ); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
877 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
878 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
879 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
880 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyDDSBesInit); |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
881 |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
882 // done |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
883 Measuring_1 = N_MEASUREMENT_NONE; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
884 } |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
885 break; |
4bb197635664
Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
25
diff
changeset
|
886 } |
0 | 887 |
888 if (Measuring_2==TRUE) | |
889 { | |
890 if (Step1_2==FALSE) { | |
891 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1) ; | |
892 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); | |
893 | |
894 GetCtrlVal(MainPanel, PANEL_DDS2, &FrequencyDDSBesInit) ; | |
895 GetCtrlVal(MainPanel, PANEL_DDS3, &FrequencyDDS3Init) ; | |
896 t1_2=utc; | |
897 Frequ_slope_2=Math1; | |
898 Beat_slope_2=Ch2; | |
899 Moy_slope_2= Frequ_slope_2; | |
900 Moy_Beatslope_2= Beat_slope_2; | |
901 N_slope_2=1; | |
902 Step1_2=TRUE ; | |
903 Nu1=(250000000+Math1)*N1; | |
904 } | |
905 else { | |
906 if(Step2_2==FALSE){ | |
907 N_slope_2=N_slope_2+1; | |
908 Frequ_slope_2=Math1; | |
909 Beat_slope_2=Ch2; | |
910 Moy_slope_2=((N_slope_2-1)*Moy_slope_2 + Frequ_slope_2)/N_slope_2; | |
911 Moy_Beatslope_2=((N_slope_2-1)*Moy_Beatslope_2 + Beat_slope_2)/N_slope_2; | |
912 Slope_slope_2 = (Slope_slope_2*(N_slope_2-2) + 6*(Frequ_slope_2-Moy_slope_2)/N_slope_2)/(N_slope_2+1) ; | |
913 Slope_Beatslope_2 = (Slope_Beatslope_2*(N_slope_2-2) + 6*(Beat_slope_2-Moy_Beatslope_2)/N_slope_2)/(N_slope_2+1) ; | |
914 if (utc-t1_2>SlopeTime2) { | |
915 Slope_2 = Slope_slope_2; | |
916 Beatslope_2 = Slope_Beatslope_2; | |
917 Step2_2=TRUE ; | |
918 N_slope_2=0; | |
919 Frequ_slope_2=0.0; | |
920 Moy_slope_2=0.0; | |
921 Slope_slope_2 =0.0; | |
922 Moy_Beatslope_2=0.0; | |
923 Slope_Beatslope_2 =0.0; | |
924 Beat_slope_2=0.0; | |
925 | |
926 DDS4xAD9912_FrequencyRampe (&DDS4xAD9912,1, FrequDDS1,(FrequDDS1+DeltakHz_2*1000), Step2/Ndiv ) ; | |
927 SetCtrlVal(MainPanel, PANEL_DDS1, (FrequDDS1+DeltakHz_2*1000)) ; | |
928 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, (FrequDDS1+DeltakHz_2*1000)); | |
929 Delay(0.1); | |
930 DeltaDDS3 = -DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1) - Beatslope_2*(utc-t1_2); | |
931 SetCtrlVal(MainPanel, PANEL_DDS3, (FrequencyDDS3Init+DeltaDDS3)) ; | |
932 DDS4xAD9912_SetFrequency (&DDS4xAD9912,3,(FrequencyDDS3Init+DeltaDDS3)) ; | |
933 | |
934 } | |
935 } | |
936 else { | |
937 if (DDSBesChanged1==FALSE){ | |
938 | |
939 if (nDDSChange<3) | |
940 { nDDSChange=nDDSChange+1;} | |
941 | |
942 else | |
943 { | |
944 nDDSChange=0; | |
945 | |
27
419db63a9949
Remove two global variables
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
26
diff
changeset
|
946 double DeltaFrep275 = 275000-Ch4; |
419db63a9949
Remove two global variables
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
26
diff
changeset
|
947 double DeltaFrep10 = 10000-Ch2; |
33 | 948 DeltaDDS3 = DeltaDDS3 + DeltaFrep10; |
949 FrequencyDDSBes = FrequencyDDSBesInit + DeltaFrep275; | |
950 FrequencyDDS3 = FrequencyDDS3Init + DeltaDDS3; | |
0 | 951 |
952 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBes) ; | |
953 DDS4xAD9912_SetFrequency(&DDS4xAD9912,2,FrequencyDDSBes); | |
954 | |
955 Delay(0.1); | |
956 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3) ; | |
957 DDS4xAD9912_SetFrequency(&DDS4xAD9912,3,FrequencyDDS3); | |
958 | |
959 DDSBesChanged1=TRUE; | |
960 t2_2=utc; | |
961 | |
962 } | |
963 | |
964 } | |
965 else{ | |
966 | |
967 if(Step3_2==FALSE){ | |
968 if (nstabilization<3) | |
969 {nstabilization= nstabilization+1;} | |
970 else | |
971 { | |
972 if (utc-t2_2<DeltaT_2) { | |
973 Frepplus_2=Frepplus_2 +Math1+250000000-Slope_2*(utc-t2_2); | |
974 Delta10K_Plus= Delta10K_Plus + 10000 - (Ch2 -Beatslope_2*(utc-t2_2)); | |
975 n_2=n_2+1; | |
976 } | |
977 else{ | |
978 Frepplus_2=Frepplus_2/n_2; | |
979 Delta10K_Plus=Delta10K_Plus/n_2; | |
980 n_2=0; | |
981 Step3_2=TRUE ; | |
982 nstabilization=0; | |
983 DDS4xAD9912_FrequencyRampe ( &DDS4xAD9912,1, (FrequDDS1+DeltakHz_2*1000),(FrequDDS1-DeltakHz_2*1000), Step2/Ndiv ) ; | |
984 SetCtrlVal(MainPanel, PANEL_DDS1, (FrequDDS1-DeltakHz_2*1000)) ; | |
985 DDS4xAD9912_SetFrequency (&DDS4xAD9912,1, (FrequDDS1-DeltakHz_2*1000) ) ; | |
986 | |
987 Delay(0.1); | |
988 DeltaDDS3 = (FrequencyDDS3Init+DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1)) - FrequencyDDS3; | |
989 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3+DeltaDDS3) ; | |
990 DDS4xAD9912_SetFrequency (&DDS4xAD9912,3, FrequencyDDS3+DeltaDDS3 ) ; | |
991 | |
992 } | |
993 } | |
994 } | |
995 | |
996 else { | |
997 if (DDSBesChanged2==FALSE){ | |
998 | |
999 if (nDDSChange<3) | |
1000 { nDDSChange=nDDSChange+1;} | |
1001 | |
1002 else | |
1003 { | |
1004 nDDSChange=0; | |
1005 | |
1006 | |
27
419db63a9949
Remove two global variables
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
26
diff
changeset
|
1007 double DeltaFrep275=275000-Ch4; |
419db63a9949
Remove two global variables
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
26
diff
changeset
|
1008 double DeltaFrep10=10000-Ch2; |
0 | 1009 DeltaDDS3 = DeltaDDS3+(DeltaFrep10) ; |
1010 FrequencyDDSBes=FrequencyDDSBes+(DeltaFrep275) ; | |
1011 FrequencyDDS3=FrequencyDDS3+DeltaDDS3 ; | |
1012 DDS4xAD9912_SetFrequency(&DDS4xAD9912,2,FrequencyDDSBes); | |
1013 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBes); | |
1014 | |
1015 Delay(0.1); | |
1016 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3) ; | |
1017 DDS4xAD9912_SetFrequency(&DDS4xAD9912,3,FrequencyDDS3); | |
1018 | |
1019 DDSBesChanged2=TRUE; | |
1020 t3_2=utc; | |
1021 | |
1022 | |
1023 } | |
1024 } | |
1025 | |
1026 else{ | |
1027 if (nstabilization<3) | |
1028 { nstabilization=nstabilization+1;} | |
1029 else | |
1030 { | |
1031 if (utc-t3_2<DeltaT_2) { | |
1032 Frepminus_2=Frepminus_2 +Math1+250000000-Slope_2*(utc-t3_2); | |
1033 Delta10K_Minus= Delta10K_Minus +10000 - ( Ch2 -Beatslope_2*(utc-t3_2)); | |
1034 n_2=n_2+1; | |
1035 } | |
1036 else{ | |
1037 Frepminus_2=Frepminus_2/(n_2); | |
1038 Delta10K_Minus= Delta10K_Minus/n_2; | |
1039 N_2 = (Signe2)*(-DeltaDDS3+Delta10K_Plus-Delta10K_Minus-Beatslope_2*(t3_2-t2_2) )/(Frepminus_2-Frepplus_2-Slope_2*(t3_2-t2_2)); | |
1040 n_2=0; | |
1041 Frepminus_2=0.0; | |
1042 Frepplus_2=0.0; | |
1043 Delta10K_Minus=0.0; | |
1044 Delta10K_Plus=0.0; | |
1045 DDS4xAD9912_FrequencyRampe (&DDS4xAD9912, 1, FrequDDS1-DeltakHz_2*1000,FrequDDS1, Step2/Ndiv ) ; | |
1046 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1) ; | |
1047 DDS4xAD9912_SetFrequency(&DDS4xAD9912,1,FrequDDS1); | |
1048 | |
1049 Delay(0.1); | |
1050 | |
1051 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit) ; | |
1052 DDS4xAD9912_SetFrequency (&DDS4xAD9912, 2, FrequencyDDSBesInit ) ; | |
1053 | |
1054 Delay(0.1); | |
1055 | |
1056 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init-Beatslope_2*(utc-t1_2)) ; | |
1057 DDS4xAD9912_SetFrequency (&DDS4xAD9912, 3, FrequencyDDS3Init-Beatslope_2*(utc-t1_2) ) ; | |
1058 | |
1059 Measuring_2=FALSE ; | |
1060 Step1_2=FALSE ; | |
1061 Step2_2=FALSE ; | |
1062 Step3_2=FALSE ; | |
1063 t1_2=0.0; | |
1064 t2_2=0.0; | |
1065 t3_2=0.0; | |
1066 DDSBesChanged1=FALSE; | |
1067 DDSBesChanged2=FALSE; | |
1068 FrequencyDDSBes=0.0; | |
1069 nstabilization=0; | |
1070 | |
1071 } | |
1072 } | |
1073 } | |
1074 } | |
1075 } | |
1076 } | |
1077 } | |
1078 } | |
1079 | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1080 switch (Measuring_3) { |
0 | 1081 |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1082 case N_MEASUREMENT_STEP_0: |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1083 // not measuring N3 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1084 break; |
0 | 1085 |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1086 case N_MEASUREMENT_STEP_1: // init |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1087 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1088 SetCtrlVal(MainPanel, PANEL_DDS4, FrequDDS4); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1089 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, FrequDDS4); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1090 settling = 3; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1091 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1092 t1_3 = utc; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1093 N_slope_3 = 0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1094 // record current DDS3 frequency |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1095 GetCtrlVal(MainPanel, PANEL_DDS3, &FrequencyDDS3Init); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1096 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1097 // step 1 done |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1098 Measuring_3 = N_MEASUREMENT_STEP_2; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1099 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1100 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1101 case N_MEASUREMENT_STEP_2: // slope measurement |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1102 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1103 if (settling > 0) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1104 settling--; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1105 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1106 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1107 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1108 N_slope_3++; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1109 Frequ_slope_3 = Ch2; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1110 Moy_slope_3 = ((N_slope_3-1)*Moy_slope_3 + Frequ_slope_3)/N_slope_3; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1111 Slope_slope_3 = (Slope_slope_3*(N_slope_3-2) + 6*(Frequ_slope_3-Moy_slope_3)/N_slope_3)/(N_slope_3+1) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1112 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1113 if (utc - t1_3 > SlopeTime3) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1114 // slope measurement |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1115 Slope_3 = Slope_slope_3; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1116 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1117 t2_3 = utc; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1118 N_slope_3 = 0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1119 Frequ_slope_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1120 Moy_slope_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1121 Slope_slope_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1122 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1123 // step 2 done |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1124 Measuring_3 = N_MEASUREMENT_STEP_3; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1125 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1126 // frep positive step |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1127 SetCtrlVal(MainPanel, PANEL_DDS4, FrequDDS4 + DeltakHz_3 * 1000); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1128 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, FrequDDS4 + DeltakHz_3 * 1000); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1129 // compensate with DDS3 to keep measured beatnote in counter box range |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
1130 double fDDS3 = FrequencyDDS3Init + N3/N1 * Ndiv * DeltakHz_3 * 1000; |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1131 SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1132 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1133 // allow counter to settle |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1134 settling = 3; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1135 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1136 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1137 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1138 case N_MEASUREMENT_STEP_3: // frep positive step |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1139 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1140 if (settling > 0) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1141 settling--; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1142 break; |
0 | 1143 } |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1144 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1145 n_3++; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1146 Frepplus_3 += Ch2 - Slope_3 * (utc - t2_3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1147 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1148 if (utc - t2_3 > DeltaT_3) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1149 // positive step measurement |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1150 Frepplus_3 = Frepplus_3 / n_3; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1151 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1152 n_3 = 0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1153 t3_3 = utc; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1154 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1155 // step 3 done |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1156 Measuring_3 = N_MEASUREMENT_STEP_4; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1157 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1158 // frep negative step |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1159 SetCtrlVal(MainPanel, PANEL_DDS4, FrequDDS4 - DeltakHz_3 * 1000); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1160 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, FrequDDS4 - DeltakHz_3 * 1000); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1161 // compensate with DDS3 to keep measured beatnote in counter box range |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
1162 double fDDS3 = FrequencyDDS3Init - N3/N1 * Ndiv * DeltakHz_3 * 1000; |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1163 SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1164 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1165 // allow counter to settle |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1166 settling = 3; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1167 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1168 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1169 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1170 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1171 case N_MEASUREMENT_STEP_4: // frep negative step |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1172 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1173 if (settling > 0) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1174 settling--; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1175 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1176 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1177 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1178 n_3++; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1179 Frepminus_3 += Ch2 - Slope_3 * (utc - t3_3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1180 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1181 if (utc - t3_3 > DeltaT_3) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1182 // positive step measurement |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1183 Frepminus_3 = Frepminus_3 / n_3; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1184 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1185 // compute N3 |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
1186 N_3 = 1000.0 * DeltakHz_3 / (Frepplus_3 - Frepminus_3 + (2 * N3/N1 * Ndiv * DeltakHz_3 * 1000)); |
22
b7b3b5f1c5a6
Remove unused widgets from N1 measurement panel. Harmonize widgets names
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
20
diff
changeset
|
1187 SetCtrlVal(CalcN3Panel, CALCN3_N, N_3); |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1188 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1189 t1_3=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1190 t2_3=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1191 t3_3=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1192 n_3 = 0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1193 Frepminus_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1194 Frepplus_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1195 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1196 // step 4 done |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1197 Measuring_3 = N_MEASUREMENT_STEP_0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1198 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1199 // back to nominal frep |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1200 SetCtrlVal(MainPanel, PANEL_DDS4, FrequDDS4); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1201 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, FrequDDS4); |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
1202 // back to initial DDS3 frequency |
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
1203 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init); |
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
1204 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyDDS3Init); |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1205 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1206 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1207 } |
0 | 1208 |
1209 // Calcul du signe de fb | |
1210 | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1211 if (Getsign1 == TRUE) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1212 if (utc > tbegin1+2) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1213 if (Math1 > Frepbefore1) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1214 Signe1 = -1.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1215 else |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1216 Signe1 = +1.0; |
0 | 1217 SetCtrlVal(MainPanel, PANEL_DDS1, Frequency1) ; |
1218 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency1); | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1219 Getsign1 = FALSE; |
0 | 1220 } |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1221 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1222 if (Getsign2 == TRUE) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1223 if (utc > tbegin2+2){ |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1224 if (Math1 > Frepbefore2) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1225 if (Ch2 > Ch2before) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1226 Signe2 = +1.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1227 else |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1228 Signe2 = -1.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1229 } else { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1230 if (Ch2 > Ch2before) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1231 Signe2 = -1.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1232 else |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1233 Signe2 = +1.0; |
0 | 1234 } |
1235 SetCtrlVal(MainPanel, PANEL_DDS1, Frequency2) ; | |
1236 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency2); | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1237 Getsign2 = FALSE; |
0 | 1238 } |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1239 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1240 if (Getsign3 == TRUE) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1241 if (utc > tbegin3+2){ |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1242 if (Ch3 > Frepbefore3) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1243 Signe3 = -1.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1244 else |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1245 Signe3 = +1.0; |
0 | 1246 SetCtrlVal(MainPanel, PANEL_DDS3, Frequency3) ; |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1247 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1248 Getsign3 = FALSE; |
0 | 1249 } |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1250 } |
0 | 1251 |
1252 | |
1253 | |
1254 | |
1 | 1255 /* |
1256 * Slope Cancelling | |
1257 */ | |
0 | 1258 |
1 | 1259 if (SlopeMeasuring == TRUE) |
1260 { | |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
1261 double currentFreq = 0.0; |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1262 |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1263 /* select reference */ |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1264 switch (slopeReference) { |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1265 case SLOPE_REFERENCE_MICROWAVE: |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1266 currentFreq = Math2; |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1267 break; |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1268 case SLOPE_REFERENCE_HG_CAVITY: |
10
239f2fe67cc0
Fix slope cancelling following Hg cavity
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
8
diff
changeset
|
1269 currentFreq = Ch2 * 1062.5 / 1542.2; |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1270 break; |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1271 } |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1272 |
1 | 1273 if (utc-SlopeMeasuringTimeBegin > TimetoSlope) |
0 | 1274 { |
1 | 1275 Nratio = Nratio + 1; |
0 | 1276 |
1 | 1277 if (Nratio >= 1) |
0 | 1278 { |
1 | 1279 MoyMath2 = MoyMath2 + Moy_Math2slope; |
0 | 1280 } |
1 | 1281 SlopeMath2 = SlopeMath2 + Slope_Math2slope; |
1282 N_Math2slope = 0.0; | |
1283 Math2_slope = 0.0; | |
1284 Moy_Math2slope = 0.0; | |
1285 Slope_Math2slope = 0.0; | |
0 | 1286 |
1 | 1287 if (Nratio == 1 && CenterFrequencyCh2ToDetermine == TRUE) |
1288 { | |
1289 CenterFrequencyCh2 = MoyMath2; | |
1290 CenterFrequencyCh2ToDetermine = FALSE; | |
1291 } | |
0 | 1292 |
1 | 1293 OnSlopeCancelling = TRUE; |
29
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
1294 |
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
1295 FoxFrequ = DDSFox_ReadFreq(&DDS1xAD9956); |
1 | 1296 |
1297 if (Nratio == ratio) | |
1298 { | |
1299 if (FrequCorrec == TRUE) | |
0 | 1300 { |
1 | 1301 SlopeCorrection = (MoyMath2/ratio-CenterFrequencyCh2)/TimetoSlope; |
1302 SlopeMath2 = SlopeMath2 + SlopeCorrection; | |
0 | 1303 } |
1 | 1304 Nratio = 0; |
1305 MoyMath2 = 0.0; | |
1306 } | |
0 | 1307 |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1308 SetCtrlVal(MainPanel, PANEL_SLOPETOCANCEL, SlopeMath2); |
29
585c60175bd5
Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
28
diff
changeset
|
1309 DDSFox_Set(&DDS1xAD9956, FoxFrequ, SlopeMath2); |
0 | 1310 |
1 | 1311 nstabilisationSlopeMeasuring = 0; |
1312 SlopeMeasuringTimeBegin = utc; | |
0 | 1313 |
1314 } | |
1315 else | |
1316 { | |
1 | 1317 if (nstabilisationSlopeMeasuring < 5) |
1318 { | |
1319 nstabilisationSlopeMeasuring = nstabilisationSlopeMeasuring + 1; | |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1320 Math2_slope = currentFreq; |
1 | 1321 } |
1322 else | |
1323 { | |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1324 if ((currentFreq-Math2_slope) < limitotakoff && (currentFreq-Math2_slope) > -limitotakoff) |
0 | 1325 { |
1 | 1326 N_Math2slope = N_Math2slope + 1; |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1327 Math2_slope = currentFreq; |
1 | 1328 Moy_Math2slope = ((N_Math2slope-1)*Moy_Math2slope + Math2_slope)/N_Math2slope; |
1329 Slope_Math2slope = (Slope_Math2slope*(N_Math2slope-2) + 6*(Math2_slope-Moy_Math2slope)/N_Math2slope)/(N_Math2slope+1) ; | |
0 | 1330 } |
1331 else | |
1332 { | |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1333 if (AutoStopSlopeCancellingIfDelock) { |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1334 // stop slope cancelling if the comb is not locked |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1335 |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1336 double frequency = DEDRIFT_DDS_FREQUENCY; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1337 if (KeepFrequ) |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1338 frequency = DDSFox_ReadFreq(&DDS1xAD9956); |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1339 |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1340 if (! KeepSlope) { |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1341 SlopeMath2 = 0.0; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1342 OnSlopeCancelling = FALSE; |
1 | 1343 } |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1344 |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1345 SetCtrlVal(MainPanel, PANEL_SLOPETOCANCEL, SlopeMath2); |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
1346 DDSFox_Set(&DDS1xAD9956, frequency, SlopeMath2); |
0 | 1347 |
1 | 1348 SlopeMeasuring = FALSE; |
1349 N_Math2slope = 0.0; | |
1350 Math2_slope = 0.0; | |
1351 MoyMath2 = 0.0; | |
1352 Moy_Math2slope = 0.0; | |
1353 Slope_Math2slope = 0.0; | |
1354 CenterFrequencyCh2 = 0.0; | |
1355 CenterFrequencyCh2ToDetermine = TRUE; | |
1356 Nratio = -1; | |
1357 nstabilisationSlopeMeasuring = 0; | |
1358 | |
1359 SetCtrlVal(MainPanel, PANEL_STARTCANCEL, 0); | |
0 | 1360 } |
1361 } | |
1 | 1362 } |
0 | 1363 } |
1364 } | |
1365 | |
1366 | |
1367 //// For re-centering | |
1368 | |
1369 if (KeepCentering) | |
1370 { | |
1371 | |
1372 DeltaCh4=275000-Ch4; | |
1373 DeltaCh2=10000-Ch2; | |
1374 | |
1375 if (utc- CenteringTimeBegin275K > Timetorecenter275K && CenteringTimeBegin275K>10) | |
1376 { | |
1377 GetCtrlVal(MainPanel, PANEL_DDS2, &FrequencyToChange) ; | |
1378 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyToChange+DeltaCh4) ; | |
1379 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyToChange+DeltaCh4); | |
1380 CenteringTimeBegin275K=utc; | |
1381 | |
1382 | |
1383 } | |
1384 | |
1385 if (utc- CenteringTimeBegin10K > Timetorecenter10K && CenteringTimeBegin10K>10) | |
1386 { | |
1387 GetCtrlVal(MainPanel, PANEL_DDS3, &FrequencyToChange) ; | |
1388 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyToChange+DeltaCh2) ; | |
1389 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyToChange+DeltaCh2); | |
1390 CenteringTimeBegin10K=utc; | |
1391 | |
1392 | |
1393 } | |
1394 | |
1395 | |
1396 } | |
1397 | |
1398 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2AUTOSAV, &BoxChecked) ; // AutoSave OL | |
1399 if (BoxChecked) { | |
1400 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 | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1401 } |
0 | 1402 |
1403 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH2SAVE, &BoxChecked) ; // Save OL (Math2) | |
1404 if (BoxChecked) { | |
1405 FileOpt = OpenFile("z:\\MeasuresFifi1\\OptCavity.txt", VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII) ; | |
1406 Fmt(ReportString, "%s\t%s\t%f[p3]\t%f[p3]", Date, Time, utc, Math2); | |
1407 WriteLine(FileOpt, ReportString, -1) ; | |
1408 CloseFile(FileOpt) ; | |
1409 FileOpt = OpenFile("C:\\Femto\\Results\\OptCavity.txt", VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII) ; // a local backup for debugging | |
1410 Fmt(ReportString, "%s\t%s\t%f[p3]\t%f[p3]", Date, Time, utc, Math2); | |
1411 WriteLine(FileOpt, ReportString, -1) ; | |
1412 CloseFile(FileOpt) ; | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1413 } |
0 | 1414 |
1415 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH3AUTOSAV, &BoxChecked) ; // AutoSave Hg (Math3) | |
1416 if (BoxChecked) { | |
1417 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 | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1418 } |
0 | 1419 |
1420 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH3SAVE, &BoxChecked) ; // Save Hg | |
1421 | |
1422 if (BoxChecked) { | |
1423 FileHg = OpenFile("z:\\MeasuresFifi1\\HgCavity.txt", VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII) ; | |
1424 Fmt(ReportString, "%s\t%s\t%f[p3]\t%f[p3]", Date, Time, utc, Math3); | |
1425 WriteLine(FileHg, ReportString, -1) ; | |
1426 CloseFile(FileHg) ; | |
1427 FileHg = OpenFile("C:\\Femto\\Results\\HgCavity.txt", VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII) ; | |
1428 Fmt(ReportString, "%s\t%s\t%f[p3]\t%f[p3]", Date, Time, utc, Math3); | |
1429 WriteLine(FileHg, ReportString, -1) ; | |
1430 CloseFile(FileHg) ; | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1431 } |
0 | 1432 |
1433 GetCtrlVal(MainPanel, PANEL_CHECKBOX_MATH5SAVE, &BoxChecked) ; // Save ExtraMath (Math5) | |
1434 if (BoxChecked) { | |
1435 FileExtraMath = OpenFile(ExtraMathFileName, VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII) ; | |
1436 Fmt(ReportString, "%s\t%s\t%f[p3]\t%f[p7]", Date, Time, utc, Math5); | |
1437 WriteLine(FileExtraMath, ReportString, -1) ; | |
1438 CloseFile(FileExtraMath) ; | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1439 } |
0 | 1440 |
1441 // Special case to handle change of day at next second | |
1442 if ( LocalTime.tm_hour==23 && LocalTime.tm_min==59 && strtod(Sec,NULL)>=58 ) { | |
1443 printf("Entering change of date substructure\r\n"); | |
1444 printf("old file : %s %s %s \r\n",Date, Time, LogFileName); | |
1445 Acquiring = FALSE ; | |
1446 do { | |
1447 Delay(5.1); | |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
1448 CurrentFileName(LogFileName) ; |
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
1449 } while (!GetFileInfo(LogFileName, &OldLogFilePtr)); |
0 | 1450 printf("new file : %s \r\n\r\n",Date, Time, LogFileName); |
1451 Acquiring = TRUE ; | |
1452 OldLogFilePtr = 2; | |
25
fde495ba28d2
Correct DDS3 frequency adjustement on N3 measurement. Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
24
diff
changeset
|
1453 } |
0 | 1454 |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
1455 ResumeTimerCallbacks() ; |
0 | 1456 |
1457 } ; | |
1458 | |
1459 break; | |
1460 case FALSE: | |
1461 break; | |
1462 } | |
1463 break; | |
1464 } | |
1465 return 0; | |
1466 } | |
1467 | |
1468 | |
1469 | |
1470 | |
1471 int CVICALLBACK CB_OnFreqPlot (int panel, int control, int event, | |
1472 void *callbackData, int eventData1, int eventData2) | |
1473 { | |
1474 int BoxChecked ; | |
1475 Plot_Data * pPlot = NULL; | |
1476 char PlotTitle[] = "Ch? Frequency Plot" ; | |
1477 double PlotMin = 10e6 ; | |
1478 double PlotMax = 65e6 ; | |
1479 | |
1480 switch (event) | |
1481 { | |
1482 case EVENT_COMMIT: | |
1483 | |
1484 GetCtrlVal(MainPanel, control, &BoxChecked); | |
1485 switch (control) { | |
1486 case PANEL_CHECKBOX_FREQ1PLOT : | |
1487 pPlot = &PlotCh1 ; | |
1488 Fmt(PlotTitle, "Ch1 Frequency Plot") ; | |
1489 PlotMin = 54.999e6 ; PlotMax = 55.001e6 ; | |
1490 break ; | |
1491 case PANEL_CHECKBOX_FREQ2PLOT : | |
1492 pPlot = &PlotCh2 ; | |
1493 Fmt(PlotTitle, "Ch2 Frequency Plot") ; | |
1494 PlotMin = 8.0e3 ; PlotMax = 12.0e3 ; | |
1495 break ; | |
1496 case PANEL_CHECKBOX_FREQ3PLOT : | |
1497 pPlot = &PlotCh3 ; | |
1498 Fmt(PlotTitle, "Ch3 Frequency Plot") ; | |
1499 PlotMin = 8.0e3 ; PlotMax = 12.0e3 ; | |
1500 break ; | |
1501 case PANEL_CHECKBOX_FREQ4PLOT : | |
1502 pPlot = &PlotCh4 ; | |
1503 Fmt(PlotTitle, "Ch4 Frequency Plot") ; | |
1504 break ; | |
1505 case PANEL_CHECKBOX_MATH1PLOT : | |
1506 pPlot = &PlotMath1 ; | |
1507 Fmt(PlotTitle, "Math1 Plot") ; | |
1508 PlotMin = 765.0e6 ; PlotMax = 775.0e6 ; | |
1509 break ; | |
1510 case PANEL_CHECKBOX_MATH2PLOT : | |
1511 pPlot = &PlotMath2 ; | |
1512 Fmt(PlotTitle, "Math2 Plot") ; | |
1513 PlotMin = -1.0e9 ; PlotMax = 1.0e9 ; | |
1514 break ; | |
1515 case PANEL_CHECKBOX_MATH3PLOT : | |
1516 pPlot = &PlotMath3 ; | |
1517 Fmt(PlotTitle, "Math3 Plot") ; | |
1518 PlotMin = -1.0e9 ; PlotMax = 1.0e9 ; | |
1519 break ; | |
1520 case PANEL_CHECKBOX_MATH4PLOT : | |
1521 pPlot = &PlotMath4 ; | |
1522 Fmt(PlotTitle, "Math4 Plot") ; | |
1523 PlotMin = -1.0e9 ; PlotMax = 1.0e9 ; | |
1524 break ; | |
1525 case PANEL_CHECKBOX_MATH5PLOT : | |
1526 pPlot = &PlotMath5 ; | |
1527 Fmt(PlotTitle, "Math5 Plot") ; | |
1528 PlotMin = -1.0e9 ; PlotMax = 1.0e9 ; | |
1529 break ; | |
1530 } | |
1531 | |
1532 if (BoxChecked) { | |
1533 Plot_InitPanel(pPlot, PlotTitle, PlotMin, PlotMax, &OnCloseViewPanel) ; | |
1534 } | |
1535 else { | |
1536 Plot_ClosePanel(pPlot) ; | |
1537 } ; | |
1538 break; | |
1539 | |
1540 case EVENT_RIGHT_CLICK: | |
1541 | |
1542 break; | |
1543 | |
1544 } | |
1545 return 0; | |
1546 } | |
1547 | |
1548 | |
1549 int CVICALLBACK CB_OnAllanPlot (int panel, int control, int event, | |
1550 void *callbackData, int eventData1, int eventData2) | |
1551 { | |
1552 int BoxChecked ; | |
1553 Allan_Data * pAllan = NULL; | |
1554 char AllanTitle[] = "Ch? Allan Deviation " ; | |
1555 double Normalizer = 300e12 ; | |
1556 | |
1557 switch (event) | |
1558 { | |
1559 case EVENT_COMMIT: | |
1560 | |
1561 GetCtrlVal(MainPanel, control, &BoxChecked); | |
1562 switch (control) { | |
1563 case PANEL_CHECKBOX_FREQ1ALLAN : | |
1564 pAllan = &AllanCh1 ; | |
1565 Fmt(AllanTitle, "Ch1 Allan Deviation") ; | |
1566 Normalizer = 1.84e12 ; | |
1567 break ; | |
1568 case PANEL_CHECKBOX_FREQ2ALLAN : | |
1569 pAllan = &AllanCh2 ; | |
1570 Fmt(AllanTitle, "Ch2 Allan Deviation") ; | |
1571 Normalizer = 10.e3 ; | |
1572 break ; | |
1573 case PANEL_CHECKBOX_FREQ3ALLAN : | |
1574 pAllan = &AllanCh3 ; | |
1575 Fmt(AllanTitle, "Ch3 Allan Deviation") ; | |
1576 Normalizer = 429.228e12 ; | |
1577 break ; | |
1578 case PANEL_CHECKBOX_FREQ4ALLAN : | |
1579 pAllan = &AllanCh4 ; | |
1580 Fmt(AllanTitle, "Ch4 Allan Deviation") ; | |
1581 Normalizer = 275.0e3 ; | |
1582 break ; | |
1583 case PANEL_CHECKBOX_MATH1ALLAN : | |
1584 pAllan = &AllanMath1 ; | |
1585 Fmt(AllanTitle, "Math1 Allan Deviation") ; | |
1586 Normalizer = 250.0e6 ; | |
1587 break ; | |
1588 case PANEL_CHECKBOX_MATH2ALLAN : | |
1589 pAllan = &AllanMath2 ; | |
1590 Fmt(AllanTitle, "Math2 Allan Deviation") ; | |
1591 Normalizer = 194.395e12 ; | |
1592 break ; | |
1593 case PANEL_CHECKBOX_MATH3ALLAN : | |
1594 pAllan = &AllanMath3 ; | |
1595 Fmt(AllanTitle, "Math3 Allan Deviation") ; | |
1596 Normalizer = 282.143e12 ; | |
1597 break ; | |
1598 case PANEL_CHECKBOX_MATH4ALLAN : | |
1599 pAllan = &AllanMath4 ; | |
1600 Fmt(AllanTitle, "Math4 Allan Deviation") ; | |
1601 Normalizer = 429.228e12 ; | |
1602 break ; | |
1603 case PANEL_CHECKBOX_MATH5ALLAN : | |
1604 pAllan = &AllanMath5 ; | |
1605 Fmt(AllanTitle, "Math5 Allan Deviation") ; | |
1606 Normalizer = 429.228e12 ; | |
1607 break ; | |
1608 } | |
1609 | |
1610 if (BoxChecked) { | |
1611 Allan_InitPanel(pAllan, AllanTitle, Normalizer, &OnCloseViewPanel) ; | |
1612 } | |
1613 else { | |
1614 Allan_ClosePanel(pAllan) ; | |
1615 } ; | |
1616 break; | |
1617 | |
1618 case EVENT_RIGHT_CLICK: | |
1619 | |
1620 break; | |
1621 | |
1622 } | |
1623 return 0; | |
1624 } | |
1625 | |
1626 int CVICALLBACK CB_ChangeDDSOut (int panel, int control, int event, | |
1627 void *callbackData, int eventData1, int eventData2) | |
1628 { | |
28
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1629 double frequency ; |
0 | 1630 |
28
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1631 switch (event) { |
0 | 1632 case EVENT_COMMIT: |
28
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1633 GetCtrlVal(MainPanel, control, &frequency); |
0 | 1634 |
28
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1635 switch (control) { |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1636 case PANEL_DDS1: |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1637 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, frequency); |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1638 break; |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1639 case PANEL_DDS2: |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1640 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency); |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1641 break; |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1642 case PANEL_DDS3: |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1643 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency); |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1644 break; |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1645 case PANEL_DDS4: |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1646 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1647 break; |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1648 } |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1649 } |
0 | 1650 return 0; |
1651 } | |
1652 | |
1653 int CVICALLBACK CB_ChangeDDSStep (int panel, int control, int event, | |
1654 void *callbackData, int eventData1, int eventData2) | |
1655 { | |
1656 double Step ; | |
1657 | |
1658 switch (event) | |
1659 { | |
1660 case EVENT_COMMIT: | |
28
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1661 GetCtrlVal(MainPanel, control, &Step); |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1662 if (control==PANEL_DDS1STEP) { SetCtrlAttribute(panel, PANEL_DDS1, ATTR_INCR_VALUE, Step); } |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1663 if (control==PANEL_DDS2STEP) { SetCtrlAttribute(panel, PANEL_DDS2, ATTR_INCR_VALUE, Step); } |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1664 if (control==PANEL_DDS3STEP) { SetCtrlAttribute(panel, PANEL_DDS3, ATTR_INCR_VALUE, Step); } |
1e4ecf64b485
Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
27
diff
changeset
|
1665 if (control==PANEL_DDS4STEP) { SetCtrlAttribute(panel, PANEL_DDS4, ATTR_INCR_VALUE, Step); } |
0 | 1666 break; |
1667 case EVENT_RIGHT_CLICK: | |
1668 | |
1669 break; | |
1670 | |
1671 } | |
1672 return 0; | |
1673 } | |
1674 | |
1675 int CVICALLBACK CB_ChangeMath (int panel, int control, int event, | |
1676 void *callbackData, int eventData1, int eventData2) | |
1677 { | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1678 int len; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1679 char *string; |
0 | 1680 |
1681 switch (event) | |
1682 { | |
1683 case EVENT_COMMIT: | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1684 GetCtrlAttribute(panel, control, ATTR_STRING_TEXT_LENGTH, &len); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1685 string = (char *)malloc(sizeof(char) * (len + 1)); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1686 GetCtrlVal(panel, control, string); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1687 switch (control) { |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1688 case PANEL_MATHSTRING1: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1689 mupSetExpr(MathParser1, string); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1690 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1691 case PANEL_MATHSTRING2: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1692 mupSetExpr(MathParser2, string); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1693 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1694 case PANEL_MATHSTRING3: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1695 mupSetExpr(MathParser3, string); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1696 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1697 case PANEL_MATHSTRING4: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1698 mupSetExpr(MathParser4, string); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1699 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1700 case PANEL_MATHSTRING5: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1701 mupSetExpr(MathParser5, string); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1702 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1703 } |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1704 free(string); |
0 | 1705 break; |
1706 } | |
1707 return 0; | |
1708 } | |
1709 | |
1710 int CVICALLBACK CB_ChangeN (int panel, int control, int event, | |
1711 void *callbackData, int eventData1, int eventData2) | |
1712 { | |
1713 | |
1714 switch (event) | |
1715 { | |
1716 case EVENT_COMMIT: | |
1717 if (control==PANEL_N1CHOICE) GetCtrlVal(MainPanel, control, &N1) ; | |
1718 if (control==PANEL_N2CHOICE) GetCtrlVal(MainPanel, control, &N2) ; | |
1719 if (control==PANEL_N3CHOICE) GetCtrlVal(MainPanel, control, &N3) ; | |
1720 break; | |
1721 } | |
1722 return 0; | |
1723 } | |
1724 | |
1725 int CVICALLBACK CB_OnPlus10k (int panel, int control, int event, | |
1726 void *callbackData, int eventData1, int eventData2) | |
1727 { | |
1728 double Frequency ; | |
1729 | |
1730 switch (event) | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1731 { |
0 | 1732 case EVENT_COMMIT: |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1733 switch (control) |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1734 { |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1735 case PANEL_PLUS10KDDS1: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1736 GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1737 Frequency += 10000.0; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1738 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1739 SetCtrlVal(MainPanel, PANEL_DDS1, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1740 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1741 case PANEL_PLUS10KDDS2: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1742 GetCtrlVal(MainPanel, PANEL_DDS2, &Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1743 Frequency += 10000.0; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1744 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1745 SetCtrlVal(MainPanel, PANEL_DDS2, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1746 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1747 case PANEL_PLUS10KDDS3: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1748 GetCtrlVal(MainPanel, PANEL_DDS3, &Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1749 Frequency += 10000.0; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1750 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1751 SetCtrlVal(MainPanel, PANEL_DDS3, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1752 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1753 case PANEL_PLUS10KDDS4: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1754 GetCtrlVal(MainPanel, PANEL_DDS4, &Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1755 Frequency += 10000.0; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1756 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1757 SetCtrlVal(MainPanel, PANEL_DDS4, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1758 break; |
0 | 1759 } |
1760 break; | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1761 } |
0 | 1762 return 0; |
1763 } | |
1764 | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1765 |
0 | 1766 int CVICALLBACK CB_OnMinus10k (int panel, int control, int event, |
1767 void *callbackData, int eventData1, int eventData2) | |
1768 { | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1769 double Frequency; |
0 | 1770 |
1771 switch (event) | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1772 { |
0 | 1773 case EVENT_COMMIT: |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1774 switch (control) |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1775 { |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1776 case PANEL_MINUS10KDDS1: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1777 GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1778 Frequency -= 10000.0; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1779 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1780 SetCtrlVal(MainPanel, PANEL_DDS1, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1781 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1782 case PANEL_MINUS10KDDS2: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1783 GetCtrlVal(MainPanel, PANEL_DDS2, &Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1784 Frequency -= 10000.0; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1785 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1786 SetCtrlVal(MainPanel, PANEL_DDS2, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1787 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1788 case PANEL_MINUS10KDDS3: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1789 GetCtrlVal(MainPanel, PANEL_DDS3, &Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1790 Frequency -= 10000.0; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1791 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1792 SetCtrlVal(MainPanel, PANEL_DDS3, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1793 break; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1794 case PANEL_MINUS10KDDS4: |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1795 GetCtrlVal(MainPanel, PANEL_DDS4, &Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1796 Frequency -= 10000.0; |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1797 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1798 SetCtrlVal(MainPanel, PANEL_DDS4, Frequency); |
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1799 break; |
0 | 1800 } |
1801 break; | |
24
b838371c7a91
Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
23
diff
changeset
|
1802 } |
0 | 1803 return 0; |
1804 } | |
1805 | |
1806 | |
1807 | |
1808 int CVICALLBACK CB_OnSaveOpt (int panel, int control, int event, | |
1809 void *callbackData, int eventData1, int eventData2) | |
1810 { | |
1811 bool BoxChecked = FALSE ; | |
1812 | |
1813 switch (event) | |
1814 { | |
1815 case EVENT_COMMIT: | |
1816 | |
1817 GetCtrlVal(MainPanel, control, &BoxChecked); | |
1818 | |
1819 if (BoxChecked) { | |
1820 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH2AUTOSAV, ATTR_DIMMED, FALSE) ; | |
1821 } | |
1822 | |
1823 if (!BoxChecked) { | |
1824 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH2AUTOSAV, ATTR_DIMMED, TRUE) ; | |
1825 } | |
1826 | |
1827 break; | |
1828 } | |
1829 return 0; | |
1830 } | |
1831 | |
1832 | |
1833 | |
1834 | |
1835 int CVICALLBACK CB_OnSaveHg (int panel, int control, int event, | |
1836 void *callbackData, int eventData1, int eventData2) | |
1837 { | |
1838 bool BoxChecked = FALSE ; | |
1839 | |
1840 switch (event) | |
1841 { | |
1842 case EVENT_COMMIT: | |
1843 | |
1844 GetCtrlVal(MainPanel, control, &BoxChecked); | |
1845 | |
1846 if (BoxChecked) { | |
1847 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH3AUTOSAV, ATTR_DIMMED, FALSE) ; | |
1848 } | |
1849 | |
1850 if (!BoxChecked) { | |
1851 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH3AUTOSAV, ATTR_DIMMED, TRUE) ; | |
1852 } | |
1853 | |
1854 break; | |
1855 } | |
1856 return 0; | |
1857 } | |
1858 | |
1859 int CVICALLBACK CB_OnAutoSaveHg (int panel, int control, int event, | |
1860 void *callbackData, int eventData1, int eventData2) | |
1861 { | |
1862 bool BoxChecked = FALSE ; | |
1863 | |
1864 switch (event) | |
1865 { | |
1866 case EVENT_COMMIT: | |
1867 | |
1868 GetCtrlVal(MainPanel, control, &BoxChecked); | |
1869 | |
1870 if (BoxChecked) { | |
1871 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH2SAVE, ATTR_DIMMED, TRUE) ; | |
1872 } | |
1873 | |
1874 if (!BoxChecked) { | |
1875 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH2SAVE, ATTR_DIMMED, FALSE) ; | |
1876 } | |
1877 | |
1878 break; | |
1879 } | |
1880 return 0; | |
1881 } | |
1882 | |
1883 int CVICALLBACK CB_OnSaveSr (int panel, int control, int event, | |
1884 void *callbackData, int eventData1, int eventData2) | |
1885 { | |
1886 bool BoxChecked = FALSE ; | |
1887 | |
1888 switch (event) | |
1889 { | |
1890 case EVENT_COMMIT: | |
1891 | |
1892 GetCtrlVal(MainPanel, control, &BoxChecked); | |
1893 | |
1894 if (BoxChecked) { | |
1895 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH3AUTOSAV, ATTR_DIMMED, FALSE) ; | |
1896 } | |
1897 | |
1898 if (!BoxChecked) { | |
1899 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH3AUTOSAV, ATTR_DIMMED, TRUE) ; | |
1900 } | |
1901 break; | |
1902 } | |
1903 return 0; | |
1904 } | |
1905 | |
1906 int CVICALLBACK CB_OnAutoSaveSr (int panel, int control, int event, | |
1907 void *callbackData, int eventData1, int eventData2) | |
1908 { | |
1909 bool BoxChecked = FALSE ; | |
1910 | |
1911 switch (event) | |
1912 { | |
1913 case EVENT_COMMIT: | |
1914 | |
1915 GetCtrlVal(MainPanel, control, &BoxChecked); | |
1916 | |
1917 if (BoxChecked) { | |
1918 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH3SAVE, ATTR_DIMMED, TRUE) ; | |
1919 } | |
1920 | |
1921 if (!BoxChecked) { | |
1922 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH3SAVE, ATTR_DIMMED, FALSE) ; | |
1923 } | |
1924 | |
1925 break; | |
1926 } | |
1927 return 0; | |
1928 } | |
1929 | |
1930 | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1931 int CVICALLBACK CB_OnAcceptN (int panel, int control, int event, |
0 | 1932 void *callbackData, int eventData1, int eventData2) |
1933 { | |
1934 switch (event) | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1935 { |
0 | 1936 case EVENT_COMMIT: |
1937 if (panel == CalcN1Panel) { | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1938 N1 = round(N_1); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1939 SetCtrlVal(MainPanel, PANEL_N1CHOICE, N1); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1940 } |
0 | 1941 if (panel == CalcN2Panel) { |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1942 N2 = round(N_2); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1943 SetCtrlVal(MainPanel, PANEL_N2CHOICE, N2); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1944 } |
0 | 1945 if (panel == CalcN3Panel) { |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1946 N3 = round(N_3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1947 SetCtrlVal(MainPanel, PANEL_N3CHOICE, N3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1948 } |
0 | 1949 break; |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
1950 } |
0 | 1951 return 0; |
1952 } | |
1953 | |
1954 | |
1955 int CVICALLBACK OnChooseSaveFile (int panel, int control, int event, | |
1956 void *callbackData, int eventData1, int eventData2) | |
1957 { | |
1958 switch (event) | |
1959 { | |
1960 case EVENT_COMMIT: | |
1961 | |
1962 FileSelectPopup("D:\\Manip Femto", "*.txt", "*.txt", "Selection of the ExtraMath saving file", VAL_SAVE_BUTTON, 0, 0, 0, FALSE, ExtraMathFileName) ; | |
1963 SetCtrlAttribute(MainPanel, PANEL_CHECKBOX_MATH5SAVE, ATTR_DIMMED, FALSE) ; | |
1964 | |
1965 break; | |
1966 } | |
1967 return 0; | |
1968 } | |
1969 | |
1970 | |
1971 int CVICALLBACK CB_OnNCalculus (int panel, int control, int event, | |
1972 void *callbackData, int eventData1, int eventData2) | |
1973 { | |
1974 | |
1975 int PanelIsVisible, PanelTop, PanelLeft, PanelWidth ; | |
1976 | |
1977 switch (event) | |
1978 { | |
1979 case EVENT_COMMIT: | |
1980 | |
1981 if (control==PANEL_N1CALCULUS){ | |
1982 GetPanelAttribute (CalcN1Panel, ATTR_VISIBLE , &PanelIsVisible); | |
1983 if (PanelIsVisible) { | |
1984 } | |
1985 else { | |
1986 GetPanelAttribute (MainPanel, ATTR_TOP, &PanelTop) ; | |
1987 GetPanelAttribute (MainPanel, ATTR_LEFT, &PanelLeft) ; | |
1988 GetPanelAttribute (MainPanel, ATTR_WIDTH, &PanelWidth) ; | |
1989 SetPanelAttribute (CalcN1Panel, ATTR_TOP, PanelTop+170 ) ; | |
1990 SetPanelAttribute (CalcN1Panel, ATTR_LEFT, PanelLeft+PanelWidth+4 ) ; | |
1991 DisplayPanel(CalcN1Panel) ; | |
1992 } | |
1993 } | |
1994 if (control==PANEL_N2CALCULUS){ | |
1995 GetPanelAttribute (CalcN2Panel, ATTR_VISIBLE , &PanelIsVisible); | |
1996 if (PanelIsVisible) { | |
1997 } | |
1998 else { | |
1999 GetPanelAttribute (MainPanel, ATTR_TOP, &PanelTop) ; | |
2000 GetPanelAttribute (MainPanel, ATTR_LEFT, &PanelLeft) ; | |
2001 GetPanelAttribute (MainPanel, ATTR_WIDTH, &PanelWidth) ; | |
2002 SetPanelAttribute (CalcN2Panel, ATTR_TOP, PanelTop+310 ) ; | |
2003 SetPanelAttribute (CalcN2Panel, ATTR_LEFT, PanelLeft+PanelWidth+4 ) ; | |
2004 DisplayPanel(CalcN2Panel) ; | |
2005 } | |
2006 } | |
2007 if (control==PANEL_N3CALCULUS){ | |
2008 GetPanelAttribute (CalcN3Panel, ATTR_VISIBLE , &PanelIsVisible); | |
2009 if (PanelIsVisible) { | |
2010 } | |
2011 else { | |
2012 GetPanelAttribute (MainPanel, ATTR_TOP, &PanelTop) ; | |
2013 GetPanelAttribute (MainPanel, ATTR_LEFT, &PanelLeft) ; | |
2014 GetPanelAttribute (MainPanel, ATTR_WIDTH, &PanelWidth) ; | |
2015 SetPanelAttribute (CalcN3Panel, ATTR_TOP, PanelTop+480 ) ; | |
2016 SetPanelAttribute (CalcN3Panel, ATTR_LEFT, PanelLeft+PanelWidth+4 ) ; | |
2017 DisplayPanel(CalcN3Panel) ; | |
2018 } | |
2019 } | |
2020 break; | |
2021 } | |
2022 | |
2023 return 0; | |
2024 } | |
2025 | |
2026 | |
2027 int CVICALLBACK CB_OnStartNCalculus (int panel, int control, int event, | |
2028 void *callbackData, int eventData1, int eventData2) | |
2029 { | |
2030 | |
2031 switch (event) | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2032 { |
0 | 2033 case EVENT_COMMIT: |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2034 if (panel == CalcN1Panel) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2035 Measuring_1 = TRUE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2036 if (panel == CalcN2Panel) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2037 Measuring_2 = TRUE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2038 if (panel == CalcN3Panel) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2039 Measuring_3 = TRUE; |
0 | 2040 break; |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2041 } |
0 | 2042 |
2043 return 0; | |
2044 } | |
2045 | |
2046 | |
2047 | |
2048 int CVICALLBACK CB_OnNStop (int panel, int control, int event, | |
2049 void *callbackData, int eventData1, int eventData2) | |
2050 { | |
2051 int PanelIsVisible; | |
2052 | |
2053 switch (event) | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2054 { |
0 | 2055 case EVENT_COMMIT: |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2056 if (panel == CalcN1Panel) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2057 GetPanelAttribute (CalcN1Panel, ATTR_VISIBLE, &PanelIsVisible); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2058 if (PanelIsVisible) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2059 HidePanel(CalcN1Panel); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2060 |
32
3ea9fb26ecdf
Fix N1 measurement code after cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
30
diff
changeset
|
2061 Measuring_1 = FALSE; |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2062 Frepminus_1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2063 Frepplus_1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2064 t1_1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2065 t2_1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2066 t3_1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2067 N_slope_1=0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2068 Frequ_slope_1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2069 Moy_slope_1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2070 Slope_slope_1 =0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2071 Ch4_slope=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2072 Moy_Ch4slope_1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2073 Slope_Ch4slope_1=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2074 DDSBesChanged1=FALSE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2075 DDSBesChanged2=FALSE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2076 nDDSChange=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2077 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2078 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2079 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2080 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2081 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyDDSBesInit); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2082 nstabilization=0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2083 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2084 if (panel == CalcN2Panel) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2085 GetPanelAttribute (CalcN2Panel, ATTR_VISIBLE, &PanelIsVisible); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2086 if (PanelIsVisible) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2087 HidePanel(CalcN2Panel); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2088 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2089 Measuring_2=FALSE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2090 Step1_2=FALSE ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2091 Step2_2=FALSE ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2092 Step3_2=FALSE ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2093 Frepminus_2=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2094 Delta10K_Minus=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2095 Frepplus_2=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2096 Delta10K_Plus=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2097 DeltaDDS3=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2098 t1_2=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2099 t2_2=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2100 t3_2=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2101 N_slope_2=0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2102 Frequ_slope_2=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2103 Moy_slope_2=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2104 Beat_slope_2=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2105 Moy_Beatslope_2=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2106 Slope_Beatslope_2 =0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2107 Slope_slope_2 =0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2108 DDSBesChanged1=FALSE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2109 DDSBesChanged2=FALSE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2110 nDDSChange=0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2111 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2112 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2113 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2114 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2115 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyDDSBesInit); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2116 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2117 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyDDS3Init); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2118 nstabilization=0; |
0 | 2119 } |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2120 if (panel == CalcN3Panel) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2121 GetPanelAttribute (CalcN3Panel, ATTR_VISIBLE, &PanelIsVisible); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2122 if (PanelIsVisible) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2123 HidePanel(CalcN3Panel); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2124 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2125 Measuring_3 = FALSE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2126 Frepminus_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2127 Frepplus_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2128 t1_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2129 t2_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2130 t3_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2131 N_slope_3 = 0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2132 Frequ_slope_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2133 Moy_slope_3 = 0.0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2134 Slope_slope_3 = 0.0; |
0 | 2135 } |
2136 break; | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2137 } |
0 | 2138 return 0; |
2139 } | |
2140 | |
2141 | |
2142 int CVICALLBACK CB_OnIntegrationTime (int panel, int control, int event, | |
2143 void *callbackData, int eventData1, int eventData2) | |
2144 { | |
2145 double Time ; | |
2146 | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2147 switch (event) { |
0 | 2148 case EVENT_COMMIT: |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2149 if (panel == CalcN1Panel) { |
0 | 2150 GetCtrlVal(CalcN1Panel, CALCN1_INTEGRATIONTIME, &Time) ; |
2151 DeltaT_1=Time; | |
2152 } | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2153 if (panel == CalcN2Panel) { |
0 | 2154 GetCtrlVal(CalcN2Panel, CALCN2_INTEGRATIONTIME, &Time) ; |
2155 DeltaT_2=Time; | |
2156 } | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2157 if (panel == CalcN3Panel) { |
0 | 2158 GetCtrlVal(CalcN3Panel, CALCN3_INTEGRATIONTIME, &Time) ; |
2159 DeltaT_3=Time; | |
2160 } | |
2161 break; | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2162 } |
0 | 2163 return 0; |
2164 } | |
2165 | |
2166 | |
2167 int CVICALLBACK CB_OnDeltaFreq (int panel, int control, int event, | |
2168 void *callbackData, int eventData1, int eventData2) | |
2169 { | |
2170 double Frequ ; | |
2171 | |
2172 switch (event) | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2173 { |
0 | 2174 case EVENT_COMMIT: |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2175 if (panel == CalcN1Panel) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2176 GetCtrlVal(CalcN1Panel, CALCN1_DELTAFREQ, &Frequ); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2177 DeltakHz_1 = Frequ; |
0 | 2178 } |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2179 if (panel == CalcN2Panel) { |
0 | 2180 GetCtrlVal(CalcN2Panel, CALCN2_DELTAFREQ, &Frequ) ; |
2181 DeltakHz_2=Frequ; | |
2182 } | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2183 if (panel == CalcN3Panel) { |
0 | 2184 GetCtrlVal(CalcN3Panel, CALCN3_DELTAFREQ, &Frequ) ; |
2185 DeltakHz_3=Frequ; | |
2186 } | |
2187 break; | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2188 } |
0 | 2189 return 0; |
2190 } | |
2191 | |
2192 | |
2193 int CVICALLBACK CB_OnFindSign (int panel, int control, int event, | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2194 void *callbackData, int eventData1, int eventData2) |
0 | 2195 { |
2196 | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2197 switch (event) { |
0 | 2198 case EVENT_COMMIT: |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2199 switch (control) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2200 { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2201 case PANEL_FINDSIGN1: |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2202 tbegin1 = utc; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2203 Frepbefore1 = Math1; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2204 GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency1) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2205 SetCtrlVal(MainPanel, PANEL_DDS1, Frequency1+Frequencystep1) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2206 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency1+Frequencystep1); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2207 Getsign1 = TRUE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2208 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2209 case PANEL_FINDSIGN2: |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2210 tbegin2 = utc; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2211 Frepbefore2 = Math1; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2212 Ch2before = Ch2; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2213 GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency2) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2214 SetCtrlVal(MainPanel, PANEL_DDS1, Frequency2+Frequencystep2) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2215 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency2+Frequencystep2); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2216 Getsign2 = TRUE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2217 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2218 case PANEL_FINDSIGN3: |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2219 tbegin3 = utc; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2220 Frepbefore3 = Math1; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2221 GetCtrlVal(MainPanel, PANEL_DDS4, &Frequency3) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2222 SetCtrlVal(MainPanel, PANEL_DDS4, Frequency3+Frequencystep3) ; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2223 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency3+Frequencystep3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2224 Getsign3 = TRUE; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2225 break; |
0 | 2226 } |
2227 break; | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2228 } |
0 | 2229 return 0; |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2230 } |
0 | 2231 |
2232 | |
2233 int CVICALLBACK CB_OnFind275K (int panel, int control, int event, | |
2234 void *callbackData, int eventData1, int eventData2) | |
2235 { | |
2236 | |
2237 | |
2238 double FrequencyToChange,DeltaCh4,DeltaCh2; | |
2239 | |
2240 DeltaCh4=275000-Ch4; | |
2241 DeltaCh2=10000-Ch2; | |
2242 | |
2243 switch (event) | |
2244 { | |
2245 case EVENT_COMMIT: | |
2246 if (control==PANEL_FIND275K2){ | |
2247 GetCtrlVal(MainPanel, PANEL_DDS2, &FrequencyToChange) ; | |
2248 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyToChange+DeltaCh4) ; | |
2249 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyToChange+DeltaCh4); | |
2250 | |
2251 } | |
2252 | |
2253 if (control==PANEL_FIND10K3){ | |
2254 GetCtrlVal(MainPanel, PANEL_DDS3, &FrequencyToChange) ; | |
2255 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyToChange+DeltaCh2) ; | |
2256 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyToChange+DeltaCh2); | |
2257 | |
2258 } | |
2259 | |
2260 break; | |
2261 | |
2262 } | |
2263 return 0; | |
2264 } | |
2265 | |
2266 | |
2267 int CVICALLBACK CB_OnSlopeTime (int panel, int control, int event, | |
2268 void *callbackData, int eventData1, int eventData2) | |
2269 { | |
2270 double Time ; | |
2271 | |
2272 switch (event) | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2273 { |
0 | 2274 case EVENT_COMMIT: |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2275 if (panel == CalcN1Panel) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2276 GetCtrlVal(CalcN1Panel, CALCN1_SLOPETIME, &Time); |
0 | 2277 SlopeTime1=Time; |
2278 } | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2279 if (panel == CalcN2Panel) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2280 GetCtrlVal(CalcN2Panel, CALCN2_SLOPETIME, &Time); |
0 | 2281 SlopeTime2=Time; |
2282 } | |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2283 if (panel == CalcN3Panel) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2284 GetCtrlVal(CalcN3Panel, CALCN3_SLOPETIME, &Time); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2285 SlopeTime3=Time; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2286 } |
0 | 2287 break; |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2288 } |
0 | 2289 return 0; |
2290 } | |
2291 | |
2292 | |
2293 int CVICALLBACK CB_OnChangeNdiv (int panel, int control, int event, | |
2294 void *callbackData, int eventData1, int eventData2) | |
2295 { | |
2296 double NewN ; | |
2297 | |
2298 switch (event) | |
2299 { | |
2300 case EVENT_COMMIT: | |
2301 if (control==PANEL_CHANGENDIV){ | |
2302 GetCtrlVal(MainPanel, PANEL_CHANGENDIV, &NewN) ; | |
2303 Ndiv=NewN; | |
2304 FrequDDS1=880000000.0/Ndiv; | |
2305 DeltakHz_1=1800.0*8/Ndiv; | |
2306 DeltakHz_2=1500.0*8/Ndiv; | |
2307 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1) ; | |
2308 DDS4xAD9912_SetFrequency(&DDS4xAD9912,1,FrequDDS1); | |
2309 SetCtrlVal(CalcN1Panel, CALCN1_DELTAFREQ, DeltakHz_1) ; | |
2310 SetCtrlVal(CalcN2Panel, CALCN2_DELTAFREQ, DeltakHz_2) ; | |
2311 } | |
2312 | |
2313 break; | |
2314 | |
2315 } | |
2316 return 0; | |
2317 } | |
2318 | |
2319 | |
2320 int CVICALLBACK CB_OnStartSlopeCancelling (int panel, int control, int event, | |
2321 void *callbackData, int eventData1, int eventData2) | |
2322 { | |
2323 | |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2324 double frequency; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2325 int activate; |
0 | 2326 |
2327 switch (event) | |
33 | 2328 { |
0 | 2329 case EVENT_COMMIT: |
2330 | |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2331 GetCtrlVal(MainPanel, PANEL_STARTCANCEL, &activate); |
0 | 2332 |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2333 if (activate) { |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2334 |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2335 SlopeMeasuringTimeBegin = utc; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2336 SlopeMeasuring = TRUE; |
33 | 2337 |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2338 frequency = DDSFox_ReadFreq(&DDS1xAD9956); |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2339 GetCtrlVal(MainPanel, PANEL_SLOPETOCANCEL, &SlopeMath2); |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2340 DDSFox_Set(&DDS1xAD9956, frequency, SlopeMath2); |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2341 |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2342 Nratio = -1; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2343 CenterFrequencyCh2ToDetermine = TRUE ; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2344 CenterFrequencyCh2 = 0.0; |
33 | 2345 |
2346 } else { | |
2347 | |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2348 frequency = DEDRIFT_DDS_FREQUENCY; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2349 if (KeepFrequ) |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2350 frequency = DDSFox_ReadFreq(&DDS1xAD9956); |
33 | 2351 |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2352 if (! KeepSlope) { |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2353 SlopeMath2 = 0.0; |
33 | 2354 OnSlopeCancelling = FALSE; |
2355 } | |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2356 |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2357 SetCtrlVal(MainPanel, PANEL_SLOPETOCANCEL, SlopeMath2); |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2358 DDSFox_Set(&DDS1xAD9956, frequency, SlopeMath2); |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2359 |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2360 SlopeMeasuring = FALSE; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2361 N_Math2slope = 0.0; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2362 Math2_slope = 0.0; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2363 Moy_Math2slope = 0.0; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2364 Slope_Math2slope = 0.0; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2365 MoyMath2 = 0.0; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2366 Slope_Math2slope = 0.0; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2367 CenterFrequencyCh2 = 0.0; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2368 Nratio = -1; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2369 nstabilisationSlopeMeasuring = 0; |
33 | 2370 |
2371 } | |
0 | 2372 break; |
33 | 2373 } |
0 | 2374 return 0; |
2375 } | |
2376 | |
2377 | |
14
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2378 int CVICALLBACK CB_OnResetSlope (int panel, int control, int event, |
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2379 void *callbackData, int eventData1, int eventData2) |
0 | 2380 { |
2381 | |
14
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2382 switch (event) { |
0 | 2383 case EVENT_COMMIT: |
14
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2384 CenterFrequencyCh2 = 0.0; |
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2385 MoyMath2 = 0.0; |
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2386 Nratio = -1; |
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2387 CenterFrequencyCh2ToDetermine = TRUE ; |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2388 OnSlopeCancelling = FALSE; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2389 SlopeMath2 = 0.0; |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2390 SetCtrlVal(MainPanel, PANEL_SLOPETOCANCEL, SlopeMath2); |
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2391 DDSFox_Set(&DDS1xAD9956, DEDRIFT_DDS_FREQUENCY, SlopeMath2); |
0 | 2392 break; |
14
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2393 } |
0 | 2394 return 0; |
2395 } | |
2396 | |
2397 | |
14
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2398 int CVICALLBACK CB_ChangeSlopeTime (int panel, int control, int event, |
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2399 void *callbackData, int eventData1, int eventData2) |
0 | 2400 { |
2401 | |
14
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2402 switch (event) { |
0 | 2403 case EVENT_COMMIT: |
14
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2404 GetCtrlVal(MainPanel, PANEL_SLOPETIME, &TimetoSlope); |
0 | 2405 break; |
14
783407954cdf
Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
10
diff
changeset
|
2406 } |
0 | 2407 return 0; |
2408 } | |
2409 | |
2410 | |
2411 int CVICALLBACK CB_OnCROX (int panel, int control, int event, | |
2412 void *callbackData, int eventData1, int eventData2) | |
2413 { | |
34
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2414 switch (event) { |
0 | 2415 case EVENT_COMMIT: |
34
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2416 switch (control) { |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2417 |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2418 case PANEL_CHECKBOX_CORRFREQU: |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2419 // enable frequency correction |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2420 GetCtrlVal(MainPanel, PANEL_CHECKBOX_CORRFREQU, &FrequCorrec); |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2421 break; |
0 | 2422 |
34
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2423 case PANEL_CHECKBOX_KEEP: |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2424 // keep current dedrifting frequency when dedrifting is disabled |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2425 GetCtrlVal(MainPanel, PANEL_CHECKBOX_KEEP, &KeepFrequ); |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2426 break; |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2427 |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2428 case PANEL_CHECKBOX_KEEPSLOPE: |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2429 // keep current dedrifting slope when dedrifting is disabled |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2430 GetCtrlVal(MainPanel, PANEL_CHECKBOX_KEEPSLOPE, &KeepSlope); |
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2431 break; |
0 | 2432 } |
2433 break; | |
34
1e4b8ba97faf
Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
33
diff
changeset
|
2434 } |
0 | 2435 return 0; |
2436 } | |
2437 | |
2438 | |
2439 | |
2440 int CVICALLBACK CB_OnReCentering (int panel, int control, int event, | |
2441 void *callbackData, int eventData1, int eventData2) | |
2442 { | |
2443 bool BoxChecked = FALSE; | |
2444 | |
2445 switch (event) | |
2446 { | |
2447 case EVENT_COMMIT: | |
2448 | |
2449 if (control== PANEL_CHECKBOX_RECENTER) | |
2450 { | |
2451 GetCtrlVal(MainPanel, PANEL_CHECKBOX_RECENTER, &BoxChecked) ; | |
2452 if (BoxChecked) { | |
2453 KeepCentering=TRUE ; | |
2454 CenteringTimeBegin275K=utc; | |
2455 CenteringTimeBegin10K=utc; | |
2456 } | |
2457 else {KeepCentering=FALSE ;} | |
2458 | |
2459 } | |
2460 | |
2461 | |
2462 break; | |
2463 | |
2464 } | |
2465 return 0; | |
2466 } | |
2467 | |
2468 | |
2469 int CVICALLBACK CB_OnAutoStopSlopeCancellingIfDelock (int panel, int control, int event, | |
2470 void *callbackData, int eventData1, int eventData2) | |
2471 { | |
2472 switch (event) | |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
2473 { |
0 | 2474 case EVENT_COMMIT: |
20
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
2475 GetCtrlVal(MainPanel, PANEL_CHECKBOX_STOPIFAUTODE, &AutoStopSlopeCancellingIfDelock); |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
2476 break; |
3a7f088d4960
Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
17
diff
changeset
|
2477 } |
0 | 2478 return 0; |
2479 } | |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2480 |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2481 int CVICALLBACK CB_OnSlopeReference (int panel, int control, int event, |
2
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2482 void *callbackData, int eventData1, int eventData2) |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2483 { |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2484 switch (event) |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2485 { |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2486 case EVENT_COMMIT: |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2487 GetCtrlVal(MainPanel, PANEL_SLOPE_REFERENCE, &slopeReference); |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2488 break; |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2489 } |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2490 return 0; |
bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
1
diff
changeset
|
2491 } |
17
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2492 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2493 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2494 int CVICALLBACK CB_OnEstimateN (int panel, int control, int event, |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2495 void *callbackData, int eventData1, int eventData2) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2496 { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2497 int visible; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2498 double wl; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2499 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2500 switch (event) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2501 { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2502 case EVENT_COMMIT: |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2503 /* be prepaid to support more N estimates for different beat notes */ |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2504 switch (control) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2505 { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2506 case PANEL_ESTIMATE_N3: |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2507 GetPanelAttribute(EstimateN3Panel, ATTR_VISIBLE , &visible); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2508 if (! visible) { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2509 DisplayPanel(EstimateN3Panel); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2510 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2511 /* set current frep */ |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2512 SetCtrlVal(EstimateN3Panel, ESTIMATEN3_FREP, 250e6 + Math1); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2513 /* default wavelenght for Sr cavity */ |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2514 GetCtrlVal(EstimateN3Panel, ESTIMATEN3_WAVELENGTH, &wl); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2515 if (wl == 0.0) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2516 SetCtrlVal(EstimateN3Panel, ESTIMATEN3_WAVELENGTH, 698.50); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2517 /* reset N3 estimate */ |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2518 SetCtrlVal(EstimateN3Panel, ESTIMATEN3_N, 0.0); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2519 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2520 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2521 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2522 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2523 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2524 return 0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2525 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2526 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2527 int CVICALLBACK CB_OnNEstimateCancel (int panel, int control, int event, |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2528 void *callbackData, int eventData1, int eventData2) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2529 { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2530 int visible; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2531 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2532 switch (event) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2533 { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2534 case EVENT_COMMIT: |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2535 GetPanelAttribute(panel, ATTR_VISIBLE, &visible); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2536 if (visible) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2537 HidePanel(panel); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2538 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2539 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2540 return 0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2541 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2542 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2543 int CVICALLBACK CB_OnNEstimateSet (int panel, int control, int event, |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2544 void *callbackData, int eventData1, int eventData2) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2545 { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2546 switch (event) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2547 { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2548 case EVENT_COMMIT: |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2549 GetCtrlVal(panel, ESTIMATEN3_N, &N3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2550 SetCtrlVal(MainPanel, PANEL_N3CHOICE, N3); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2551 HidePanel(panel); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2552 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2553 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2554 return 0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2555 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2556 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2557 int CVICALLBACK CB_OnNEstimate (int panel, int control, int event, |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2558 void *callbackData, int eventData1, int eventData2) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2559 { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2560 double frep, wl, N; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2561 |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2562 switch (event) |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2563 { |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2564 case EVENT_COMMIT: |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2565 GetCtrlVal(panel, ESTIMATEN3_FREP, &frep); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2566 GetCtrlVal(panel, ESTIMATEN3_WAVELENGTH, &wl); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2567 N = round(299792458.0 / wl / 1e-9 / frep); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2568 SetCtrlVal(panel, ESTIMATEN3_N, N); |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2569 break; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2570 } |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2571 return 0; |
9cadd12e7722
Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
14
diff
changeset
|
2572 } |
30
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2573 |
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2574 int CVICALLBACK CB_SetSlope (int panel, int control, int event, |
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2575 void *callbackData, int eventData1, int eventData2) |
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2576 { |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2577 double frequency; |
30
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2578 |
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2579 switch (event) |
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2580 { |
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2581 case EVENT_COMMIT: |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2582 GetCtrlVal(panel, control, &SlopeMath2); |
30
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2583 frequency = DDSFox_ReadFreq(&DDS1xAD9956); |
35
914e0f16b19a
Update displayed dedrifting slope when it is modified and not at each timer tick
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
34
diff
changeset
|
2584 DDSFox_Set(&DDS1xAD9956, frequency, SlopeMath2); |
30
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2585 break; |
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2586 } |
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2587 return 0; |
56095062acd4
Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
29
diff
changeset
|
2588 } |