author | groke6 |
Thu, 07 Feb 2008 10:25:15 +0100 | |
changeset 384 | 83793fc7ce48 |
parent 382 | 860e858685d3 |
child 385 | fff25f16c923 |
permissions | -rw-r--r-- |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
1 |
#include <wx/wxprec.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
2 |
#include <wx/wx.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
3 |
#include <wx/textctrl.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
4 |
#include <wx/spinctrl.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
5 |
#include <wx/tglbtn.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
6 |
#include <wx/slider.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
7 |
#include <iostream> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
8 |
#include <wx/brush.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
9 |
#include <sstream> |
295
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
10 |
#include <string.h> |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
11 |
#include <wx/listbox.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
12 |
#include <wx/dynarray.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
13 |
#include <wx/dcclient.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
14 |
#include <wx/gauge.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
15 |
#include <wx/spinctrl.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
16 |
|
295
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
17 |
//#include "monicone.xpm" |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
18 |
|
329 | 19 |
#if defined(WIN32) && !defined(__CYGWIN__) |
20 |
#include <windows.h> |
|
382 | 21 |
extern "C" |
22 |
{ |
|
23 |
#include "getopt.h" |
|
329 | 24 |
} |
25 |
#endif |
|
26 |
||
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
27 |
#include "main.h" |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
28 |
#include "TestSlaveGui.h" |
382 | 29 |
extern "C" |
30 |
{ |
|
31 |
#include "canfestival.h" |
|
32 |
#include "ObjDict.h" |
|
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
33 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
34 |
#include "wx/wxprec.h" |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
35 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
36 |
#ifdef __BORLANDC__ |
382 | 37 |
#pragma hdrstop |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
38 |
#endif |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
39 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
40 |
#ifndef WX_PRECOMP |
382 | 41 |
#include "wx/wx.h" |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
42 |
#endif |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
43 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
44 |
|
382 | 45 |
wxTextCtrl *textLog; |
46 |
int node_id_ext; |
|
295
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
47 |
int to_start = 0; |
382 | 48 |
MyFrame *frame; |
295
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
49 |
#define MAXLENGTH_BUSNAME 32 |
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
50 |
#define MAXLENGTH_BAUDRATE 8 |
382 | 51 |
char _busname[MAXLENGTH_BUSNAME] = "vcan0"; |
52 |
char _baudrate[MAXLENGTH_BAUDRATE] = "500K"; |
|
53 |
s_BOARD SlaveBoard = { _busname, _baudrate }; |
|
54 |
||
295
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
55 |
#define MAXLENGTH_LIBPATH 1024 |
382 | 56 |
char LibraryPath[MAXLENGTH_LIBPATH] = "libcanfestival_can_virtual.so"; |
57 |
double Gtime = 0; |
|
58 |
double y[28][45]; |
|
59 |
double hdelta = 0; |
|
60 |
double old_max = 5; |
|
61 |
double old_min = -5; |
|
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
62 |
|
331 | 63 |
#if defined(WIN32) |
64 |
#define LIB_EXTENT wxT("*.dll") |
|
65 |
#else |
|
66 |
#define LIB_EXTENT wxT("*.so") |
|
67 |
#endif |
|
68 |
||
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
69 |
// Declare some IDs. These are arbitrary. |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
70 |
const int BOOKCTRL = 100; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
71 |
const int FILE_QUIT = wxID_EXIT; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
72 |
const int HELP_ABOUT = wxID_ABOUT; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
73 |
const int ADD = 105; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
74 |
const int REMOVE = 108; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
75 |
const int QUIT = 109; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
76 |
const int FREQBOX = 110; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
77 |
const int START = 112; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
78 |
const int TEXTBOX1 = 113; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
79 |
const int STOP = 114; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
80 |
const int LOAD = 115; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
81 |
const int INBT1 = 118; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
82 |
const int INBT2 = 119; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
83 |
const int INBT3 = 120; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
84 |
const int INBT4 = 121; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
85 |
const int INBT5 = 122; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
86 |
const int INBT6 = 123; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
87 |
const int INBT7 = 124; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
88 |
const int INBT8 = 125; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
89 |
const int INS1 = 126; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
90 |
const int INS2 = 127; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
91 |
const int INS3 = 128; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
92 |
const int INS4 = 129; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
93 |
const int INS5 = 135; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
94 |
const int INS6 = 136; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
95 |
const int INS7 = 137; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
96 |
const int INS8 = 138; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
97 |
const int TIMER_ID = 130; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
98 |
const int INST1 = 131; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
99 |
const int INST2 = 132; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
100 |
const int INST3 = 133; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
101 |
const int INST4 = 134; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
102 |
const int INST5 = 135; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
103 |
const int INST6 = 136; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
104 |
const int INST7 = 137; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
105 |
const int INST8 = 138; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
106 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
107 |
// Attach the event handlers. Put this after MyFrame declaration. |
382 | 108 |
BEGIN_EVENT_TABLE (MyFrame, wxFrame) |
109 |
EVT_BUTTON (STOP, MyFrame::OnStop) |
|
110 |
EVT_BUTTON (LOAD, MyFrame::OnLoad) |
|
111 |
EVT_BUTTON (START, MyFrame::OnStart) |
|
112 |
EVT_TOGGLEBUTTON (INBT1, MyFrame::OnInbt1) |
|
113 |
EVT_TOGGLEBUTTON (INBT2, MyFrame::OnInbt2) |
|
114 |
EVT_TOGGLEBUTTON (INBT3, MyFrame::OnInbt3) |
|
115 |
EVT_TOGGLEBUTTON (INBT4, MyFrame::OnInbt4) |
|
116 |
EVT_TOGGLEBUTTON (INBT5, MyFrame::OnInbt5) |
|
117 |
EVT_TOGGLEBUTTON (INBT6, MyFrame::OnInbt6) |
|
118 |
EVT_TOGGLEBUTTON (INBT7, MyFrame::OnInbt7) |
|
119 |
EVT_TOGGLEBUTTON (INBT8, MyFrame::OnInbt8) |
|
120 |
EVT_COMMAND_SCROLL (INS1, MyFrame::OnIns1) |
|
121 |
EVT_COMMAND_SCROLL (INS2, MyFrame::OnIns2) |
|
122 |
EVT_COMMAND_SCROLL (INS3, MyFrame::OnIns3) |
|
123 |
EVT_COMMAND_SCROLL (INS4, MyFrame::OnIns4) |
|
124 |
EVT_COMMAND_SCROLL (INS5, MyFrame::OnIns5) |
|
125 |
EVT_COMMAND_SCROLL (INS6, MyFrame::OnIns6) |
|
126 |
EVT_COMMAND_SCROLL (INS7, MyFrame::OnIns7) |
|
127 |
EVT_COMMAND_SCROLL (INS8, MyFrame::OnIns8) |
|
128 |
EVT_SPINCTRL (INST1, MyFrame::OnInst1) |
|
129 |
EVT_SPINCTRL (INST2, MyFrame::OnInst2) |
|
130 |
EVT_SPINCTRL (INST3, MyFrame::OnInst3) |
|
131 |
EVT_SPINCTRL (INST4, MyFrame::OnInst4) |
|
132 |
EVT_SPINCTRL (INST5, MyFrame::OnInst5) |
|
133 |
EVT_SPINCTRL (INST6, MyFrame::OnInst6) |
|
134 |
EVT_SPINCTRL (INST7, MyFrame::OnInst7) |
|
135 |
EVT_SPINCTRL (INST8, MyFrame::OnInst8) |
|
136 |
EVT_LISTBOX (FREQBOX, MyFrame::OnFreqBoxClick) |
|
137 |
EVT_MENU (FILE_QUIT, MyFrame::OnQuit) |
|
138 |
EVT_BUTTON (QUIT, MyFrame::OnQuit) EVT_MENU (HELP_ABOUT, MyFrame::OnAbout) |
|
139 |
//EVT_PAINT(MyFrame::OnPaint) |
|
140 |
EVT_TIMER (TIMER_ID, MyFrame::OnTimer) |
|
141 |
END_EVENT_TABLE ()IMPLEMENT_APP_NO_MAIN (MyApp); |
|
295
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
142 |
IMPLEMENT_WX_THEME_SUPPORT; |
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
143 |
|
382 | 144 |
void |
145 |
help () |
|
146 |
{ |
|
147 |
printf ("**************************************************************\n"); |
|
148 |
printf ("* DS-401 Slave GUI *\n"); |
|
149 |
printf ("* *\n"); |
|
150 |
printf ("* Usage: *\n"); |
|
151 |
printf ("* ./DS401_Slave_Gui [OPTIONS] *\n"); |
|
152 |
printf ("* *\n"); |
|
153 |
printf ("* OPTIONS: *\n"); |
|
154 |
printf |
|
155 |
("* -l : Can library [\"libcanfestival_can_virtual.so\"] *\n"); |
|
156 |
printf ("* *\n"); |
|
157 |
printf ("* Slave: *\n"); |
|
158 |
printf ("* -i : Node id format [0x01 , 0x7F] *\n"); |
|
159 |
printf ("* *\n"); |
|
160 |
printf ("* CAN bus: *\n"); |
|
161 |
printf |
|
162 |
("* -b : bus name [\"1\"] *\n"); |
|
163 |
printf ("* -B : 1M,500K,250K,125K,100K,50K,20K,10K *\n"); |
|
164 |
printf ("* *\n"); |
|
165 |
printf ("**************************************************************\n"); |
|
166 |
} |
|
167 |
||
168 |
||
169 |
int |
|
170 |
main (int argc, char **argv) |
|
295
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
171 |
{ |
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
172 |
|
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
173 |
int c; |
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
174 |
extern char *optarg; |
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
175 |
char *snodeid; |
382 | 176 |
while ((c = getopt (argc, argv, "-b:B:l:i:s")) != EOF) |
295
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
177 |
{ |
382 | 178 |
switch (c) |
179 |
{ |
|
180 |
case 'b': |
|
181 |
if (optarg[0] == 0) |
|
182 |
{ |
|
183 |
help (); |
|
184 |
exit (1); |
|
185 |
} |
|
186 |
SlaveBoard.busname = optarg; |
|
187 |
break; |
|
188 |
case 'B': |
|
189 |
if (optarg[0] == 0) |
|
190 |
{ |
|
191 |
help (); |
|
192 |
exit (1); |
|
193 |
} |
|
194 |
SlaveBoard.baudrate = optarg; |
|
195 |
break; |
|
196 |
case 'l': |
|
197 |
if (optarg[0] == 0) |
|
198 |
{ |
|
199 |
help (); |
|
200 |
exit (1); |
|
201 |
} |
|
202 |
strncpy (LibraryPath, optarg, MAXLENGTH_LIBPATH); |
|
203 |
break; |
|
204 |
case 'i': |
|
205 |
if (optarg[0] == 0) |
|
206 |
{ |
|
207 |
help (); |
|
208 |
exit (1); |
|
209 |
} |
|
210 |
snodeid = optarg; |
|
211 |
sscanf (snodeid, "%x", &node_id_ext); |
|
212 |
break; |
|
213 |
case 's': |
|
214 |
to_start = 1; |
|
215 |
break; |
|
216 |
default: |
|
217 |
help (); |
|
218 |
exit (1); |
|
219 |
} |
|
295
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
220 |
} |
382 | 221 |
wxEntry (argc, argv); |
222 |
} |
|
223 |
||
224 |
||
225 |
bool |
|
226 |
MyApp::OnInit () |
|
227 |
{ |
|
228 |
frame = new MyFrame (_T ("I-O simulator")); |
|
229 |
frame->Show (true); |
|
230 |
return true; |
|
231 |
} |
|
232 |
||
233 |
MyFrame::MyFrame (const wxString & title):wxFrame (NULL, wxID_ANY, title, wxDefaultPosition, wxSize (800, 740), |
|
234 |
wxDEFAULT_FRAME_STYLE, wxT ("frame")), m_timer (this, |
|
235 |
TIMER_ID) |
|
236 |
{ |
|
237 |
wxMenu * |
|
238 |
fileMenu = new wxMenu; |
|
239 |
wxMenu * |
|
240 |
helpMenu = new wxMenu; |
|
241 |
wxPanel * |
|
242 |
panel; |
|
243 |
wxButton * |
|
244 |
quit; |
|
245 |
wxButton * |
|
246 |
load; |
|
247 |
wxBoxSizer * |
|
248 |
mysizer; |
|
249 |
wxBoxSizer * |
|
250 |
mysssizer; |
|
251 |
wxBoxSizer * |
|
252 |
myhsizer; |
|
253 |
wxBoxSizer * |
|
254 |
mybsizer; |
|
255 |
wxBoxSizer * |
|
256 |
myentrysizer; |
|
257 |
wxListBox * |
|
258 |
freqlist; |
|
259 |
wxStaticBox * |
|
260 |
namebox; |
|
261 |
wxStaticBox * |
|
262 |
freqbox; |
|
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
263 |
|
295
25ff2fadff89
DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
etisserant
parents:
246
diff
changeset
|
264 |
// SetIcon(wxICON(monicone)); |
382 | 265 |
SetBackgroundColour (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNFACE)); |
266 |
helpMenu->Append (HELP_ABOUT, _T ("&About...\tF1"), |
|
267 |
_T ("Show about dialog")); |
|
268 |
fileMenu->Append (FILE_QUIT, _T ("E&xit\tAlt-X"), _T ("Quit this program")); |
|
269 |
wxMenuBar * |
|
270 |
menuBar = new wxMenuBar (); |
|
271 |
menuBar->Append (fileMenu, _T ("&File")); |
|
272 |
menuBar->Append (helpMenu, _T ("&Help")); |
|
273 |
SetMenuBar (menuBar); |
|
274 |
CreateStatusBar (2); |
|
275 |
SetStatusText (_T ("Lolitech."), 0); |
|
276 |
SetStatusText (_T ("Welcome."), 1); |
|
277 |
||
278 |
book = new wxNotebook (this, BOOKCTRL); |
|
279 |
||
280 |
panel = new wxPanel (book); |
|
281 |
book->AddPage (panel, _T ("Configuration"), true); |
|
282 |
mysizer = new wxBoxSizer (wxVERTICAL); |
|
283 |
panel->SetSizer (mysizer); |
|
284 |
wxString |
|
285 |
choices[] = { |
|
286 |
_T ("10K"), _T ("20K"), _T ("50K"), _T ("100K"), |
|
287 |
_T ("125K"), _T ("250K"), _T ("500K"), _T ("1M") |
|
288 |
}; |
|
289 |
||
290 |
myhsizer = |
|
291 |
new wxStaticBoxSizer (new |
|
292 |
wxStaticBox (panel, wxID_ANY, _T ("Bus driver")), |
|
293 |
wxHORIZONTAL); |
|
294 |
mysizer->Add (myhsizer, 0, wxEXPAND | wxALL, 5); |
|
295 |
load = new wxButton (panel, LOAD, _T ("Load can driver")); |
|
296 |
myhsizer->Add (load, 0, wxLEFT, 5); |
|
297 |
drivername = |
|
298 |
new wxTextCtrl (panel, wxID_ANY, |
|
299 |
wxString ((const char *) LibraryPath, wxConvLocal)); |
|
300 |
myhsizer->Add (drivername, 1, wxEXPAND | wxALL, 5); |
|
301 |
myentrysizer = new wxBoxSizer (wxHORIZONTAL); |
|
302 |
mysizer->Add (myentrysizer, 0, wxEXPAND | wxALL, 5); |
|
303 |
myhsizer = |
|
304 |
new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T ("Bus name")), |
|
305 |
wxHORIZONTAL); |
|
306 |
myentrysizer->Add (myhsizer, 0, wxEXPAND | wxALL, 5); |
|
307 |
busname = |
|
308 |
new wxTextCtrl (panel, wxID_ANY, |
|
309 |
wxString ((const char *) SlaveBoard.busname, |
|
310 |
wxConvLocal)); |
|
311 |
myhsizer->Add (busname, 0, wxLEFT, 5); |
|
312 |
myhsizer = |
|
313 |
new wxStaticBoxSizer (new |
|
314 |
wxStaticBox (panel, wxID_ANY, |
|
315 |
_T ("Node ID (Hexa)")), wxHORIZONTAL); |
|
316 |
myentrysizer->Add (myhsizer, 0, wxEXPAND | wxALL, 5); |
|
317 |
node_id = |
|
318 |
new wxSpinCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, |
|
319 |
wxDefaultSize, wxSP_ARROW_KEYS, 1, 127, node_id_ext, |
|
320 |
_T ("wxSpinCtrl")); |
|
321 |
myhsizer->Add (node_id, 0, wxRIGHT, 5); |
|
322 |
myhsizer = |
|
323 |
new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T ("Baudrate")), |
|
324 |
wxHORIZONTAL); |
|
325 |
mysizer->Add (myhsizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 5); |
|
326 |
freqlist = |
|
327 |
new wxListBox (panel, FREQBOX, wxDefaultPosition, wxDefaultSize, 8, |
|
328 |
choices, wxLB_SINGLE | wxLB_HSCROLL); |
|
329 |
myhsizer->Add (freqlist, wxEXPAND | wxALL, wxEXPAND | wxALL, 5); |
|
330 |
quit = new wxButton (panel, QUIT, _T ("QUIT")); |
|
331 |
mysizer->Add (quit, 0, wxALL, 5); |
|
332 |
||
333 |
||
334 |
panel = new wxPanel (book); |
|
335 |
book->AddPage (panel, wxT ("Inputs"), true); |
|
336 |
mysizer = new wxBoxSizer (wxVERTICAL); |
|
337 |
panel->SetSizer (mysizer); |
|
338 |
myhsizer = |
|
339 |
new wxStaticBoxSizer (new |
|
340 |
wxStaticBox (panel, wxID_ANY, |
|
341 |
_T ("Read Inputs UNSIGNED8")), |
|
342 |
wxHORIZONTAL); |
|
343 |
mysizer->Add (myhsizer, 0, wxEXPAND | wxALL, 30); |
|
344 |
inbt1 = new wxToggleButton (panel, INBT1, wxT ("1")); |
|
345 |
inbt2 = new wxToggleButton (panel, INBT2, wxT ("2")); |
|
346 |
inbt3 = new wxToggleButton (panel, INBT3, wxT ("3")); |
|
347 |
inbt4 = new wxToggleButton (panel, INBT4, wxT ("4")); |
|
348 |
inbt5 = new wxToggleButton (panel, INBT5, wxT ("5")); |
|
349 |
inbt6 = new wxToggleButton (panel, INBT6, wxT ("6")); |
|
350 |
inbt7 = new wxToggleButton (panel, INBT7, wxT ("7")); |
|
351 |
inbt8 = new wxToggleButton (panel, INBT8, wxT ("8")); |
|
352 |
myhsizer->Add (inbt1, wxEXPAND | wxALL, 0, 5); |
|
353 |
myhsizer->Add (inbt2, wxEXPAND | wxALL, 0, 5); |
|
354 |
myhsizer->Add (inbt3, wxEXPAND | wxALL, 0, 5); |
|
355 |
myhsizer->Add (inbt4, wxEXPAND | wxALL, 0, 5); |
|
356 |
myhsizer->Add (inbt5, wxEXPAND | wxALL, 0, 5); |
|
357 |
myhsizer->Add (inbt6, wxEXPAND | wxALL, 0, 5); |
|
358 |
myhsizer->Add (inbt7, wxEXPAND | wxALL, 0, 5); |
|
359 |
myhsizer->Add (inbt8, wxEXPAND | wxALL, 0, 5); |
|
360 |
myhsizer = |
|
361 |
new wxStaticBoxSizer (new |
|
362 |
wxStaticBox (panel, wxID_ANY, |
|
363 |
_T ("Analogue Inputs INTEGER16")), |
|
364 |
wxVERTICAL); |
|
365 |
mysizer->Add (myhsizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 30); |
|
366 |
mysssizer = new wxBoxSizer (wxHORIZONTAL); |
|
367 |
myhsizer->Add (mysssizer, 0, wxEXPAND | wxALL, 0); |
|
368 |
inst1 = |
|
369 |
new wxSpinCtrl (panel, INST1, wxEmptyString, wxDefaultPosition, |
|
370 |
wxDefaultSize, wxSP_ARROW_KEYS, -32768, 32767, 0, |
|
371 |
_T ("0")); |
|
372 |
inst2 = |
|
373 |
new wxSpinCtrl (panel, INST2, wxEmptyString, wxDefaultPosition, |
|
374 |
wxDefaultSize, wxSP_ARROW_KEYS, -32768, 32767, 0, |
|
375 |
_T ("0")); |
|
376 |
inst3 = |
|
377 |
new wxSpinCtrl (panel, INST3, wxEmptyString, wxDefaultPosition, |
|
378 |
wxDefaultSize, wxSP_ARROW_KEYS, -32768, 32767, 0, |
|
379 |
_T ("0")); |
|
380 |
inst4 = |
|
381 |
new wxSpinCtrl (panel, INST4, wxEmptyString, wxDefaultPosition, |
|
382 |
wxDefaultSize, wxSP_ARROW_KEYS, -32768, 32767, 0, |
|
383 |
_T ("0")); |
|
384 |
inst5 = |
|
385 |
new wxSpinCtrl (panel, INST5, wxEmptyString, wxDefaultPosition, |
|
386 |
wxDefaultSize, wxSP_ARROW_KEYS, -32768, 32767, 0, |
|
387 |
_T ("0")); |
|
388 |
inst6 = |
|
389 |
new wxSpinCtrl (panel, INST6, wxEmptyString, wxDefaultPosition, |
|
390 |
wxDefaultSize, wxSP_ARROW_KEYS, -32768, 32767, 0, |
|
391 |
_T ("0")); |
|
392 |
inst7 = |
|
393 |
new wxSpinCtrl (panel, INST7, wxEmptyString, wxDefaultPosition, |
|
394 |
wxDefaultSize, wxSP_ARROW_KEYS, -32768, 32767, 0, |
|
395 |
_T ("0")); |
|
396 |
inst8 = |
|
397 |
new wxSpinCtrl (panel, INST8, wxEmptyString, wxDefaultPosition, |
|
398 |
wxDefaultSize, wxSP_ARROW_KEYS, -32768, 32767, 0, |
|
399 |
_T ("0")); |
|
400 |
mysssizer->Add (inst1, wxALL, 0, 5); |
|
401 |
mysssizer->Add (inst2, wxALL, 0, 5); |
|
402 |
mysssizer->Add (inst3, wxALL, 0, 5); |
|
403 |
mysssizer->Add (inst4, wxALL, 0, 5); |
|
404 |
mysssizer->Add (inst5, wxALL, 0, 5); |
|
405 |
mysssizer->Add (inst6, wxALL, 0, 5); |
|
406 |
mysssizer->Add (inst7, wxALL, 0, 5); |
|
407 |
mysssizer->Add (inst8, wxALL, 0, 5); |
|
408 |
mysssizer = new wxBoxSizer (wxHORIZONTAL); |
|
409 |
myhsizer->Add (mysssizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 0); |
|
410 |
ins1 = |
|
411 |
new wxSlider (panel, INS1, 0, -32768, 32767, wxDefaultPosition, |
|
412 |
wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE, |
|
413 |
wxDefaultValidator, wxT ("slider")); |
|
414 |
ins2 = |
|
415 |
new wxSlider (panel, INS2, 0, -32768, 32767, wxDefaultPosition, |
|
416 |
wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE, |
|
417 |
wxDefaultValidator, wxT ("slider")); |
|
418 |
ins3 = |
|
419 |
new wxSlider (panel, INS3, 0, -32768, 32767, wxDefaultPosition, |
|
420 |
wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE, |
|
421 |
wxDefaultValidator, wxT ("slider")); |
|
422 |
ins4 = |
|
423 |
new wxSlider (panel, INS4, 0, -32768, 32767, wxDefaultPosition, |
|
424 |
wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE, |
|
425 |
wxDefaultValidator, wxT ("slider")); |
|
426 |
ins5 = |
|
427 |
new wxSlider (panel, INS5, 0, -32768, 32767, wxDefaultPosition, |
|
428 |
wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE, |
|
429 |
wxDefaultValidator, wxT ("slider")); |
|
430 |
ins6 = |
|
431 |
new wxSlider (panel, INS6, 0, -32768, 32767, wxDefaultPosition, |
|
432 |
wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE, |
|
433 |
wxDefaultValidator, wxT ("slider")); |
|
434 |
ins7 = |
|
435 |
new wxSlider (panel, INS7, 0, -32768, 32767, wxDefaultPosition, |
|
436 |
wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE, |
|
437 |
wxDefaultValidator, wxT ("slider")); |
|
438 |
ins8 = |
|
439 |
new wxSlider (panel, INS8, 0, -32768, 32767, wxDefaultPosition, |
|
440 |
wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE, |
|
441 |
wxDefaultValidator, wxT ("slider")); |
|
442 |
mysssizer->Add (ins1, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
443 |
mysssizer->Add (ins2, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
444 |
mysssizer->Add (ins3, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
445 |
mysssizer->Add (ins4, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
446 |
mysssizer->Add (ins5, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
447 |
mysssizer->Add (ins6, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
448 |
mysssizer->Add (ins7, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
449 |
mysssizer->Add (ins8, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
450 |
quit = new wxButton (panel, QUIT, _T ("QUIT")); |
|
451 |
mysizer->Add (quit, 0, wxALL, 5); |
|
452 |
||
453 |
panel = new wxPanel (book); |
|
454 |
book->AddPage (panel, wxT ("Outputs"), true); |
|
455 |
mysizer = new wxBoxSizer (wxVERTICAL); |
|
456 |
panel->SetSizer (mysizer); |
|
457 |
myhsizer = |
|
458 |
new wxStaticBoxSizer (new |
|
459 |
wxStaticBox (panel, wxID_ANY, |
|
460 |
_T ("Write Outputs UNSIGNED8")), |
|
461 |
wxHORIZONTAL); |
|
462 |
mysizer->Add (myhsizer, 0, wxEXPAND | wxALL, 30); |
|
463 |
outbt1 = new wxToggleButton (panel, wxID_ANY, wxT ("1")); |
|
464 |
outbt2 = new wxToggleButton (panel, wxID_ANY, wxT ("2")); |
|
465 |
outbt3 = new wxToggleButton (panel, wxID_ANY, wxT ("3")); |
|
466 |
outbt4 = new wxToggleButton (panel, wxID_ANY, wxT ("4")); |
|
467 |
outbt5 = new wxToggleButton (panel, wxID_ANY, wxT ("5")); |
|
468 |
outbt6 = new wxToggleButton (panel, wxID_ANY, wxT ("6")); |
|
469 |
outbt7 = new wxToggleButton (panel, wxID_ANY, wxT ("7")); |
|
470 |
outbt8 = new wxToggleButton (panel, wxID_ANY, wxT ("8")); |
|
471 |
myhsizer->Add (outbt1, wxEXPAND | wxALL, 0, 5); |
|
472 |
myhsizer->Add (outbt2, wxEXPAND | wxALL, 0, 5); |
|
473 |
myhsizer->Add (outbt3, wxEXPAND | wxALL, 0, 5); |
|
474 |
myhsizer->Add (outbt4, wxEXPAND | wxALL, 0, 5); |
|
475 |
myhsizer->Add (outbt5, wxEXPAND | wxALL, 0, 5); |
|
476 |
myhsizer->Add (outbt6, wxEXPAND | wxALL, 0, 5); |
|
477 |
myhsizer->Add (outbt7, wxEXPAND | wxALL, 0, 5); |
|
478 |
myhsizer->Add (outbt8, wxEXPAND | wxALL, 0, 5); |
|
479 |
myhsizer = |
|
480 |
new wxStaticBoxSizer (new |
|
481 |
wxStaticBox (panel, wxID_ANY, |
|
482 |
_T ("Analogue Output INTEGER16")), |
|
483 |
wxVERTICAL); |
|
484 |
mysizer->Add (myhsizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 30); |
|
485 |
mysssizer = new wxBoxSizer (wxHORIZONTAL); |
|
486 |
myhsizer->Add (mysssizer, 0, wxEXPAND | wxALL, 0); |
|
487 |
outst1 = |
|
488 |
new wxStaticText (panel, wxID_ANY, wxT ("label"), wxDefaultPosition, |
|
489 |
wxDefaultSize, 0, wxT ("staticText")); |
|
490 |
outst2 = |
|
491 |
new wxStaticText (panel, wxID_ANY, wxT ("label"), wxDefaultPosition, |
|
492 |
wxDefaultSize, 0, wxT ("staticText")); |
|
493 |
outst3 = |
|
494 |
new wxStaticText (panel, wxID_ANY, wxT ("label"), wxDefaultPosition, |
|
495 |
wxDefaultSize, 0, wxT ("staticText")); |
|
496 |
outst4 = |
|
497 |
new wxStaticText (panel, wxID_ANY, wxT ("label"), wxDefaultPosition, |
|
498 |
wxDefaultSize, 0, wxT ("staticText")); |
|
499 |
mysssizer->Add (outst1, wxEXPAND | wxALL, wxEXPAND | wxALL, 5); |
|
500 |
mysssizer->Add (outst2, wxEXPAND | wxALL, wxEXPAND | wxALL, 5); |
|
501 |
mysssizer->Add (outst3, wxEXPAND | wxALL, wxEXPAND | wxALL, 5); |
|
502 |
mysssizer->Add (outst4, wxEXPAND | wxALL, wxEXPAND | wxALL, 5); |
|
503 |
mysssizer = new wxBoxSizer (wxHORIZONTAL); |
|
504 |
myhsizer->Add (mysssizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 0); |
|
505 |
outs1 = |
|
506 |
new wxGauge (panel, wxID_ANY, 65535, wxDefaultPosition, wxDefaultSize, |
|
507 |
wxSL_VERTICAL | wxSL_INVERSE, wxDefaultValidator, |
|
508 |
wxT ("gauge")); |
|
509 |
outs2 = |
|
510 |
new wxGauge (panel, wxID_ANY, 65535, wxDefaultPosition, wxDefaultSize, |
|
511 |
wxSL_VERTICAL | wxSL_INVERSE, wxDefaultValidator, |
|
512 |
wxT ("gauge")); |
|
513 |
outs3 = |
|
514 |
new wxGauge (panel, wxID_ANY, 65535, wxDefaultPosition, wxDefaultSize, |
|
515 |
wxSL_VERTICAL | wxSL_INVERSE, wxDefaultValidator, |
|
516 |
wxT ("gauge")); |
|
517 |
outs4 = |
|
518 |
new wxGauge (panel, wxID_ANY, 65535, wxDefaultPosition, wxDefaultSize, |
|
519 |
wxSL_VERTICAL | wxSL_INVERSE, wxDefaultValidator, |
|
520 |
wxT ("gauge")); |
|
521 |
mysssizer->Add (outs1, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
522 |
mysssizer->Add (outs2, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
523 |
mysssizer->Add (outs3, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
524 |
mysssizer->Add (outs4, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
525 |
quit = new wxButton (panel, QUIT, _T ("QUIT")); |
|
526 |
mysizer->Add (quit, 0, wxALL, 5); |
|
527 |
||
528 |
wxString |
|
529 |
choice[] = { |
|
530 |
_T ("Analogue Out 1"), _T ("Analogue Out 2"), |
|
531 |
_T ("Analogue Out 3"), _T ("Analogue Out 4"), |
|
532 |
_T ("Bool Out 1"), _T ("Bool Out 2"), |
|
533 |
_T ("Bool Out 3"), _T ("Bool Out 4"), |
|
534 |
_T ("Bool Out 5"), _T ("Bool Out 6"), |
|
535 |
_T ("Bool Out 7"), _T ("Bool Out 8"), |
|
536 |
_T ("Analogue Input 1"), _T ("Analogue Input 2"), |
|
537 |
_T ("Analogue Input 3"), _T ("Analogue Input 4"), |
|
538 |
_T ("Analogue Input 5"), _T ("Analogue Input 6"), |
|
539 |
_T ("Analogue Input 7"), _T ("Analogue Input 8"), |
|
540 |
_T ("Bool Input 1"), _T ("Bool Input 2"), |
|
541 |
_T ("Bool Input 3"), _T ("Bool Input 4"), |
|
542 |
_T ("Bool Input 5"), _T ("Bool Input 6"), |
|
543 |
_T ("Bool Input 7"), _T ("Bool Input 8"), |
|
544 |
}; |
|
545 |
panel = new wxPanel (book); |
|
546 |
book->AddPage(panel, wxT("Graphic"), true); |
|
547 |
mysizer = new wxBoxSizer (wxVERTICAL); |
|
548 |
panel->SetSizer (mysizer); |
|
549 |
//panel->Hide (); |
|
550 |
myhsizer = |
|
551 |
new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T ("Graphic")), |
|
552 |
wxVERTICAL); |
|
553 |
mysizer->Add (myhsizer, 0, wxEXPAND | wxALL, 10); |
|
554 |
mygraphpan = |
|
555 |
new wxPanel (panel, wxID_ANY, wxDefaultPosition, wxSize (0, 350), |
|
556 |
wxTAB_TRAVERSAL, wxT ("Graphic")); |
|
557 |
myhsizer->Add (mygraphpan, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
558 |
echelle = |
|
559 |
new wxSlider (panel, wxID_ANY, 44, 44, 1000, wxDefaultPosition, |
|
560 |
wxDefaultSize, wxSL_HORIZONTAL, wxDefaultValidator, |
|
561 |
wxT ("slider")); |
|
562 |
myhsizer->Add (echelle, 0, wxEXPAND | wxALL, 0); |
|
563 |
mybsizer = new wxBoxSizer (wxHORIZONTAL); |
|
564 |
mysizer->Add (mybsizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 5); |
|
565 |
myhsizer = |
|
566 |
new wxStaticBoxSizer (new |
|
567 |
wxStaticBox (panel, wxID_ANY, |
|
568 |
_T ("Select viewable Inputs")), |
|
569 |
wxHORIZONTAL); |
|
570 |
mybsizer->Add (myhsizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 10); |
|
571 |
inlist = |
|
572 |
new wxListBox (panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 28, |
|
573 |
choice, wxLB_EXTENDED | wxLB_HSCROLL); |
|
574 |
myhsizer->Add (inlist, wxEXPAND | wxALL, wxEXPAND | wxALL, 5); |
|
575 |
myhsizer = |
|
576 |
new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T ("Legende")), |
|
577 |
wxHORIZONTAL); |
|
578 |
mybsizer->Add (myhsizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 10); |
|
579 |
mylegpan = |
|
580 |
new wxPanel (panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, |
|
581 |
wxTAB_TRAVERSAL, wxT ("Legende")); |
|
582 |
myhsizer->Add (mylegpan, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
583 |
quit = new wxButton (panel, QUIT, _T ("QUIT")); |
|
584 |
mysizer->Add (quit, 0, wxALL, 5); |
|
585 |
||
586 |
panel = new wxPanel (book); |
|
587 |
book->InsertPage (0, panel, wxT ("Control"), true); |
|
588 |
mysizer = new wxBoxSizer (wxVERTICAL); |
|
589 |
panel->SetSizer (mysizer); |
|
590 |
myhsizer = new wxBoxSizer (wxHORIZONTAL); |
|
591 |
myhsizer = |
|
592 |
new wxStaticBoxSizer (new |
|
593 |
wxStaticBox (panel, wxID_ANY, |
|
594 |
_T ("Control your node")), |
|
595 |
wxHORIZONTAL); |
|
596 |
mysizer->Add (myhsizer, 0, wxALL, 5); |
|
597 |
start = new wxButton (panel, START, _T ("START")); |
|
598 |
stop = new wxButton (panel, STOP, _T ("STOP")); |
|
599 |
stop->Enable (false); |
|
600 |
myhsizer->Add (start, 0, wxRIGHT, 5); |
|
601 |
myhsizer->Add (stop, 0, wxLEFT, 5); |
|
602 |
myhsizer = |
|
603 |
new wxStaticBoxSizer (new |
|
604 |
wxStaticBox (panel, wxID_ANY, _T ("Operation log")), |
|
605 |
wxHORIZONTAL); |
|
606 |
mysizer->Add (myhsizer, wxALL, wxEXPAND | wxALL, 5); |
|
607 |
textLog = |
|
608 |
new wxTextCtrl (panel, TEXTBOX1, _T (""), wxDefaultPosition, |
|
609 |
wxDefaultSize, wxTE_MULTILINE, wxDefaultValidator, |
|
610 |
wxTextCtrlNameStr); |
|
611 |
myhsizer->Add (textLog, wxALL, wxEXPAND | wxALL, 5); |
|
612 |
quit = new wxButton (panel, QUIT, _T ("QUIT")); |
|
613 |
mysizer->Add (quit, 0, wxALL, 5); |
|
614 |
||
615 |
for (int i = 0; i < 28; i++) |
|
616 |
for (int j = 0; j < 44; j++) |
|
617 |
y[i][j] = 0; |
|
618 |
m_timer.Start (100); |
|
619 |
if (to_start) |
|
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
620 |
{ |
382 | 621 |
Start (); |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
622 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
623 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
624 |
|
382 | 625 |
void |
626 |
MyFrame::OnQuit (wxCommandEvent & WXUNUSED (event)) |
|
627 |
{ |
|
628 |
Close (true); |
|
629 |
} |
|
630 |
||
631 |
void |
|
632 |
MyFrame::Start () |
|
633 |
{ |
|
634 |
if (main_can (SlaveBoard, LibraryPath)) |
|
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
635 |
{ |
382 | 636 |
printf ("[KO]\n"); |
637 |
*textLog << |
|
638 |
wxT |
|
639 |
("----------------------------------------------------Initialization [KO]\n"); |
|
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
640 |
} |
382 | 641 |
else |
642 |
{ |
|
643 |
printf ("[OK]\n"); |
|
644 |
*textLog << |
|
645 |
wxT |
|
646 |
("----------------------------------------------------Initialization [OK]\n"); |
|
647 |
stop->Enable (true); |
|
648 |
start->Enable (false); |
|
649 |
} |
|
650 |
} |
|
651 |
||
652 |
void |
|
653 |
MyFrame::OnStart (wxCommandEvent & WXUNUSED (event)) |
|
654 |
{ |
|
655 |
wxString s; |
|
656 |
||
657 |
node_id_ext = node_id->GetValue (); |
|
658 |
s = busname->GetValue (); |
|
659 |
strncpy (SlaveBoard.busname, s.mb_str (), MAXLENGTH_BUSNAME); |
|
660 |
*textLog << wxT ("-- Bus name: ------> ") << s << wxT ("\n"); |
|
661 |
*textLog << wxT ("-- Node ID: -------> ") << node_id-> |
|
662 |
GetValue () << wxT ("\n"); |
|
663 |
Start (); |
|
664 |
} |
|
665 |
||
666 |
||
667 |
void |
|
668 |
MyFrame::OnStop (wxCommandEvent & WXUNUSED (event)) |
|
669 |
{ |
|
670 |
||
671 |
*textLog << |
|
672 |
wxT |
|
673 |
("----------------------------------------------------Slave [STOPPED]") << |
|
674 |
wxT ("\n"); |
|
675 |
stop_slave (); |
|
676 |
stop->Enable (false); |
|
677 |
start->Enable (true); |
|
678 |
} |
|
679 |
||
680 |
void |
|
681 |
MyFrame::OnLoad (wxCommandEvent & WXUNUSED (event)) |
|
682 |
{ |
|
683 |
wxFileDialog fd (this, wxT ("Choose a can driver library"), wxT (""), |
|
684 |
wxT (""), LIB_EXTENT); |
|
685 |
||
686 |
if (fd.ShowModal () == wxID_OK) |
|
687 |
{ |
|
688 |
drivername->Clear (); |
|
689 |
drivername->AppendText (fd.GetPath ()); |
|
690 |
*textLog << wxT ("LibraryPath: ") << fd.GetPath () << wxT ("\n"); |
|
691 |
strncpy (LibraryPath, fd.GetPath ().mb_str (), MAXLENGTH_LIBPATH); |
|
692 |
printf ("path=%s", LibraryPath); |
|
693 |
} |
|
694 |
} |
|
695 |
||
696 |
void |
|
697 |
MyFrame::OnInbt1 (wxCommandEvent & WXUNUSED (event)) |
|
698 |
{ |
|
699 |
Read_Inputs_8_Bit[0] = Read_Inputs_8_Bit[0] ^ 0x1; |
|
700 |
} |
|
701 |
||
702 |
void |
|
703 |
MyFrame::OnInbt2 (wxCommandEvent & WXUNUSED (event)) |
|
704 |
{ |
|
705 |
Read_Inputs_8_Bit[0] = Read_Inputs_8_Bit[0] ^ 0x2; |
|
706 |
} |
|
707 |
||
708 |
void |
|
709 |
MyFrame::OnInbt3 (wxCommandEvent & WXUNUSED (event)) |
|
710 |
{ |
|
711 |
Read_Inputs_8_Bit[0] = Read_Inputs_8_Bit[0] ^ 0x4; |
|
712 |
} |
|
713 |
||
714 |
void |
|
715 |
MyFrame::OnInbt4 (wxCommandEvent & WXUNUSED (event)) |
|
716 |
{ |
|
717 |
Read_Inputs_8_Bit[0] = Read_Inputs_8_Bit[0] ^ 0x8; |
|
718 |
} |
|
719 |
||
720 |
void |
|
721 |
MyFrame::OnInbt5 (wxCommandEvent & WXUNUSED (event)) |
|
722 |
{ |
|
723 |
Read_Inputs_8_Bit[0] = Read_Inputs_8_Bit[0] ^ 0x10; |
|
724 |
} |
|
725 |
||
726 |
void |
|
727 |
MyFrame::OnInbt6 (wxCommandEvent & WXUNUSED (event)) |
|
728 |
{ |
|
729 |
Read_Inputs_8_Bit[0] = Read_Inputs_8_Bit[0] ^ 0x20; |
|
730 |
} |
|
731 |
||
732 |
void |
|
733 |
MyFrame::OnInbt7 (wxCommandEvent & WXUNUSED (event)) |
|
734 |
{ |
|
735 |
Read_Inputs_8_Bit[0] = Read_Inputs_8_Bit[0] ^ 0x40; |
|
736 |
} |
|
737 |
||
738 |
void |
|
739 |
MyFrame::OnInbt8 (wxCommandEvent & WXUNUSED (event)) |
|
740 |
{ |
|
741 |
Read_Inputs_8_Bit[0] = Read_Inputs_8_Bit[0] ^ 0x80; |
|
742 |
} |
|
743 |
||
744 |
||
745 |
||
746 |
void |
|
747 |
MyFrame::OnIns1 (wxScrollEvent & event) |
|
748 |
{ |
|
749 |
Read_Analogue_Input_16_Bit[0] = ins1->GetValue (); |
|
750 |
inst1->SetValue (ins1->GetValue ()); |
|
751 |
} |
|
752 |
||
753 |
void |
|
754 |
MyFrame::OnIns2 (wxScrollEvent & event) |
|
755 |
{ |
|
756 |
Read_Analogue_Input_16_Bit[1] = ins2->GetValue (); |
|
757 |
inst2->SetValue (ins2->GetValue ()); |
|
758 |
} |
|
759 |
||
760 |
void |
|
761 |
MyFrame::OnIns3 (wxScrollEvent & event) |
|
762 |
{ |
|
763 |
Read_Analogue_Input_16_Bit[2] = ins3->GetValue (); |
|
764 |
inst3->SetValue (ins3->GetValue ()); |
|
765 |
} |
|
766 |
||
767 |
void |
|
768 |
MyFrame::OnIns4 (wxScrollEvent & event) |
|
769 |
{ |
|
770 |
Read_Analogue_Input_16_Bit[3] = ins4->GetValue (); |
|
771 |
inst4->SetValue (ins4->GetValue ()); |
|
772 |
} |
|
773 |
||
774 |
void |
|
775 |
MyFrame::OnIns5 (wxScrollEvent & event) |
|
776 |
{ |
|
777 |
Read_Analogue_Input_16_Bit[4] = ins5->GetValue (); |
|
778 |
inst5->SetValue (ins5->GetValue ()); |
|
779 |
} |
|
780 |
||
781 |
void |
|
782 |
MyFrame::OnIns6 (wxScrollEvent & event) |
|
783 |
{ |
|
784 |
Read_Analogue_Input_16_Bit[5] = ins6->GetValue (); |
|
785 |
inst6->SetValue (ins6->GetValue ()); |
|
786 |
} |
|
787 |
||
788 |
void |
|
789 |
MyFrame::OnIns7 (wxScrollEvent & event) |
|
790 |
{ |
|
791 |
Read_Analogue_Input_16_Bit[6] = ins7->GetValue (); |
|
792 |
inst7->SetValue (ins7->GetValue ()); |
|
793 |
} |
|
794 |
||
795 |
void |
|
796 |
MyFrame::OnIns8 (wxScrollEvent & event) |
|
797 |
{ |
|
798 |
Read_Analogue_Input_16_Bit[7] = ins8->GetValue (); |
|
799 |
inst8->SetValue (ins8->GetValue ()); |
|
800 |
} |
|
801 |
||
802 |
||
803 |
void |
|
804 |
MyFrame::OnInst1 (wxSpinEvent & ev) |
|
805 |
{ |
|
806 |
Read_Analogue_Input_16_Bit[0] = inst1->GetValue (); |
|
807 |
ins1->SetValue (inst1->GetValue ()); |
|
808 |
} |
|
809 |
||
810 |
void |
|
811 |
MyFrame::OnInst2 (wxSpinEvent & ev) |
|
812 |
{ |
|
813 |
Read_Analogue_Input_16_Bit[1] = inst2->GetValue (); |
|
814 |
ins2->SetValue (inst2->GetValue ()); |
|
815 |
} |
|
816 |
||
817 |
void |
|
818 |
MyFrame::OnInst3 (wxSpinEvent & ev) |
|
819 |
{ |
|
820 |
Read_Analogue_Input_16_Bit[2] = inst3->GetValue (); |
|
821 |
ins3->SetValue (inst3->GetValue ()); |
|
822 |
} |
|
823 |
||
824 |
void |
|
825 |
MyFrame::OnInst4 (wxSpinEvent & ev) |
|
826 |
{ |
|
827 |
Read_Analogue_Input_16_Bit[3] = inst4->GetValue (); |
|
828 |
ins4->SetValue (inst4->GetValue ()); |
|
829 |
} |
|
830 |
||
831 |
void |
|
832 |
MyFrame::OnInst5 (wxSpinEvent & ev) |
|
833 |
{ |
|
834 |
Read_Analogue_Input_16_Bit[4] = inst5->GetValue (); |
|
835 |
ins5->SetValue (inst5->GetValue ()); |
|
836 |
} |
|
837 |
||
838 |
void |
|
839 |
MyFrame::OnInst6 (wxSpinEvent & ev) |
|
840 |
{ |
|
841 |
Read_Analogue_Input_16_Bit[5] = inst6->GetValue (); |
|
842 |
ins6->SetValue (inst6->GetValue ()); |
|
843 |
} |
|
844 |
||
845 |
void |
|
846 |
MyFrame::OnInst7 (wxSpinEvent & ev) |
|
847 |
{ |
|
848 |
Read_Analogue_Input_16_Bit[6] = inst7->GetValue (); |
|
849 |
ins7->SetValue (inst7->GetValue ()); |
|
850 |
} |
|
851 |
||
852 |
void |
|
853 |
MyFrame::OnInst8 (wxSpinEvent & ev) |
|
854 |
{ |
|
855 |
Read_Analogue_Input_16_Bit[7] = inst8->GetValue (); |
|
856 |
ins8->SetValue (inst8->GetValue ()); |
|
857 |
} |
|
858 |
||
859 |
||
860 |
void |
|
861 |
MyFrame::OnAbout (wxCommandEvent & WXUNUSED (event)) |
|
862 |
{ |
|
863 |
wxString msg; |
|
864 |
msg.Printf (_T ("About.\n\n") |
|
865 |
_T |
|
866 |
("Input-Output simulation by GRANDEMANGE Nicolas for CanFestival!!")); |
|
867 |
||
868 |
wxMessageBox (msg, _T ("About !!!"), wxOK | wxICON_INFORMATION, this); |
|
869 |
} |
|
870 |
||
871 |
||
872 |
void |
|
873 |
MyFrame::OnFreqBoxClick (wxCommandEvent & event) |
|
874 |
{ |
|
875 |
wxString wxstr; |
|
876 |
||
877 |
wxstr = event.GetString (); |
|
878 |
strncpy (SlaveBoard.baudrate, wxstr.mb_str (), MAXLENGTH_BAUDRATE); |
|
879 |
*textLog << wxT ("Baudrate:") << event.GetString () << wxT ("\n"); |
|
880 |
} |
|
881 |
||
882 |
static int |
|
883 |
is_set (int i, wxListBox * inlist, wxArrayInt in) |
|
884 |
{ |
|
885 |
inlist->GetSelections (in); |
|
886 |
for (int j = 0; j < in.GetCount (); j++) |
|
887 |
{ |
|
888 |
if (i == (in[j] + 1)) |
|
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
889 |
{ |
382 | 890 |
return (i); |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
891 |
} |
382 | 892 |
} |
893 |
return (0); |
|
894 |
} |
|
895 |
||
896 |
static int |
|
897 |
get_bit (UNS8 input, int bit) |
|
898 |
{ |
|
899 |
return input & (((UNS8) 1) << bit - 1) ? 1 : 0; |
|
900 |
} |
|
901 |
||
902 |
void |
|
903 |
MyFrame::Paint () |
|
904 |
{ |
|
905 |
double vmax = old_max; |
|
906 |
double vmin = old_min; |
|
907 |
double vdelta = vmax - vmin; |
|
908 |
double vech = ((float) vdelta) / 10.0; |
|
909 |
||
910 |
double hmax = frame->echelle->GetValue (); |
|
911 |
double hech = hdelta / 11; |
|
912 |
||
913 |
double d = 300 / vdelta; |
|
914 |
double g = 0; |
|
915 |
double top = 5; |
|
916 |
double left = 50; |
|
917 |
||
918 |
double tmpi = 0; |
|
919 |
wxString tmps; |
|
920 |
double p = 0; |
|
921 |
double q = 0; |
|
922 |
int i = 0; |
|
923 |
int j = 0; |
|
924 |
wxColor col[8] = |
|
925 |
{ wxColor (wxT ("BLUE")), wxColor (wxT ("RED")), wxColor (wxT ("GREEN")), |
|
926 |
wxColor (wxT ("GREY")), |
|
927 |
wxColor (wxT ("ORANGE")), wxColor (wxT ("YELLOW")), |
|
928 |
wxColor (wxT ("PINK")), wxColor (wxT ("BLACK")) |
|
929 |
}; |
|
930 |
hdelta = hmax - 0; |
|
931 |
g = (Gtime / hdelta) * 44.00; |
|
932 |
||
933 |
wxClientDC MonDc (mygraphpan); |
|
934 |
MonDc.Clear (); |
|
935 |
||
936 |
MonDc.SetPen (wxPen (wxColour (200, 200, 200), 5, wxSOLID)); |
|
937 |
MonDc.DrawRectangle ((int) left, (int) top, 660, 300); |
|
938 |
||
939 |
MonDc.SetPen (wxPen (wxColor (150, 200, 150), 2, wxSOLID)); |
|
940 |
MonDc. |
|
941 |
SetFont (wxFont |
|
942 |
(9, wxSWISS, wxNORMAL, wxNORMAL, false, wxT ("Arial Black"))); |
|
943 |
for (i = 0; i < 11; i++) |
|
944 |
{ |
|
945 |
tmpi = (vmin + (vech * i)); |
|
946 |
tmps.Printf (wxT ("%d"), (int) tmpi); |
|
947 |
MonDc.DrawRotatedText (tmps, 0, (int) (293 - (30 * i) + top), 0); |
|
948 |
} |
|
949 |
for (i = 0; i < 12; i++) |
|
950 |
{ |
|
951 |
tmpi = (hech * i * 100); |
|
952 |
if (tmpi < 1000) |
|
953 |
tmps.Printf (wxT ("%ims"), (int) tmpi); |
|
954 |
if (tmpi > 1000) |
|
955 |
tmps.Printf (wxT ("%is"), (int) (tmpi / 1000)); |
|
956 |
MonDc.DrawRotatedText (tmps, (int) ((60 * i) + left) - 10, |
|
957 |
(int) (317 + top), 0); |
|
958 |
} |
|
959 |
for (j = 1; j < 10; j++) |
|
960 |
MonDc.DrawLine ((int) left, (int) (300 - (30 * j) + top), |
|
961 |
(int) (left + 660), (int) (300 - (30 * j) + top)); |
|
962 |
MonDc.SetPen (wxPen (wxColor (150, 200, 150), 2, wxSOLID)); |
|
963 |
for (j = 1; j < 22; j++) |
|
964 |
MonDc.DrawLine ((int) (30 * j + left), (int) (300 + top), |
|
965 |
(int) (30 * j + left), (int) (top)); |
|
966 |
MonDc.SetPen (wxPen (wxColor (150, 170, 150), 1, wxSOLID)); |
|
967 |
for (j = 1; j < 22; j++) |
|
968 |
MonDc.DrawLine ((int) (30 * j + left - 15), (int) (300 + top), |
|
969 |
(int) (30 * j + left - 15), (int) (top)); |
|
970 |
MonDc.DrawLine ((int) (30 * 22 + left - 15), (int) (300 + top), |
|
971 |
(int) (30 * 22 + left - 15), (int) (top)); |
|
972 |
||
973 |
double m = (-vmin) * d; |
|
974 |
MonDc.SetPen (wxPen (wxColor (170, 170, 150), 3, wxSOLID)); |
|
975 |
MonDc.DrawLine ((int) (left), (int) (300 + top - m), (int) (left + 660), |
|
976 |
(int) (300 + top - m)); |
|
977 |
||
978 |
wxClientDC MaLeg (mylegpan); |
|
979 |
MaLeg.Clear (); |
|
980 |
||
981 |
MaLeg.SetPen (wxPen (wxColour (150, 200, 100), 2, wxSOLID)); |
|
982 |
MaLeg. |
|
983 |
SetFont (wxFont |
|
984 |
(7, wxSWISS, wxNORMAL, wxNORMAL, false, wxT ("Arial Black"))); |
|
985 |
for (int k = 1, tmpi = 0; k < 30; k++) |
|
986 |
{ |
|
987 |
if ((tmpi < 8) && is_set (k, inlist, in)) |
|
988 |
{ |
|
989 |
if (k <= 4) |
|
990 |
tmps.Printf (wxT ("Analogue Output %d"), k); |
|
991 |
if ((k > 4) && (k <= 12)) |
|
992 |
tmps.Printf (wxT ("Bool Output %d"), k - 4); |
|
993 |
if ((k > 12) && (k <= 20)) |
|
994 |
tmps.Printf (wxT ("Analogue Input %d"), k - 12); |
|
995 |
if ((k > 20) && (k <= 28)) |
|
996 |
tmps.Printf (wxT ("Bool Input %d"), k - 20); |
|
997 |
||
998 |
MaLeg.DrawRotatedText (tmps, 0, 10 * tmpi, 0); |
|
999 |
MaLeg.SetPen (wxPen (col[tmpi], 4, wxSOLID)); |
|
1000 |
MaLeg.DrawLine (100, 10 * tmpi + 6, 115, 10 * tmpi + 6); |
|
1001 |
//////////////////////////////////////////DAW//////////////////////////////////////// |
|
1002 |
MonDc.SetPen (wxPen (col[tmpi], 4, wxSOLID)); |
|
1003 |
if (k <= 4) |
|
1004 |
y[k - 1][(int) g] = Write_Analogue_Output_16_Bit[k - 1]; |
|
1005 |
if ((k > 4) && (k <= 12)) |
|
1006 |
y[k - 1][(int) g] = get_bit (Write_Outputs_8_Bit[0], k - 4); |
|
1007 |
if ((k > 12) && (k <= 20)) |
|
1008 |
y[k - 1][(int) g] = Read_Analogue_Input_16_Bit[k - 1 - 12]; |
|
1009 |
if ((k > 20) && (k <= 28)) |
|
1010 |
y[k - 1][(int) g] = get_bit (Read_Inputs_8_Bit[0], k - 20); |
|
1011 |
||
1012 |
if (y[k - 1][(int) g] > old_max) |
|
1013 |
old_max = y[k - 1][(int) g]; |
|
1014 |
if (y[k - 1][(int) g] < old_min) |
|
1015 |
old_min = y[k - 1][(int) g]; |
|
1016 |
for (j = 1; j < (g + 1); j++) |
|
1017 |
{ |
|
1018 |
p = (y[k - 1][j - 1] - vmin) * d; |
|
1019 |
q = (y[k - 1][j] - vmin) * d; |
|
1020 |
MonDc.DrawLine ((int) (15 * (j - 1) + left), |
|
1021 |
(int) (300 + top - p), (int) (15 * j + left), |
|
1022 |
(int) (300 + top - q)); |
|
1023 |
} |
|
1024 |
///////////////////////////////////////////////////////////////////////////////////// |
|
1025 |
tmpi++; |
|
1026 |
} |
|
1027 |
} |
|
1028 |
} |
|
1029 |
||
1030 |
void |
|
1031 |
actu_output (void) |
|
1032 |
{ |
|
1033 |
wxString tmp; |
|
1034 |
||
1035 |
frame->outbt1->SetValue (get_bit (Write_Outputs_8_Bit[0], 1)); |
|
1036 |
frame->outbt2->SetValue (get_bit (Write_Outputs_8_Bit[0], 2)); |
|
1037 |
frame->outbt3->SetValue (get_bit (Write_Outputs_8_Bit[0], 3)); |
|
1038 |
frame->outbt4->SetValue (get_bit (Write_Outputs_8_Bit[0], 4)); |
|
1039 |
frame->outbt5->SetValue (get_bit (Write_Outputs_8_Bit[0], 5)); |
|
1040 |
frame->outbt6->SetValue (get_bit (Write_Outputs_8_Bit[0], 6)); |
|
1041 |
frame->outbt7->SetValue (get_bit (Write_Outputs_8_Bit[0], 7)); |
|
1042 |
frame->outbt8->SetValue (get_bit (Write_Outputs_8_Bit[0], 8)); |
|
1043 |
||
1044 |
frame->outs1->SetValue (Write_Analogue_Output_16_Bit[0] + 32768); |
|
1045 |
frame->outs2->SetValue (Write_Analogue_Output_16_Bit[1] + 32768); |
|
1046 |
frame->outs3->SetValue (Write_Analogue_Output_16_Bit[2] + 32768); |
|
1047 |
frame->outs4->SetValue (Write_Analogue_Output_16_Bit[3] + 32768); |
|
1048 |
tmp.Printf (wxT (" %i"), Write_Analogue_Output_16_Bit[0]); |
|
1049 |
frame->outst1->SetLabel (tmp); |
|
1050 |
tmp.Printf (wxT (" %i"), Write_Analogue_Output_16_Bit[1]); |
|
1051 |
frame->outst2->SetLabel (tmp); |
|
1052 |
tmp.Printf (wxT (" %i"), Write_Analogue_Output_16_Bit[2]); |
|
1053 |
frame->outst3->SetLabel (tmp); |
|
1054 |
tmp.Printf (wxT (" %i"), Write_Analogue_Output_16_Bit[3]); |
|
1055 |
frame->outst4->SetLabel (tmp); |
|
1056 |
} |
|
1057 |
||
1058 |
void |
|
1059 |
actu (void) |
|
1060 |
{ |
|
1061 |
actu_output (); |
|
1062 |
||
1063 |
Gtime++; |
|
1064 |
if (Gtime > hdelta) |
|
1065 |
{ |
|
1066 |
old_max = 5; |
|
1067 |
old_min = -5; |
|
1068 |
Gtime = 0; |
|
1069 |
} |
|
1070 |
frame->Paint (); |
|
1071 |
} |
|
1072 |
||
1073 |
void |
|
1074 |
MyFrame::OnTimer (wxTimerEvent & event) |
|
1075 |
{ |
|
1076 |
actu (); // do whatever you want to do every second here |
|
1077 |
} |
|
1078 |
||
1079 |
void |
|
1080 |
MyFrame::OnPaint (wxPaintEvent & event) |
|
1081 |
{ |
|
1082 |
//Paint(); |
|
1083 |
} |