Rev 210 | Rev 265 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 210 | Rev 217 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | #include "H1D.h" |
|
- | 2 | #include "H2D.h" |
|
1 | #include <formatio.h> |
3 | #include <formatio.h> |
2 | #include <utility.h> |
4 | #include <utility.h> |
3 | #include <ansi_c.h> |
5 | #include <ansi_c.h> |
4 | #include <cvirte.h> |
6 | #include <cvirte.h> |
5 | #include <userint.h> |
7 | #include <userint.h> |
Line 12... | Line 14... | ||
12 | #include "MIKRO.h" |
14 | #include "MIKRO.h" |
13 | #endif |
15 | #endif |
14 | 16 | ||
15 | static int daq_on; |
17 | static int daq_on; |
16 | static int ph, p2,plothandle[4]= {0,0,0,0}; |
18 | static int ph, p2,plothandle[4]= {0,0,0,0}; |
- | 19 | static int scanplothandle; |
|
17 | static int tfID; |
20 | static int tfID; |
18 | static int controlID; |
21 | static int controlID; |
19 | 22 | ||
20 | #define MAX_THREADS 10 |
23 | #define MAX_THREADS 10 |
21 | 24 | ||
22 | static CmtThreadPoolHandle poolHandle = 0; |
25 | static CmtThreadPoolHandle poolHandle = 0; |
23 | 26 | ||
- | 27 | static float gSum[4]={0,0,0,0}; |
|
24 | int main (int argc, char *argv[]) { |
28 | int main (int argc, char *argv[]) { |
25 | short port; |
29 | short port; |
26 | if (InitCVIRTE (0, argv, 0) == 0) |
30 | if (InitCVIRTE (0, argv, 0) == 0) |
27 | return -1; /* out of memory */ |
31 | return -1; /* out of memory */ |
28 | if ((ph = LoadPanel (0, "drs4.uir", PANEL)) < 0) |
32 | if ((ph = LoadPanel (0, "drs4.uir", PANEL)) < 0) |
Line 99... | Line 103... | ||
99 | return ; |
103 | return ; |
100 | 104 | ||
101 | } |
105 | } |
102 | 106 | ||
103 | 107 | ||
- | 108 | static float xs[4][1024]; |
|
104 | int CVICALLBACK daq(void *functionData) { |
109 | int CVICALLBACK daq(void *functionData) { |
105 | 110 | ||
106 | 111 | ||
107 | int neve; |
112 | int neve; |
108 | char filename[0xff]; |
113 | char filename[0xff]; |
Line 119... | Line 124... | ||
119 | int pfreq; |
124 | int pfreq; |
120 | int enabledoutput; |
125 | int enabledoutput; |
121 | int neveold = 0; |
126 | int neveold = 0; |
122 | double rate; |
127 | double rate; |
123 | int *args = (int *) functionData; |
128 | int *args = (int *) functionData; |
- | 129 | double twin[2]; |
|
124 | 130 | ||
125 | GetCtrlVal(ph, PANEL_FILENAME, filename ); |
- | |
- | 131 | ||
126 | GetCtrlVal(ph, PANEL_CH0, &imask[0] ); |
132 | GetCtrlVal(ph, PANEL_CH0, &imask[0] ); |
127 | GetCtrlVal(ph, PANEL_CH1, &imask[1] ); |
133 | GetCtrlVal(ph, PANEL_CH1, &imask[1] ); |
128 | GetCtrlVal(ph, PANEL_CH2, &imask[2] ); |
134 | GetCtrlVal(ph, PANEL_CH2, &imask[2] ); |
129 | GetCtrlVal(ph, PANEL_CH3, &imask[3] ); |
135 | GetCtrlVal(ph, PANEL_CH3, &imask[3] ); |
130 | mask = 0; |
136 | mask = 0; |
Line 144... | Line 150... | ||
144 | GetCtrlVal(ph,PANEL_TRGTYPE, &trgtype); |
150 | GetCtrlVal(ph,PANEL_TRGTYPE, &trgtype); |
145 | GetCtrlVal(ph,PANEL_TRGLEVEL, &trglevel); |
151 | GetCtrlVal(ph,PANEL_TRGLEVEL, &trglevel); |
146 | GetCtrlVal(ph,PANEL_TRGPOLARITY, &trgpolarity); |
152 | GetCtrlVal(ph,PANEL_TRGPOLARITY, &trgpolarity); |
147 | GetCtrlVal(ph,PANEL_RANGE, &range); |
153 | GetCtrlVal(ph,PANEL_RANGE, &range); |
148 | 154 | ||
149 | - | ||
- | 155 | GetCtrlVal(ph,PANEL_TWIN0, &twin[0]); |
|
- | 156 | GetCtrlVal(ph,PANEL_TWIN1, &twin[1]); |
|
150 | //printf("mask=0x%x\n",mask); |
157 | //printf("mask=0x%x\n",mask); |
151 | 158 | ||
152 | DRSSetMask( (unsigned char)( mask & 0xF ) ); |
159 | DRSSetMask( (unsigned char)( mask & 0xF ) ); |
153 | 160 | ||
154 | DRSSetFrequency( frequency ); |
161 | DRSSetFrequency( frequency ); |
Line 157... | Line 164... | ||
157 | DRSSetTriggerType( trgtype ); |
164 | DRSSetTriggerType( trgtype ); |
158 | DRSSetTriggerLevel(trglevel); |
165 | DRSSetTriggerLevel(trglevel); |
159 | DRSSetTriggerPolarity(trgpolarity); |
166 | DRSSetTriggerPolarity(trgpolarity); |
160 | 167 | ||
161 | DRSSetRange ( range ); |
168 | DRSSetRange ( range ); |
162 | 169 | ||
163 | 170 | ||
164 | 171 | ||
165 | FILE *fp= NULL; |
172 | FILE *fp= NULL; |
166 | 173 | ||
167 | if (enabledoutput) { |
174 | if (enabledoutput) { |
- | 175 | if (args[0]) { |
|
- | 176 | GetCtrlVal(ph, PANEL_FILENAME, filename ); |
|
168 |
|
177 | fp = fopen(filename,"wb"); |
- | 178 | } else { |
|
- | 179 | GetCtrlVal(p2, SCAN_FILENAME, filename ); |
|
169 |
|
180 | fp = fopen(filename,"ab"); |
- | 181 | } |
|
170 | } |
182 | } |
171 | 183 | ||
172 | static unsigned char *buffer; |
184 | static unsigned char *buffer; |
173 | 185 | ||
174 | int buffer_size = 0; |
186 | int buffer_size = 0; |
175 | const int nBoards=1; |
187 | const int nBoards=1; |
176 | const int waveDepth=1024; |
188 | const int waveDepth=1024; |
Line 185... | Line 197... | ||
185 | time_t t=0,told=0, tstart=0; |
197 | time_t t=0,told=0, tstart=0; |
186 | 198 | ||
187 | if (!DRSInit()) { |
199 | if (!DRSInit()) { |
188 | time(&tstart); |
200 | time(&tstart); |
189 | told=tstart; |
201 | told=tstart; |
190 | int |
202 | int nev=0; |
- | 203 | for (int k = 0;k<4;k++){ |
|
- | 204 | gSum[k]=0; |
|
- | 205 | } |
|
191 | for (i=0; i<neve; i++) { |
206 | for (int i=0; i<neve; i++) { |
192 | start_timer(1);// 1 s timeout |
207 | start_timer(1);// 1 s timeout |
193 | int retval = DRSRead(0); |
208 | int retval = DRSRead(0); |
194 | stop_timer(); |
209 | stop_timer(); |
195 | int nb = ( retval == 0 && fp ) ? DRSToBuffer( buffer , i ) : 0; |
210 | int nb = ( retval == 0 && fp ) ? DRSToBuffer( buffer , i ) : 0; |
196 | SetCtrlVal(ph,PANEL_CEVE,i); |
211 | SetCtrlVal(ph,PANEL_CEVE,i); |
197 | if (retval) i--; |
212 | if (retval) i--; |
- | 213 | nev++; |
|
198 | if (!daq_on) break; |
214 | if (!daq_on) break; |
199 | time(&t); |
215 | time(&t); |
200 | if (t!=told ) { |
216 | if (t!=told ) { |
201 | rate = (i-neveold); |
217 | rate = (i-neveold); |
202 | printf("%d events in %2.2f min (%d s) Rate %f Hz %s ",i+1, (double)(t-tstart)/60.,(t-tstart), rate , ctime(&t)); |
218 | printf("%d events in %2.2f min (%d s) Rate %f Hz %s ",i+1, (double)(t-tstart)/60.,(t-tstart), rate , ctime(&t)); |
Line 205... | Line 221... | ||
205 | } |
221 | } |
206 | told=t; |
222 | told=t; |
207 | // Save data |
223 | // Save data |
208 | if (nb>0 && fp) fwrite(buffer, 1,nb ,fp); |
224 | if (nb>0 && fp) fwrite(buffer, 1,nb ,fp); |
209 | // Plot Data |
225 | // Plot Data |
210 |
|
226 | for (int k=0; k<4; k++) { |
211 | if ( |
227 | if ( (mask & ( 0x1<<k )) ){ |
212 | float *t=DRSGetTime(k); |
228 | float *t=DRSGetTime(k); |
213 | float *x=DRSGetWave(k); |
229 | float *x=DRSGetWave(k); |
- | 230 | ; |
|
- | 231 | for (int j=0 ; j<1024 ; j++) { |
|
- | 232 | xs[k][j]= x[j]*1e-3; |
|
- | 233 | ||
- | 234 | if (t[j]> twin[0] && t[j] < twin[1]) gSum[k]+= fabs(xs[k][j]); |
|
- | 235 | if (verbose) printf("[%d] %d. x= %3.2f y=%3.2f\n", k, i, t[j], x[j] ); |
|
- | 236 | //h[k]->Fill( t[i], x[i]*1e-3); |
|
- | 237 | } |
|
214 | 238 | ||
- | 239 | if (i % pfreq == 0) { |
|
- | 240 | ||
215 | const int col[4]= {VAL_WHITE,VAL_RED,VAL_GREEN,VAL_BLUE}; |
241 | const int col[4]= {VAL_WHITE,VAL_RED,VAL_GREEN,VAL_BLUE}; |
216 | if |
242 | if (plothandle[k]) DeleteGraphPlot (ph, PANEL_GRAPH, plothandle[k], VAL_IMMEDIATE_DRAW); |
217 | plothandle |
243 | plothandle[k] = PlotXY (ph, PANEL_GRAPH, t, xs[k], 1024, VAL_FLOAT, VAL_FLOAT, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, col[k]); |
218 | - | ||
219 |
|
244 | } |
220 | if (verbose) printf("[%d] %d. x= %3.2f y=%3.2f\n", k, i, t[i], x[i] ); |
- | |
221 | //h[k]->Fill( t[i], x[i]*1e-3); |
- | |
222 | } |
245 | } |
- | 246 | ||
223 | } |
247 | } |
224 | 248 | ||
225 | 249 | ||
226 | } |
250 | } |
227 | time(&t); |
251 | time(&t); |
228 | printf("%d events in %2.2f min (%d s) %s", |
252 | printf("%d events in %2.2f min (%d s) %s",nev, (double)(t-tstart)/60.,t-tstart, ctime(&t)); |
229 | DRSEnd(); |
253 | DRSEnd(); |
230 | } |
254 | } |
231 | 255 | ||
232 | if (fp) fclose(fp); |
256 | if (fp) fclose(fp); |
233 | 257 | ||
234 | free(buffer); |
258 | free(buffer); |
235 | 259 | ||
236 | return 0; |
260 | return 0; |
237 | 261 | ||
238 | } |
262 | } |
Line 253... | Line 277... | ||
253 | int n[3]; |
277 | int n[3]; |
254 | char filename[0xFF]; |
278 | char filename[0xFF]; |
255 | int enabledoutput; |
279 | int enabledoutput; |
256 | 280 | ||
257 | FILE *fp; |
281 | FILE *fp; |
258 | GetCtrlVal( |
282 | GetCtrlVal(p2, SCAN_FILENAME, filename ); |
259 | 283 | ||
260 | GetCtrlVal(ph,PANEL_ENABLEDOUTPUT, &enabledoutput); |
284 | GetCtrlVal(ph,PANEL_ENABLEDOUTPUT, &enabledoutput); |
261 | 285 | ||
262 | if ( GetFileInfo(filename,&size) ) { |
286 | if ( GetFileInfo(filename,&size) ) { |
263 |
|
287 | MessagePopup ("Warning","File exist. Remove it first or choose another file"); |
264 |
|
288 | return 0; |
265 | } |
289 | } |
266 | GetCtrlVal(p2, SCAN_STEPX, &dx[0]); |
290 | GetCtrlVal(p2, SCAN_STEPX, &dx[0]); |
267 | GetCtrlVal(p2, SCAN_STEPY, &dx[1]); |
291 | GetCtrlVal(p2, SCAN_STEPY, &dx[1]); |
268 | GetCtrlVal(p2, SCAN_NSTEPSX, &nx[0]); |
292 | GetCtrlVal(p2, SCAN_NSTEPSX, &nx[0]); |
269 | GetCtrlVal(p2, SCAN_NSTEPSY, &nx[1]); |
293 | GetCtrlVal(p2, SCAN_NSTEPSY, &nx[1]); |
270 | GetCtrlVal(p2, SCAN_STARTX, &x0[0]); |
294 | GetCtrlVal(p2, SCAN_STARTX, &x0[0]); |
271 | GetCtrlVal(p2, SCAN_STARTY, &x0[1]); |
295 | GetCtrlVal(p2, SCAN_STARTY, &x0[1]); |
- | 296 | for (int k=0;k<4;k++) { |
|
- | 297 | H2D_Init(k, "charge","Induced charge", |
|
- | 298 | nx[0], x0[0] - dx[0]*0.5 ,x0[0] + dx[0] * ( nx[0] - 0.5) , |
|
- | 299 | nx[1], x0[1] - dx[1]*0.5 ,x0[1] + dx[1] * ( nx[1] - 0.5)); |
|
- | 300 | H1D_Init(k, "charge","Induced charge projection x", |
|
- | 301 | nx[0], x0[0] - dx[0]*0.5 ,x0[0] + dx[0] * ( nx[0] - 0.5) ); |
|
272 | - | ||
- | 302 | H1D_Init(100 + k, "charge","Induced charge projection y", |
|
- | 303 | nx[1], x0[1] - dx[1]*0.5 ,x0[1] + dx[1] * ( nx[1] - 0.5) ); |
|
273 | 304 | } |
|
274 | if (enabledoutput) { |
305 | if (enabledoutput) { |
275 | fp = fopen(filename,"ab"); |
306 | fp = fopen(filename,"ab"); |
276 | if (fp) { |
307 | if (fp) { |
277 | size=36; |
308 | size=36; |
278 | fwrite(runbuf, 1,4 ,fp); |
309 | fwrite(runbuf, 1,4 ,fp); |
Line 318... | Line 349... | ||
318 | } |
349 | } |
319 | } |
350 | } |
320 | 351 | ||
321 | #endif |
352 | #endif |
322 | daq(functionData); |
353 | daq(functionData); |
- | 354 | ||
- | 355 | for (int k=0;k<4;k++) { |
|
- | 356 | H2D_Fill(k, ix[0], ix[1] , gSum[k] ); |
|
- | 357 | H1D_Fill(k, ix[0] , gSum[k] ); |
|
- | 358 | H1D_Fill(100+ k, ix[1] , gSum[k] ); |
|
- | 359 | } |
|
- | 360 | PlotScanHistogramCB(0,0,EVENT_COMMIT,NULL, 0,0); |
|
323 | if (!daq_on) break; |
361 | if (!daq_on) break; |
324 | } |
362 | } |
325 | if (!daq_on) break; |
363 | if (!daq_on) break; |
326 | } |
364 | } |
327 | 365 | ||
Line 333... | Line 371... | ||
333 | void *callbackData, int eventData1, int eventData2) { |
371 | void *callbackData, int eventData1, int eventData2) { |
334 | ThreadFunctionPtr mythread = NULL; |
372 | ThreadFunctionPtr mythread = NULL; |
335 | switch (event) { |
373 | switch (event) { |
336 | 374 | ||
337 | case EVENT_COMMIT: |
375 | case EVENT_COMMIT: |
338 | 376 | ||
339 | controlID=0; |
377 | controlID=0; |
340 | if (panel == ph && control == PANEL_START) { |
378 | if (panel == ph && control == PANEL_START) { |
341 | mythread = daq; |
379 | mythread = daq; |
342 | controlID= control; |
380 | controlID= control; |
343 | } |
381 | } |
344 | if (panel == p2 && control == SCAN_SCAN) mythread = scan; |
382 | if (panel == p2 && control == SCAN_SCAN) mythread = scan; |
345 | if (mythread!=NULL) { |
383 | if (mythread!=NULL) { |
346 | printf("New Thread panel=%d button=%d\n", panel, control); |
384 | printf("New Thread panel=%d button=%d\n", panel, control); |
347 | 385 | ||
348 | // SetDimming(1); |
386 | // SetDimming(1); |
349 | 387 | ||
350 | daq_on=1; |
388 | daq_on=1; |
351 | CmtScheduleThreadPoolFunctionAdv (poolHandle, mythread, &controlID, |
389 | CmtScheduleThreadPoolFunctionAdv (poolHandle, mythread, &controlID, |
352 | DEFAULT_THREAD_PRIORITY, |
390 | DEFAULT_THREAD_PRIORITY, |
353 | EndOfThread, |
391 | EndOfThread, |
354 | EVENT_TP_THREAD_FUNCTION_END, |
392 | EVENT_TP_THREAD_FUNCTION_END, |
355 | NULL, RUN_IN_SCHEDULED_THREAD, |
393 | NULL, RUN_IN_SCHEDULED_THREAD, |
356 | &tfID); |
394 | &tfID); |
357 | } |
395 | } |
358 | break; |
396 | break; |
359 | } |
397 | } |
360 | return 0; |
398 | return 0; |
361 | } |
399 | } |
362 | 400 | ||
363 | int CVICALLBACK StopCB (int panel, int control, int event, |
401 | int CVICALLBACK StopCB (int panel, int control, int event, |
364 | void *callbackData, int eventData1, int eventData2) { |
402 | void *callbackData, int eventData1, int eventData2) { |
365 | switch (event) { |
403 | switch (event) { |
366 | case EVENT_COMMIT: |
404 | case EVENT_COMMIT: |
367 | daq_on=0; |
405 | daq_on=0; |
368 | break; |
406 | break; |
369 | } |
407 | } |
370 | return 0; |
408 | return 0; |
371 | } |
409 | } |
372 | 410 | ||
373 | int CVICALLBACK ExitCB (int panel, int control, int event, |
411 | int CVICALLBACK ExitCB (int panel, int control, int event, |
374 | void *callbackData, int eventData1, int eventData2) { |
412 | void *callbackData, int eventData1, int eventData2) { |
375 | switch (event) { |
413 | switch (event) { |
376 | case EVENT_COMMIT: |
414 | case EVENT_COMMIT: |
377 | QuitUserInterface (0); |
415 | QuitUserInterface (0); |
378 | break; |
416 | break; |
379 | } |
417 | } |
380 | return 0; |
418 | return 0; |
381 | } |
419 | } |
Line 387... | Line 425... | ||
387 | case EVENT_COMMIT: |
425 | case EVENT_COMMIT: |
388 | 426 | ||
389 | if (panel == p2) { |
427 | if (panel == p2) { |
390 | switch (control) { |
428 | switch (control) { |
391 | case SCAN_BR : |
429 | case SCAN_BR : |
392 | axis = 1; |
430 | axis = 1; |
393 | direction = 1; |
431 | direction = 1; |
394 | GetCtrlVal(p2, SCAN_STEPX, &step); |
432 | GetCtrlVal(p2, SCAN_STEPX, &step); |
395 | break; |
433 | break; |
396 | case SCAN_BL : |
434 | case SCAN_BL : |
397 | axis = 1; |
435 | axis = 1; |
398 | direction = -1; |
436 | direction = -1; |
399 | GetCtrlVal(p2, SCAN_STEPX, &step); |
437 | GetCtrlVal(p2, SCAN_STEPX, &step); |
400 | break; |
438 | break; |
401 | case SCAN_BU : |
439 | case SCAN_BU : |
402 | axis = 2; |
440 | axis = 2; |
403 | direction = 1; |
441 | direction = 1; |
404 | GetCtrlVal(p2, SCAN_STEPY, &step); |
442 | GetCtrlVal(p2, SCAN_STEPY, &step); |
405 | break; |
443 | break; |
406 | case SCAN_BD : |
444 | case SCAN_BD : |
407 | axis = 2; |
445 | axis = 2; |
Line 414... | Line 452... | ||
414 | MIKRO_GetPosition(axis,&n); |
452 | MIKRO_GetPosition(axis,&n); |
415 | if (axis == 1) SetCtrlVal (p2, SCAN_XP, n); |
453 | if (axis == 1) SetCtrlVal (p2, SCAN_XP, n); |
416 | if (axis == 2) SetCtrlVal (p2, SCAN_YP, n); |
454 | if (axis == 2) SetCtrlVal (p2, SCAN_YP, n); |
417 | #endif // MIKRO |
455 | #endif // MIKRO |
418 | } |
456 | } |
419 | 457 | ||
420 | break; |
458 | break; |
421 | } |
459 | } |
422 | return 0; |
460 | return 0; |
423 | } |
461 | } |
424 | 462 | ||
425 | 463 | ||
426 | 464 | ||
427 | 465 | ||
428 | 466 | ||
429 | int CVICALLBACK GoXCB (int panel, int control, int event, |
467 | int CVICALLBACK GoXCB (int panel, int control, int event, |
430 | void *callbackData, int eventData1, int eventData2) { |
468 | void *callbackData, int eventData1, int eventData2) { |
431 | int n2; |
469 | int n2; |
Line 436... | Line 474... | ||
436 | MIKRO_MoveTo(1,n2); |
474 | MIKRO_MoveTo(1,n2); |
437 | MIKRO_GetPosition(1,&n2); |
475 | MIKRO_GetPosition(1,&n2); |
438 | 476 | ||
439 | #endif |
477 | #endif |
440 | SetCtrlVal (p2, SCAN_XP, n2); |
478 | SetCtrlVal (p2, SCAN_XP, n2); |
441 | break; |
479 | break; |
442 | } |
480 | } |
443 | return 0; |
481 | return 0; |
444 | } |
482 | } |
445 | 483 | ||
446 | int CVICALLBACK GoYCB (int panel, int control, int event, |
484 | int CVICALLBACK GoYCB (int panel, int control, int event, |
447 | void *callbackData, int eventData1, int eventData2) { |
485 | void *callbackData, int eventData1, int eventData2) { |
448 | int n2; |
486 | int n2; |
449 | switch (event) { |
487 | switch (event) { |
450 | case EVENT_COMMIT: |
488 | case EVENT_COMMIT: |
Line 453... | Line 491... | ||
453 | MIKRO_MoveTo(2,n2); |
491 | MIKRO_MoveTo(2,n2); |
454 | MIKRO_GetPosition(2,&n2); |
492 | MIKRO_GetPosition(2,&n2); |
455 | 493 | ||
456 | #endif |
494 | #endif |
457 | SetCtrlVal (p2, SCAN_YP, n2); |
495 | SetCtrlVal (p2, SCAN_YP, n2); |
458 | break; |
496 | break; |
459 | } |
497 | } |
460 | return 0; |
498 | return 0; |
461 | } |
499 | } |
462 | 500 | ||
463 | int CVICALLBACK GetCurrentPositionCB (int panel, int control, int event, |
501 | int CVICALLBACK GetCurrentPositionCB (int panel, int control, int event, |
464 | void *callbackData, int eventData1, int eventData2) { |
502 | void *callbackData, int eventData1, int eventData2) { |
465 | 503 | ||
466 | int n[2]; |
504 | int n[2]; |
467 | switch (event) { |
505 | switch (event) { |
468 | case EVENT_COMMIT: |
506 | case EVENT_COMMIT: |
469 | #ifdef MIKRO |
507 | #ifdef MIKRO |
470 | MIKRO_GetPosition(1,&n[0]); |
508 | MIKRO_GetPosition(1,&n[0]); |
471 | SetCtrlVal (p2, SCAN_XP, n[0]); |
509 | SetCtrlVal (p2, SCAN_XP, n[0]); |
472 | MIKRO_GetPosition(2,&n[1]); |
510 | MIKRO_GetPosition(2,&n[1]); |
Line 475... | Line 513... | ||
475 | break; |
513 | break; |
476 | } |
514 | } |
477 | return 0; |
515 | return 0; |
478 | } |
516 | } |
479 | 517 | ||
480 | int CVICALLBACK HomeCB (int panel, int control, int event, |
518 | int CVICALLBACK HomeCB (int panel, int control, int event, |
481 | void *callbackData, int eventData1, int eventData2) { |
519 | void *callbackData, int eventData1, int eventData2) { |
- | 520 | switch (event) { |
|
- | 521 | case EVENT_COMMIT: |
|
- | 522 | #ifdef MIKRO |
|
- | 523 | MIKRO_ReferenceMove(1); |
|
- | 524 | MIKRO_ReferenceMove(2); |
|
- | 525 | GetCurrentPositionCB(panel, control, event, NULL, 0, 0); |
|
- | 526 | #endif |
|
- | 527 | break; |
|
- | 528 | } |
|
- | 529 | return 0; |
|
- | 530 | } |
|
- | 531 | ||
- | 532 | int CVICALLBACK PlotScanHistogramCB (int panel, int control, int event, |
|
- | 533 | void *callbackData, int eventData1, int eventData2) { |
|
- | 534 | int hid=0; |
|
- | 535 | int nx; |
|
- | 536 | int ny; |
|
- | 537 | switch (event) { |
|
- | 538 | case EVENT_COMMIT: |
|
- | 539 | GetCtrlVal (p2, SCAN_CHANNEL, &hid); |
|
- | 540 | GetCtrlVal(p2, SCAN_NSTEPSX, &nx); |
|
- | 541 | GetCtrlVal(p2, SCAN_NSTEPSY, &ny); |
|
- | 542 | if (nx>1 && ny>1) { |
|
- | 543 | H2D_Draw(hid,p2,SCAN_GRAPH,&scanplothandle); |
|
- | 544 | printf("redraw 2d\n"); |
|
- | 545 | } else { |
|
- | 546 | if (nx>1) { |
|
- | 547 | printf("redraw 1d x\n"); |
|
- | 548 | H1D_Draw(hid,p2,SCAN_GRAPH,&scanplothandle); |
|
- | 549 | } |
|
- | 550 | if (ny>1) { |
|
- | 551 | printf("redraw 1d x\n"); |
|
- | 552 | H1D_Draw(100+hid,p2,SCAN_GRAPH,&scanplothandle); |
|
- | 553 | } |
|
- | 554 | } |
|
- | 555 | break; |
|
- | 556 | } |
|
- | 557 | return 0; |
|
- | 558 | } |
|
- | 559 | ||
- | 560 | int CVICALLBACK OpenGuiCB (int panel, int control, int event, |
|
- | 561 | void *callbackData, int eventData1, int eventData2) { |
|
482 | switch (event) { |
562 | switch (event) { |
483 | case EVENT_COMMIT: |
563 | case EVENT_COMMIT: |
484 | #ifdef MIKRO |
- | |
485 |
|
564 | DisplayPanel (ph); |
486 |
|
565 | DisplayPanel (p2); |
487 | GetCurrentPositionCB(panel, control, event, NULL, 0, 0); |
- | |
488 | #endif |
- | |
489 | break; |
566 | break; |
490 | } |
567 | } |
491 | return 0; |
568 | return 0; |
492 | } |
569 | } |