Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4 | ligi | 1 | /*************************************************************** |
2 | * |
||
3 | * minimal canvas to test Abstraction layer on various Phones |
||
4 | * |
||
5 | * Author: Marcus -LiGi- Bueschleb |
||
6 | * |
||
7 | * see README for further Infos |
||
8 | * |
||
9 | ***************************************************************/ |
||
10 | |||
11 | import javax.microedition.lcdui.*; |
||
12 | import javax.microedition.rms.*; |
||
13 | |||
14 | |||
15 | public class MKMiniCanvas |
||
16 | extends Canvas |
||
17 | implements Runnable |
||
18 | { |
||
19 | |||
20 | // name/handle for the recordStore to memorize some stuff |
||
70 | ligi | 21 | private final static String RECORD_STORE_NAME="DUBSETT"; |
4 | ligi | 22 | |
23 | private BTSearcher bt_scanner; |
||
24 | public MKCommunicator mk=null; |
||
25 | private MKStatistics mk_stat=null; |
||
26 | private MKParamsEditor params_editor=null; |
||
59 | ligi | 27 | |
28 | //#if voice_mode!="no_voice" |
||
31 | ligi | 29 | private MKStatusVoice status_voice; |
59 | ligi | 30 | //#endif |
4 | ligi | 31 | |
32 | private String err=""; |
||
33 | private DUBwise root; |
||
34 | |||
70 | ligi | 35 | byte[] settings_arr; |
4 | ligi | 36 | |
70 | ligi | 37 | public boolean do_vibra=true; |
38 | public boolean do_sound=true; |
||
39 | public boolean do_graph=true; |
||
40 | public boolean keep_lighton=false; |
||
4 | ligi | 41 | |
42 | private Image bg_img; |
||
43 | private Image bt_img; |
||
44 | private Image lcd_img; |
||
45 | private Image load_img; |
||
46 | |||
47 | |||
48 | final static int SKINID_DARK= 0; |
||
49 | final static int SKINID_LIGHT = 1; |
||
50 | |||
51 | byte act_skin=SKINID_DARK; |
||
52 | |||
53 | |||
54 | public int[] nick_line_pos_data; |
||
55 | public int[] roll_line_pos_data; |
||
56 | |||
57 | public int[] accnick_line_pos_data; |
||
58 | public int[] accroll_line_pos_data; |
||
59 | |||
60 | public int lcd_char_width=0; |
||
61 | public int lcd_char_height=0; |
||
62 | |||
63 | public int frame_pos=0; |
||
64 | |||
65 | int line_scaler=20; |
||
66 | |||
67 | public int line_middle_y; |
||
68 | |||
69 | boolean quit=false; |
||
70 | boolean rescan=true; |
||
71 | int bg_offset=0; |
||
72 | |||
73 | // variable to hold the current state |
||
74 | public int state=-1; |
||
75 | |||
76 | // id for each state - must just be uniq - order isnt important |
||
77 | public final static int STATEID_SCANNING =0; |
||
78 | public final static int STATEID_DEVICESELECT =1; |
||
79 | public final static int STATEID_MAINMENU =2; |
||
80 | public final static int STATEID_MOTORTEST =3; |
||
81 | public final static int STATEID_SELECT_PARAMSET =4; |
||
82 | public final static int STATEID_EDIT_PARAMS =5; |
||
83 | public final static int STATEID_HANDLE_PARAMS =6; |
||
84 | public final static int STATEID_FLIGHTVIEW =7; |
||
85 | public final static int STATEID_RAWDEBUG =8; |
||
86 | // public final static int STATEID_RAWDEBUG =8; |
||
87 | public final static int STATEID_KEYCONTROL =9; |
||
70 | ligi | 88 | public final static int STATEID_SETTINGSMENU =10; |
4 | ligi | 89 | |
90 | |||
91 | public boolean fullscreen=false; |
||
92 | public int act_motor=0; |
||
93 | public int act_motor_increase=0; |
||
94 | public boolean motor_test_sel_all=false; |
||
95 | |||
70 | ligi | 96 | public String[] main_menu_items={"Telemetry","Raw Debug", "MK-KeyControl", "Motor Test" , "Flight Settings","Tool Settings","Proxy","Change Device" , "Quit " }; |
4 | ligi | 97 | public final static int MAINMENU_TELEMETRY =0; |
98 | public final static int MAINMENU_RAWDEBUG =1+MAINMENU_TELEMETRY; |
||
99 | public final static int MAINMENU_KEYCONTROL =1+MAINMENU_RAWDEBUG; |
||
100 | public final static int MAINMENU_MOTORTEST =1+MAINMENU_KEYCONTROL; |
||
101 | public final static int MAINMENU_PARAMS =1+MAINMENU_MOTORTEST; |
||
70 | ligi | 102 | public final static int MAINMENU_SETTINGSMENU =1+MAINMENU_PARAMS; |
103 | public final static int MAINMENU_PROXY =1+MAINMENU_SETTINGSMENU; |
||
4 | ligi | 104 | public final static int MAINMENU_DEVICESELECT =1+MAINMENU_PROXY; |
105 | public final static int MAINMENU_QUIT =1+MAINMENU_DEVICESELECT; |
||
70 | ligi | 106 | |
107 | public String[] settings_menu_items={"Skin ","Sound ","Vibra " ,"Graph ","FullScreen " ,"Keep BGLight " ,"Back" }; |
||
108 | public final static int SETTINGSMENU_CHANGESKIN =0; |
||
109 | public final static int SETTINGSMENU_SOUNDTOGGLE =1; |
||
110 | public final static int SETTINGSMENU_VIBRATOGGLE =2; |
||
111 | public final static int SETTINGSMENU_GRAPHTOGGLE =3; |
||
112 | public final static int SETTINGSMENU_FULLSCREENTOGGLE =4; |
||
113 | public final static int SETTINGSMENU_LIGHTTOGGLE =5; |
||
114 | public final static int SETTINGSMENU_BACK =6; |
||
115 | |||
116 | |||
4 | ligi | 117 | |
118 | int local_max=-1; |
||
119 | |||
120 | int y_off=0; |
||
121 | int spacer=0; |
||
122 | int spacer1=0; |
||
123 | |||
124 | int[] motor_test = {0,0,0,0}; |
||
125 | |||
126 | |||
127 | String[] menu_items; |
||
128 | int act_menu_select=0; |
||
129 | |||
130 | String[] lcd_lines =null; |
||
131 | |||
132 | public void paint_menu(Graphics g) |
||
133 | { |
||
134 | for ( int i=0;i<menu_items.length;i++) |
||
135 | lcd_lines[i]=(act_menu_select==i?"# ":" ") + menu_items[i]; |
||
136 | paint_lcd(g,true); |
||
137 | } |
||
138 | |||
139 | public void menu_keypress(int keyCode) |
||
140 | { |
||
141 | switch (getGameAction (keyCode)) |
||
142 | { |
||
143 | case UP: |
||
144 | if (act_menu_select!=0) act_menu_select--; |
||
145 | else |
||
146 | act_menu_select=menu_items.length-1; |
||
147 | break; |
||
148 | |||
149 | case DOWN: |
||
150 | if (act_menu_select<(menu_items.length-1)) act_menu_select++; |
||
151 | else act_menu_select=0; |
||
152 | break; |
||
153 | |||
154 | } |
||
155 | |||
156 | } |
||
157 | |||
158 | public void paint_lcd(Graphics g,boolean bottomup) |
||
159 | { |
||
160 | |||
161 | int y; |
||
162 | |||
163 | for(int i=0;i<lcd_lines.length;i++) |
||
164 | for (int pos=0;pos<20;pos++) |
||
165 | { |
||
166 | if (bottomup) |
||
167 | y=this.getHeight()-(lcd_lines.length-i)*lcd_char_height; |
||
168 | else |
||
169 | y=i*lcd_char_height; |
||
170 | g.setClip((lcd_img.getWidth()/222)*pos,y,(lcd_img.getWidth()/222),lcd_img.getHeight()); |
||
171 | g.drawImage(lcd_img,(lcd_img.getWidth()/222)*pos-((pos<lcd_lines[i].length()?lcd_lines[i].charAt(pos):' ')-' ')*(lcd_img.getWidth()/222),y,g.TOP | g.LEFT); |
||
172 | |||
173 | } |
||
174 | } |
||
175 | |||
176 | public void load_images() |
||
177 | { |
||
178 | try |
||
179 | { |
||
180 | // load all needed images |
||
181 | switch (act_skin) |
||
182 | { |
||
183 | case SKINID_DARK: |
||
184 | lcd_img=Image.createImage("/lcd_green.png"); |
||
185 | bg_img=Image.createImage("/starfield.jpg"); break; |
||
186 | |||
187 | case SKINID_LIGHT: |
||
188 | lcd_img=Image.createImage("/lcd_blue.png"); |
||
189 | bg_img=Image.createImage("/clouds.jpg"); |
||
190 | break; |
||
191 | } |
||
192 | |||
193 | |||
194 | bt_img=Image.createImage("/bt.png"); |
||
195 | |||
196 | load_img=Image.createImage("/load.png"); |
||
197 | } |
||
198 | catch (Exception e) |
||
199 | { |
||
200 | err+=e.toString(); |
||
201 | } |
||
202 | |||
203 | lcd_char_width=lcd_img.getWidth()/222; |
||
204 | lcd_char_height=lcd_img.getHeight(); |
||
205 | |||
206 | |||
207 | nick_line_pos_data=new int[bg_img.getWidth()]; |
||
208 | roll_line_pos_data=new int[bg_img.getWidth()]; |
||
209 | accnick_line_pos_data=new int[bg_img.getWidth()]; |
||
210 | accroll_line_pos_data=new int[bg_img.getWidth()]; |
||
211 | |||
212 | for (int c=0;c<bg_img.getWidth();c++) |
||
213 | { |
||
214 | nick_line_pos_data[c]=-1; |
||
215 | roll_line_pos_data[c]=-1; |
||
216 | accnick_line_pos_data[c]=-1; |
||
217 | accroll_line_pos_data[c]=-1; |
||
218 | } |
||
219 | |||
220 | } |
||
221 | |||
222 | public MKMiniCanvas(DUBwise _root) |
||
223 | { |
||
224 | |||
225 | root=_root; |
||
226 | |||
227 | bt_scanner = new BTSearcher(); |
||
228 | params_editor = new MKParamsEditor(this); |
||
31 | ligi | 229 | |
230 | |||
4 | ligi | 231 | mk = new MKCommunicator(root); |
232 | mk_stat= new MKStatistics(mk); |
||
59 | ligi | 233 | |
234 | //#if voice_mode!="no_voice" |
||
70 | ligi | 235 | status_voice=new MKStatusVoice(mk,this); |
59 | ligi | 236 | //#endif |
4 | ligi | 237 | |
238 | |||
239 | try |
||
240 | { |
||
241 | RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME , true ); |
||
242 | |||
70 | ligi | 243 | if (recStore.getNumRecords()==3) |
4 | ligi | 244 | { |
245 | |||
246 | //byte[] recData = new byte[recStore.getRecordSize(1)]; |
||
247 | //int len = recStore.getRecord(1, recData, 0); |
||
248 | |||
249 | //byte[] recData2 = new byte[recStore.getRecordSize(2)]; |
||
250 | //int len2 = recStore.getRecord(2, recData, 0); |
||
251 | |||
252 | byte[] url_data=recStore.getRecord(1); |
||
253 | byte[] name_data=recStore.getRecord(2); |
||
70 | ligi | 254 | settings_arr=recStore.getRecord(3); |
255 | |||
256 | act_skin=settings_arr[0]; |
||
257 | do_sound=(settings_arr[1]==1); |
||
258 | do_vibra=(settings_arr[2]==1); |
||
259 | do_graph=(settings_arr[3]==1); |
||
260 | fullscreen=(settings_arr[4]==1); |
||
261 | keep_lighton=(settings_arr[5]==1); |
||
4 | ligi | 262 | |
263 | connect_mk(new String(url_data, 0, url_data.length),new String(name_data, 0, name_data.length)); |
||
264 | |||
265 | } |
||
266 | recStore.closeRecordStore(); |
||
267 | } |
||
268 | catch (Exception e) |
||
269 | { |
||
70 | ligi | 270 | settings_arr=new byte[10]; |
271 | |||
4 | ligi | 272 | err+=e.toString(); |
273 | } |
||
274 | |||
70 | ligi | 275 | |
276 | load_images(); |
||
277 | |||
4 | ligi | 278 | chg_state((mk.force_disconnect)?STATEID_SCANNING:STATEID_MAINMENU); |
279 | |||
280 | |||
281 | |||
282 | new Thread(this).start(); |
||
283 | |||
284 | } |
||
285 | |||
286 | |||
70 | ligi | 287 | |
4 | ligi | 288 | |
289 | /****************************** Thread ******************/ |
||
290 | // ticking runnable Section |
||
291 | public void run() |
||
292 | { |
||
293 | |||
294 | |||
295 | while(true) |
||
296 | { |
||
297 | try { |
||
298 | |||
70 | ligi | 299 | |
4 | ligi | 300 | repaint(); |
301 | serviceRepaints(); |
||
302 | |||
303 | long loopStartTime = System.currentTimeMillis(); |
||
304 | long sleeptime=0; |
||
305 | // ticked thing |
||
306 | |||
307 | frame_pos++; |
||
308 | |||
309 | switch(state) |
||
310 | { |
||
311 | case STATEID_KEYCONTROL: |
||
312 | mk.send_keys(keycontrol_bitfield); |
||
313 | break; |
||
314 | |||
315 | case STATEID_MOTORTEST: |
||
316 | |||
317 | if (motor_test_sel_all) |
||
318 | for (int m=0;m<4;m++) |
||
319 | { |
||
320 | motor_test[m]+=act_motor_increase; |
||
321 | if (motor_test[m]<0)motor_test[m]=0; |
||
322 | if (motor_test[m]>255)motor_test[m]=255; |
||
323 | } |
||
324 | else |
||
325 | { |
||
326 | motor_test[act_motor]+=act_motor_increase; |
||
327 | if (motor_test[act_motor]<0) motor_test[act_motor]=0; |
||
328 | if (motor_test[act_motor]>255) motor_test[act_motor]=255; |
||
329 | } |
||
330 | |||
331 | mk.motor_test(motor_test); |
||
332 | break; |
||
333 | |||
334 | case STATEID_SCANNING: |
||
335 | intro_str_delay--; |
||
336 | if (intro_str_delay<0) |
||
337 | { |
||
338 | intro_str_delay=1; |
||
339 | if (intro_str_pos>intro_str.length()) |
||
340 | intro_str_pos=0; |
||
341 | lcd_lines[3]=intro_str.substring(intro_str_pos, (((intro_str_pos+20)>intro_str.length())?intro_str.length():intro_str_pos+20)); |
||
342 | intro_str_pos++; |
||
343 | } |
||
344 | |||
345 | if (!bt_scanner.searching) |
||
346 | chg_state(STATEID_DEVICESELECT); |
||
347 | |||
348 | |||
349 | break; |
||
350 | |||
351 | |||
352 | |||
353 | } |
||
354 | |||
355 | try { |
||
356 | nick_line_pos_data[-bg_offset] = mk.debug_data.nick_int(); |
||
357 | roll_line_pos_data[-bg_offset] = mk.debug_data.roll_int(); |
||
358 | accnick_line_pos_data[-bg_offset] = mk.debug_data.accnick(); |
||
359 | accroll_line_pos_data[-bg_offset] = mk.debug_data.accroll(); |
||
360 | } |
||
361 | catch (Exception e) |
||
362 | { |
||
363 | err+=e.toString(); |
||
364 | } |
||
365 | |||
366 | |||
367 | |||
368 | |||
369 | if (quit) |
||
370 | { |
||
371 | |||
372 | |||
373 | |||
374 | try |
||
375 | { |
||
376 | RecordStore.deleteRecordStore(RECORD_STORE_NAME); |
||
377 | RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME, true ); |
||
378 | recStore.addRecord(mk.mk_url.getBytes(), 0, mk.mk_url.getBytes().length); |
||
379 | recStore.addRecord(mk.name.getBytes(), 0, mk.name.getBytes().length); |
||
70 | ligi | 380 | settings_arr=new byte[10]; |
381 | settings_arr[0]=(byte)act_skin; |
||
382 | settings_arr[1]=(byte)(do_sound?1:0); |
||
383 | settings_arr[2]=(byte)(do_vibra?1:0); |
||
384 | settings_arr[3]=(byte)(do_graph?1:0); |
||
385 | settings_arr[4]=(byte)(fullscreen?1:0); |
||
386 | settings_arr[5]=(byte)(keep_lighton?1:0); |
||
387 | |||
388 | recStore.addRecord(settings_arr, 0, settings_arr.length); |
||
389 | |||
390 | |||
391 | |||
4 | ligi | 392 | recStore.closeRecordStore(); |
393 | |||
394 | } |
||
395 | catch (Exception e) |
||
396 | { |
||
397 | err+=e.toString(); |
||
398 | } |
||
399 | |||
400 | root.quit(); |
||
401 | } |
||
402 | if (rescan) |
||
403 | { |
||
404 | |||
405 | rescan=false; |
||
406 | } |
||
407 | |||
408 | try { |
||
409 | //rescan=false; |
||
410 | bg_offset--; |
||
411 | if (bg_offset==-bg_img.getWidth()) |
||
412 | bg_offset=0; |
||
70 | ligi | 413 | if (keep_lighton) com.nokia.mid.ui.DeviceControl.setLights(0,100); |
4 | ligi | 414 | //bt.tick(); |
415 | // every state has sth to do in tick section |
||
416 | } |
||
417 | catch (Exception e) |
||
418 | { |
||
419 | |||
420 | } |
||
421 | |||
422 | |||
423 | // System.gc(); |
||
424 | |||
425 | |||
426 | |||
427 | |||
428 | sleeptime=1000/ 15 - (int) (System.currentTimeMillis()- loopStartTime); |
||
429 | |||
430 | |||
431 | |||
432 | if (sleeptime<0) |
||
433 | sleeptime=100; // everyone has fi sleep |
||
434 | |||
435 | try { Thread.sleep(sleeptime); } |
||
436 | catch (Exception e) |
||
437 | { |
||
438 | err="Problem Sleeping "; |
||
439 | } |
||
440 | |||
441 | } |
||
442 | catch (Exception e) |
||
443 | { |
||
444 | err+=e.toString(); |
||
445 | } |
||
446 | } |
||
447 | } |
||
448 | |||
449 | |||
450 | |||
70 | ligi | 451 | boolean firstrun=true; |
4 | ligi | 452 | |
453 | |||
454 | // drawing section |
||
455 | public void paint(Graphics g) { |
||
70 | ligi | 456 | if (firstrun) |
457 | { |
||
458 | if (fullscreen) setFullScreenMode(fullscreen); |
||
459 | firstrun=false; |
||
460 | } |
||
4 | ligi | 461 | y_off=0; |
462 | try { |
||
463 | |||
464 | if (mk!=null) |
||
465 | { |
||
466 | line_middle_y=this.getHeight()/2; |
||
467 | if (local_max<Math.abs(mk.debug_data.nick_int())) |
||
468 | local_max=Math.abs(mk.debug_data.nick_int()); |
||
469 | if (local_max<Math.abs(mk.debug_data.roll_int())) |
||
470 | local_max=Math.abs(mk.debug_data.roll_int()); |
||
471 | if (local_max<Math.abs(mk.debug_data.accnick())) |
||
472 | local_max=Math.abs(mk.debug_data.accnick()); |
||
473 | if (local_max<Math.abs(mk.debug_data.accroll())) |
||
474 | local_max=Math.abs(mk.debug_data.accroll()); |
||
475 | line_scaler= local_max/(this.getHeight()/2)+1; |
||
476 | } |
||
477 | |||
478 | |||
479 | Font f1 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM); |
||
480 | Font f2 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL); |
||
481 | |||
482 | spacer=(f1.getHeight()); |
||
483 | spacer1=(f2.getHeight()); |
||
484 | |||
485 | //default Font |
||
486 | g.setFont(f1); |
||
487 | |||
488 | if (state==STATEID_EDIT_PARAMS) |
||
489 | { |
||
490 | g.setColor(0x000000); |
||
491 | g.fillRect(0,0,this.getWidth(),this.getHeight()); |
||
492 | } |
||
493 | else |
||
494 | { |
||
495 | g.setColor(0xFFFFFF); |
||
496 | g.fillRect(0,0,this.getWidth(),this.getHeight()); |
||
497 | g.drawImage(bg_img,bg_offset,0, g.TOP | g.LEFT); |
||
498 | |||
499 | if (bg_offset+bg_img.getWidth()<this.getWidth()) |
||
500 | g.drawImage(bg_img,bg_offset+bg_img.getWidth(),0, g.TOP | g.LEFT); |
||
501 | } |
||
502 | |||
503 | switch (act_skin) |
||
504 | { |
||
505 | case SKINID_DARK: |
||
506 | g.setColor(0x2dcf20); |
||
507 | |||
508 | break; |
||
509 | |||
510 | case SKINID_LIGHT: |
||
511 | g.setColor(0x000000); |
||
512 | break; |
||
513 | } |
||
514 | |||
515 | |||
516 | |||
517 | switch(state) |
||
518 | { |
||
519 | case STATEID_KEYCONTROL: |
||
520 | |||
521 | |||
522 | y_off+=spacer; |
||
523 | g.drawString("UP&DOWN => nick",0,y_off,Graphics.TOP | Graphics.LEFT); |
||
524 | y_off+=spacer; |
||
525 | g.drawString("LEFT&RIGHT => roll",0,y_off,Graphics.TOP | Graphics.LEFT); |
||
526 | y_off+=spacer; |
||
527 | g.drawString("1&4 => altitude",0,y_off,Graphics.TOP | Graphics.LEFT); |
||
528 | |||
529 | y_off+=spacer; |
||
530 | g.drawString("2&3 => gier",0,y_off,Graphics.TOP | Graphics.LEFT); |
||
531 | |||
532 | y_off+=spacer; |
||
533 | g.drawString("Press # and * at once",0,y_off,Graphics.TOP | Graphics.LEFT); |
||
534 | y_off+=spacer; |
||
535 | g.drawString("to quit KeyControl",0,y_off,Graphics.TOP | Graphics.LEFT); |
||
536 | y_off+=spacer; |
||
537 | g.drawString("bf1:"+ keycontrol_bitfield[0] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
538 | g.drawString("bf2:"+ keycontrol_bitfield[1] ,this.getWidth()/2,y_off,Graphics.TOP | Graphics.LEFT); |
||
539 | |||
540 | break; |
||
541 | |||
542 | case STATEID_MOTORTEST: |
||
543 | for (int bar=0;bar<4;bar++) |
||
544 | |||
545 | { |
||
546 | g.setColor(((bar==act_motor)|motor_test_sel_all)?0x44CC44:0x4444DD); |
||
547 | g.fillRect(this.getWidth()/(8*2)+bar*2*this.getWidth()/8,10,this.getWidth()/8,20+motor_test[bar]); |
||
548 | g.setColor(0x000000); |
||
549 | g.drawString(""+motor_test[bar] ,this.getWidth()/8+bar*2*this.getWidth()/8,10,Graphics.TOP | Graphics.HCENTER); |
||
550 | if(bar!=4) g.drawString(""+mk.debug_data.motor_val(bar) ,this.getWidth()/8+bar*2*this.getWidth()/8,30,Graphics.TOP | Graphics.HCENTER); |
||
551 | } |
||
552 | break; |
||
553 | |||
554 | case STATEID_EDIT_PARAMS: |
||
555 | params_editor.paint(g); |
||
556 | break; |
||
557 | |||
558 | case STATEID_SCANNING: |
||
559 | paint_lcd(g,true); |
||
560 | |||
561 | g.setClip(this.getWidth()/2-load_img.getWidth()/6+1,this.getHeight()/2-load_img.getHeight()/8+1, load_img.getWidth()/4,load_img.getHeight()/3);; |
||
562 | g.drawImage(load_img,this.getWidth()/2-load_img.getWidth()/8 - ((((frame_pos/3)%12)%4)*(load_img.getWidth()/4)) ,this.getHeight()/2-load_img.getHeight()/6- ((((frame_pos/3)%12)/4)*(load_img.getHeight()/3)), g.TOP | g.LEFT); |
||
563 | g.drawImage(bt_img,this.getWidth()/2 ,this.getHeight()/2 , g.HCENTER | g.VCENTER); |
||
564 | break; |
||
565 | |||
566 | case STATEID_RAWDEBUG: |
||
567 | g.setFont(f2); |
||
568 | for (int i=0;i<16;i++) |
||
569 | { |
||
570 | g.drawString(mk.debug_data.names[i] + mk.debug_data.analog[i] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
571 | g.drawString(mk.debug_data.names[16+i] + mk.debug_data.analog[16+i] ,this.getWidth()/2,y_off,Graphics.TOP | Graphics.LEFT); |
||
572 | y_off+=spacer1; |
||
573 | } |
||
574 | |||
575 | |||
576 | |||
577 | break; |
||
578 | |||
579 | |||
580 | case STATEID_MAINMENU: |
||
581 | g.drawString("MK-Connection(" + (mk.connected?("open"+((System.currentTimeMillis()- mk.connection_start_time)/1000)+"s"):"close")+"):",0,y_off,Graphics.TOP | Graphics.LEFT); |
||
582 | y_off+=spacer; |
||
583 | g.setFont(f2); |
||
584 | g.drawString(" Name:" + mk.name,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
585 | y_off+=spacer1; |
||
586 | g.drawString(" URL:" + mk.mk_url,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
587 | y_off+=spacer1; |
||
588 | g.drawString(" Version:" + mk.version.str,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
589 | y_off+=spacer1; |
||
590 | |||
591 | g.setFont(f1); |
||
592 | g.drawString("Packet Traffic:",0,y_off,Graphics.TOP | Graphics.LEFT); |
||
593 | y_off+=spacer; |
||
594 | g.setFont(f2); |
||
595 | g.drawString( " debug:"+mk.debug_data_count+ " LCD:" + mk.lcd_data_count + " vers:" + mk.version_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
596 | y_off+=spacer1; |
||
597 | g.drawString( " other:"+mk.other_data_count+" params:"+mk.params_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
598 | |||
599 | |||
600 | |||
70 | ligi | 601 | case STATEID_SETTINGSMENU: |
4 | ligi | 602 | // falltru wanted |
603 | case STATEID_SELECT_PARAMSET: |
||
604 | case STATEID_HANDLE_PARAMS: |
||
605 | |||
606 | case STATEID_DEVICESELECT: |
||
607 | paint_menu(g); |
||
608 | break; |
||
609 | |||
610 | case STATEID_FLIGHTVIEW: |
||
611 | |||
612 | |||
613 | // !!TODO!! check exactly which version those Datas where introduced |
||
614 | if (mk.version.compare(0,60)==mk.version.VERSION_PREVIOUS) |
||
615 | { |
||
616 | g.drawString("Power: " + (mk.debug_data.UBatt()/10) + "," +(mk.debug_data.UBatt()%10)+"V" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
617 | g.drawString("Sender: " + mk.debug_data.SenderOkay(),this.getWidth()/2,y_off,Graphics.TOP | Graphics.LEFT); |
||
618 | y_off+=spacer; |
||
619 | } |
||
620 | |||
621 | g.drawString(mk.version.str+"(d"+mk.debug_data_count+ "l" + mk.lcd_data_count+ "v" + mk.version_data_count+"o"+mk.other_data_count+"p"+mk.params_data_count+")",0,y_off,Graphics.TOP | Graphics.LEFT); |
||
622 | |||
623 | y_off+=spacer; |
||
624 | |||
625 | g.drawString("n:"+mk.debug_data.nick_int() + " r:"+mk.debug_data.roll_int() + " an:"+mk.debug_data.accnick() + " ar:"+mk.debug_data.accroll() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
626 | y_off+=spacer; |
||
627 | |||
628 | |||
629 | g.drawString("m1:"+mk.debug_data.motor_val(0) + " m2:"+mk.debug_data.motor_val(1)+" m3:"+mk.debug_data.motor_val(2) + " m4:"+mk.debug_data.motor_val(3) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
630 | y_off+=spacer; |
||
631 | |||
632 | if (mk.connected) |
||
633 | { |
||
634 | g.drawString("time conn:" +((System.currentTimeMillis()- mk.connection_start_time)/1000)+"s" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
635 | y_off+=spacer; |
||
636 | g.drawString("time motor>15:" +(mk_stat.motor_on_time/1000) +"s" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
637 | y_off+=spacer; |
||
638 | g.drawString("time motor=15:" +(mk_stat.motor_stand_time/1000) +"s" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
||
639 | } |
||
640 | |||
641 | |||
642 | y_off=this.getHeight()-4*lcd_img.getHeight(); |
||
643 | |||
644 | for ( int foo=0;foo<4;foo++) |
||
645 | { |
||
646 | for (int x=0;x<20;x++) |
||
647 | { |
||
648 | g.setClip((lcd_img.getWidth()/222)*x,y_off,(lcd_img.getWidth()/222),lcd_img.getHeight()); |
||
649 | g.drawImage(lcd_img,(lcd_img.getWidth()/222)*x-(mk.LCD.LCD_str[foo].charAt(x)-' ')*(lcd_img.getWidth()/222),y_off, g.TOP | g.LEFT); |
||
650 | |||
651 | } |
||
652 | y_off+=lcd_img.getHeight(); |
||
653 | } |
||
654 | |||
655 | g.setClip(0,0,this.getWidth(),this.getHeight()); |
||
656 | |||
657 | |||
658 | |||
659 | |||
660 | |||
661 | // draw lines |
||
662 | |||
70 | ligi | 663 | if (do_graph) for ( int x=0;x<this.getWidth();x++) |
4 | ligi | 664 | |
665 | { |
||
666 | |||
667 | int p= (((-bg_offset+x-this.getWidth()-5))); |
||
668 | if (p<1) |
||
669 | p+=bg_img.getWidth(); |
||
670 | p%=(bg_img.getWidth()-1); |
||
671 | |||
672 | g.setColor(0x156315); |
||
673 | draw_graph_part(g,x,nick_line_pos_data[p]/line_scaler,nick_line_pos_data[p+1]/line_scaler); |
||
674 | g.setColor(0xCC1315); |
||
675 | draw_graph_part(g,x,roll_line_pos_data[p]/line_scaler,roll_line_pos_data[p+1]/line_scaler); |
||
676 | g.setColor(0xf8ef02); |
||
677 | draw_graph_part(g,x,accnick_line_pos_data[p]/line_scaler,accnick_line_pos_data[p+1]/line_scaler); |
||
678 | g.setColor(0x19194d); |
||
679 | draw_graph_part(g,x,accroll_line_pos_data[p]/line_scaler,accroll_line_pos_data[p+1]/line_scaler); |
||
680 | |||
681 | |||
682 | |||
683 | } |
||
684 | |||
685 | } |
||
686 | |||
687 | |||
688 | |||
689 | } catch (Exception e) {} |
||
690 | } |
||
691 | |||
692 | private void connect_mk(String url,String name) |
||
693 | { |
||
694 | mk.connect_to(url,name); |
||
695 | |||
696 | } |
||
697 | |||
698 | public void draw_graph_part(Graphics g,int x,int y1,int y2) |
||
699 | { |
||
700 | if ( this.getWidth()>200) |
||
701 | { |
||
702 | g.fillRect(x,line_middle_y-y1,1,1 ); |
||
703 | if (y1>y2) |
||
704 | g.fillRect(x,line_middle_y-y1,1,y1-y2); |
||
705 | else |
||
706 | g.fillRect(x,line_middle_y-y2,1,y2-y1); |
||
707 | |||
708 | } |
||
709 | else |
||
710 | { |
||
711 | g.fillRect(x,line_middle_y-y1,1,1 ); |
||
712 | if (y1>y2) |
||
713 | g.fillRect(x,line_middle_y-y1,1,y1-y2); |
||
714 | else |
||
715 | g.fillRect(x,line_middle_y-y2,1,y2-y1); |
||
716 | } |
||
717 | |||
718 | } |
||
719 | |||
720 | |||
721 | /*********************************************** input Section **********************************************/ |
||
722 | |||
723 | |||
724 | public final String intro_str=" Digital Ufo Broadcasting with intelligent service equipment by Marcus -LiGi- Bueschleb ; Big Up Holger&Ingo for the MikroKopter Project (http://www.mikrokopter.de) "; |
||
725 | |||
726 | int intro_str_pos=0; |
||
727 | int intro_str_delay=3; |
||
728 | |||
729 | public void chg_state(int next_state) |
||
730 | { |
||
70 | ligi | 731 | if (next_state!=state)act_menu_select=0; |
4 | ligi | 732 | // prepare next state |
733 | switch(next_state) |
||
734 | { |
||
735 | case STATEID_KEYCONTROL: |
||
736 | keycontrol_exit=0; |
||
737 | break; |
||
738 | |||
739 | case STATEID_SCANNING: |
||
740 | lcd_lines=new String[4]; |
||
741 | lcd_lines[0]="Scanning for Devices"; |
||
742 | lcd_lines[1]=" "; |
||
743 | |||
744 | //#expand lcd_lines[2]="DUBwise v%VERSION% "; |
||
745 | lcd_lines[3]=intro_str.substring(0,20); |
||
746 | mk.close_connections(true); |
||
747 | |||
748 | bt_scanner.search(); |
||
749 | break; |
||
750 | |||
751 | case STATEID_HANDLE_PARAMS: |
||
752 | menu_items=new String[2]; |
||
753 | menu_items[0]="write to MK"; |
||
754 | menu_items[1]="Discard"; |
||
755 | lcd_lines=new String[2]; |
||
756 | |||
757 | break; |
||
758 | |||
759 | case STATEID_SELECT_PARAMSET: |
||
760 | menu_items=new String[5]; |
||
761 | for (int i=0;i<5;i++) |
||
762 | menu_items[i]=mk.params.names[i]; |
||
763 | |||
764 | lcd_lines=new String[5]; |
||
765 | break; |
||
766 | |||
767 | case STATEID_DEVICESELECT: |
||
768 | menu_items=new String[bt_scanner.remote_device_count+1]; |
||
769 | for (int i=0;i<bt_scanner.remote_device_count;i++) |
||
770 | menu_items[i]=bt_scanner.remote_device_name[i]; |
||
771 | menu_items[bt_scanner.remote_device_count]="scan again"; |
||
772 | lcd_lines=new String[bt_scanner.remote_device_count+1]; |
||
773 | break; |
||
774 | |||
70 | ligi | 775 | |
4 | ligi | 776 | case STATEID_MAINMENU: |
777 | menu_items=main_menu_items; |
||
778 | lcd_lines=new String[menu_items.length]; |
||
779 | break; |
||
780 | |||
70 | ligi | 781 | case STATEID_SETTINGSMENU: |
782 | |||
783 | menu_items=new String[settings_menu_items.length]; |
||
784 | for(int cnt=0;cnt<settings_menu_items.length;cnt++) |
||
785 | menu_items[cnt]=settings_menu_items[cnt]; |
||
786 | |||
787 | menu_items[0]+=(act_skin==SKINID_DARK)?"Dark":"Light"; |
||
788 | menu_items[1]+=(!do_sound)?"Off":"On"; |
||
789 | menu_items[2]+=(!do_vibra)?"Off":"On"; |
||
790 | menu_items[3]+=(!do_graph)?"Off":"On"; |
||
791 | menu_items[4]+=(!fullscreen)?"Off":"On"; |
||
792 | menu_items[5]+=(!keep_lighton)?"Off":"On"; |
||
793 | |||
794 | lcd_lines=new String[menu_items.length]; |
||
795 | break; |
||
796 | |||
4 | ligi | 797 | } |
798 | |||
799 | // switch state |
||
800 | state=next_state; |
||
801 | } |
||
802 | |||
803 | |||
804 | public void keyReleased(int keyCode) |
||
805 | { |
||
806 | |||
807 | switch(state) |
||
808 | { |
||
809 | case STATEID_MOTORTEST: |
||
810 | act_motor_increase=0; |
||
811 | break; |
||
812 | |||
813 | case STATEID_KEYCONTROL: |
||
814 | if (keyCode==KEY_POUND) |
||
815 | keycontrol_exit &= 255^1; |
||
816 | else |
||
817 | if (keyCode==KEY_STAR) |
||
818 | keycontrol_exit &= 255^2; |
||
819 | else |
||
820 | if ((keyCode >= this.KEY_NUM0) && (keyCode < this.KEY_NUM8)) |
||
821 | keycontrol_bitfield[0]&=255^( 1<<(keyCode-this.KEY_NUM0)); |
||
822 | else |
||
823 | if ((keyCode >= this.KEY_NUM8) && (keyCode <= this.KEY_NUM9)) |
||
824 | keycontrol_bitfield[1]&=255^( 1<<(keyCode-this.KEY_NUM8)); |
||
825 | else |
||
826 | switch (getGameAction (keyCode)) |
||
827 | { |
||
828 | case UP: |
||
829 | keycontrol_bitfield[1]&=255^4; |
||
830 | break; |
||
831 | |||
832 | case DOWN: |
||
833 | keycontrol_bitfield[1]&=255^8; |
||
834 | break; |
||
835 | |||
836 | |||
837 | case LEFT: |
||
838 | keycontrol_bitfield[1]&=255^16; |
||
839 | break; |
||
840 | |||
841 | case RIGHT: |
||
842 | keycontrol_bitfield[1]&=255^32; |
||
843 | break; |
||
844 | |||
845 | case FIRE: |
||
846 | keycontrol_bitfield[1]&=255^64; |
||
847 | break; |
||
848 | |||
849 | |||
850 | } |
||
851 | mk.send_keys(keycontrol_bitfield); |
||
852 | break; |
||
853 | } |
||
854 | |||
855 | } |
||
856 | |||
857 | |||
858 | byte keycontrol_exit=0; |
||
859 | |||
860 | public final static int[] keycontrol_bitfield={0,0}; |
||
861 | |||
59 | ligi | 862 | |
863 | public void pointerPressed (int pointer_x, int pointer_y) |
||
864 | { |
||
865 | if (pointer_x<this.getWidth()/2) |
||
866 | { |
||
867 | if (state==STATEID_EDIT_PARAMS) |
||
868 | { |
||
869 | chg_state(STATEID_HANDLE_PARAMS); |
||
870 | return; |
||
871 | } |
||
872 | |||
873 | else |
||
874 | if (state!=STATEID_KEYCONTROL) |
||
875 | { |
||
876 | chg_state(STATEID_MAINMENU); |
||
877 | return; |
||
878 | } |
||
879 | } |
||
880 | else |
||
881 | { |
||
882 | fullscreen=!fullscreen; |
||
883 | setFullScreenMode(fullscreen); |
||
884 | } |
||
885 | |||
886 | } |
||
887 | |||
4 | ligi | 888 | public void keyPressed(int keyCode) |
889 | { |
||
890 | |||
891 | if (keyCode==KEY_STAR) |
||
892 | { |
||
893 | if (state==STATEID_EDIT_PARAMS) |
||
894 | { |
||
895 | chg_state(STATEID_HANDLE_PARAMS); |
||
896 | return; |
||
897 | } |
||
898 | else |
||
899 | if (state!=STATEID_KEYCONTROL) |
||
900 | { |
||
901 | chg_state(STATEID_MAINMENU); |
||
902 | return; |
||
903 | } |
||
904 | |||
905 | } |
||
906 | if ((keyCode==KEY_POUND)&&(state!=STATEID_KEYCONTROL)) |
||
907 | { |
||
908 | fullscreen=!fullscreen; |
||
909 | setFullScreenMode(fullscreen); |
||
910 | return; |
||
911 | } |
||
912 | switch(state) |
||
913 | { |
||
914 | case STATEID_KEYCONTROL: |
||
915 | if (keyCode==KEY_POUND) |
||
916 | keycontrol_exit |= 1; |
||
917 | else |
||
918 | if (keyCode==KEY_STAR) |
||
919 | keycontrol_exit |= 2; |
||
920 | else |
||
921 | if ((keyCode >= this.KEY_NUM0) && (keyCode < this.KEY_NUM8)) |
||
922 | keycontrol_bitfield[0]|=1<<(keyCode-this.KEY_NUM0); |
||
923 | else |
||
924 | if ((keyCode >= this.KEY_NUM8) && (keyCode <= this.KEY_NUM9)) |
||
925 | keycontrol_bitfield[1]|=1<<(keyCode-this.KEY_NUM8); |
||
926 | |||
927 | else |
||
928 | switch (getGameAction (keyCode)) |
||
929 | { |
||
930 | case UP: |
||
931 | keycontrol_bitfield[1]|=4; |
||
932 | break; |
||
933 | |||
934 | case DOWN: |
||
935 | keycontrol_bitfield[1]|=8; |
||
936 | break; |
||
937 | |||
938 | |||
939 | case LEFT: |
||
940 | keycontrol_bitfield[1]|=16; |
||
941 | break; |
||
942 | |||
943 | case RIGHT: |
||
944 | keycontrol_bitfield[1]|=32; |
||
945 | break; |
||
946 | |||
947 | case FIRE: |
||
948 | keycontrol_bitfield[1]|=64; |
||
949 | break; |
||
950 | |||
951 | } |
||
952 | if (keycontrol_exit==3) |
||
953 | chg_state(STATEID_MAINMENU); |
||
954 | else |
||
955 | mk.send_keys(keycontrol_bitfield); |
||
956 | break; |
||
957 | |||
958 | |||
959 | case STATEID_MOTORTEST: |
||
960 | switch (getGameAction (keyCode)) |
||
961 | { |
||
962 | case UP: |
||
963 | act_motor_increase=-1; |
||
964 | break; |
||
965 | |||
966 | case DOWN: |
||
967 | act_motor_increase=1; |
||
968 | break; |
||
969 | |||
970 | case FIRE: |
||
971 | motor_test_sel_all=!motor_test_sel_all; |
||
972 | break; |
||
973 | |||
974 | case LEFT: |
||
975 | act_motor--; |
||
976 | if (act_motor<0) {act_motor=0; chg_state(STATEID_MAINMENU); } |
||
977 | break; |
||
978 | |||
979 | case RIGHT: |
||
980 | act_motor++; |
||
981 | act_motor%=4; |
||
982 | break; |
||
983 | } |
||
984 | |||
985 | break; |
||
986 | case STATEID_HANDLE_PARAMS: |
||
987 | if ( getGameAction (keyCode)==FIRE ) |
||
988 | switch(act_menu_select) |
||
989 | { |
||
990 | case 0: |
||
991 | mk.write_params(); |
||
992 | default: |
||
993 | chg_state(STATEID_MAINMENU); |
||
994 | } |
||
995 | else |
||
996 | menu_keypress(keyCode); |
||
997 | break; |
||
70 | ligi | 998 | |
999 | case STATEID_SETTINGSMENU: |
||
4 | ligi | 1000 | if ( getGameAction (keyCode)==FIRE ) |
1001 | switch(act_menu_select) |
||
1002 | { |
||
70 | ligi | 1003 | case SETTINGSMENU_CHANGESKIN: |
4 | ligi | 1004 | act_skin++; |
1005 | act_skin=(byte)(act_skin%2); |
||
1006 | load_images(); |
||
70 | ligi | 1007 | chg_state(STATEID_SETTINGSMENU); |
4 | ligi | 1008 | break; |
70 | ligi | 1009 | case SETTINGSMENU_SOUNDTOGGLE: |
1010 | do_sound=!do_sound; |
||
1011 | chg_state(STATEID_SETTINGSMENU); |
||
1012 | break; |
||
1013 | case SETTINGSMENU_VIBRATOGGLE: |
||
1014 | do_vibra=!do_vibra; |
||
1015 | chg_state(STATEID_SETTINGSMENU); |
||
1016 | break; |
||
4 | ligi | 1017 | |
70 | ligi | 1018 | case SETTINGSMENU_GRAPHTOGGLE: |
1019 | do_graph=!do_graph; |
||
1020 | chg_state(STATEID_SETTINGSMENU); |
||
1021 | break; |
||
1022 | |||
1023 | |||
1024 | case SETTINGSMENU_FULLSCREENTOGGLE: |
||
1025 | fullscreen=!fullscreen; |
||
1026 | setFullScreenMode(fullscreen); |
||
1027 | chg_state(STATEID_SETTINGSMENU); |
||
1028 | break; |
||
1029 | |||
1030 | case SETTINGSMENU_LIGHTTOGGLE: |
||
1031 | keep_lighton =!keep_lighton; |
||
1032 | chg_state(STATEID_SETTINGSMENU); |
||
1033 | break; |
||
1034 | |||
1035 | case SETTINGSMENU_BACK: |
||
1036 | chg_state(STATEID_MAINMENU); |
||
1037 | chg_state(STATEID_SETTINGSMENU); |
||
1038 | break; |
||
1039 | |||
1040 | } |
||
1041 | else menu_keypress(keyCode); |
||
1042 | break; |
||
1043 | |||
1044 | case STATEID_MAINMENU: |
||
1045 | if ( getGameAction (keyCode)==FIRE ) |
||
1046 | switch(act_menu_select) |
||
1047 | { |
||
1048 | case MAINMENU_SETTINGSMENU: |
||
1049 | |||
1050 | chg_state(STATEID_SETTINGSMENU); |
||
1051 | break; |
||
1052 | |||
4 | ligi | 1053 | case MAINMENU_KEYCONTROL: |
1054 | chg_state(STATEID_KEYCONTROL); |
||
1055 | break; |
||
1056 | |||
1057 | case MAINMENU_TELEMETRY : |
||
1058 | chg_state(STATEID_FLIGHTVIEW); |
||
1059 | break; |
||
1060 | |||
1061 | case MAINMENU_MOTORTEST : |
||
1062 | chg_state(STATEID_MOTORTEST); |
||
1063 | break; |
||
1064 | |||
1065 | case MAINMENU_PARAMS : |
||
1066 | chg_state(STATEID_SELECT_PARAMSET); |
||
1067 | break; |
||
1068 | |||
1069 | |||
1070 | case MAINMENU_PROXY: |
||
1071 | mk.do_proxy("socket://192.168.1.42:2323"); |
||
1072 | break; |
||
1073 | |||
1074 | case MAINMENU_DEVICESELECT: |
||
1075 | chg_state(STATEID_SCANNING); |
||
1076 | break; |
||
1077 | |||
1078 | case MAINMENU_RAWDEBUG: |
||
1079 | chg_state(STATEID_RAWDEBUG); |
||
1080 | break; |
||
1081 | |||
1082 | case MAINMENU_QUIT: |
||
1083 | // set quit Flag |
||
1084 | quit=true; |
||
1085 | break; |
||
1086 | |||
1087 | } |
||
1088 | else menu_keypress(keyCode); |
||
1089 | break; |
||
1090 | |||
1091 | case STATEID_SELECT_PARAMSET: |
||
1092 | if ( getGameAction (keyCode)==FIRE ) |
||
1093 | { |
||
62 | ligi | 1094 | if ( mk.params.field[act_menu_select]!=null) |
1095 | { |
||
1096 | mk.params.act_paramset=act_menu_select; |
||
1097 | chg_state(STATEID_EDIT_PARAMS); |
||
1098 | } |
||
4 | ligi | 1099 | } |
1100 | else menu_keypress(keyCode); |
||
1101 | break; |
||
1102 | case STATEID_DEVICESELECT: |
||
1103 | /* |
||
1104 | if ((keyCode >= this.KEY_NUM0) && (keyCode < this.KEY_NUM0+bt_scanner.remote_device_count)) |
||
1105 | { |
||
1106 | connect_mk("btspp://"+bt_scanner.remote_device_mac[keyCode-this.KEY_NUM0] + ":1",bt_scanner.remote_device_name[keyCode-this.KEY_NUM0]); |
||
1107 | chg_state(STATEID_MAINMENU); |
||
1108 | } |
||
1109 | else |
||
1110 | */ |
||
1111 | |||
1112 | if ( getGameAction (keyCode)==FIRE ) |
||
1113 | { |
||
1114 | |||
1115 | if (bt_scanner.remote_device_count > act_menu_select) |
||
1116 | { |
||
1117 | connect_mk("btspp://"+bt_scanner.remote_device_mac[act_menu_select] + ":1",bt_scanner.remote_device_name[act_menu_select]); |
||
1118 | chg_state(STATEID_MAINMENU); |
||
1119 | } |
||
1120 | else |
||
1121 | chg_state(STATEID_SCANNING); |
||
1122 | } |
||
1123 | else menu_keypress(keyCode); |
||
1124 | |||
1125 | break; |
||
1126 | |||
1127 | case STATEID_EDIT_PARAMS: |
||
1128 | params_editor.keypress(keyCode,getGameAction (keyCode)) ; |
||
1129 | break; |
||
1130 | |||
1131 | case STATEID_FLIGHTVIEW: |
||
1132 | |||
1133 | switch (getGameAction (keyCode)) |
||
1134 | { |
||
1135 | case UP: |
||
1136 | mk.LCD.LCD_PREVPAGE(); |
||
1137 | break; |
||
1138 | |||
1139 | case DOWN: |
||
1140 | mk.LCD.LCD_NEXTPAGE(); |
||
1141 | break; |
||
1142 | |||
1143 | case LEFT: |
||
1144 | chg_state(STATEID_MAINMENU); |
||
1145 | break; |
||
1146 | |||
1147 | } |
||
1148 | break; |
||
1149 | } |
||
1150 | |||
1151 | |||
1152 | |||
1153 | } |
||
1154 | |||
1155 | |||
1156 | |||
1157 | |||
1158 | |||
1159 | |||
1160 | |||
1161 | |||
1162 | } |
||
1163 | |||
1164 |