annotate FXAnalyse.c @ 170:a4fcebb5941b

Make data folder configurable in configuration file
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Fri, 14 Feb 2014 16:58:19 +0100
parents 97112b45b838
children d96f0b04f7fe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
119
f9fb17fb64cc Add Sr frequency logging to disk and to Sr data logger
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 118
diff changeset
1 #include <tcpsupp.h>
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
2 #include <utility.h>
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
3 #include <ansi_c.h>
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
4 #include <cvirte.h>
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
5 #include <userint.h>
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
6 #include <formatio.h>
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
7 #include <inifile.h>
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
8 #include <string.h>
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
9
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
10 #include "FXAnalyse.h"
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
11 #include "Plot.h"
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
12 #include "Allan.h"
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
13 #include "DDS4xAD9912.h"
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
14 #include "DDS_Fox.h"
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
15 #include "muParserDLL.h"
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
16 #include "utils.h"
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
17 #include "stat.h"
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
18 #include "future.h"
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
19 #include "data-provider.h"
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
20 #include "sr-data-logger.h"
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
21 #include "config.h"
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
22 #include "logging.h"
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
23
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
24
109
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
25 #define FREP_STEP_SIZE 50000.0
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
26 #define SPEED_OF_LIGHT 299792458.0 // m/s
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
27 #define SR_WAVELENGTH 698.4460 // nm
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
28 #define HG_WAVELENGTH 1062.4000 // nm
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
29
170
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
30 // select which data provider to use
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
31 #ifdef NDEBUG
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
32 #define DataProvider KKDataProvider
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
33 #else
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
34 #define DataProvider FakeDataProvider
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
35 #endif
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
36
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
37
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
38 // data acquisition status
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
39 int acquiring;
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
40 // data queue
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
41 CmtTSQHandle dataQueue;
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
42 // data provider thread
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
43 CmtThreadFunctionID dataProviderThread;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
44
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
45
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
46 struct event event;
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
47 double utc;
37
5e81800fe354 Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 35
diff changeset
48 double Ch1, Ch2, Ch3, Ch4;
5e81800fe354 Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 35
diff changeset
49 double Math1, Math2, Math3, Math4, Math5;
135
77539f2597b1 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 134
diff changeset
50 double N1, N2, N3;
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
51 double Ndiv = 8.0;
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
52 double Sign1 = 1.0, Sign2 = 1.0, Sign3 = 0.0;
168
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
53 void *MathParser1, *MathParser2, *MathParser3, *MathParser4, *MathParser5;
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
54
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
55
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
56 // panels
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
57 static int MainPanel;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
58 static int CalcNPanel;
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
59 static int EstimateNPanel;
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
60
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
61
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
62 struct adev {
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
63 Allan_Data allan;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
64 double *data;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
65 const char *title;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
66 double normalization;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
67 int control;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
68 };
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
69
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
70
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
71 #define ADEV(__channel, __normalization) \
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
72 { \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
73 .data = & ## __channel, \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
74 .title = #__channel, \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
75 .normalization = __normalization, \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
76 .control = PANEL_ADEV_ ## __channel \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
77 }
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
78
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
79
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
80 static int adev_toggle(struct adev *adev)
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
81 {
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
82 if (adev->allan.active)
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
83 Allan_ClosePanel(&(adev->allan));
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
84 else
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
85 Allan_InitPanel(&(adev->allan), adev->title,
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
86 adev->normalization, MainPanel, adev->control);
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
87 return adev->allan.active;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
88 }
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
89
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
90
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
91 static inline void adev_update(struct adev *adev)
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
92 {
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
93 if (adev->allan.active)
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
94 Allan_AddFrequency(&(adev->allan), *(adev->data));
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
95 }
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
96
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
97
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
98 struct adev adevs[] = {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
99 ADEV(Ch1, 1.84e12),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
100 ADEV(Ch2, 10.0e3),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
101 ADEV(Ch3, 429.228e12),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
102 ADEV(Ch4, 275.0e3),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
103 ADEV(Math1, 250.0e6),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
104 ADEV(Math2, 194.395e12),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
105 ADEV(Math3, 282.143e12),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
106 ADEV(Math4, 429.228e12),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
107 ADEV(Math5, 1.0),
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
108 { NULL }
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
109 };
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
110
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
111
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
112 struct plot {
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
113 Plot_Data plot;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
114 double *data;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
115 const char *title;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
116 double min;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
117 double max;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
118 int control;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
119 };
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
120
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
121
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
122 #define PLOT(__channel, __min, __max) \
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
123 { \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
124 .data = & ## __channel, \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
125 .title = #__channel, \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
126 .min = __min, \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
127 .max = __max, \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
128 .control = PANEL_PLOT_ ## __channel \
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
129 }
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
130
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
131
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
132 static int plot_toggle(struct plot *plot)
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
133 {
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
134 if (plot->plot.active)
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
135 Plot_ClosePanel(&(plot->plot));
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
136 else
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
137 Plot_InitPanel(&(plot->plot), plot->title,
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
138 plot->min, plot->max, MainPanel, plot->control);
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
139 return plot->plot.active;
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
140 }
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
141
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
142
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
143 static inline void plot_update(struct plot *plot)
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
144 {
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
145 if (plot->plot.active)
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
146 Plot_AddFrequency(&(plot->plot), *(plot->data));
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
147 }
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
148
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
149 struct plot plots[] = {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
150 PLOT(Ch1, 54.999e6, 55.001e6),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
151 PLOT(Ch2, 0.0, 0.0),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
152 PLOT(Ch3, 0.0, 0.0),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
153 PLOT(Ch4, 0.0, 0.0),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
154 PLOT(Math1, 0.0, 0.0),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
155 PLOT(Math2, 0.0, 0.0),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
156 PLOT(Math3, 0.0, 0.0),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
157 PLOT(Math4, 0.0, 0.0),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
158 PLOT(Math5, 0.0, 0.0),
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
159 { NULL }
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
160 };
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
161
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
162
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
163 // dedrift DDS
29
585c60175bd5 Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 28
diff changeset
164 DDSParameter DDS1xAD9956;
585c60175bd5 Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 28
diff changeset
165 // 4xAD9912 DDS box
585c60175bd5 Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 28
diff changeset
166 DDS4xAD9912_Data DDS4xAD9912;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
167
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
168
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
169 enum {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
170 LO = 1,
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
171 HG = 2,
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
172 SR = 4,
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
173 };
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
174
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
175 enum {
26
4bb197635664 Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 25
diff changeset
176 N_MEASUREMENT_NONE,
4bb197635664 Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 25
diff changeset
177 N_MEASUREMENT_INIT,
4bb197635664 Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 25
diff changeset
178 N_MEASUREMENT_SLOPE,
4bb197635664 Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 25
diff changeset
179 N_MEASUREMENT_ADJUST_FREQ_PLUS,
4bb197635664 Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 25
diff changeset
180 N_MEASUREMENT_FREP_PLUS,
4bb197635664 Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 25
diff changeset
181 N_MEASUREMENT_ADJUST_FREQ_MINUS,
4bb197635664 Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 25
diff changeset
182 N_MEASUREMENT_FREP_MINUS,
4bb197635664 Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 25
diff changeset
183 };
4bb197635664 Cleanup N1 measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 25
diff changeset
184
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
185 int Measuring_1 = N_MEASUREMENT_NONE;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
186 int Measuring_2 = N_MEASUREMENT_NONE;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
187 int Measuring_3 = N_MEASUREMENT_NONE;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
188
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
189 int nobs = 0;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
190 int settling = 0;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
191
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
192 double f0_DDS1 = 110000000.0, f0_DDS2, f0_DDS3, df_DDS3;
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
193
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
194 double SlopeTime1=40.0, DeltaT_1=20.0, delta_f_lock_1=500.0;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
195 double SlopeTime2=40.0, DeltaT_2=20.0, delta_f_lock_2=500.0;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
196 double SlopeTime3=40.0, DeltaT_3=20.0, delta_f_lock_3=500.0;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
197
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
198 double t1, t2, t3;
156
4ab8099a18e2 Add beatnote frequency drift correction to N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 155
diff changeset
199 double f_rep_slope, f_beat_slope;
115
23f8b7b2b63a Use DDS1 to change frep in the measurement of N3. Improve some variable names
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 114
diff changeset
200 double f_rep_plus, f_rep_minus;
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
201 double f_beat_plus, f_beat_minus;
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
202 double N_measured;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
203
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
204 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
205 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
206 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
207
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
208 int Getsign1=FALSE,Getsign2=FALSE,Getsign3=FALSE;
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
209
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
210 struct stat stat_math1, stat_ch2, stat_ch3, freq;
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
211 struct rollmean rollmean_ch1, rollmean_ch2, rollmean_ch3, rollmean_ch4;
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
212
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
213
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
214 // dedrift
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
215 enum {
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
216 DEDRIFT_REFERENCE_MICROWAVE = 0,
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
217 DEDRIFT_REFERENCE_HG = 1,
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
218 };
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
219
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
220 struct dedrift {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
221 int enabled; // dedrift enabled
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
222 int reference; // reference frequency
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
223 int invert; // invert applied slope sign
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
224 int doubleslope; // double applied slope
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
225 int keep_freq; // keep current frequency value when dedrift is disabled
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
226 int keep_slope; // keep current slope value when dedrift is disabled
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
227 double freq0; // DDS center frequency
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
228 double threshold; // maximum allowed frequency change
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
229 double applied; // currently applied slope
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
230 double interval; // measurement duration
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
231 double t0; // beginning of currrent measurement interval
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
232 };
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
233
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
234 struct dedrift dedrift = {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
235 .enabled = FALSE,
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
236 .reference = DEDRIFT_REFERENCE_MICROWAVE,
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
237 .invert = FALSE,
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
238 .doubleslope = FALSE,
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
239 .keep_freq = TRUE,
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
240 .keep_slope = TRUE,
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
241 .freq0 = 70e6,
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
242 .threshold = 100.0,
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
243 .applied = 0.0,
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
244 .interval = 30.0,
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
245 .t0 = 0.0
2
bd7501b65f56 Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 1
diff changeset
246 };
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
247
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
248
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
249 // recenter
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
250 struct recenter {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
251 int enabled; // recenter enabled
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
252 int lo; // recenter microwave beatnote
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
253 int sr; // recenter Sr beatnote
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
254 int hg; // recenter Hg beatnote
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
255 double interval; // interval
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
256 double t0; // beginning of current interval
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
257 };
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
258
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
259 struct recenter recenter = {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
260 .enabled = FALSE,
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
261 .lo = FALSE,
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
262 .sr = FALSE,
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
263 .hg = FALSE,
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
264 .interval = 1800.0,
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
265 .t0 = 0.0
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
266 };
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
267
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
268
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
269 // data loggging
170
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
270 static char *datafolder;
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
271
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
272 struct datafile {
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
273 char *name;
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
274 double *data;
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
275 int nchan;
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
276 int control;
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
277 int write;
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
278 };
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
279
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
280 #define DATAFILE(__name, __data, __nchan, __control, __write) \
168
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
281 { \
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
282 .name = __name, \
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
283 .data = __data, \
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
284 .nchan = __nchan, \
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
285 .control = __control, \
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
286 .write = __write \
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
287 }
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
288
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
289 struct datafile datafiles[] = {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
290 DATAFILE("Raw", event.data, 4, PANEL_SAVE_RAW, TRUE),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
291 DATAFILE("DDS", DDS4xAD9912.frequency, 4, PANEL_SAVE_DDS, FALSE),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
292 DATAFILE("Lo", &Math2, 1, PANEL_SAVE_LO, FALSE),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
293 DATAFILE("Hg", &Math3, 1, PANEL_SAVE_HG, FALSE),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
294 DATAFILE("Sr", &Math4, 1, PANEL_SAVE_SR, FALSE),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
295 DATAFILE("Ex", &Math5, 1, PANEL_SAVE_EXTRA, FALSE),
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
296 { NULL, }
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
297 };
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
298
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
299
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
300 static void write_data(const char *folder, const char *name, const char *id,
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
301 const char *timestr, double utc, double *v, int nchan)
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
302 {
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
303 char line[1024];
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
304 char filename[FILENAME_MAX];
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
305
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
306 // construct filename in the form folder\\id-name.txt
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
307 snprintf(filename, sizeof(filename), "%s\\%s-%s.txt", folder, id, name);
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
308
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
309 int fd = OpenFile(filename, VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII);
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
310 switch (nchan)
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
311 {
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
312 case 1:
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
313 Fmt(line, "%s\t%f[p3]\t%f[p3]",
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
314 timestr, utc, v[0]);
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
315 break;
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
316 case 4:
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
317 Fmt(line, "%s\t%f[p3]\t%f[p3]\t%f[p3]\t%f[p3]\t%f[p3]",
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
318 timestr, utc, v[0], v[1], v[2], v[3]);
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
319 break;
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
320 default:
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
321 strcpy(line, "?");
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
322 }
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
323 WriteLine(fd, line, -1);
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
324 CloseFile(fd);
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
325 }
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
326
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
327
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
328 static inline void datafile_append(struct datafile *d, char *id, char *timestr)
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
329 {
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
330 if (d->write)
170
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
331 write_data(datafolder, d->name, id, timestr, utc, d->data, d->nchan);
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
332 }
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
333
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
334
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
335 static struct datalogger datalogger;
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
336
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
337
168
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
338 void * muParserNew()
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
339 {
168
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
340 void *parser = mupCreate();
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
341
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
342 mupDefineOprtChars(parser, "abcdefghijklmnopqrstuvwxyzµ"
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
343 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
344 "+-*^/?<>=#!$%&|~'_");
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
345
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
346 mupDefineVar(parser, "Ch1", &Ch1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
347 mupDefineVar(parser, "Ch2", &Ch2);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
348 mupDefineVar(parser, "Ch3", &Ch3);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
349 mupDefineVar(parser, "Ch4", &Ch4);
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
350 mupDefineVar(parser, "DDS1", &(DDS4xAD9912.frequency[0]));
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
351 mupDefineVar(parser, "DDS2", &(DDS4xAD9912.frequency[1]));
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
352 mupDefineVar(parser, "DDS3", &(DDS4xAD9912.frequency[2]));
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
353 mupDefineVar(parser, "DDS4", &(DDS4xAD9912.frequency[3]));
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
354 mupDefineVar(parser, "N1", &N1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
355 mupDefineVar(parser, "N2", &N2);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
356 mupDefineVar(parser, "N3", &N3);
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
357 mupDefineVar(parser, "Sign1", &Sign1);
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
358 mupDefineVar(parser, "Sign2", &Sign2);
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
359 mupDefineVar(parser, "Sign3", &Sign3);
109
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
360 mupDefineVar(parser, "Ndiv", &Ndiv);
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
361 mupDefinePostfixOprt(parser, "P", &Peta, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
362 mupDefinePostfixOprt(parser, "T", &Tera, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
363 mupDefinePostfixOprt(parser, "G", &Giga, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
364 mupDefinePostfixOprt(parser, "M", &Mega, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
365 mupDefinePostfixOprt(parser, "k", &kilo, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
366 mupDefinePostfixOprt(parser, "m", &milli, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
367 mupDefinePostfixOprt(parser, "u", &micro, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
368 mupDefinePostfixOprt(parser, "µ", &micro, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
369 mupDefinePostfixOprt(parser, "n", &nano, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
370 mupDefinePostfixOprt(parser, "p", &pico, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
371 mupDefinePostfixOprt(parser, "f", &femto, 1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
372
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
373 return parser;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
374 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
375
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
376
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
377 void CVICALLBACK DataAvailableCB (CmtTSQHandle queueHandle, unsigned int event,
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
378 int value, void *callbackData);
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
379
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
380
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
381 int main (int argc, char *argv[])
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
382 {
164
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
383 int rv;
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
384 double frequency;
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
385 char expr[1024];
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
386
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
387 if ((MainPanel = LoadPanel (0, "FXAnalyse.uir", PANEL)) < 0)
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
388 return -1;
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
389 if ((CalcNPanel = LoadPanel (MainPanel, "FXAnalyse.uir", CALCN)) < 0)
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
390 return -1;
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
391 if ((EstimateNPanel = LoadPanel (MainPanel, "FXAnalyse.uir", ESTIMATEN)) < 0)
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
392 return -1;
164
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
393
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
394 // logging
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
395 logger_init();
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
396
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
397 // load configuration file
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
398 char path[MAX_PATHNAME_LEN];
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
399 GetIniFilePath(path);
164
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
400 IniText configuration = Ini_New(TRUE);
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
401 Ini_ReadFromFile(configuration, path);
164
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
402
170
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
403 // data folder
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
404 rv = Ini_GetStringCopy(configuration, "data", "folder", &datafolder);
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
405 if (rv <= 0) {
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
406 logmessage(ERROR, "data folder not configured in %s", path);
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
407 // do not allow to start the acquisition
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
408 SetCtrlAttribute(MainPanel, PANEL_STARTBUTTON, ATTR_DIMMED, TRUE);
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
409 }
a4fcebb5941b Make data folder configurable in configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 169
diff changeset
410
164
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
411 // get AD9956 configuration parameters
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
412 char host[256];
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
413 int port;
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
414 double clock;
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
415 rv = Ini_GetStringIntoBuffer(configuration, "AD9956", "host", host, sizeof(host));
164
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
416 if (! rv)
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
417 return -1;
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
418 rv = Ini_GetInt(configuration, "AD9956", "port", &port);
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
419 if (! rv)
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
420 return -1;
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
421 rv = Ini_GetDouble(configuration, "AD9956", "clock", &clock);
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
422 if (! rv)
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
423 return -1;
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
424
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
425 // dispose configuration
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
426 Ini_Dispose(configuration);
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
427
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
428 // Sr data logger
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
429 sr_datalogger_init(&datalogger);
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
430
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
431 // dedrift DDS
164
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
432 DDSFox_Initialize(&DDS1xAD9956, host, port, dedrift.freq0);
211ea3950310 Read AD9956 configuration from configuration file
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 162
diff changeset
433
29
585c60175bd5 Cleanup AD9956 DDS parameters setting code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 28
diff changeset
434 // initialize 4x AD9959 DDS box
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
435 DDS4xAD9912_Reset(&DDS4xAD9912);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
436 GetCtrlVal(MainPanel, PANEL_DDS1, &frequency);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
437 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, frequency);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
438 GetCtrlVal(MainPanel, PANEL_DDS2, &frequency);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
439 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
440 GetCtrlVal(MainPanel, PANEL_DDS3, &frequency);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
441 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
442 GetCtrlVal(MainPanel, PANEL_DDS4, &frequency);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
443 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
444
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
445 GetCtrlVal(MainPanel, PANEL_N1CHOICE, &N1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
446 GetCtrlVal(MainPanel, PANEL_N2CHOICE, &N2);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
447 GetCtrlVal(MainPanel, PANEL_N3CHOICE, &N3);
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
448
168
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
449 MathParser1 = muParserNew();
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
450 GetCtrlVal(MainPanel, PANEL_MATHSTRING1, expr);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
451 mupSetExpr(MathParser1, expr);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
452
168
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
453 MathParser2 = muParserNew();
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
454 mupDefineVar(MathParser2, "Math1", &Math1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
455 GetCtrlVal(MainPanel, PANEL_MATHSTRING2, expr);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
456 mupSetExpr(MathParser2, expr);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
457
168
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
458 MathParser3 = muParserNew();
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
459 mupDefineVar(MathParser3, "Math1", &Math1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
460 mupDefineVar(MathParser3, "Math2", &Math2);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
461 GetCtrlVal(MainPanel, PANEL_MATHSTRING3, expr);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
462 mupSetExpr(MathParser3, expr);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
463
168
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
464 MathParser4 = muParserNew();
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
465 mupDefineVar(MathParser4, "Math1", &Math1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
466 mupDefineVar(MathParser4, "Math2", &Math2);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
467 mupDefineVar(MathParser4, "Math3", &Math3);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
468 GetCtrlVal(MainPanel, PANEL_MATHSTRING4, expr);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
469 mupSetExpr(MathParser4, expr);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
470
168
4de7f2c9f328 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 166
diff changeset
471 MathParser5 = muParserNew();
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
472 mupDefineVar(MathParser5, "Math1", &Math1);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
473 mupDefineVar(MathParser5, "Math2", &Math2);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
474 mupDefineVar(MathParser5, "Math3", &Math3);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
475 mupDefineVar(MathParser5, "Math4", &Math4);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
476 GetCtrlVal(MainPanel, PANEL_MATHSTRING5, expr);
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
477 mupSetExpr(MathParser5, expr);
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
478
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
479 // data queue
91
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
480 CmtNewTSQ(128, sizeof(struct event), 0, &dataQueue);
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
481
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
482 // register callback to execute when data will be in the data queue
91
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
483 CmtInstallTSQCallback(dataQueue, EVENT_TSQ_ITEMS_IN_QUEUE, 1,
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
484 DataAvailableCB, NULL, CmtGetCurrentThreadID(), NULL);
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
485
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
486 DisplayPanel(MainPanel);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
487
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
488 RunUserInterface();
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
489
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
490 DiscardPanel(MainPanel);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
491 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
492 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
493
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
494 int CVICALLBACK QuitCallback (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
495 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
496 {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
497 switch (event)
40
50544ecfcfc7 Handle application quit just once
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 39
diff changeset
498 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
499 case EVENT_COMMIT:
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
500 QuitUserInterface(0);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
501 break;
40
50544ecfcfc7 Handle application quit just once
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 39
diff changeset
502 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
503 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
504 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
505
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
506 int CVICALLBACK CB_OnEventMain(int panel, int event,
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
507 void *callbackData, int eventData1, int eventData2)
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
508 {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
509 int control, index;
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
510 double step;
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
511
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
512 #define do_arrow(__DDS, __STEP) \
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
513 do { \
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
514 GetCtrlIndex(panel, __STEP, &index); \
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
515 if ((eventData1 == VAL_RIGHT_ARROW_VKEY) && (index < 14)) \
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
516 SetCtrlIndex(panel, __STEP, index + 1); \
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
517 if ((eventData1 == VAL_LEFT_ARROW_VKEY) && (index > 0)) \
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
518 SetCtrlIndex(panel, __STEP, index - 1); \
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
519 GetCtrlVal(panel, __STEP, &step); \
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
520 SetCtrlAttribute(panel, __DDS, ATTR_INCR_VALUE, step); \
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
521 } while (0)
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
522
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
523 switch (event) {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
524 case EVENT_KEYPRESS:
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
525 /* key code */
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
526 switch (eventData1) {
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
527 case VAL_RIGHT_ARROW_VKEY:
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
528 case VAL_LEFT_ARROW_VKEY:
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
529 control = GetActiveCtrl(panel);
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
530 switch (control) {
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
531 case PANEL_DDS1:
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
532 case PANEL_DDS1STEP:
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
533 do_arrow(PANEL_DDS1, PANEL_DDS1STEP);
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
534 break;
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
535 case PANEL_DDS2:
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
536 case PANEL_DDS2STEP:
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
537 do_arrow(PANEL_DDS2, PANEL_DDS2STEP);
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
538 break;
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
539 case PANEL_DDS3:
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
540 case PANEL_DDS3STEP:
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
541 do_arrow(PANEL_DDS3, PANEL_DDS3STEP);
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
542 break;
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
543 case PANEL_DDS4:
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
544 case PANEL_DDS4STEP:
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
545 do_arrow(PANEL_DDS4, PANEL_DDS4STEP);
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
546 break;
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
547 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
548 break;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
549 case VAL_F2_VKEY :
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
550 SetActiveCtrl(panel, PANEL_DDS1);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
551 break;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
552 case VAL_F3_VKEY :
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
553 SetActiveCtrl(panel, PANEL_DDS2);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
554 break;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
555 case VAL_F4_VKEY :
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
556 SetActiveCtrl(panel, PANEL_DDS3);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
557 break;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
558 case VAL_F5_VKEY :
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
559 SetActiveCtrl(panel, PANEL_DDS4);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
560 break;
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
561 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
562 break;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
563 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
564 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
565 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
566
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
567 int CVICALLBACK CB_OnStart (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
568 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
569 {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
570 switch (event)
20
3a7f088d4960 Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 17
diff changeset
571 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
572 case EVENT_COMMIT:
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
573 if (acquiring)
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
574 break;
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
575
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
576 logmsg("start");
105
29b1aa89a34c Disable the Start button when data acquisition thread is running
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 97
diff changeset
577 SetCtrlAttribute(panel, PANEL_STARTBUTTON, ATTR_DIMMED, TRUE);
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
578 acquiring = 1;
82
47860259afe2 Implement logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 80
diff changeset
579
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
580 // start data provider thread
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
581 CmtScheduleThreadPoolFunctionAdv(
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
582 DEFAULT_THREAD_POOL_HANDLE, DataProvider, NULL,
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
583 THREAD_PRIORITY_HIGHEST, NULL, 0, NULL, 0, &dataProviderThread);
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
584
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
585 break;
82
47860259afe2 Implement logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 80
diff changeset
586 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
587 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
588 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
589
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
590 int CVICALLBACK CB_OnStop (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
591 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
592 {
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
593 switch (event) {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
594 case EVENT_COMMIT:
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
595 if (! acquiring)
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
596 break;
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
597
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
598 logmsg("stop");
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
599 acquiring = 0;
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
600
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
601 // wait for data provider thread to terminate
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
602 CmtWaitForThreadPoolFunctionCompletion(
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
603 DEFAULT_THREAD_POOL_HANDLE, dataProviderThread,
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
604 OPT_TP_PROCESS_EVENTS_WHILE_WAITING);
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
605 CmtReleaseThreadPoolFunctionID(
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
606 DEFAULT_THREAD_POOL_HANDLE, dataProviderThread);
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
607
105
29b1aa89a34c Disable the Start button when data acquisition thread is running
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 97
diff changeset
608 SetCtrlAttribute(panel, PANEL_STARTBUTTON, ATTR_DIMMED, FALSE);
29b1aa89a34c Disable the Start button when data acquisition thread is running
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 97
diff changeset
609
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
610 break;
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
611 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
612 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
613 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
614
91
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
615 void CVICALLBACK DataAvailableCB (CmtTSQHandle queueHandle, unsigned int ev,
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
616 int value, void *callbackData)
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
617 {
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
618 int read;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
619
91
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
620 switch (ev) {
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
621 case EVENT_TSQ_ITEMS_IN_QUEUE:
124
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
622 // read data from the data queue
91
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
623 while (value > 0) {
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
624
91
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
625 read = CmtReadTSQData(queueHandle, &event, 1, TSQ_INFINITE_TIMEOUT, 0);
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
626 if (read != 1)
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
627 logmsg("Error!");
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
628 value = value - read;
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
629
91
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
630 utc = event.time.tv_sec + event.time.tv_usec * 1e-6;
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
631 Ch1 = event.data[0];
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
632 Ch2 = event.data[1];
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
633 Ch3 = event.data[2];
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
634 Ch4 = event.data[3];
124
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
635
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
636 // update display
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
637 SetCtrlVal(MainPanel, PANEL_UTC, utc);
124
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
638 SetCtrlVal(MainPanel, PANEL_CH1, Ch1);
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
639 SetCtrlVal(MainPanel, PANEL_CH2, Ch2);
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
640 SetCtrlVal(MainPanel, PANEL_CH3, Ch3);
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
641 SetCtrlVal(MainPanel, PANEL_CH4, Ch4);
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
642
124
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
643 // compute
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
644 Math1 = mupEval(MathParser1);
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
645 Math2 = mupEval(MathParser2);
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
646 Math3 = mupEval(MathParser3);
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
647 Math4 = mupEval(MathParser4);
124
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
648 Math5 = mupEval(MathParser5);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
649
124
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
650 // update display. numeric controllers do not format values
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
651 // with a thousands separator: use string controllers and a
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
652 // custom formatting function
bdfc61a8ebee Add thousands separator to important numeric displays
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 123
diff changeset
653 char buffer[256];
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
654 SetCtrlVal(MainPanel, PANEL_MATH1, thousands(buffer, sizeof(buffer), "%.6f", Math1));
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
655 SetCtrlVal(MainPanel, PANEL_MATH2, thousands(buffer, sizeof(buffer), "%.3f", Math2));
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
656 SetCtrlVal(MainPanel, PANEL_MATH3, thousands(buffer, sizeof(buffer), "%.3f", Math3));
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
657 SetCtrlVal(MainPanel, PANEL_MATH4, thousands(buffer, sizeof(buffer), "%.3f", Math4));
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
658 SetCtrlVal(MainPanel, PANEL_MATH5, thousands(buffer, sizeof(buffer), "%.3f", Math5));
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
659
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
660 // update timeseries plots
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
661 for (struct plot *plot = plots; plot->data; plot++)
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
662 plot_update(plot);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
663
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
664 // update allan deviation plots
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
665 for (struct adev *adev = adevs; adev->data; adev++)
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
666 adev_update(adev);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
667
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
668 // N measurement
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
669
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
670 switch (Measuring_1) {
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
671
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
672 case N_MEASUREMENT_NONE:
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
673 // not measuring
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
674 break;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
675
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
676 case N_MEASUREMENT_INIT:
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
677 // initialization step
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
678
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
679 // set DDS1 to nominal frequency
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
680 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
681
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
682 // record current DDS frequencies
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
683 f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2);
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
684
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
685 t1 = utc;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
686 t2 = t3 = 0.0;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
687 nobs = 0;
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
688 stat_zero(&stat_math1);
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
689 f_rep_plus = f_rep_minus = 0.0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
690
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
691 // next step
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
692 Measuring_1 += 1;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
693 break;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
694
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
695 case N_MEASUREMENT_SLOPE:
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
696 // slope measurement
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
697
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
698 stat_accumulate(&stat_math1, Math1);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
699
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
700 if ((utc - t1) > SlopeTime1) {
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
701 f_rep_slope = stat_math1.slope;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
702
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
703 // frep positive step
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
704 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + delta_f_lock_1, FREP_STEP_SIZE);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
705
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
706 // allow counter to settle
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
707 settling = 3;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
708
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
709 // next step
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
710 Measuring_1 += 1;
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
711 }
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
712 break;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
713
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
714 case N_MEASUREMENT_ADJUST_FREQ_PLUS:
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
715 case N_MEASUREMENT_ADJUST_FREQ_MINUS:
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
716 // adjust DDS frequency to keep beatnote within the bandpass filter
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
717
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
718 if (settling-- > 0)
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
719 break;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
720
118
43b35f4aae78 Fix N3 measurement. Simply frequnecy ramping functions.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 117
diff changeset
721 double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2);
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
722 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2 + 275000 - Ch4);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
723
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
724 // allow counter to settle
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
725 settling = 3;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
726
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
727 // next step
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
728 Measuring_1 += 1;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
729 break;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
730
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
731 case N_MEASUREMENT_FREP_PLUS:
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
732 // frep positive step
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
733
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
734 if (settling-- > 0)
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
735 break;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
736
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
737 if (t2 == 0.0)
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
738 t2 = utc;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
739
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
740 f_rep_plus += Math1 - f_rep_slope * (utc - t2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
741 nobs += 1;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
742
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
743 if ((utc - t2) > DeltaT_1) {
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
744 f_rep_plus = f_rep_plus / nobs;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
745 nobs = 0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
746
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
747 // frep negative step
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
748 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - delta_f_lock_1, FREP_STEP_SIZE);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
749
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
750 // allow counter to settle
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
751 settling = 3;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
752
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
753 // next step
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
754 Measuring_1 += 1;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
755 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
756 break;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
757
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
758 case N_MEASUREMENT_FREP_MINUS:
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
759 // frep negative step
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
760
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
761 if (settling-- > 0)
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
762 break;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
763
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
764 if (t3 == 0.0)
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
765 t3 = utc;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
766
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
767 f_rep_minus += Math1 - f_rep_slope * (utc - t2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
768 nobs += 1;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
769
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
770 if ((utc - t3) > DeltaT_1) {
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
771 f_rep_minus = f_rep_minus / nobs;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
772 nobs = 0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
773
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
774 // compute N1
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
775 double delta_f_rep = f_rep_minus - f_rep_plus;
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
776 N_measured = Sign1 * 2 * Ndiv * delta_f_lock_1 / delta_f_rep;
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
777 SetCtrlVal(CalcNPanel, CALCN_N, N_measured);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
778
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
779 // back to nominal frep
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
780 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
781 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
782
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
783 // done
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
784 Measuring_1 = N_MEASUREMENT_NONE;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
785 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
786 break;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
787 }
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
788
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
789 switch (Measuring_2) {
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
790
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
791 case N_MEASUREMENT_NONE:
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
792 // not measuring
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
793 break;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
794
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
795 case N_MEASUREMENT_INIT:
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
796 // initialization step
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
797
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
798 // set DDS1 to nominal frequency
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
799 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
800
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
801 // record current DDS frequencies
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
802 f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
803 f0_DDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3);
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
804
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
805 t1 = utc;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
806 t2 = t3 = 0.0;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
807 nobs = 0;
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
808 stat_zero(&stat_math1);
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
809 stat_zero(&stat_ch2);
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
810 f_rep_plus = f_rep_minus = 0.0;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
811 f_beat_plus = f_beat_minus = 0.0;
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
812
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
813 // next step
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
814 Measuring_2 += 1;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
815 break;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
816
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
817 case N_MEASUREMENT_SLOPE:
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
818 // slope measurement
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
819
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
820 stat_accumulate(&stat_math1, Math1);
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
821 stat_accumulate(&stat_ch2, Ch2);
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
822
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
823 if ((utc - t1) > SlopeTime2) {
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
824 f_rep_slope = stat_math1.slope;
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
825 f_beat_slope = stat_ch2.slope;
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
826
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
827 // frep positive step
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
828 double fDDS1 = f0_DDS1 + delta_f_lock_2;
118
43b35f4aae78 Fix N3 measurement. Simply frequnecy ramping functions.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 117
diff changeset
829 DDS4xAD9912_RampFrequency(&DDS4xAD9912,1, fDDS1, FREP_STEP_SIZE);
62
53dbce5f0745 Further simplification
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 61
diff changeset
830
61
37075b60408b Fix N2 measurement after cleanup. Further simplification
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 60
diff changeset
831 // adjust DDS3 to keep beatnote within the bandpass filter. prediction
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
832 double fDDS3 = f0_DDS3 + Sign1 * Sign2 * N2/N1 * Ndiv * delta_f_lock_2;
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
833 df_DDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3);
62
53dbce5f0745 Further simplification
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 61
diff changeset
834 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
835
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
836 // allow counter to settle
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
837 settling = 3;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
838
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
839 // next step
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
840 Measuring_2 += 1;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
841 }
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
842 break;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
843
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
844 case N_MEASUREMENT_ADJUST_FREQ_PLUS:
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
845 case N_MEASUREMENT_ADJUST_FREQ_MINUS:
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
846 // adjust DDS frequency to keep beatnote within the bandpass filter
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
847
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
848 if (settling-- > 0)
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
849 break;
61
37075b60408b Fix N2 measurement after cleanup. Further simplification
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 60
diff changeset
850
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
851 double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4;
61
37075b60408b Fix N2 measurement after cleanup. Further simplification
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 60
diff changeset
852 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2);
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
853
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
854 double fDDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3) + 10000 - Ch2;
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
855 df_DDS3 = df_DDS3 + 10000 - Ch2;
61
37075b60408b Fix N2 measurement after cleanup. Further simplification
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 60
diff changeset
856 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
857
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
858 // allow counter to settle
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
859 settling = 3;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
860
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
861 // next step
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
862 Measuring_2 += 1;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
863 break;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
864
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
865 case N_MEASUREMENT_FREP_PLUS:
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
866 // frep positive step
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
867
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
868 if (settling-- > 0)
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
869 break;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
870
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
871 if (t2 == 0.0)
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
872 t2 = utc;
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
873
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
874 f_rep_plus += Math1 + 250000000 - f_rep_slope * (utc - t2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
875 f_beat_plus += Ch2 - f_beat_slope * (utc - t2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
876 nobs += 1;
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
877
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
878 if ((utc - t2) > DeltaT_2) {
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
879 f_rep_plus = f_rep_plus / nobs;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
880 f_beat_plus = f_beat_plus / nobs;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
881 nobs = 0;
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
882
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
883 // negative frequency step
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
884 double fDDS1 = f0_DDS1 - delta_f_lock_2;
118
43b35f4aae78 Fix N3 measurement. Simply frequnecy ramping functions.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 117
diff changeset
885 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, fDDS1, FREP_STEP_SIZE);
62
53dbce5f0745 Further simplification
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 61
diff changeset
886
53dbce5f0745 Further simplification
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 61
diff changeset
887 // adjust DDS3 to keep beatnote within the bandpass filter. prediction
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
888 double fDDS3 = f0_DDS3 - Sign1 * Sign2 * N2/N1 * Ndiv * delta_f_lock_2;
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
889 df_DDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3);
61
37075b60408b Fix N2 measurement after cleanup. Further simplification
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 60
diff changeset
890 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
891
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
892 // allow counter to settle
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
893 settling = 3;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
894
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
895 // next step
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
896 Measuring_2 += 1;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
897 }
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
898 break;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
899
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
900 case N_MEASUREMENT_FREP_MINUS:
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
901 // frep negative step
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
902
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
903 if (settling-- > 0)
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
904 break;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
905
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
906 if (t3 == 0.0)
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
907 t3 = utc;
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
908
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
909 f_rep_minus += Math1 + 250000000 - f_rep_slope * (utc - t2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
910 f_beat_minus += Ch2 + f_beat_slope * (utc - t2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
911 nobs += 1;
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
912
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
913 if ((utc -t3) > DeltaT_2) {
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
914 f_rep_minus = f_rep_minus / nobs;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
915 f_beat_minus = f_beat_minus / nobs;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
916 nobs = 0;
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
917
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
918 // compute N2
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
919 double delta_f_rep_m = f_rep_minus - f_rep_plus;
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
920 double delta_f_rep = Sign1 * Ndiv * 2.0 * delta_f_lock_3 / N1;
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
921
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
922 logmsg("delta frep: measured=%e expected=%e difference=%e",
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
923 delta_f_rep_m, delta_f_rep, delta_f_rep_m - delta_f_rep);
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
924
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
925 N_measured = -Sign2 * (df_DDS3 + f_beat_minus - f_beat_plus) / delta_f_rep;
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
926 SetCtrlVal(CalcNPanel, CALCN_N, N_measured);
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
927
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
928 // back to nominal frequency
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
929 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
930 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2);
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
931 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3);
46
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
932
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
933 // done
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
934 Measuring_2 = N_MEASUREMENT_NONE;
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
935 }
6503feae1809 Cleanup. Convert N2 measurement logic to state machine like structure
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 44
diff changeset
936 break;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
937 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
938
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
939 switch (Measuring_3) {
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
940
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
941 case N_MEASUREMENT_NONE:
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
942 // not measuring N3
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
943 break;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
944
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
945 case N_MEASUREMENT_INIT:
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
946 // init
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
947
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
948 // set DDS1 to nominal frequency
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
949 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
950
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
951 // record current DDS frequencies
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
952 f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
953 f0_DDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
954
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
955 t1 = utc;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
956 t2 = t3 = 0.0;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
957 nobs = 0;
118
43b35f4aae78 Fix N3 measurement. Simply frequnecy ramping functions.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 117
diff changeset
958 stat_zero(&stat_math1);
156
4ab8099a18e2 Add beatnote frequency drift correction to N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 155
diff changeset
959 stat_zero(&stat_ch3);
115
23f8b7b2b63a Use DDS1 to change frep in the measurement of N3. Improve some variable names
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 114
diff changeset
960 f_rep_plus = f_rep_minus = 0.0;
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
961 f_beat_plus = f_beat_minus = 0.0;
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
962
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
963 // next step
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
964 Measuring_3 += 1;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
965 break;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
966
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
967 case N_MEASUREMENT_SLOPE:
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
968 // slope measurement
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
969
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
970 if (settling-- > 0)
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
971 break;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
972
118
43b35f4aae78 Fix N3 measurement. Simply frequnecy ramping functions.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 117
diff changeset
973 stat_accumulate(&stat_math1, Math1);
156
4ab8099a18e2 Add beatnote frequency drift correction to N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 155
diff changeset
974 stat_accumulate(&stat_ch3, Ch3);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
975
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
976 if (utc - t1 > SlopeTime3) {
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
977 // slope measurement
118
43b35f4aae78 Fix N3 measurement. Simply frequnecy ramping functions.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 117
diff changeset
978 f_rep_slope = stat_math1.slope;
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
979 f_beat_slope = stat_ch3.slope;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
980
156
4ab8099a18e2 Add beatnote frequency drift correction to N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 155
diff changeset
981 logmsg("f_rep_slope=%e Hz/s", f_rep_slope);
4ab8099a18e2 Add beatnote frequency drift correction to N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 155
diff changeset
982 logmsg("f_beat_slope=%e Hz/s", f_rep_slope);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
983
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
984 // frep positive step
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
985 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + delta_f_lock_3, FREP_STEP_SIZE);
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
986
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
987 // adjust DDS3 to keep beatnote within the bandpass filter
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
988 double fDDS3 = f0_DDS3 + Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
989 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
990
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
991 // allow counter to settle
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
992 settling = 3;
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
993
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
994 // next step
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
995 Measuring_3 += 1;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
996 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
997 break;
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
998
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
999 case N_MEASUREMENT_ADJUST_FREQ_PLUS:
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1000 case N_MEASUREMENT_ADJUST_FREQ_MINUS:
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1001 // adjust DDS frequency to keep beatnote within the bandpass filter
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1002
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1003 if (settling-- > 0)
109
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
1004 break;
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
1005
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
1006 // adjust DDS frequency to keep 55 MHz tracker oscillator locked
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
1007 double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4;
109
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
1008 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2);
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
1009
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
1010 // allow counter to settle
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
1011 settling = 3;
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
1012
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1013 // next step
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1014 Measuring_3 += 1;
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1015 break;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1016
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1017 case N_MEASUREMENT_FREP_PLUS:
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1018 // frep positive step
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1019
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1020 if (settling-- > 0)
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1021 break;
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1022
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1023 if (t2 == 0.0)
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1024 t2 = utc;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1025
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1026 f_rep_plus += Math1 + 250000000 - f_rep_slope * (utc - t2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1027 f_beat_plus += Ch3 - f_beat_slope * (utc - t2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1028 nobs += 1;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1029
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1030 if (utc - t2 > DeltaT_3) {
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1031 f_rep_plus = f_rep_plus / nobs;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1032 f_beat_plus = f_beat_plus / nobs;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1033 nobs = 0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1034
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1035 // frep negative step
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1036 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - delta_f_lock_3, FREP_STEP_SIZE);
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1037
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1038 // adjust DDS3 to keep beatnote within the bandpass filter
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1039 double fDDS3 = f0_DDS3 - Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1040 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1041
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1042 // allow counter to settle
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1043 settling = 3;
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1044
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1045 // next step
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1046 Measuring_3 += 1;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1047 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1048 break;
118
43b35f4aae78 Fix N3 measurement. Simply frequnecy ramping functions.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 117
diff changeset
1049
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1050 case N_MEASUREMENT_FREP_MINUS:
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1051 // frep negative step
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1052
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1053 if (settling-- > 0)
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1054 break;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1055
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1056 if (t3 == 0.0)
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1057 t3 = utc;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1058
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1059 f_rep_minus += Math1 + 250000000 - f_rep_slope * (utc - t2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1060 f_beat_minus += Ch3 - f_beat_slope * (utc - t2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1061 nobs += 1;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1062
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1063 if (utc - t3 > DeltaT_3) {
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1064 f_rep_minus = f_rep_minus / nobs;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1065 f_beat_minus = f_beat_minus / nobs;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1066 nobs = 0;
111
8bdd7e38715f Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 109
diff changeset
1067
8bdd7e38715f Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 109
diff changeset
1068 // check delta frep
118
43b35f4aae78 Fix N3 measurement. Simply frequnecy ramping functions.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 117
diff changeset
1069 double delta_f_rep_m = f_rep_plus - f_rep_minus;
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1070 double delta_f_rep = Sign1 * Ndiv * 2.0 * delta_f_lock_3 / N1;
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1071
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1072 logmsg("delta frep: measured=%e expected=%e difference=%e",
118
43b35f4aae78 Fix N3 measurement. Simply frequnecy ramping functions.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 117
diff changeset
1073 delta_f_rep_m, delta_f_rep, delta_f_rep_m - delta_f_rep);
43b35f4aae78 Fix N3 measurement. Simply frequnecy ramping functions.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 117
diff changeset
1074
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1075 logmsg("f_beat_minus=%e", f_beat_minus);
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1076 logmsg("f_beat_plus =%e", f_beat_plus);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1077
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1078 // compute N3
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1079 double delta_f_beat = f_beat_plus - f_beat_minus + 2.0 * Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3;
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1080 double delta_f_beat_expected = delta_f_rep * N3;
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1081
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1082 logmsg("delta fbeat: measured=%e expected=%e difference=%e",
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1083 delta_f_beat, delta_f_beat_expected, delta_f_beat - delta_f_beat_expected);
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1084
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
1085 N_measured = delta_f_beat / delta_f_rep;
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
1086 SetCtrlVal(CalcNPanel, CALCN_N, N_measured);
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1087
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
1088 logmsg("measured N3=%.3f", N_measured);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1089
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1090 // back to nominal frep
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1091 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1092 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1093 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3);
47
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1094
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1095 // done
1d3cd8260cbb Uniform N3 measurement code to N1 and N2
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 46
diff changeset
1096 Measuring_3 = N_MEASUREMENT_NONE;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1097 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1098 break;
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1099 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1100
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1101 // beatnote sign determination
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1102
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1103 if (Getsign1 == TRUE) {
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1104 if (utc > tbegin1+2) {
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1105 if (Math1 > Frepbefore1)
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1106 Sign1 = -1.0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1107 else
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1108 Sign1 = +1.0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1109 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency1);
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1110 Getsign1 = FALSE;
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1111 SetCtrlVal(MainPanel, PANEL_SIGN1, Sign1);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1112 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1113 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1114 if (Getsign2 == TRUE) {
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1115 if (utc > tbegin2+2){
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1116 if (Math1 > Frepbefore2) {
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1117 if (Ch2 > Ch2before)
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1118 Sign2 = +1.0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1119 else
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1120 Sign2 = -1.0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1121 } else {
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1122 if (Ch2 > Ch2before)
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1123 Sign2 = -1.0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1124 else
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1125 Sign2 = +1.0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1126 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1127 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency2);
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1128 Getsign2 = FALSE;
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1129 SetCtrlVal(MainPanel, PANEL_SIGN2, Sign2);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1130 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1131 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1132 if (Getsign3 == TRUE) {
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1133 if (utc > tbegin3+2){
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1134 if (Ch3 > Frepbefore3)
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1135 Sign3 = -1.0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1136 else
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1137 Sign3 = +1.0;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1138 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency3);
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1139 Getsign3 = FALSE;
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
1140 SetCtrlVal(MainPanel, PANEL_SIGN3, Sign3);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1141 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1142 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1143
70
a945f2b7bef6 Fix slope measurement again
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 69
diff changeset
1144 // select reference
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1145 double f = 0.0;
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1146 switch (dedrift.reference) {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1147 case DEDRIFT_REFERENCE_MICROWAVE:
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1148 f = Math2;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1149 break;
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1150 case DEDRIFT_REFERENCE_HG:
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1151 f = Ch2 * 1062.5 / 1542.2;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1152 break;
70
a945f2b7bef6 Fix slope measurement again
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 69
diff changeset
1153 }
a945f2b7bef6 Fix slope measurement again
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 69
diff changeset
1154
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1155 // stop dedrift if the comb is not locked
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1156 if ((dedrift.enabled)
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1157 & (dedrift.threshold != 0.0)
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
1158 & (freq.previous != 0.0)
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1159 & (fabs(f - freq.previous) > dedrift.threshold)) {
56
6e73fb3d94fa Simplyfy slope measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 55
diff changeset
1160
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1161 if (! dedrift.keep_slope) {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1162 dedrift.applied = 0.0;
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1163 DDSFox_SetSweepRate(&DDS1xAD9956, dedrift.applied);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1164 SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, dedrift.applied);
70
a945f2b7bef6 Fix slope measurement again
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 69
diff changeset
1165 }
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1166 if (! dedrift.keep_freq) {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1167 DDSFox_Set(&DDS1xAD9956, dedrift.freq0, dedrift.applied);
56
6e73fb3d94fa Simplyfy slope measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 55
diff changeset
1168 }
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
1169
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
1170 stat_zero(&freq);
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
1171 SetCtrlVal(MainPanel, PANEL_SLOPE_MEASURED, freq.slope);
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1172 dedrift.enabled = FALSE;
70
a945f2b7bef6 Fix slope measurement again
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 69
diff changeset
1173 SetCtrlVal(MainPanel, PANEL_MEASURE_SLOPE, 0);
a945f2b7bef6 Fix slope measurement again
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 69
diff changeset
1174 }
a945f2b7bef6 Fix slope measurement again
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 69
diff changeset
1175
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1176 // dedrifting
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1177 if (dedrift.enabled)
70
a945f2b7bef6 Fix slope measurement again
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 69
diff changeset
1178 {
56
6e73fb3d94fa Simplyfy slope measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 55
diff changeset
1179 // update slope measurement
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1180 stat_accumulate(&freq, f);
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
1181
60
cd7b5903f168 Display measured slope
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 59
diff changeset
1182 // update indicator
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
1183 SetCtrlVal(MainPanel, PANEL_SLOPE_MEASURED, freq.slope);
56
6e73fb3d94fa Simplyfy slope measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 55
diff changeset
1184
6e73fb3d94fa Simplyfy slope measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 55
diff changeset
1185 // update applied slope
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1186 if ((utc - dedrift.t0) > dedrift.interval) {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1187
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1188 if (dedrift.invert)
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1189 dedrift.applied -= freq.slope;
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
1190 else
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1191 dedrift.applied += freq.slope;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1192
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1193 SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, dedrift.applied);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1194
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1195 if (dedrift.doubleslope)
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1196 DDSFox_SetSweepRate(&DDS1xAD9956, dedrift.applied * 2.0);
123
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
1197 else
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1198 DDSFox_SetSweepRate(&DDS1xAD9956, dedrift.applied);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1199
140
3f7eef731ccc Adjust log messages
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 139
diff changeset
1200 logmsg("dedrift update: adjustment=%+3e slope=%+3e", freq.slope, dedrift.applied);
82
47860259afe2 Implement logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 80
diff changeset
1201
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
1202 stat_zero(&freq);
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1203 dedrift.t0 = utc;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1204 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1205 }
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1206
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1207 // recenter
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1208 if (recenter.enabled)
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1209 {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1210 rollmean_accumulate(&rollmean_ch2, Ch2);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1211 rollmean_accumulate(&rollmean_ch3, Ch3);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1212 rollmean_accumulate(&rollmean_ch4, Ch4);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1213
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1214 if ((utc - recenter.t0) > recenter.interval) {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1215
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
1216 if (recenter.lo) {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1217 // adjust DDS2 frequency to keep Ch4 reading at 275 kHz
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1218 double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2);
139
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1219 double adj = 275000.0 - rollmean_ch4.mean;
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1220 freq = freq + adj;
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1221 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, freq);
140
3f7eef731ccc Adjust log messages
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 139
diff changeset
1222 logmsg("recenter ch4 to 275 kHz: DDS2 adjustment=%+3e", adj);
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1223 }
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1224
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
1225 if (recenter.hg) {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1226 // adjust DDS3 frequency to keep Ch2 reading at 10 kHz
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1227 double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3);
139
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1228 double adj = 10000 - rollmean_ch2.mean;
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1229 freq = freq + adj;
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1230 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq);
140
3f7eef731ccc Adjust log messages
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 139
diff changeset
1231 logmsg("recenter Hg beatnote (ch2) to 10 kHz: DDS3 adjustment=%+3e", adj);
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1232 }
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1233
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
1234 if (recenter.sr) {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1235 // adjust DDS3 frequency to keep Ch3 reading at 10 kHz
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1236 double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3);
139
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1237 double adj = 10000 - rollmean_ch3.mean;
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1238 freq = freq + adj;
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1239 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq);
151
df7ce04af51d Fix log message
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 150
diff changeset
1240 logmsg("recenter Sr beatnote (ch3) to 10 kHz: DDS3 adjustment=%+3e", adj);
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1241 }
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1242
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1243 recenter.t0 = utc;
139
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1244 rollmean_zero(&rollmean_ch2);
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1245 rollmean_zero(&rollmean_ch3);
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1246 rollmean_zero(&rollmean_ch4);
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
1247 }
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1248 }
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1249
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1250 // update DDS frequencies display
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1251 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1252 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1253 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1254 SetCtrlVal(MainPanel, PANEL_DDS4, DDS4xAD9912.frequency[3]);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1255
91
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1256 // local time
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1257 struct tm *ltime = localtime(&event.time.tv_sec);
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1258 // round to milliseconds
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1259 int msec = round(event.time.tv_usec / 1000.0);
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1260 while (msec >= 1000) {
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1261 ltime->tm_sec += 1;
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1262 msec -= 1000;
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1263 }
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1264 // format local time
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1265 char timestr[24];
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1266 int len = strftime(timestr, sizeof(timestr), "%d/%m/%Y %H:%M:%S", ltime);
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1267 snprintf(timestr + len, sizeof(timestr) - len, ".%03d", msec);
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1268 // display local time
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1269 SetCtrlVal(MainPanel, PANEL_TIME, timestr);
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
1270
91
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1271 // run id derived from current local date in the form YYMMDD
76
5e0c314528bf Refactor data writing to disk. Implement dayly chunking to separate files
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 75
diff changeset
1272 char id[7];
91
4102fe614df2 Fix timestamping. Cleanup data providers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 89
diff changeset
1273 strftime(id, sizeof(id), "%y%m%d", ltime);
88
9b7588cd4013 Move data acquisition into separate thread
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 87
diff changeset
1274
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
1275 // write datafiles
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
1276 for (struct datafile *d = datafiles; d->data; d++)
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
1277 datafile_append(d, id, timestr);
119
f9fb17fb64cc Add Sr frequency logging to disk and to Sr data logger
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 118
diff changeset
1278
f9fb17fb64cc Add Sr frequency logging to disk and to Sr data logger
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 118
diff changeset
1279 // send Sr frequency (Math4) to Sr data logger
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
1280 sr_datalogger_send(&datalogger, utc, Math4);
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1281 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1282 break;
44
2e37910b28bc Simplify logic and reindent
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 43
diff changeset
1283 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1284 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1285
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1286 int CVICALLBACK CB_OnFreqPlot (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1287 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1288 {
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1289 switch (event)
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1290 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1291 case EVENT_COMMIT:
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1292 for (struct plot *plot = plots; plot->data; plot++) {
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1293 if (plot->control == control)
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1294 plot_toggle(plot);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1295 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1296 break;
52
30146cc6cd77 Cleanup. Remove some C abominations
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 51
diff changeset
1297 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1298 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1299 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1300
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1301 int CVICALLBACK CB_OnAllanPlot (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1302 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1303 {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1304 switch (event)
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1305 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1306 case EVENT_COMMIT:
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1307 for (struct adev *adev = adevs; adev->data; adev++) {
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1308 if (adev->control == control)
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1309 adev_toggle(adev);
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1310 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1311 break;
134
bd28161e5ac2 Major code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 133
diff changeset
1312 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1313 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1314 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1315
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1316 int CVICALLBACK CB_ChangeDDSOut (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1317 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1318 {
28
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1319 switch (event) {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1320 case EVENT_COMMIT:
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1321 double frequency;
28
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1322 GetCtrlVal(MainPanel, control, &frequency);
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1323 switch (control) {
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1324 case PANEL_DDS1:
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1325 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, frequency);
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1326 break;
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1327 case PANEL_DDS2:
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1328 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency);
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1329 break;
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1330 case PANEL_DDS3:
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1331 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency);
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1332 break;
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1333 case PANEL_DDS4:
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1334 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency);
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1335 break;
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1336 }
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1337 break;
28
1e4ecf64b485 Remove references to unused DDSBes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 27
diff changeset
1338 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1339 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1340 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1341
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1342 int CVICALLBACK CB_ChangeDDSStep (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1343 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1344 {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1345 switch (event)
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1346 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1347 case EVENT_COMMIT:
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1348 double step;
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1349 GetCtrlVal(panel, control, &step);
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1350 switch (control)
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1351 {
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1352 case PANEL_DDS1STEP:
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1353 SetCtrlAttribute(panel, PANEL_DDS1, ATTR_INCR_VALUE, step);
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1354 break;
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1355 case PANEL_DDS2STEP:
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1356 SetCtrlAttribute(panel, PANEL_DDS2, ATTR_INCR_VALUE, step);
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1357 break;
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1358 case PANEL_DDS3STEP:
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1359 SetCtrlAttribute(panel, PANEL_DDS3, ATTR_INCR_VALUE, step);
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1360 break;
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1361 case PANEL_DDS4STEP:
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1362 SetCtrlAttribute(panel, PANEL_DDS4, ATTR_INCR_VALUE, step);
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1363 break;
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1364 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1365 break;
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1366 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1367 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1368 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1369
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1370 int CVICALLBACK CB_ChangeMath (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1371 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1372 {
24
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1373 int len;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1374 char *string;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1375
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1376 switch (event)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1377 {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1378 case EVENT_COMMIT:
24
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1379 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
1380 string = (char *)malloc(sizeof(char) * (len + 1));
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1381 GetCtrlVal(panel, control, string);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1382 switch (control) {
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1383 case PANEL_MATHSTRING1:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1384 mupSetExpr(MathParser1, string);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1385 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1386 case PANEL_MATHSTRING2:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1387 mupSetExpr(MathParser2, string);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1388 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1389 case PANEL_MATHSTRING3:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1390 mupSetExpr(MathParser3, string);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1391 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1392 case PANEL_MATHSTRING4:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1393 mupSetExpr(MathParser4, string);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1394 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1395 case PANEL_MATHSTRING5:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1396 mupSetExpr(MathParser5, string);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1397 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1398 }
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1399 free(string);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1400 break;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1401 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1402 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1403 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1404
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1405 int CVICALLBACK CB_ChangeN (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1406 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1407 {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1408 switch (event)
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1409 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1410 case EVENT_COMMIT:
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1411 switch (control)
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1412 {
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1413 case PANEL_N1CHOICE:
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1414 GetCtrlVal(panel, control, &N1);
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1415 break;
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1416 case PANEL_N2CHOICE:
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1417 GetCtrlVal(panel, control, &N2);
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1418 break;
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1419 case PANEL_N3CHOICE:
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1420 GetCtrlVal(panel, control, &N3);
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1421 break;
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1422 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1423 break;
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1424 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1425 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1426 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1427
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1428 int CVICALLBACK CB_OnPlus10k (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1429 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1430 {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1431 double Frequency ;
166
fdd2f8fd7714 Minor cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 164
diff changeset
1432
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1433 switch (event)
24
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1434 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1435 case EVENT_COMMIT:
24
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1436 switch (control)
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1437 {
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1438 case PANEL_PLUS10KDDS1:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1439 GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1440 Frequency += 10000.0;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1441 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1442 SetCtrlVal(MainPanel, PANEL_DDS1, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1443 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1444 case PANEL_PLUS10KDDS2:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1445 GetCtrlVal(MainPanel, PANEL_DDS2, &Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1446 Frequency += 10000.0;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1447 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1448 SetCtrlVal(MainPanel, PANEL_DDS2, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1449 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1450 case PANEL_PLUS10KDDS3:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1451 GetCtrlVal(MainPanel, PANEL_DDS3, &Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1452 Frequency += 10000.0;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1453 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1454 SetCtrlVal(MainPanel, PANEL_DDS3, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1455 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1456 case PANEL_PLUS10KDDS4:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1457 GetCtrlVal(MainPanel, PANEL_DDS4, &Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1458 Frequency += 10000.0;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1459 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1460 SetCtrlVal(MainPanel, PANEL_DDS4, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1461 break;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1462 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1463 break;
24
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1464 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1465 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1466 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1467
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1468 int CVICALLBACK CB_OnMinus10k (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1469 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1470 {
24
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1471 double Frequency;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1472
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1473 switch (event)
24
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1474 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1475 case EVENT_COMMIT:
24
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1476 switch (control)
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1477 {
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1478 case PANEL_MINUS10KDDS1:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1479 GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1480 Frequency -= 10000.0;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1481 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1482 SetCtrlVal(MainPanel, PANEL_DDS1, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1483 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1484 case PANEL_MINUS10KDDS2:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1485 GetCtrlVal(MainPanel, PANEL_DDS2, &Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1486 Frequency -= 10000.0;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1487 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1488 SetCtrlVal(MainPanel, PANEL_DDS2, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1489 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1490 case PANEL_MINUS10KDDS3:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1491 GetCtrlVal(MainPanel, PANEL_DDS3, &Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1492 Frequency -= 10000.0;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1493 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1494 SetCtrlVal(MainPanel, PANEL_DDS3, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1495 break;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1496 case PANEL_MINUS10KDDS4:
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1497 GetCtrlVal(MainPanel, PANEL_DDS4, &Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1498 Frequency -= 10000.0;
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1499 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1500 SetCtrlVal(MainPanel, PANEL_DDS4, Frequency);
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1501 break;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1502 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1503 break;
24
b838371c7a91 Code cleanup and dead code removal
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 23
diff changeset
1504 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1505 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1506 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1507
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1508 int CVICALLBACK CB_OnAcceptN (int panel, int control, int event,
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1509 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1510 {
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1511 int measure;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1512
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1513 switch (event) {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1514 case EVENT_COMMIT:
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1515 GetPanelAttribute(panel, ATTR_CALLBACK_DATA, &measure);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1516 switch (measure) {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1517 case LO:
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
1518 N1 = round(N_measured);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1519 SetCtrlVal(MainPanel, PANEL_N1CHOICE, N1);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1520 break;
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1521 case HG:
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
1522 N2 = round(N_measured);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1523 SetCtrlVal(MainPanel, PANEL_N2CHOICE, N2);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1524 break;
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1525 case SR:
162
1517a56163de Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 161
diff changeset
1526 N3 = round(N_measured);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1527 SetCtrlVal(MainPanel, PANEL_N3CHOICE, N3);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1528 break;
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1529 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1530 break;
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1531 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1532 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1533 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1534
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1535 int CVICALLBACK CB_OnNCalculus (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1536 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1537 {
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1538 int visible;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1539
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1540 switch (event) {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1541 case EVENT_COMMIT:
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1542 switch (control) {
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1543 case PANEL_N1CALCULUS:
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1544 GetPanelAttribute(CalcNPanel, ATTR_VISIBLE, &visible);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1545 if (! visible) {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1546 SetPanelAttribute(panel, ATTR_CALLBACK_DATA, LO);
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1547 SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Lo");
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1548 SetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, DeltaT_1);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1549 SetCtrlVal(CalcNPanel, CALCN_SLOPETIME, SlopeTime1);
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1550 SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, delta_f_lock_1 / 1000.0);
132
fbd72d87b4dc Support graceful intrerruption of N3 measurement. Minor user interface fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 130
diff changeset
1551 SetCtrlVal(CalcNPanel, CALCN_N, 0.0);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1552 DisplayPanel(CalcNPanel);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1553 }
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1554 break;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1555 case PANEL_N2CALCULUS:
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1556 GetPanelAttribute(CalcNPanel, ATTR_VISIBLE, &visible);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1557 if (! visible) {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1558 SetPanelAttribute(panel, ATTR_CALLBACK_DATA, HG);
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1559 SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Hg");
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1560 SetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, DeltaT_2);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1561 SetCtrlVal(CalcNPanel, CALCN_SLOPETIME, SlopeTime2);
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1562 SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, delta_f_lock_2 / 1000.0);
132
fbd72d87b4dc Support graceful intrerruption of N3 measurement. Minor user interface fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 130
diff changeset
1563 SetCtrlVal(CalcNPanel, CALCN_N, 0.0);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1564 DisplayPanel(CalcNPanel);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1565 }
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1566 break;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1567 case PANEL_N3CALCULUS:
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1568 GetPanelAttribute(CalcNPanel, ATTR_VISIBLE, &visible);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1569 if (! visible) {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1570 SetPanelAttribute(panel, ATTR_CALLBACK_DATA, SR);
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1571 SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Sr");
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1572 SetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, DeltaT_3);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1573 SetCtrlVal(CalcNPanel, CALCN_SLOPETIME, SlopeTime3);
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1574 SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, delta_f_lock_3 / 1000.0);
132
fbd72d87b4dc Support graceful intrerruption of N3 measurement. Minor user interface fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 130
diff changeset
1575 SetCtrlVal(CalcNPanel, CALCN_N, 0.0);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1576 DisplayPanel(CalcNPanel);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1577 }
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1578 break;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1579 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1580 break;
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1581 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1582 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1583 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1584
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1585 int CVICALLBACK CB_OnStartNCalculus (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1586 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1587 {
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1588 int measuring;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1589
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1590 switch (event) {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1591 case EVENT_COMMIT:
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1592 GetPanelAttribute(panel, ATTR_CALLBACK_DATA, &measuring);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1593 switch (measuring) {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1594 case LO:
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1595 GetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, &DeltaT_1);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1596 GetCtrlVal(CalcNPanel, CALCN_SLOPETIME, &SlopeTime1);
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1597 GetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, &delta_f_lock_1);
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1598 // convert from kHz to Hz
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1599 delta_f_lock_1 = delta_f_lock_1 * 1000.0;
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1600 Measuring_1 = TRUE;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1601 break;
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1602 case HG:
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1603 GetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, &DeltaT_2);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1604 GetCtrlVal(CalcNPanel, CALCN_SLOPETIME, &SlopeTime2);
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1605 GetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, &delta_f_lock_2);
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1606 // convert from kHz to Hz
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1607 delta_f_lock_2 = delta_f_lock_2 * 1000.0;
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1608 Measuring_2 = TRUE;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1609 break;
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1610 case SR:
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1611 GetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, &DeltaT_3);
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1612 GetCtrlVal(CalcNPanel, CALCN_SLOPETIME, &SlopeTime3);
159
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1613 GetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, &delta_f_lock_3);
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1614 // convert from kHz to Hz
07153c41ba16 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 158
diff changeset
1615 delta_f_lock_3 = delta_f_lock_3 * 1000.0;
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1616 Measuring_3 = TRUE;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1617 break;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1618 }
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1619 break;
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1620 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1621 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1622 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1623
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1624 int CVICALLBACK CB_OnNStop (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1625 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1626 {
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1627 int measuring;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1628
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1629 switch (event) {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1630 case EVENT_COMMIT:
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1631 HidePanel(CalcNPanel);
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1632 GetPanelAttribute(panel, ATTR_CALLBACK_DATA, &measuring);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1633 switch (measuring) {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1634 case LO:
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1635 Measuring_1 = FALSE;
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1636 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1637 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1638 break;
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1639 case HG:
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1640 Measuring_2 = FALSE;
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1641 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1642 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1643 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1644 break;
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1645 case SR:
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1646 Measuring_3 = FALSE;
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1647 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1648 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1649 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1650 break;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1651 }
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1652
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1653 // update DDS frequencies display
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1654 SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1655 SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1656 SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1657 SetCtrlVal(MainPanel, PANEL_DDS4, DDS4xAD9912.frequency[3]);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1658
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1659 break;
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1660 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1661 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1662 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1663
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1664 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
1665 void *callbackData, int eventData1, int eventData2)
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1666 {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1667 switch (event)
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1668 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1669 case EVENT_COMMIT:
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1670 switch (control)
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1671 {
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1672 case PANEL_FINDSIGN1:
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1673 tbegin1 = utc;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1674 Frepbefore1 = Math1;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1675 GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency1) ;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1676 SetCtrlVal(MainPanel, PANEL_DDS1, Frequency1+Frequencystep1) ;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1677 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency1+Frequencystep1);
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1678 Getsign1 = TRUE;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1679 break;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1680 case PANEL_FINDSIGN2:
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1681 tbegin2 = utc;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1682 Frepbefore2 = Math1;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1683 Ch2before = Ch2;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1684 GetCtrlVal(MainPanel, PANEL_DDS1, &Frequency2) ;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1685 SetCtrlVal(MainPanel, PANEL_DDS1, Frequency2+Frequencystep2) ;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1686 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency2+Frequencystep2);
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1687 Getsign2 = TRUE;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1688 break;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1689 case PANEL_FINDSIGN3:
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1690 tbegin3 = utc;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1691 Frepbefore3 = Math1;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1692 GetCtrlVal(MainPanel, PANEL_DDS4, &Frequency3) ;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1693 SetCtrlVal(MainPanel, PANEL_DDS4, Frequency3+Frequencystep3) ;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1694 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency3+Frequencystep3);
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1695 Getsign3 = TRUE;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1696 break;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1697 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1698 break;
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1699 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1700 return 0;
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1701 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1702
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1703 int CVICALLBACK CB_OnFind275K (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1704 void *callbackData, int eventData1, int eventData2)
42
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1705 {
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1706 double frequency;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1707
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1708 switch (event)
42
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1709 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1710 case EVENT_COMMIT:
42
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1711 switch (control)
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1712 {
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1713 case PANEL_FIND275K2:
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1714 GetCtrlVal(MainPanel, PANEL_DDS2, &frequency);
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1715 frequency = frequency + 275000 - Ch4;
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1716 SetCtrlVal(MainPanel, PANEL_DDS2, frequency) ;
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1717 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency);
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1718 break;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1719
42
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1720 case PANEL_FIND10K3:
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1721 GetCtrlVal(MainPanel, PANEL_DDS3, &frequency);
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1722 frequency = frequency + 10000 - Ch2;
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1723 SetCtrlVal(MainPanel, PANEL_DDS3, frequency);
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1724 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency);
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1725 break;
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1726 }
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1727 break;
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1728 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1729 return 0;
42
dcc305411dcc Cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 40
diff changeset
1730 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1731
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
1732 int CVICALLBACK CB_OnChangeNdiv (int panel, int control, int event,
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1733 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1734 {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1735 switch (event)
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1736 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1737 case EVENT_COMMIT:
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1738 GetCtrlVal(MainPanel, PANEL_CHANGENDIV, &Ndiv);
158
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1739 f0_DDS1 = 880000000.0 / Ndiv;
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1740 SetCtrlVal(MainPanel, PANEL_DDS1, f0_DDS1);
9154291658ef Simplify DDS frequency juggling in N measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 156
diff changeset
1741 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1742 break;
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
1743 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1744 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1745 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1746
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
1747 int CVICALLBACK CB_MeasureSlope (int panel, int control, int event,
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1748 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1749 {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1750 switch (event)
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1751 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1752 case EVENT_COMMIT:
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1753 GetCtrlVal(panel, control, &dedrift.enabled);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1754 if (dedrift.enabled) {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1755 dedrift.t0 = utc;
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
1756 stat_zero(&freq);
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1757 logmsg("dedrift start");
33
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 32
diff changeset
1758 } else {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1759 if (! dedrift.keep_slope) {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1760 dedrift.applied = 0.0;
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1761 DDSFox_SetSweepRate(&DDS1xAD9956, dedrift.applied);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1762 SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, dedrift.applied);
70
a945f2b7bef6 Fix slope measurement again
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 69
diff changeset
1763 }
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1764 if (! dedrift.keep_freq) {
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1765 DDSFox_Set(&DDS1xAD9956, dedrift.freq0, dedrift.applied);
70
a945f2b7bef6 Fix slope measurement again
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 69
diff changeset
1766 }
73
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
1767 stat_zero(&freq);
1dfaf5ef0352 Refactor mean and slope measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 70
diff changeset
1768 SetCtrlVal(panel, PANEL_SLOPE_MEASURED, freq.slope);
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1769 logmsg("dedrift stop");
33
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 32
diff changeset
1770 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1771 break;
33
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 32
diff changeset
1772 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1773 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1774 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1775
14
783407954cdf Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 10
diff changeset
1776 int CVICALLBACK CB_OnResetSlope (int panel, int control, int event,
783407954cdf Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 10
diff changeset
1777 void *callbackData, int eventData1, int eventData2)
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1778 {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1779 switch (event)
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1780 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1781 case EVENT_COMMIT:
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1782 dedrift.applied = 0.0;
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1783 SetCtrlVal(panel, PANEL_SLOPE_APPLIED, dedrift.applied);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1784 DDSFox_Set(&DDS1xAD9956, dedrift.freq0, dedrift.applied);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1785 logmsg("dedrift reset");
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1786 break;
14
783407954cdf Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 10
diff changeset
1787 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1788 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1789 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1790
14
783407954cdf Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 10
diff changeset
1791 int CVICALLBACK CB_ChangeSlopeTime (int panel, int control, int event,
783407954cdf Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 10
diff changeset
1792 void *callbackData, int eventData1, int eventData2)
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1793 {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1794 switch (event)
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1795 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1796 case EVENT_COMMIT:
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1797 GetCtrlVal(MainPanel, PANEL_SLOPETIME, &dedrift.interval);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1798 break;
14
783407954cdf Minor code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 10
diff changeset
1799 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1800 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1801 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1802
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1803 int CVICALLBACK CB_OnCROX (int panel, int control, int event,
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1804 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1805 {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1806 switch (event)
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1807 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1808 case EVENT_COMMIT:
34
1e4b8ba97faf Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 33
diff changeset
1809 switch (control) {
1e4b8ba97faf Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 33
diff changeset
1810 case PANEL_CHECKBOX_KEEP:
1e4b8ba97faf Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 33
diff changeset
1811 // keep current dedrifting frequency when dedrifting is disabled
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1812 GetCtrlVal(MainPanel, PANEL_CHECKBOX_KEEP, &dedrift.keep_freq);
34
1e4b8ba97faf Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 33
diff changeset
1813 break;
1e4b8ba97faf Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 33
diff changeset
1814 case PANEL_CHECKBOX_KEEPSLOPE:
1e4b8ba97faf Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 33
diff changeset
1815 // keep current dedrifting slope when dedrifting is disabled
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1816 GetCtrlVal(MainPanel, PANEL_CHECKBOX_KEEPSLOPE, &dedrift.keep_slope);
34
1e4b8ba97faf Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 33
diff changeset
1817 break;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1818 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1819 break;
34
1e4b8ba97faf Cleanup code handling dedrifing options
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 33
diff changeset
1820 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1821 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1822 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1823
139
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1824 int CVICALLBACK CB_RecenterEnable (int panel, int control, int event,
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1825 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1826 {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1827 switch (event)
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1828 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1829 case EVENT_COMMIT:
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1830 GetCtrlVal(panel, control, &recenter.enabled);
136
7b9cf3d4346e Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 135
diff changeset
1831 recenter.t0 = utc;
139
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1832 rollmean_zero(&rollmean_ch2);
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1833 rollmean_zero(&rollmean_ch3);
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
1834 rollmean_zero(&rollmean_ch4);
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1835 break;
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1836 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1837 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1838 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1839
56
6e73fb3d94fa Simplyfy slope measurement code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 55
diff changeset
1840 int CVICALLBACK CB_OnStopSlopeCancellingOnUnlocked (int panel, int control, int event,
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1841 void *callbackData, int eventData1, int eventData2)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1842 {
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1843 int value;
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1844 switch (event)
20
3a7f088d4960 Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 17
diff changeset
1845 {
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1846 case EVENT_COMMIT:
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1847 GetCtrlVal(MainPanel, PANEL_CHECKBOX_STOPIFAUTODE, &value);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1848 dedrift.threshold = value ? 100.0 : 0.0;
20
3a7f088d4960 Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 17
diff changeset
1849 break;
3a7f088d4960 Get rid of unused variables. Some minor coding style improvements
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 17
diff changeset
1850 }
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1851 return 0;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1852 }
2
bd7501b65f56 Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 1
diff changeset
1853
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1854 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
1855 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
1856 {
bd7501b65f56 Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 1
diff changeset
1857 switch (event)
bd7501b65f56 Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 1
diff changeset
1858 {
bd7501b65f56 Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 1
diff changeset
1859 case EVENT_COMMIT:
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1860 GetCtrlVal(MainPanel, PANEL_SLOPE_REFERENCE, &dedrift.reference);
2
bd7501b65f56 Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 1
diff changeset
1861 break;
bd7501b65f56 Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 1
diff changeset
1862 }
bd7501b65f56 Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 1
diff changeset
1863 return 0;
bd7501b65f56 Implement reference selection (microwave or Hg cavity) for slope cancelling
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 1
diff changeset
1864 }
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1865
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1866 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
1867 void *callbackData, int eventData1, int eventData2)
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1868 {
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1869 int visible;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1870
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1871 switch (event)
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1872 {
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1873 case EVENT_COMMIT:
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1874 GetPanelAttribute(EstimateNPanel, ATTR_VISIBLE , &visible);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1875 if (! visible)
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1876 DisplayPanel(EstimateNPanel);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1877 // reset N estimate
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1878 SetCtrlVal(EstimateNPanel, ESTIMATEN_N, 0.0);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1879 // set current frep
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1880 SetCtrlVal(EstimateNPanel, ESTIMATEN_FREP, 250e6 + Math1);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1881 switch (control) {
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1882 case PANEL_ESTIMATE_N2:
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1883 SetCtrlVal(EstimateNPanel, ESTIMATEN_WAVELENGTH, HG_WAVELENGTH);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1884 SetPanelAttribute(panel, ATTR_TITLE, "Estimate N_Hg");
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1885 SetPanelAttribute(panel, ATTR_CALLBACK_DATA, HG);
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1886 break;
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1887 case PANEL_ESTIMATE_N3:
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1888 SetCtrlVal(EstimateNPanel, ESTIMATEN_WAVELENGTH, SR_WAVELENGTH);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1889 SetPanelAttribute(panel, ATTR_TITLE, "Estimate N_Sr");
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1890 SetPanelAttribute(panel, ATTR_CALLBACK_DATA, SR);
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1891 break;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1892 }
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1893 break;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1894 }
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1895 return 0;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1896 }
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1897
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1898 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
1899 void *callbackData, int eventData1, int eventData2)
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1900 {
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1901 int visible;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1902
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1903 switch (event)
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1904 {
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1905 case EVENT_COMMIT:
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1906 GetPanelAttribute(panel, ATTR_VISIBLE, &visible);
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1907 if (visible)
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1908 HidePanel(panel);
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1909 break;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1910 }
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1911 return 0;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1912 }
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1913
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1914 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
1915 void *callbackData, int eventData1, int eventData2)
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1916 {
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1917 int estimate;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1918
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1919 switch (event)
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1920 {
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1921 case EVENT_COMMIT:
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1922 GetPanelAttribute(panel, ATTR_CALLBACK_DATA, &estimate);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1923 switch (estimate) {
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1924 case HG:
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1925 GetCtrlVal(panel, ESTIMATEN_N, &N2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1926 SetCtrlVal(MainPanel, PANEL_N3CHOICE, N2);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1927 break;
161
6ee23cb3d6bb Coding style fixes
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 160
diff changeset
1928 case SR:
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1929 GetCtrlVal(panel, ESTIMATEN_N, &N3);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1930 SetCtrlVal(MainPanel, PANEL_N3CHOICE, N3);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1931 break;
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1932 }
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1933 HidePanel(panel);
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1934 break;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1935 }
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1936 return 0;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1937 }
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1938
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1939 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
1940 void *callbackData, int eventData1, int eventData2)
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1941 {
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1942 double frep, wl, N;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1943
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1944 switch (event)
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1945 {
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1946 case EVENT_COMMIT:
160
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1947 GetCtrlVal(panel, ESTIMATEN_FREP, &frep);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1948 GetCtrlVal(panel, ESTIMATEN_WAVELENGTH, &wl);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1949 N = round(SPEED_OF_LIGHT / wl / 1e-9 / frep);
f609fb29536b Simplification and code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 159
diff changeset
1950 SetCtrlVal(panel, ESTIMATEN_N, N);
17
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1951 break;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1952 }
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1953 return 0;
9cadd12e7722 Implement N3 measurement. Large code cleanup.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 14
diff changeset
1954 }
30
56095062acd4 Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 29
diff changeset
1955
56095062acd4 Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 29
diff changeset
1956 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
1957 void *callbackData, int eventData1, int eventData2)
56095062acd4 Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 29
diff changeset
1958 {
56095062acd4 Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 29
diff changeset
1959 switch (event)
56095062acd4 Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 29
diff changeset
1960 {
56095062acd4 Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 29
diff changeset
1961 case EVENT_COMMIT:
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1962 GetCtrlVal(panel, control, &dedrift.applied);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1963 DDSFox_SetSweepRate(&DDS1xAD9956, dedrift.applied);
30
56095062acd4 Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 29
diff changeset
1964 break;
56095062acd4 Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 29
diff changeset
1965 }
56095062acd4 Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 29
diff changeset
1966 return 0;
56095062acd4 Allow manual setting of frequency dedrifting rate
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 29
diff changeset
1967 }
39
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1968
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1969 int CVICALLBACK CB_InvertSlopeSign (int panel, int control, int event,
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1970 void *callbackData, int eventData1, int eventData2)
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1971 {
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1972 switch (event)
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1973 {
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1974 case EVENT_COMMIT:
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1975 GetCtrlVal(panel, control, &dedrift.invert);
39
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1976 break;
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1977 }
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1978 return 0;
2e1b3148d6e6 Add setting to invert the sign of the measured slope on dedrifting
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 37
diff changeset
1979 }
48
70980f27e1a4 Simplify dedrifting interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 47
diff changeset
1980
80
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1981 int CVICALLBACK CB_ResetDedriftDDS (int panel, int control, int event,
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1982 void *callbackData, int eventData1, int eventData2)
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1983 {
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1984 switch (event)
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1985 {
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1986 case EVENT_COMMIT:
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1987 // stop slope measurement and reset slope
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1988 dedrift.enabled = FALSE;
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1989 SetCtrlVal(panel, PANEL_MEASURE_SLOPE, 0);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1990 dedrift.applied = 0.0;
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1991 SetCtrlVal(panel, PANEL_SLOPE_APPLIED, dedrift.applied);
80
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1992 // reset DDS
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1993 DDSFox_Reset(&DDS1xAD9956);
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1994 DDSFox_SetProfile(&DDS1xAD9956);
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1995 DDSFox_SetDiv(&DDS1xAD9956, 1);
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
1996 DDSFox_Set(&DDS1xAD9956, dedrift.freq0, 0.0);
80
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1997 break;
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1998 }
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
1999 return 0;
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
2000 }
46fe62febcd0 Add dedrifting DDS reset functionality
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 79
diff changeset
2001
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2002 int CVICALLBACK CB_ShowLog (int panel, int control, int event,
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2003 void *callbackData, int eventData1, int eventData2)
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2004 {
122
bdd3ec3c212e Improve user interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 121
diff changeset
2005 int visible;
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2006 switch (event)
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2007 {
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2008 case EVENT_COMMIT:
122
bdd3ec3c212e Improve user interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 121
diff changeset
2009 GetCtrlVal(panel, PANEL_SHOWLOG, &visible);
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
2010 logger_panel_visible(visible);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2011 break;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2012 }
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2013 return 0;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2014 }
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2015
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2016 int CVICALLBACK CB_OnLoggingPanelEvent(int panel, int event,
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2017 void *callbackData, int eventData1, int eventData2)
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2018 {
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2019 switch (event)
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2020 {
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2021 case EVENT_CLOSE:
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
2022 logger_panel_visible(0);
122
bdd3ec3c212e Improve user interface
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 121
diff changeset
2023 SetCtrlVal(MainPanel, PANEL_SHOWLOG, 0);
84
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2024 break;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2025 }
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2026 return 0;
c03263186dd7 Rework and cleanup N measurement panels handling. Move logs to dedicated panel.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 82
diff changeset
2027 }
109
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2028
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2029 int CVICALLBACK CB_Sign3 (int panel, int control, int event,
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2030 void *callbackData, int eventData1, int eventData2)
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2031 {
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2032 switch (event)
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2033 {
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2034 case EVENT_COMMIT:
125
37535873ee83 Rename variables from SigneX to SignX
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 124
diff changeset
2035 GetCtrlVal(panel, control, &Sign3);
109
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2036 break;
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2037 }
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2038 return 0;
2a9f8a811d87 Fix N3 measurement
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 105
diff changeset
2039 }
123
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2040
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2041 int CVICALLBACK CB_SlopeX2 (int panel, int control, int event,
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2042 void *callbackData, int eventData1, int eventData2)
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2043 {
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2044 switch (event)
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2045 {
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2046 case EVENT_COMMIT:
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
2047 GetCtrlVal(panel, control, &dedrift.doubleslope);
123
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2048 break;
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2049 }
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2050 return 0;
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2051 }
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2052
142
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2053 int CVICALLBACK CB_SaveData (int panel, int control, int event,
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2054 void *callbackData, int eventData1, int eventData2)
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2055 {
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2056 switch (event)
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2057 {
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2058 case EVENT_COMMIT:
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2059 for (struct datafile *d = datafiles; d->data; d++) {
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2060 if (d->control == control)
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2061 GetCtrlVal(panel, control, &(d->write));
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2062 }
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2063 break;
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2064 }
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2065 return 0;
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2066 }
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2067
fd085d61e4ca Rework data logging
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 140
diff changeset
2068
139
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2069 int CVICALLBACK CB_RecenterInterval (int panel, int control, int event,
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2070 void *callbackData, int eventData1, int eventData2)
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2071 {
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2072 switch (event)
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2073 {
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2074 case EVENT_COMMIT:
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2075 GetCtrlVal(panel, control, &recenter.interval);
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2076 break;
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2077 }
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2078 return 0;
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2079 }
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2080
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2081 int CVICALLBACK CB_RecenterChannel (int panel, int control, int event,
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2082 void *callbackData, int eventData1, int eventData2)
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2083 {
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2084 switch (event)
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2085 {
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2086 case EVENT_COMMIT:
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2087 switch (control)
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2088 {
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2089 case PANEL_RECENTER_LO:
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2090 GetCtrlVal(panel, control, &recenter.lo);
139
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2091 break;
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2092 case PANEL_RECENTER_HG:
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2093 GetCtrlVal(panel, control, &recenter.hg);
139
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2094 break;
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2095 case PANEL_RECENTER_SR:
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2096 GetCtrlVal(panel, control, &recenter.sr);
139
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2097 break;
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2098 }
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2099 break;
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2100 }
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2101 return 0;
e04123ab79ef Fix recenter
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 136
diff changeset
2102 }
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2103
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2104 int CVICALLBACK CB_SrDatalogger (int panel, int control, int event,
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2105 void *callbackData, int eventData1, int eventData2)
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2106 {
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2107 switch (event)
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2108 {
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2109 case EVENT_COMMIT:
169
97112b45b838 Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 168
diff changeset
2110 GetCtrlVal(panel, control, &datalogger.enabled);
144
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2111 break;
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2112 }
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2113 return 0;
be87c8e78266 Code cleanup
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 143
diff changeset
2114 }
123
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2115 int CVICALLBACK CB_DedriftDDSFreq (int panel, int control, int event,
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2116 void *callbackData, int eventData1, int eventData2)
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2117 {
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2118 switch (event)
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2119 {
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2120 case EVENT_COMMIT:
133
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
2121 GetCtrlVal(panel, control, &dedrift.freq0);
7540703b8473 Major code cleanup. Implement beatnote recentering.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 132
diff changeset
2122 DDSFox_Set(&DDS1xAD9956, dedrift.freq0, dedrift.applied);
123
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2123 break;
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2124 }
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2125 return 0;
35861fe64d14 Allow to set dedrift DDS central frequency. Add option to double applied slope.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents: 122
diff changeset
2126 }