Rev 203 | Rev 210 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 203 | Rev 207 | ||
---|---|---|---|
Line 151... | Line 151... | ||
151 | static unsigned char *buffer; |
151 | static unsigned char *buffer; |
152 | 152 | ||
153 | int buffer_size = 0; |
153 | int buffer_size = 0; |
154 | const int nBoards=1; |
154 | const int nBoards=1; |
155 | const int waveDepth=1024; |
155 | const int waveDepth=1024; |
156 | if (buffer_size == 0) { |
- | |
157 | buffer_size = 4 + nBoards * (4 + 4*(4+waveDepth*4)); |
- | |
158 | buffer_size += 24 + nBoards * (8 + 4*(4+waveDepth*2)); |
- | |
159 | buffer = (unsigned char *)malloc(buffer_size); |
- | |
160 | } |
- | |
161 | 156 | ||
- | 157 | if (buffer_size == 0) { |
|
- | 158 | buffer_size = 8; // file header + time header |
|
- | 159 | buffer_size += nBoards * (4 + 4*(4+waveDepth*4)); // bin widths |
|
- | 160 | buffer_size += 24 + nBoards * (8 + 4*(8+waveDepth*2)); |
|
- | 161 | buffer = (unsigned char *)malloc(buffer_size); |
|
- | 162 | } |
|
- | 163 | ||
162 | time_t t=0,told=0, tstart=0; |
164 | time_t t=0,told=0, tstart=0; |
163 | 165 | ||
164 | if (!DRSInit()) { |
166 | if (!DRSInit()) { |
165 | time(&tstart); |
167 | time(&tstart); |
166 | told=tstart; |
168 | told=tstart; |
Line 216... | Line 218... | ||
216 | 218 | ||
217 | 219 | ||
218 | 220 | ||
219 | int CVICALLBACK scan(void *functionData) { |
221 | int CVICALLBACK scan(void *functionData) { |
220 | 222 | ||
221 | int dx[ |
223 | int dx[3]={0,0,0}; |
222 | int nx[ |
224 | int nx[3]={0,0,0}; |
223 | int x0[ |
225 | int x0[3]={0,0,0}; |
224 | int ix[ |
226 | int ix[3]={0,0,0}; |
- | 227 | int idx[3]={0,0,0}; |
|
225 | int size; |
228 | int size; |
- | 229 | char posrec[4]="POSR"; |
|
- | 230 | char runbuf[4]="PRUN"; |
|
226 | 231 | ||
227 | char buffer[12]="POSR"; |
- | |
228 | int |
232 | int n[3]; |
229 | char filename[0xFF]; |
233 | char filename[0xFF]; |
230 | int enabledoutput; |
234 | int enabledoutput; |
231 | 235 | ||
232 | FILE *fp; |
236 | FILE *fp; |
233 | GetCtrlVal(ph, PANEL_FILENAME, filename ); |
237 | GetCtrlVal(ph, PANEL_FILENAME, filename ); |
Line 242... | Line 246... | ||
242 | GetCtrlVal(p2, SCAN_STEPY, &dx[1]); |
246 | GetCtrlVal(p2, SCAN_STEPY, &dx[1]); |
243 | GetCtrlVal(p2, SCAN_NSTEPSX, &nx[0]); |
247 | GetCtrlVal(p2, SCAN_NSTEPSX, &nx[0]); |
244 | GetCtrlVal(p2, SCAN_NSTEPSY, &nx[1]); |
248 | GetCtrlVal(p2, SCAN_NSTEPSY, &nx[1]); |
245 | GetCtrlVal(p2, SCAN_STARTX, &x0[0]); |
249 | GetCtrlVal(p2, SCAN_STARTX, &x0[0]); |
246 | GetCtrlVal(p2, SCAN_STARTY, &x0[1]); |
250 | GetCtrlVal(p2, SCAN_STARTY, &x0[1]); |
- | 251 | ||
- | 252 | ||
- | 253 | if (enabledoutput) { |
|
- | 254 | fp = fopen(filename,"ab"); |
|
- | 255 | if (fp) { |
|
- | 256 | size=36; |
|
- | 257 | fwrite(runbuf, 1,4 ,fp); |
|
- | 258 | fwrite(&size , 1,4 ,fp); |
|
- | 259 | fwrite(x0 , 1,4*3 ,fp); |
|
- | 260 | fwrite(dx , 1,4*3 ,fp); |
|
- | 261 | fwrite(nx , 1,4*3 ,fp); |
|
- | 262 | fclose(fp); |
|
- | 263 | } |
|
- | 264 | } |
|
- | 265 | ||
247 | for (int i=0; i<nx[0]; i++) { |
266 | for (int i=0; i<nx[0]; i++) { |
248 | 267 | ||
249 | ix[0]= x0[0]+i*dx[0]; |
268 | ix[0]= x0[0]+i*dx[0]; |
250 | #ifdef MIKRO |
269 | #ifdef MIKRO |
251 | MIKRO_MoveTo(1,ix[0]); |
270 | MIKRO_MoveTo(1,ix[0]); |
Line 261... | Line 280... | ||
261 | 280 | ||
262 | MIKRO_GetPosition(1,&n[0]); |
281 | MIKRO_GetPosition(1,&n[0]); |
263 | SetCtrlVal (p2, SCAN_XP, n[0]); |
282 | SetCtrlVal (p2, SCAN_XP, n[0]); |
264 | MIKRO_GetPosition(2,&n[1]); |
283 | MIKRO_GetPosition(2,&n[1]); |
265 | SetCtrlVal (p2, SCAN_YP, n[1]); |
284 | SetCtrlVal (p2, SCAN_YP, n[1]); |
- | 285 | ||
266 | if (enabledoutput) { |
286 | if (enabledoutput) { |
267 | fp = fopen(filename,"ab"); |
287 | fp = fopen(filename,"ab"); |
268 | if (fp) { |
288 | if (fp) { |
- | 289 | idx[0]=i; |
|
- | 290 | idx[1]=j; |
|
- | 291 | size=24; |
|
269 | fwrite( |
292 | fwrite(posrec, 1,4 ,fp); |
- | 293 | fwrite(&size , 1,4 ,fp); |
|
- | 294 | fwrite(n , 1,4*3 ,fp); |
|
- | 295 | fwrite(idx , 1,4*3 ,fp); |
|
270 | fclose(fp); |
296 | fclose(fp); |
271 | } |
297 | } |
272 | } |
298 | } |
273 | 299 | ||
274 | #endif |
300 | #endif |