This repository has been archived by the owner on Jun 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scan.c
153 lines (129 loc) · 4.94 KB
/
scan.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/**
@file scan.c
@brief The inner workings of this is a mystery, wrapped in an enigma.
This code doesn't act on the scan information, that is done in
GUIDesign.c with UpdateScanValue().
Scan has 2 modes of operation: Analog and Time.
*/
#include "Scan.h"
#include <ansi_c.h>
#include <userint.h>
#include "GUIDesign.h"
#include "GUIDesign2.h"
#include "Scan2.h"
#include "vars.h"
int CVICALLBACK CALLBACK_SCANOK(int panel, int control, int event,
void* callbackData, int eventData1,
int eventData2) {
switch (event) {
case EVENT_COMMIT:
ReadScanValues();
PScan.ScanMode = 0; // set to Analog scan
HidePanel(panelHandle7);
HidePanel(panelHandle4);
break;
}
return 0;
}
// last update: May 11, 2005
// May12, 2005: initialize for time scans
void InitializeScanPanel(void) {
SetCtrlVal(panelHandle7, SCANPANEL_NUM_COLUMN, PScan.Column);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_ROW, PScan.Row);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_PAGE, PScan.Page);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_CHANNEL, AChName[PScan.Row].chnum);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_DURATION,
TimeArray[PScan.Column][PScan.Page]);
SetCtrlVal(panelHandle7, SCANPANEL_RING_MODE, PScan.Analog.Analog_Mode);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_SCANSTART, PScan.Analog.Start_Of_Scan);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_SCANEND, PScan.Analog.End_Of_Scan);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_SCANSTEP, PScan.Analog.Scan_Step_Size);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_ITERATIONS,
PScan.Analog.Iterations_Per_Step);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_TIMESTART, PScan.Time.Start_Of_Scan);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_TIMEEND, PScan.Time.End_Of_Scan);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_TIMESTEP, PScan.Time.Scan_Step_Size);
SetCtrlVal(panelHandle7, SCANPANEL_NUM_TIMEITER,
PScan.Time.Iterations_Per_Step);
DisplayPanel(panelHandle7);
}
// last update:
// May 12,2005: read in values for time and dds, set mode (ANALOG, TIME or DDS)
// set initial values
void ReadScanValues(void) {
GetCtrlVal(panelHandle7, SCANPANEL_NUM_SCANSTART,
&PScan.Analog.Start_Of_Scan);
GetCtrlVal(panelHandle7, SCANPANEL_NUM_SCANEND, &PScan.Analog.End_Of_Scan);
GetCtrlVal(panelHandle7, SCANPANEL_NUM_SCANSTEP,
&PScan.Analog.Scan_Step_Size);
GetCtrlVal(panelHandle7, SCANPANEL_NUM_ITERATIONS,
&PScan.Analog.Iterations_Per_Step);
GetCtrlVal(panelHandle7, SCANPANEL_RING_MODE, &PScan.Analog.Analog_Mode);
GetCtrlVal(panelHandle7, SCANPANEL_NUM_TIMESTART, &PScan.Time.Start_Of_Scan);
GetCtrlVal(panelHandle7, SCANPANEL_NUM_TIMEEND, &PScan.Time.End_Of_Scan);
GetCtrlVal(panelHandle7, SCANPANEL_NUM_TIMESTEP, &PScan.Time.Scan_Step_Size);
GetCtrlVal(panelHandle7, SCANPANEL_NUM_TIMEITER,
&PScan.Time.Iterations_Per_Step);
ScanVal.Current_Step = 0;
}
int CVICALLBACK CALLBACK_SCAN_CANCEL(int panel, int control, int event,
void* callbackData, int eventData1,
int eventData2) {
switch (event) {
case EVENT_COMMIT:
PScan.Scan_Active = FALSE;
HidePanel(panelHandle7);
HidePanel(panelHandle4);
break;
}
return 0;
}
int CVICALLBACK CALLBACK_TIMESCANOK(int panel, int control, int event,
void* callbackData, int eventData1,
int eventData2) {
switch (event) {
case EVENT_COMMIT:
ReadScanValues();
PScan.ScanMode = 1; // set to Time scan
HidePanel(panelHandle7);
HidePanel(panelHandle4);
break;
}
return 0;
}
int CVICALLBACK CMD_GETSCANVALS_CALLBACK(int panel, int control, int event,
void* callbackData, int eventData1,
int eventData2) {
int cx = 0, cy = 0, cz = 0;
switch (event) {
case EVENT_COMMIT:
PScan.Column = currentx;
PScan.Row = currenty;
PScan.Page = currentpage;
cx = currentx;
cy = currenty;
cz = currentpage;
PScan.Analog.Analog_Mode = AnalogTable[cx][cy][cz].fcn;
PScan.Analog.Start_Of_Scan = AnalogTable[cx][cy][cz].fval;
PScan.Analog.End_Of_Scan = AnalogTable[cx][cy][cz].fval;
PScan.Analog.Scan_Step_Size = 0.1;
PScan.Analog.Iterations_Per_Step = 1;
PScan.Time.Start_Of_Scan = TimeArray[cx][cz];
PScan.Time.End_Of_Scan = TimeArray[cx][cz];
PScan.Time.Scan_Step_Size = 0.1;
PScan.Time.Iterations_Per_Step = 1;
InitializeScanPanel();
DisplayPanel(panelHandle7);
break;
}
return 0;
}
int CVICALLBACK CHECK_USE_LIST_CALLBACK(int panel, int control, int event,
void* callbackData, int eventData1,
int eventData2) {
switch (event) {
case EVENT_COMMIT:
break;
}
return 0;
}