Rev 135 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 135 | Rev 149 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | import javax.microedition.rms.*; |
12 | import javax.microedition.rms.*; |
Line 13... | Line 13... | ||
13 | 13 | ||
14 | import javax.microedition.media.*; |
14 | import javax.microedition.media.*; |
Line -... | Line 15... | ||
- | 15 | import javax.microedition.media.control.*; |
|
- | 16 | ||
- | 17 | ||
- | 18 | // for fileapi |
|
- | 19 | import javax.microedition.io.*; |
|
- | 20 | import javax.microedition.midlet.*; |
|
- | 21 | import javax.microedition.io.file.*; |
|
- | 22 | ||
- | 23 | import java.io.*; |
|
- | 24 | import java.util.*; |
|
- | 25 | ||
- | 26 | ||
15 | import javax.microedition.media.control.*; |
27 | // end for fileapi |
16 | 28 | ||
17 | public class DUBwiseCanvas |
29 | public class DUBwiseCanvas |
18 | extends Canvas |
30 | extends Canvas |
Line -... | Line 31... | ||
- | 31 | implements Runnable,DUBwiseDefinitions |
|
- | 32 | { |
|
- | 33 | ||
- | 34 | // for fileapi |
|
- | 35 | public final static int MAX_FILELIST_LENGTH=100; |
|
- | 36 | public final static int MAX_PATH_DEPTH=10; |
|
- | 37 | // String act_path=""; |
|
- | 38 | // String last_path=""; |
|
- | 39 | ||
- | 40 | byte act_path_depth=0; |
|
- | 41 | String[] act_path_arr; |
|
- | 42 | ||
- | 43 | ||
- | 44 | public String act_path() |
|
- | 45 | { |
|
- | 46 | String res=""; |
|
- | 47 | for (int i=0;i<act_path_depth;i++) |
|
- | 48 | res+=act_path_arr[i]; |
|
- | 49 | return res; |
|
- | 50 | } |
|
- | 51 | ||
- | 52 | String[] file_list; |
|
- | 53 | int file_list_length=0; |
|
- | 54 | ||
- | 55 | ||
- | 56 | ||
- | 57 | int[] act_proxy_ip={192,168,1,42,4242}; // { ip , ip , ip , ip , port } |
|
- | 58 | int[] act_connection_ip={192,168,1,42,4242}; // { ip , ip , ip , ip , port } |
|
- | 59 | ||
- | 60 | ||
- | 61 | int ipinput_pos=0; |
|
- | 62 | // end for fileapi |
|
- | 63 | ||
- | 64 | public String ip_digit_zeroes(int digit) |
|
- | 65 | { return "" + digit/100 + "" + (digit/10)%10 + "" + (digit)%10; } |
|
- | 66 | ||
- | 67 | public String ip_str(int[] ip,boolean with_zeroes) |
|
- | 68 | { |
|
- | 69 | if(with_zeroes) |
|
- | 70 | return ip_digit_zeroes(ip[0]) + "." +ip_digit_zeroes(ip[1]) + "."+ip_digit_zeroes(ip[2]) + "."+ip_digit_zeroes(ip[3]) + ":"+ip_digit_zeroes(ip[4]) ; |
|
- | 71 | else |
|
- | 72 | return ip[0]+"."+ip[1]+"."+ip[2]+"."+ip[3]+":"+ip[4]; |
|
- | 73 | ||
19 | implements Runnable,DUBwiseDefinitions |
74 | } |
Line 20... | Line 75... | ||
20 | { |
75 | |
21 | 76 | int heading_offset=0; |
|
Line 41... | Line 96... | ||
41 | 96 | ||
Line 42... | Line 97... | ||
42 | byte[] settings_arr; |
97 | byte[] settings_arr; |
43 | 98 | ||
44 | public boolean do_vibra=true; |
99 | public boolean do_vibra=true; |
45 | public boolean do_sound=true; |
100 | public boolean do_sound=true; |
Line 46... | Line 101... | ||
46 | public boolean do_graph=true; |
101 | public boolean do_scrollbg=true; |
47 | public boolean keep_lighton=false; |
102 | public boolean keep_lighton=false; |
48 | 103 | ||
49 | private Image bg_img; |
104 | private Image bg_img; |
- | 105 | private Image bt_img; |
|
Line 50... | Line 106... | ||
50 | private Image bt_img; |
106 | private Image lcd_img; |
51 | private Image lcd_img; |
107 | private Image load_img; |
52 | private Image load_img; |
108 | private Image symbols_img; |
Line 63... | Line 119... | ||
63 | 119 | ||
64 | //holds id of actual skin |
120 | //holds id of actual skin |
Line -... | Line 121... | ||
- | 121 | byte act_skin=SKINID_DARK; |
|
- | 122 | ||
- | 123 | ||
- | 124 | public final static int MAX_GRAPHS=4; |
|
- | 125 | ||
- | 126 | public final static int[] graph_colors={0x156315,0xCC1315,0xf8ef02,0x19194d}; |
|
- | 127 | ||
- | 128 | public int[] graph_sources={0,1,2,3}; |
|
- | 129 | public String[] graph_names={"nick int","roll int","nick acc","roll acc"}; |
|
65 | byte act_skin=SKINID_DARK; |
130 | |
66 | 131 | public int[][] graph_data; |
|
Line 67... | Line 132... | ||
67 | 132 | ||
68 | public int[] nick_line_pos_data; |
133 | public int[] nick_line_pos_data; |
Line 85... | Line 150... | ||
85 | 150 | ||
Line 86... | Line 151... | ||
86 | public int line_middle_y; |
151 | public int line_middle_y; |
87 | 152 | ||
88 | boolean quit=false; |
153 | boolean quit=false; |
Line 89... | Line 154... | ||
89 | boolean rescan=true; |
154 | boolean rescan=true; |
90 | int bg_offset=0; |
155 | int bg_offset=0; |
Line 91... | Line -... | ||
91 | - | ||
92 | // variable to hold the current state |
- | |
93 | public int state=-1; |
156 | |
Line 94... | Line 157... | ||
94 | 157 | // variable to hold the current state |
|
95 | 158 | public int state=-1; |
|
96 | 159 | ||
Line 97... | Line 160... | ||
97 | int local_max=-1; |
160 | int local_max=-1; |
Line 98... | Line 161... | ||
98 | 161 | ||
- | 162 | int y_off=0; |
|
99 | int y_off=0; |
163 | int spacer=0; |
Line 100... | Line 164... | ||
100 | int spacer=0; |
164 | int spacer1=0; |
Line 101... | Line 165... | ||
101 | int spacer1=0; |
165 | |
Line 128... | Line 192... | ||
128 | paint_lcd(g,true); |
192 | paint_lcd(g,true); |
129 | } |
193 | } |
Line 130... | Line 194... | ||
130 | 194 | ||
131 | public void menu_keypress(int keyCode) |
195 | public void menu_keypress(int keyCode) |
- | 196 | { |
|
132 | { |
197 | debug.log("KeyCode:"+keyCode); |
133 | switch (getGameAction (keyCode)) |
198 | switch (getGameAction (keyCode)) |
134 | { |
199 | { |
135 | case UP: |
200 | case UP: |
136 | if (act_menu_select!=0) act_menu_select--; |
201 | if (act_menu_select!=0) act_menu_select--; |
Line 151... | Line 216... | ||
151 | { |
216 | { |
152 | return (mk.stick_data.stick[5]>100); |
217 | return (mk.stick_data.stick[5]>100); |
Line 153... | Line 218... | ||
153 | 218 | ||
Line -... | Line 219... | ||
- | 219 | } |
|
- | 220 | ||
154 | } |
221 | // int lcd_top=25; |
155 | 222 | ||
Line 156... | Line 223... | ||
156 | public void paint_lcd(Graphics g,boolean bottomup) |
223 | public void paint_lcd(Graphics g,boolean bottomup) |
Line -... | Line 224... | ||
- | 224 | { |
|
- | 225 | ||
- | 226 | int y; |
|
157 | { |
227 | |
- | 228 | int lcd_top= (state==STATEID_EDIT_PARAMS?0:25); |
|
- | 229 | ||
- | 230 | int spacer_left_right=(this.getWidth()-(20*(lcd_img.getWidth()/222)))/2; |
|
- | 231 | // for(int i=0;i<lcd_lines.length;i++) |
|
- | 232 | int max_lines=(this.getHeight()-lcd_top)/lcd_char_height; |
|
- | 233 | int display_lines=(lcd_lines.length>max_lines?max_lines:lcd_lines.length); |
|
- | 234 | ||
- | 235 | ||
158 | 236 | int lcd_off= (state==STATEID_EDIT_PARAMS?params_editor.act_y:act_menu_select)-display_lines+1; |
|
159 | int y; |
237 | if ( lcd_off<0) lcd_off=0; |
160 | 238 | ||
161 | for(int i=0;i<lcd_lines.length;i++) |
239 | for(int i=0;i<display_lines;i++) |
162 | for (int pos=0;pos<20;pos++) |
240 | for (int pos=0;pos<20;pos++) |
163 | { |
241 | { |
164 | if (bottomup) |
242 | if (bottomup) |
165 | y=this.getHeight()-(lcd_lines.length-i)*lcd_char_height; |
243 | y=this.getHeight()-(display_lines-i)*lcd_char_height; |
Line 166... | Line 244... | ||
166 | else |
244 | else |
167 | y=i*lcd_char_height; |
245 | y=i*lcd_char_height; |
Line 168... | Line 246... | ||
168 | g.setClip((lcd_img.getWidth()/222)*pos,y,(lcd_img.getWidth()/222),lcd_img.getHeight()); |
246 | g.setClip((lcd_img.getWidth()/222)*pos+spacer_left_right,y,(lcd_img.getWidth()/222),lcd_img.getHeight()); |
Line 188... | Line 266... | ||
188 | break; |
266 | break; |
189 | } |
267 | } |
Line 190... | Line 268... | ||
190 | 268 | ||
191 | - | ||
- | 269 | ||
192 | bt_img=Image.createImage("/bt.png"); |
270 | bt_img=Image.createImage("/bt.png"); |
193 | - | ||
194 | load_img=Image.createImage("/load.png"); |
- | |
195 | } |
- | |
196 | catch (Exception e) |
- | |
197 | { |
- | |
Line 198... | Line 271... | ||
198 | err+=e.toString(); |
271 | symbols_img=Image.createImage("/symbols.png"); |
199 | } |
272 | load_img=Image.createImage("/load.png"); |
Line -... | Line 273... | ||
- | 273 | ||
- | 274 | lcd_char_width=lcd_img.getWidth()/222; |
|
- | 275 | lcd_char_height=lcd_img.getHeight(); |
|
- | 276 | ||
- | 277 | ||
- | 278 | graph_data=new int[MAX_GRAPHS][bg_img.getWidth()]; |
|
- | 279 | ||
- | 280 | for (int c=0;c<bg_img.getWidth();c++) |
|
200 | 281 | for (int d=0;d<MAX_GRAPHS;d++) |
|
201 | lcd_char_width=lcd_img.getWidth()/222; |
282 | graph_data[d][c]=-1; |
202 | lcd_char_height=lcd_img.getHeight(); |
283 | |
203 | 284 | ||
Line 213... | Line 294... | ||
213 | roll_line_pos_data[c]=-1; |
294 | roll_line_pos_data[c]=-1; |
214 | accnick_line_pos_data[c]=-1; |
295 | accnick_line_pos_data[c]=-1; |
215 | accroll_line_pos_data[c]=-1; |
296 | accroll_line_pos_data[c]=-1; |
216 | } |
297 | } |
Line -... | Line 298... | ||
- | 298 | ||
- | 299 | ||
- | 300 | } |
|
- | 301 | ||
- | 302 | catch (Exception e) |
|
- | 303 | { |
|
- | 304 | debug.err(e.toString()); |
|
- | 305 | } |
|
217 | 306 | ||
Line 218... | Line 307... | ||
218 | } |
307 | } |
219 | 308 | ||
Line -... | Line 309... | ||
- | 309 | public DUBwiseCanvas(DUBwise _root) |
|
- | 310 | { |
|
- | 311 | ||
- | 312 | ||
- | 313 | // file |
|
- | 314 | file_list= new String[MAX_FILELIST_LENGTH]; |
|
220 | public DUBwiseCanvas(DUBwise _root) |
315 | act_path_arr=new String[MAX_PATH_DEPTH]; |
Line 221... | Line 316... | ||
221 | { |
316 | // end file |
Line -... | Line 317... | ||
- | 317 | ||
- | 318 | ||
222 | 319 | root=_root; |
|
223 | 320 | ||
224 | root=_root; |
321 | debug = new DUBwiseDebug(this); |
Line 225... | Line 322... | ||
225 | 322 | ||
Line 256... | Line 353... | ||
256 | settings_arr=recStore.getRecord(3); |
353 | settings_arr=recStore.getRecord(3); |
Line 257... | Line 354... | ||
257 | 354 | ||
258 | act_skin=settings_arr[0]; |
355 | act_skin=settings_arr[0]; |
259 | do_sound=(settings_arr[1]==1); |
356 | do_sound=(settings_arr[1]==1); |
260 | do_vibra=(settings_arr[2]==1); |
357 | do_vibra=(settings_arr[2]==1); |
261 | do_graph=(settings_arr[3]==1); |
358 | do_scrollbg=(settings_arr[3]==1); |
262 | fullscreen=(settings_arr[4]==1); |
359 | fullscreen=(settings_arr[4]==1); |
Line 263... | Line 360... | ||
263 | keep_lighton=(settings_arr[5]==1); |
360 | keep_lighton=(settings_arr[5]==1); |
Line 275... | Line 372... | ||
275 | } |
372 | } |
Line 276... | Line 373... | ||
276 | 373 | ||
Line 277... | Line 374... | ||
277 | 374 | ||
- | 375 | load_images(); |
|
Line 278... | Line 376... | ||
278 | load_images(); |
376 | |
Line 368... | Line 466... | ||
368 | } |
466 | } |
Line 369... | Line 467... | ||
369 | 467 | ||
370 | mk.motor_test(motor_test); |
468 | mk.motor_test(motor_test); |
Line -... | Line 469... | ||
- | 469 | break; |
|
- | 470 | ||
- | 471 | case STATEID_IPINPUT: |
|
- | 472 | lcd_lines[1]=ip_str(act_proxy_ip,true); |
|
- | 473 | ||
- | 474 | ||
- | 475 | lcd_lines[2]=""; |
|
- | 476 | for(int foo=0;foo<20;foo++) |
|
- | 477 | { |
|
- | 478 | if (foo==ipinput_pos) |
|
- | 479 | lcd_lines[2]+="^"; |
|
- | 480 | else |
|
- | 481 | lcd_lines[2]+=" "; |
|
- | 482 | } |
|
371 | break; |
483 | break; |
372 | 484 | ||
373 | case STATEID_MAINMENU: |
485 | case STATEID_MAINMENU: |
374 | if (ufo_prober.change_notify) |
486 | if (ufo_prober.change_notify) |
375 | { |
487 | { |
Line 398... | Line 510... | ||
398 | 510 | ||
Line 399... | Line 511... | ||
399 | 511 | ||
- | 512 | } |
|
400 | } |
513 | |
401 | 514 | try { |
|
402 | try { |
515 | |
403 | nick_line_pos_data[-bg_offset] = mk.debug_data.nick_int(); |
516 | nick_line_pos_data[-bg_offset] = mk.debug_data.nick_int(); |
404 | roll_line_pos_data[-bg_offset] = mk.debug_data.roll_int(); |
517 | roll_line_pos_data[-bg_offset] = mk.debug_data.roll_int(); |
Line 414... | Line 527... | ||
414 | 527 | ||
415 | 528 | ||
Line 416... | Line -... | ||
416 | if (quit) |
- | |
417 | { |
- | |
418 | 529 | if (quit) |
|
419 | 530 | { |
|
420 | 531 | ||
421 | try |
532 | try |
422 | { |
533 | { |
423 | RecordStore.deleteRecordStore(RECORD_STORE_NAME); |
534 | RecordStore.deleteRecordStore(RECORD_STORE_NAME); |
424 | RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME, true ); |
535 | RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME, true ); |
425 | recStore.addRecord(mk.mk_url.getBytes(), 0, mk.mk_url.getBytes().length); |
536 | recStore.addRecord(mk.mk_url.getBytes(), 0, mk.mk_url.getBytes().length); |
426 | recStore.addRecord(mk.name.getBytes(), 0, mk.name.getBytes().length); |
537 | recStore.addRecord(mk.name.getBytes(), 0, mk.name.getBytes().length); |
427 | settings_arr=new byte[10]; |
538 | settings_arr=new byte[10]; |
428 | settings_arr[0]=(byte)act_skin; |
539 | settings_arr[0]=(byte)act_skin; |
429 | settings_arr[1]=(byte)(do_sound?1:0); |
540 | settings_arr[1]=(byte)(do_sound?1:0); |
430 | settings_arr[2]=(byte)(do_vibra?1:0); |
541 | settings_arr[2]=(byte)(do_vibra?1:0); |
Line 431... | Line 542... | ||
431 | settings_arr[3]=(byte)(do_graph?1:0); |
542 | settings_arr[3]=(byte)(do_scrollbg?1:0); |
Line 456... | Line 567... | ||
456 | //rescan=false; |
567 | //rescan=false; |
457 | bg_offset--; |
568 | bg_offset--; |
458 | if (bg_offset==-bg_img.getWidth()) |
569 | if (bg_offset==-bg_img.getWidth()) |
459 | bg_offset=0; |
570 | bg_offset=0; |
460 | if (keep_lighton) com.nokia.mid.ui.DeviceControl.setLights(0,100); |
571 | if (keep_lighton) com.nokia.mid.ui.DeviceControl.setLights(0,100); |
461 | //bt.tick(); |
- | |
462 | // every state has sth to do in tick section |
- | |
463 | } |
- | |
464 | catch (Exception e) |
- | |
465 | { |
- | |
466 | - | ||
467 | } |
- | |
468 | - | ||
469 | - | ||
470 | // System.gc(); |
- | |
471 | - | ||
Line -... | Line 572... | ||
- | 572 | ||
- | 573 | } |
|
Line 472... | Line 574... | ||
472 | 574 | catch (Exception e) { } |
|
473 | - | ||
Line 474... | Line 575... | ||
474 | 575 | ||
475 | sleeptime=1000/ 15 - (int) (System.currentTimeMillis()- loopStartTime); |
576 | |
Line 495... | Line 596... | ||
495 | 596 | ||
Line -... | Line 597... | ||
- | 597 | ||
- | 598 | ||
- | 599 | boolean firstrun=true; |
|
- | 600 | ||
- | 601 | public int skin_bg_color() |
|
- | 602 | { |
|
- | 603 | ||
- | 604 | switch (act_skin) |
|
- | 605 | { |
|
- | 606 | case SKINID_DARK: |
|
- | 607 | return 0x000000; |
|
- | 608 | ||
- | 609 | default: |
|
- | 610 | case SKINID_LIGHT: |
|
- | 611 | return 0xFFFFFF; |
|
- | 612 | } |
|
- | 613 | } |
|
- | 614 | ||
- | 615 | ||
- | 616 | public int skin_fg_color() |
|
- | 617 | { |
|
- | 618 | ||
- | 619 | switch (act_skin) |
|
- | 620 | { |
|
- | 621 | case SKINID_DARK: |
|
- | 622 | return 0xFFFFFF; |
|
- | 623 | ||
- | 624 | default: |
|
Line 496... | Line 625... | ||
496 | 625 | case SKINID_LIGHT: |
|
497 | 626 | return 0x000000; |
|
- | 627 | } |
|
498 | boolean firstrun=true; |
628 | } |
499 | 629 | ||
500 | 630 | // drawing section |
|
501 | // drawing section |
631 | public void paint(Graphics g) { |
502 | public void paint(Graphics g) { |
632 | // |
Line -... | Line 633... | ||
- | 633 | if (debug.showing) |
|
503 | if (debug.showing) |
634 | { |
504 | { |
635 | debug.paint(g); |
505 | debug.paint(g); |
636 | return; |
506 | return; |
637 | } |
507 | } |
638 | |
508 | 639 | ||
- | 640 | if (firstrun) |
|
- | 641 | { |
|
- | 642 | if (fullscreen) setFullScreenMode(fullscreen); |
|
509 | if (firstrun) |
643 | firstrun=false; |
Line 510... | Line 644... | ||
510 | { |
644 | } |
511 | if (fullscreen) setFullScreenMode(fullscreen); |
645 | y_off=0; |
512 | firstrun=false; |
646 | |
Line 536... | Line 670... | ||
536 | spacer1=(f2.getHeight()); |
670 | spacer1=(f2.getHeight()); |
Line 537... | Line 671... | ||
537 | 671 | ||
538 | //default Font |
672 | //default Font |
Line -... | Line 673... | ||
- | 673 | g.setFont(f1); |
|
- | 674 | ||
539 | g.setFont(f1); |
675 | |
540 | 676 | //draw background |
|
541 | if (state==STATEID_EDIT_PARAMS) |
677 | if ((!do_scrollbg) || (state==STATEID_EDIT_PARAMS)) |
542 | { |
678 | { |
- | 679 | g.setColor(0xdedfff); |
|
- | 680 | g.fillRect(0,0,this.getWidth(),symbols_img.getHeight()); |
|
- | 681 | ||
- | 682 | g.setColor(skin_bg_color()); |
|
- | 683 | g.fillRect(0,symbols_img.getHeight(),this.getWidth(),this.getHeight()-symbols_img.getHeight()); |
|
543 | g.setColor(0x000000); |
684 | |
544 | g.fillRect(0,0,this.getWidth(),this.getHeight()); |
685 | |
545 | } |
686 | } |
546 | else |
687 | else |
547 | { |
688 | { |
548 | g.setColor(0xFFFFFF); |
689 | g.setColor(0xFFFFFF); |
549 | g.fillRect(0,0,this.getWidth(),this.getHeight()); |
690 | g.fillRect(0,0,this.getWidth(),this.getHeight()); |
550 | g.drawImage(bg_img,bg_offset,0, g.TOP | g.LEFT); |
691 | g.drawImage(bg_img,bg_offset,0, g.TOP | g.LEFT); |
551 | 692 | ||
552 | if (bg_offset+bg_img.getWidth()<this.getWidth()) |
693 | if (bg_offset+bg_img.getWidth()<this.getWidth()) |
Line -... | Line 694... | ||
- | 694 | g.drawImage(bg_img,bg_offset+bg_img.getWidth(),0, g.TOP | g.LEFT); |
|
- | 695 | } |
|
- | 696 | ||
553 | g.drawImage(bg_img,bg_offset+bg_img.getWidth(),0, g.TOP | g.LEFT); |
697 | |
- | 698 | //int bar=0; |
|
- | 699 | // for ( int bar=0;bar<3;bar++) |
|
- | 700 | if (do_scrollbg) |
|
- | 701 | for ( int bar=0;bar<this.getWidth()/(symbols_img.getWidth()/10)+1;bar++) |
|
- | 702 | { |
|
- | 703 | g.setClip(bar*(symbols_img.getWidth()/10),0,(symbols_img.getWidth()/10),symbols_img.getHeight());; |
|
- | 704 | g.drawImage(symbols_img,bar*(symbols_img.getWidth()/10),0, g.TOP | g.LEFT); |
|
- | 705 | } |
|
- | 706 | ||
554 | } |
707 | |
- | 708 | g.setClip(0,0,(symbols_img.getWidth()/10),symbols_img.getHeight());; |
|
555 | 709 | if (mk.connected) |
|
- | 710 | { |
|
556 | switch (act_skin) |
711 | |
- | 712 | if (((mk.bytes_in_count>>3)&1)==1) |
|
- | 713 | g.drawImage(symbols_img,(-2)*(symbols_img.getWidth()/10),0, g.TOP | g.LEFT); |
|
557 | { |
714 | else |
558 | case SKINID_DARK: |
715 | g.drawImage(symbols_img,(-3)*(symbols_img.getWidth()/10),0, g.TOP | g.LEFT); |
- | 716 | ||
559 | g.setColor(0x2dcf20); |
717 | |
- | 718 | int symbol_spacer=5; |
|
560 | 719 | g.setClip(symbol_spacer+(symbols_img.getWidth()/10),0,(symbols_img.getWidth()/10),symbols_img.getHeight());; |
|
561 | break; |
720 | |
- | 721 | g.drawImage(symbols_img,symbol_spacer+(-3)*(symbols_img.getWidth()/10),0, g.TOP | g.LEFT); |
|
- | 722 | g.setClip(0,0,this.getWidth(),this.getHeight()); |
|
- | 723 | g.setColor(0x03035a); |
|
- | 724 | g.drawString("" + (mk.debug_data.UBatt()/10) + "," +(mk.debug_data.UBatt()%10)+"V" , symbol_spacer+2+2*(symbols_img.getWidth()/10),y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 725 | // g.drawString("Sender: " + mk.debug_data.SenderOkay(),this.getWidth()/2,y_off,Graphics.TOP | Graphics.LEFT); |
|
562 | 726 | g.setClip(2*symbol_spacer+2*(symbols_img.getWidth()/10) + g.getFont().stringWidth("88,8V"),0,(symbols_img.getWidth()/10),symbols_img.getHeight());; |
|
- | 727 | g.drawImage(symbols_img,2*symbol_spacer+(-4)*(symbols_img.getWidth()/10) + g.getFont().stringWidth("88,8V"),0, g.TOP | g.LEFT); |
|
- | 728 | ||
563 | case SKINID_LIGHT: |
729 | g.setClip(0,0,this.getWidth(),this.getHeight()); |
Line -... | Line 730... | ||
- | 730 | ||
- | 731 | g.drawString(""+mk.debug_data.SenderOkay() , 2+2*symbol_spacer+3*(symbols_img.getWidth()/10) + g.getFont().stringWidth("88,8V"),y_off,Graphics.TOP | Graphics.LEFT); |
|
Line -... | Line 732... | ||
- | 732 | } |
|
- | 733 | ||
- | 734 | else |
|
- | 735 | g.drawImage(symbols_img,(-1)*(symbols_img.getWidth()/10),0, g.TOP | g.LEFT); |
|
- | 736 | ||
- | 737 | // if (mk.connected) |
|
- | 738 | ||
- | 739 | ||
Line 564... | Line 740... | ||
564 | g.setColor(0x000000); |
740 | // unclip |
565 | break; |
741 | g.setClip(0,0,this.getWidth(),this.getHeight()); |
Line 566... | Line 742... | ||
566 | } |
742 | |
- | 743 | y_off+=symbols_img.getHeight(); |
|
- | 744 | g.setColor(skin_fg_color()); |
|
- | 745 | ||
- | 746 | switch(state) |
|
- | 747 | { |
|
- | 748 | ||
- | 749 | case STATEID_GPSVIEW: |
|
- | 750 | ||
- | 751 | g.setStrokeStyle(Graphics.SOLID); |
|
- | 752 | g.setColor(0x0000ff); |
|
- | 753 | ||
- | 754 | ||
- | 755 | // g.fillArc(0, 0, this.getWidth(), this.getWidth(), 0,45); |
|
- | 756 | ||
- | 757 | int start_angle=(360+mk.gps_position.angle2wp(act_wp) - ((360+mk.debug_data.analog[26]-heading_offset)%360))%360; |
|
- | 758 | // start_angle=0; |
|
- | 759 | start_angle=(360-start_angle +90 -(45/2))%360; |
|
- | 760 | ||
- | 761 | g.fillArc(0, 0, this.getWidth(), this.getWidth(), start_angle,45); |
|
- | 762 | // g.drawArc(1, 1, this.getWidth()-2, this.getWidth()-2, start_angle,45); |
|
- | 763 | // g.drawArc(2, 2, this.getWidth()-4, this.getWidth()-4, start_angle ,45); |
|
567 | 764 | ||
568 | 765 | ||
569 | 766 | g.setColor(skin_fg_color()); |
|
570 | switch(state) |
767 | |
571 | { |
768 | |
572 | 769 | ||
573 | case STATEID_GPSVIEW: |
- | |
574 | g.drawString("GPS-Packages: " + mk.navi_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
- | |
- | 770 | ||
575 | y_off+=spacer; |
771 | g.drawString("GPS-Packages: " + mk.navi_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); g.drawString("GPS-Packages: " + mk.navi_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); g.drawString("GPS-Packages: " + mk.navi_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
576 | g.drawString("Used Sats: " + mk.gps_position.Used_Sat ,0,y_off,Graphics.TOP | Graphics.LEFT); |
772 | y_off+=spacer; |
577 | y_off+=spacer; |
- | |
578 | g.drawString("Latitude: " + mk.gps_position.Latitude_str() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
- | |
- | 773 | g.drawString("Used Sats: " + mk.gps_position.Used_Sat ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
Line 579... | Line 774... | ||
579 | y_off+=spacer; |
774 | y_off+=spacer; |
580 | g.drawString("=>: " + mk.gps_position.Latitude_min_sec() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
775 | g.drawString("Latitude: " + mk.gps_position.Latitude_str() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
581 | y_off+=spacer; |
776 | y_off+=spacer; |
582 | g.drawString("Longitude: " + mk.gps_position.Longitude_str() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
777 | |
Line 594... | Line 789... | ||
594 | y_off+=spacer; |
789 | y_off+=spacer; |
Line 595... | Line 790... | ||
595 | 790 | ||
596 | g.drawString("WayPoints: " + act_wp + "/" + mk.gps_position.last_wp ,0,y_off,Graphics.TOP | Graphics.LEFT); |
791 | g.drawString("WayPoints: " + act_wp + "/" + mk.gps_position.last_wp ,0,y_off,Graphics.TOP | Graphics.LEFT); |
Line -... | Line 792... | ||
- | 792 | y_off+=spacer; |
|
- | 793 | ||
- | 794 | g.drawString("" + mk.gps_position.NameWP[act_wp] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
597 | y_off+=spacer; |
795 | y_off+=spacer; |
- | 796 | ||
- | 797 | g.drawString("Lat: " + mk.gps_position.WP_Latitude_str(act_wp) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 798 | y_off+=spacer; |
|
598 | 799 | ||
Line -... | Line 800... | ||
- | 800 | g.drawString("Long: " + mk.gps_position.WP_Longitude_str(act_wp) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 801 | y_off+=spacer; |
|
- | 802 | ||
- | 803 | ||
599 | g.drawString(" " + mk.gps_position.WP_Latitude_min_sec(act_wp) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
804 | g.drawString("Distance: " + mk.gps_position.distance2wp(act_wp) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
600 | y_off+=spacer; |
805 | y_off+=spacer; |
Line -... | Line 806... | ||
- | 806 | ||
- | 807 | g.drawString("Angle: " + mk.gps_position.angle2wp(act_wp) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 808 | y_off+=spacer; |
|
- | 809 | ||
- | 810 | ||
601 | 811 | g.drawString("Compas Heading: " + ((360+mk.debug_data.analog[26]-heading_offset)%360) + "(" +mk.debug_data.analog[26] +")" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
Line 602... | Line 812... | ||
602 | g.drawString(" " + mk.gps_position.WP_Longitude_min_sec(act_wp) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
812 | y_off+=spacer; |
Line 603... | Line 813... | ||
603 | y_off+=spacer; |
813 | |
Line 616... | Line 826... | ||
616 | g.drawString("height " + cam_img.getHeight(),0,y_off,Graphics.TOP | Graphics.LEFT); |
826 | g.drawString("height " + cam_img.getHeight(),0,y_off,Graphics.TOP | Graphics.LEFT); |
617 | y_off+=spacer; |
827 | y_off+=spacer; |
618 | break; |
828 | break; |
Line 619... | Line 829... | ||
619 | 829 | ||
620 | case STATEID_STICKVIEW: |
830 | case STATEID_STICKVIEW: |
621 | y_off=0; |
831 | |
622 | for(int tmp_y=0;tmp_y<10;tmp_y++) |
832 | for(int tmp_y=0;tmp_y<10;tmp_y++) |
623 | { |
833 | { |
624 | g.drawString(""+tmp_y+"=>"+mk.stick_data.stick[tmp_y],0,y_off,Graphics.TOP | Graphics.LEFT); |
834 | g.drawString(""+tmp_y+"=>"+mk.stick_data.stick[tmp_y],0,y_off,Graphics.TOP | Graphics.LEFT); |
625 | y_off+=spacer; |
835 | y_off+=spacer; |
Line 652... | Line 862... | ||
652 | case STATEID_MOTORTEST: |
862 | case STATEID_MOTORTEST: |
653 | for (int bar=0;bar<4;bar++) |
863 | for (int bar=0;bar<4;bar++) |
Line 654... | Line 864... | ||
654 | 864 | ||
655 | { |
865 | { |
656 | g.setColor(((bar==act_motor)|motor_test_sel_all)?0x44CC44:0x4444DD); |
866 | g.setColor(((bar==act_motor)|motor_test_sel_all)?0x44CC44:0x4444DD); |
657 | g.fillRect(this.getWidth()/(8*2)+bar*2*this.getWidth()/8,10,this.getWidth()/8,20+motor_test[bar]); |
867 | g.fillRect(this.getWidth()/(8*2)+bar*2*this.getWidth()/8,y_off+10,this.getWidth()/8,y_off+20+motor_test[bar]); |
658 | g.setColor(0x000000); |
868 | g.setColor(0x000000); |
659 | g.drawString(""+motor_test[bar] ,this.getWidth()/8+bar*2*this.getWidth()/8,10,Graphics.TOP | Graphics.HCENTER); |
869 | g.drawString(""+motor_test[bar] ,this.getWidth()/8+bar*2*this.getWidth()/8,y_off+10,Graphics.TOP | Graphics.HCENTER); |
660 | if(bar!=4) g.drawString(""+mk.debug_data.motor_val(bar) ,this.getWidth()/8+bar*2*this.getWidth()/8,30,Graphics.TOP | Graphics.HCENTER); |
870 | g.drawString(""+mk.debug_data.motor_val(bar) ,this.getWidth()/8+bar*2*this.getWidth()/8,y_off+25,Graphics.TOP | Graphics.HCENTER); |
661 | } |
871 | } |
Line 662... | Line 872... | ||
662 | break; |
872 | break; |
663 | 873 | ||
664 | case STATEID_EDIT_PARAMS: |
874 | case STATEID_EDIT_PARAMS: |
Line -... | Line 875... | ||
- | 875 | params_editor.paint(g); |
|
- | 876 | break; |
|
- | 877 | ||
- | 878 | case STATEID_FILEOPEN: |
|
- | 879 | y_off+=spacer; |
|
- | 880 | g.drawString("act_path" + act_path() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 881 | paint_menu(g); |
|
- | 882 | break; |
|
- | 883 | ||
- | 884 | ||
Line 665... | Line 885... | ||
665 | params_editor.paint(g); |
885 | case STATEID_IPINPUT: |
666 | break; |
886 | paint_lcd(g,true); |
Line 667... | Line 887... | ||
667 | 887 | break; |
|
668 | 888 | ||
669 | case STATEID_READ_PARAMS: |
889 | case STATEID_READ_PARAMS: |
670 | paint_lcd(g,true); |
890 | paint_lcd(g,true); |
Line 671... | Line 891... | ||
671 | 891 | ||
672 | 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);; |
892 | 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);; |
Line 693... | Line 913... | ||
693 | if (i+rawdebug_off_y==rawdebug_cursor_y) |
913 | if (i+rawdebug_off_y==rawdebug_cursor_y) |
694 | { |
914 | { |
695 | g.setColor(0x0000CC); |
915 | g.setColor(0x0000CC); |
696 | g.fillRect(0,y_off,this.getWidth(),spacer1); |
916 | g.fillRect(0,y_off,this.getWidth(),spacer1); |
Line 697... | Line -... | ||
697 | - | ||
698 | switch (act_skin) |
- | |
699 | { |
- | |
700 | case SKINID_DARK: |
917 | |
701 | g.setColor(0x2dcf20); |
918 | g.setColor(skin_fg_color()); |
702 | - | ||
703 | break; |
919 | |
704 | - | ||
705 | case SKINID_LIGHT: |
- | |
706 | g.setColor(0x000000); |
- | |
707 | break; |
- | |
708 | } |
920 | |
709 | } |
921 | } |
710 | if (i+rawdebug_off_y<32) //todo better style |
922 | if (i+rawdebug_off_y<32) //todo better style |
Line 711... | Line 923... | ||
711 | g.drawString(mk.debug_data.names[i+rawdebug_off_y] + mk.debug_data.analog[i+rawdebug_off_y] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
923 | g.drawString(mk.debug_data.names[i+rawdebug_off_y] + mk.debug_data.analog[i+rawdebug_off_y] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
Line 717... | Line 929... | ||
717 | 929 | ||
Line 718... | Line 930... | ||
718 | 930 | ||
- | 931 | break; |
|
- | 932 | ||
- | 933 | ||
719 | break; |
934 | case STATEID_CONN_DETAILS: |
720 | 935 | g.setFont(f1); |
|
721 | 936 | g.drawString("Connection::",0,y_off,Graphics.TOP | Graphics.LEFT); |
|
722 | case STATEID_MAINMENU: |
937 | y_off+=spacer; |
723 | g.setFont(f2); |
938 | g.setFont(f2); |
724 | g.drawString(ufo_prober.extended_name()+ " (" + (mk.connected?("open"+((System.currentTimeMillis()- mk.connection_start_time)/1000)+"s"):"closed")+"):",0,y_off,Graphics.TOP | Graphics.LEFT); |
- | |
725 | y_off+=spacer1; |
- | |
726 | g.drawString(" Version:" + mk.version.str ,0,y_off,Graphics.TOP | Graphics.LEFT); |
939 | g.drawString(ufo_prober.extended_name()+ " (" + (mk.connected?("open"+((System.currentTimeMillis()- mk.connection_start_time)/1000)+"s"):"closed")+"):",0,y_off,Graphics.TOP | Graphics.LEFT); |
727 | y_off+=spacer1; |
940 | y_off+=spacer1; |
728 | /* |
941 | g.drawString(" Version:" + mk.version.str ,0,y_off,Graphics.TOP | Graphics.LEFT); |
729 | 942 | y_off+=spacer1; |
|
Line 730... | Line 943... | ||
730 | g.drawString(" Name:" + mk.name,0,y_off,Graphics.TOP | Graphics.LEFT); |
943 | g.drawString(" Name:" + mk.name,0,y_off,Graphics.TOP | Graphics.LEFT); |
731 | y_off+=spacer1; |
944 | y_off+=spacer1; |
732 | g.drawString(" URL:" + mk.mk_url,0,y_off,Graphics.TOP | Graphics.LEFT); |
945 | g.drawString(" URL:" + mk.mk_url,0,y_off,Graphics.TOP | Graphics.LEFT); |
733 | y_off+=spacer1; |
946 | y_off+=spacer1; |
- | 947 | ||
- | 948 | g.setFont(f1); |
|
- | 949 | g.drawString("Packet Traffic:",0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 950 | y_off+=spacer; |
|
- | 951 | g.setFont(f2); |
|
- | 952 | g.drawString( " in:"+mk.bytes_in_count + " bytes => " + mk.bytes_in_count/((System.currentTimeMillis()- mk.connection_start_time)/1000) + " bytes/s",0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 953 | y_off+=spacer1; |
|
734 | |
954 | |
735 | g.setFont(f1); |
955 | g.drawString( " out:"+mk.bytes_out_count + " bytes =>" + mk.bytes_out_count/((System.currentTimeMillis()- mk.connection_start_time)/1000) + "bytes/s", 0,y_off,Graphics.TOP | Graphics.LEFT); |
736 | g.drawString("Packet Traffic:",0,y_off,Graphics.TOP | Graphics.LEFT); |
956 | y_off+=spacer1; |
737 | y_off+=spacer; |
957 | |
738 | g.setFont(f2);*/ |
958 | |
Line -... | Line 959... | ||
- | 959 | g.drawString( " debug:"+mk.debug_data_count+ " LCD:" + mk.lcd_data_count + " vers:" + mk.version_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
Line -... | Line 960... | ||
- | 960 | y_off+=spacer1; |
|
- | 961 | g.drawString( " other:"+mk.other_data_count+" params:"+mk.params_data_count + " GPS:"+mk.navi_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 962 | y_off+=spacer1; |
|
- | 963 | g.drawString( " debug_names:" + mk.debug_names_count + " angles:" + mk.angle_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 964 | ||
- | 965 | break; |
|
- | 966 | ||
Line -... | Line 967... | ||
- | 967 | ||
- | 968 | case STATEID_PROXY: |
|
- | 969 | g.setFont(f1); |
|
- | 970 | g.drawString("Host:",0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 971 | y_off+=spacer; |
|
- | 972 | g.setFont(f2); |
|
- | 973 | g.drawString(" " + mk.proxy.url + "("+((mk.proxy.connected)?"open":"closed") +")",0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 974 | y_off+=spacer1; |
|
- | 975 | ||
- | 976 | ||
- | 977 | g.setFont(f1); |
|
- | 978 | g.drawString("Packet Traffic:",0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 979 | y_off+=spacer; |
|
- | 980 | g.setFont(f2); |
|
- | 981 | g.drawString( " in:"+mk.bytes_in_count + " bytes => " + mk.bytes_in_count/((System.currentTimeMillis()- mk.connection_start_time)/1000) + " bytes/s",0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 982 | y_off+=spacer1; |
|
- | 983 | ||
- | 984 | g.drawString( " out:"+mk.bytes_out_count + " bytes =>" + mk.bytes_out_count/((System.currentTimeMillis()- mk.connection_start_time)/1000) + "bytes/s", 0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 985 | y_off+=spacer1; |
|
- | 986 | ||
- | 987 | ||
- | 988 | g.drawString( " debug:"+mk.debug_data_count+ " LCD:" + mk.lcd_data_count + " vers:" + mk.version_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
739 | g.drawString( " debug:"+mk.debug_data_count+ " LCD:" + mk.lcd_data_count + " vers:" + mk.version_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
989 | y_off+=spacer1; |
740 | y_off+=spacer1; |
990 | g.drawString( " other:"+mk.other_data_count+" params:"+mk.params_data_count + " GPS:"+mk.navi_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
741 | g.drawString( " other:"+mk.other_data_count+" params:"+mk.params_data_count + " GPS:"+mk.navi_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
991 | y_off+=spacer1; |
742 | y_off+=spacer1; |
992 | g.drawString( " debug_names:" + mk.debug_names_count + " angles:" + mk.angle_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
Line 743... | Line 993... | ||
743 | g.drawString( " debug_names:" + mk.debug_names_count + " angles:" + mk.angle_data_count ,0,y_off,Graphics.TOP | Graphics.LEFT); |
993 | |
- | 994 | break; |
|
744 | 995 | ||
745 | 996 | ||
Line -... | Line 997... | ||
- | 997 | case STATEID_MAINMENU: |
|
746 | 998 | case STATEID_SETTINGSMENU: |
|
- | 999 | // falltru wanted |
|
- | 1000 | case STATEID_SELECT_PARAMSET: |
|
- | 1001 | case STATEID_HANDLE_PARAMS: |
|
- | 1002 | ||
- | 1003 | case STATEID_DEVICESELECT: |
|
Line -... | Line 1004... | ||
- | 1004 | ||
- | 1005 | paint_menu(g); |
|
- | 1006 | break; |
|
- | 1007 | ||
- | 1008 | ||
- | 1009 | case STATEID_GRAPH: |
|
- | 1010 | ||
- | 1011 | ||
- | 1012 | g.setStrokeStyle(Graphics.DOTTED); |
|
- | 1013 | g.setColor(0xe1dddd); |
|
- | 1014 | ||
- | 1015 | ||
- | 1016 | int scale=0; |
|
- | 1017 | if (1/line_scaler< this.getHeight()/10) scale=1; |
|
- | 1018 | if (10/line_scaler< this.getHeight()/10) scale=10; |
|
- | 1019 | if (100/line_scaler< this.getHeight()/10) scale=100; |
|
- | 1020 | if (1000/line_scaler< this.getHeight()/10) scale=1000; |
|
- | 1021 | if (10000/line_scaler< this.getHeight()/10) scale=10000; |
|
- | 1022 | ||
- | 1023 | ||
- | 1024 | /* |
|
- | 1025 | g.drawString("scale:"+scale + "line scaler" + line_scaler,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 1026 | ||
- | 1027 | ||
- | 1028 | int jump=0; |
|
- | 1029 | g.drawLine(0,line_middle_y,this.getWidth(),line_middle_y); |
|
- | 1030 | ||
- | 1031 | while (jump<this.getHeight()/2) |
|
- | 1032 | { |
|
- | 1033 | g.drawLine(0,line_middle_y - jump/line_scaler,this.getWidth(),line_middle_y - jump/line_scaler); |
|
- | 1034 | g.drawLine(0,line_middle_y + jump/line_scaler,this.getWidth(),line_middle_y + jump/line_scaler); |
|
- | 1035 | jump+=scale; |
|
- | 1036 | } |
|
- | 1037 | */ |
|
- | 1038 | ||
- | 1039 | ||
- | 1040 | ||
- | 1041 | ||
- | 1042 | for ( int x=0;x<this.getWidth();x++) |
|
- | 1043 | { |
|
- | 1044 | int p= (((-bg_offset+x-this.getWidth()-5))); |
|
- | 1045 | if (p<1) |
|
- | 1046 | p+=bg_img.getWidth(); |
|
- | 1047 | p%=(bg_img.getWidth()-1); |
|
- | 1048 | ||
- | 1049 | ||
Line -... | Line 1050... | ||
- | 1050 | ||
- | 1051 | try { |
|
- | 1052 | ||
- | 1053 | nick_line_pos_data[-bg_offset] = mk.debug_data.nick_int(); |
|
- | 1054 | roll_line_pos_data[-bg_offset] = mk.debug_data.roll_int(); |
|
- | 1055 | accnick_line_pos_data[-bg_offset] = mk.debug_data.accnick(); |
|
- | 1056 | accroll_line_pos_data[-bg_offset] = mk.debug_data.accroll(); |
|
- | 1057 | } |
|
- | 1058 | catch (Exception e) |
|
- | 1059 | { |
|
- | 1060 | err+=e.toString(); |
|
- | 1061 | } |
|
- | 1062 | ||
- | 1063 | g.setColor(0x156315); |
|
- | 1064 | draw_graph_part(g,x,nick_line_pos_data[p]/line_scaler,nick_line_pos_data[p+1]/line_scaler); |
|
- | 1065 | g.setColor(0xCC1315); |
|
- | 1066 | draw_graph_part(g,x,roll_line_pos_data[p]/line_scaler,roll_line_pos_data[p+1]/line_scaler); |
|
- | 1067 | g.setColor(0xf8ef02); |
|
- | 1068 | draw_graph_part(g,x,accnick_line_pos_data[p]/line_scaler,accnick_line_pos_data[p+1]/line_scaler); |
|
- | 1069 | g.setColor(0x19194d); |
|
- | 1070 | draw_graph_part(g,x,accroll_line_pos_data[p]/line_scaler,accroll_line_pos_data[p+1]/line_scaler); |
|
- | 1071 | ||
- | 1072 | } |
|
- | 1073 | ||
- | 1074 | ||
- | 1075 | ||
- | 1076 | ||
- | 1077 | for (int d=0;d<MAX_GRAPHS;d++) |
|
- | 1078 | { |
|
- | 1079 | g.setColor(graph_colors[d]); |
|
- | 1080 | g.fillRect(0,y_off +spacer1/2-2 ,20,4); |
|
- | 1081 | g.setColor(skin_fg_color()); |
|
- | 1082 | g.drawString(graph_names[d],23,y_off,Graphics.TOP | Graphics.LEFT); |
|
- | 1083 | y_off+=spacer1; |
|
747 | 1084 | ||
748 | case STATEID_SETTINGSMENU: |
1085 | } |
749 | // falltru wanted |
1086 | |
750 | case STATEID_SELECT_PARAMSET: |
1087 | |
751 | case STATEID_HANDLE_PARAMS: |
1088 | |
Line 782... | Line 1119... | ||
782 | y_off+=spacer; |
1119 | y_off+=spacer; |
783 | g.drawString("time motor>15:" +(mk_stat.motor_on_time/1000) +"s" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1120 | g.drawString("time motor>15:" +(mk_stat.motor_on_time/1000) +"s" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
784 | y_off+=spacer; |
1121 | y_off+=spacer; |
785 | g.drawString("time motor=15:" +(mk_stat.motor_stand_time/1000) +"s" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1122 | g.drawString("time motor=15:" +(mk_stat.motor_stand_time/1000) +"s" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
786 | y_off+=spacer; |
1123 | y_off+=spacer; |
787 | g.drawString("act_lcd_page:" + mk.LCD.act_mk_page + "/" + mk.LCD.pages + " ( wanted: " + mk.LCD.act_user_page +")" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1124 | g.drawString("lcd:" + mk.LCD.act_mk_page + "/" + mk.LCD.pages + " ( wanted: " + mk.LCD.act_user_page + "state:" + mk.LCD.init_state +")" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
- | 1125 | ||
- | 1126 | y_off+=spacer; |
|
- | 1127 | g.drawString("lcd-key:" + mk.LCD.act_key ,0,y_off,Graphics.TOP | Graphics.LEFT); |
|
Line 788... | Line 1128... | ||
788 | 1128 | ||
- | 1129 | } |
|
Line -... | Line 1130... | ||
- | 1130 | */ |
|
Line 789... | Line 1131... | ||
789 | } |
1131 | |
Line 790... | Line 1132... | ||
790 | 1132 | int spacer_left_right=(this.getWidth()-(20*(lcd_img.getWidth()/222)))/2; |
|
791 | 1133 | ||
792 | y_off=this.getHeight()-4*lcd_img.getHeight(); |
1134 | y_off=this.getHeight()-4*lcd_img.getHeight(); |
793 | 1135 | ||
794 | for ( int foo=0;foo<4;foo++) |
1136 | for ( int foo=0;foo<4;foo++) |
795 | { |
1137 | { |
Line 796... | Line 1138... | ||
796 | for (int x=0;x<20;x++) |
1138 | for (int x=0;x<20;x++) |
797 | { |
1139 | { |
798 | g.setClip((lcd_img.getWidth()/222)*x,y_off,(lcd_img.getWidth()/222),lcd_img.getHeight()); |
1140 | g.setClip(spacer_left_right+(lcd_img.getWidth()/222)*x,y_off,(lcd_img.getWidth()/222),lcd_img.getHeight()); |
Line 799... | Line 1141... | ||
799 | g.drawImage(lcd_img,(lcd_img.getWidth()/222)*x-(mk.LCD.get_act_page()[foo].charAt(x)-' ')*(lcd_img.getWidth()/222),y_off, g.TOP | g.LEFT); |
1141 | g.drawImage(lcd_img,spacer_left_right+(lcd_img.getWidth()/222)*x-(mk.LCD.get_act_page()[foo].charAt(x)-' ')*(lcd_img.getWidth()/222),y_off, g.TOP | g.LEFT); |
Line 800... | Line -... | ||
800 | - | ||
801 | } |
- | |
802 | y_off+=lcd_img.getHeight(); |
- | |
803 | } |
- | |
804 | - | ||
805 | g.setClip(0,0,this.getWidth(),this.getHeight()); |
- | |
Line 806... | Line -... | ||
806 | - | ||
807 | - | ||
808 | - | ||
809 | - | ||
Line 810... | Line -... | ||
810 | - | ||
811 | // draw lines |
- | |
812 | - | ||
813 | if (do_graph) for ( int x=0;x<this.getWidth();x++) |
- | |
814 | - | ||
815 | { |
- | |
816 | - | ||
817 | int p= (((-bg_offset+x-this.getWidth()-5))); |
- | |
Line 818... | Line -... | ||
818 | if (p<1) |
- | |
819 | p+=bg_img.getWidth(); |
- | |
820 | p%=(bg_img.getWidth()-1); |
- | |
821 | 1142 | ||
Line 822... | Line 1143... | ||
822 | g.setColor(0x156315); |
1143 | } |
Line 877... | Line 1198... | ||
877 | 1198 | ||
Line -... | Line 1199... | ||
- | 1199 | ||
- | 1200 | } |
|
- | 1201 | ||
- | 1202 | ||
- | 1203 | public int pow(int val,int pow) |
|
- | 1204 | { |
|
- | 1205 | int res=1; |
|
- | 1206 | ||
- | 1207 | for (int p=0;p<pow;p++) |
|
- | 1208 | res*=val; |
|
- | 1209 | ||
- | 1210 | return res; |
|
- | 1211 | } |
|
- | 1212 | public int mod_decimal(int val,int mod_power,int modder,int setter,int clipper) |
|
- | 1213 | { |
|
- | 1214 | ||
- | 1215 | int res=0; |
|
- | 1216 | ||
- | 1217 | for (int power=0;power<4;power++) |
|
- | 1218 | { |
|
- | 1219 | ||
- | 1220 | int act_digit=(val/pow(10,power))%10; |
|
- | 1221 | ||
- | 1222 | int new_digit=act_digit; |
|
- | 1223 | if (power==mod_power) |
|
- | 1224 | { |
|
- | 1225 | if (setter!=-1) |
|
- | 1226 | new_digit=setter; |
|
- | 1227 | ||
- | 1228 | new_digit+=modder; |
|
- | 1229 | ||
- | 1230 | ||
- | 1231 | if(new_digit<0) |
|
- | 1232 | new_digit=0; |
|
- | 1233 | ||
- | 1234 | if(new_digit>clipper) |
|
- | 1235 | new_digit=clipper; |
|
- | 1236 | ||
- | 1237 | } |
|
- | 1238 | ||
- | 1239 | // new_digit=1; |
|
- | 1240 | res+=new_digit*pow(10,power); |
|
- | 1241 | } |
|
- | 1242 | ||
- | 1243 | ||
- | 1244 | return res; |
|
878 | 1245 | ||
Line 879... | Line 1246... | ||
879 | } |
1246 | |
Line 880... | Line 1247... | ||
880 | 1247 | } |
|
881 | 1248 | ||
Line -... | Line 1249... | ||
- | 1249 | /*********************************************** input Section **********************************************/ |
|
- | 1250 | ||
- | 1251 | ||
882 | /*********************************************** input Section **********************************************/ |
1252 | 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) "; |
883 | 1253 | ||
884 | 1254 | int intro_str_pos=0; |
|
885 | 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) "; |
1255 | int intro_str_delay=3; |
886 | 1256 | ||
887 | int intro_str_pos=0; |
1257 | |
- | 1258 | ||
- | 1259 | ||
- | 1260 | public void chg_state(int next_state) |
|
- | 1261 | { |
|
- | 1262 | if (next_state!=state)act_menu_select=0; |
|
- | 1263 | // prepare next state |
|
- | 1264 | switch(next_state) |
|
- | 1265 | { |
|
- | 1266 | ||
- | 1267 | case STATEID_FILEOPEN: |
|
- | 1268 | if (act_path_depth==0) |
|
- | 1269 | { |
|
- | 1270 | Enumeration drives = FileSystemRegistry.listRoots(); |
|
- | 1271 | int tmp_i=0; |
|
- | 1272 | while(drives.hasMoreElements()) |
|
- | 1273 | { |
|
- | 1274 | file_list[tmp_i]= (String) drives.nextElement(); |
|
- | 1275 | tmp_i++; |
|
- | 1276 | ||
- | 1277 | if (MAX_FILELIST_LENGTH<tmp_i) |
|
- | 1278 | break; |
|
- | 1279 | } |
|
- | 1280 | menu_items=new String[tmp_i]; |
|
- | 1281 | lcd_lines=new String[tmp_i]; |
|
- | 1282 | file_list_length=tmp_i; |
|
- | 1283 | ||
- | 1284 | for(tmp_i=0;tmp_i<file_list_length;tmp_i++) |
|
- | 1285 | menu_items[tmp_i]=file_list[tmp_i]; |
|
- | 1286 | ||
- | 1287 | } |
|
- | 1288 | else |
|
- | 1289 | { |
|
- | 1290 | ||
- | 1291 | try { |
|
- | 1292 | FileConnection fc = (FileConnection) Connector.open("file:///"+act_path()); |
|
- | 1293 | Enumeration filelist = fc.list("*", true); |
|
- | 1294 | int tmp_i=0; |
|
- | 1295 | while(filelist.hasMoreElements()) { |
|
- | 1296 | file_list[tmp_i] = (String) filelist.nextElement(); |
|
- | 1297 | tmp_i++; |
|
- | 1298 | /* fc = (FileConnection) |
|
- | 1299 | Connector.open("file:///CFCard/" + fileName); |
|
- | 1300 | if(fc.isDirectory()) { |
|
- | 1301 | System.out.println("\tDirectory Name: " + fileName); |
|
- | 1302 | } else { |
|
- | 1303 | System.out.println |
|
- | 1304 | ("\tFile Name: " + fileName + |
|
- | 1305 | "\tSize: "+fc.fileSize()); |
|
- | 1306 | }*/ |
|
- | 1307 | ||
- | 1308 | } |
|
- | 1309 | ||
- | 1310 | menu_items=new String[tmp_i+1]; |
|
- | 1311 | lcd_lines=new String[tmp_i+1]; |
|
- | 1312 | file_list_length=tmp_i+1; |
|
- | 1313 | ||
- | 1314 | menu_items[0]=".."; |
|
- | 1315 | for(tmp_i=1;tmp_i<file_list_length;tmp_i++) |
|
- | 1316 | menu_items[tmp_i]=file_list[tmp_i-1]; |
|
- | 1317 | ||
- | 1318 | ||
- | 1319 | fc.close(); |
|
888 | int intro_str_delay=3; |
1320 | } catch (IOException ioe) { |
Line 889... | Line 1321... | ||
889 | 1321 | System.out.println(ioe.getMessage()); |
|
890 | public void chg_state(int next_state) |
1322 | } |
891 | { |
1323 | } |
Line 932... | Line 1364... | ||
932 | lcd_lines[0]="Reading Settings "; |
1364 | lcd_lines[0]="Reading Settings "; |
933 | lcd_lines[1]=mk.watchdog.act_paramset+"/5 |"+ (mk.watchdog.act_paramset>0?"#":"_") + (mk.watchdog.act_paramset>1?"#":"_") + (mk.watchdog.act_paramset>2?"#":"_")+ (mk.watchdog.act_paramset>3?"#":"_")+ (mk.watchdog.act_paramset>4?"#":"_") + "| "; |
1365 | lcd_lines[1]=mk.watchdog.act_paramset+"/5 |"+ (mk.watchdog.act_paramset>0?"#":"_") + (mk.watchdog.act_paramset>1?"#":"_") + (mk.watchdog.act_paramset>2?"#":"_")+ (mk.watchdog.act_paramset>3?"#":"_")+ (mk.watchdog.act_paramset>4?"#":"_") + "| "; |
Line 934... | Line 1366... | ||
934 | 1366 | ||
Line -... | Line 1367... | ||
- | 1367 | break; |
|
- | 1368 | ||
- | 1369 | case STATEID_IPINPUT: |
|
- | 1370 | ||
- | 1371 | lcd_lines=new String[3]; |
|
Line 935... | Line 1372... | ||
935 | break; |
1372 | lcd_lines[0]="Address (IP:Port): "; |
936 | 1373 | break; |
|
937 | 1374 | ||
938 | case STATEID_SCANNING: |
1375 | case STATEID_SCANNING: |
Line 946... | Line 1383... | ||
946 | 1383 | ||
947 | bt_scanner.search(); |
1384 | bt_scanner.search(); |
Line 948... | Line 1385... | ||
948 | break; |
1385 | break; |
949 | 1386 | ||
950 | case STATEID_HANDLE_PARAMS: |
1387 | case STATEID_HANDLE_PARAMS: |
- | 1388 | menu_items=new String[3]; |
|
951 | menu_items=new String[2]; |
1389 | menu_items[0]="write to MK"; |
952 | menu_items[0]="write to MK"; |
1390 | menu_items[1]="don't write to MK"; |
Line 953... | Line 1391... | ||
953 | menu_items[1]="Discard"; |
1391 | menu_items[2]="discard/read again"; |
Line 954... | Line 1392... | ||
954 | lcd_lines=new String[2]; |
1392 | lcd_lines=new String[3]; |
955 | 1393 | ||
Line 962... | Line 1400... | ||
962 | 1400 | ||
963 | lcd_lines=new String[5]; |
1401 | lcd_lines=new String[5]; |
Line 964... | Line 1402... | ||
964 | break; |
1402 | break; |
- | 1403 | ||
965 | 1404 | case STATEID_DEVICESELECT: |
|
966 | case STATEID_DEVICESELECT: |
1405 | |
967 | menu_items=new String[bt_scanner.remote_device_count+1]; |
1406 | menu_items=new String[bt_scanner.remote_device_count+1]; |
968 | for (int i=0;i<bt_scanner.remote_device_count;i++) |
1407 | for (int i=0;i<bt_scanner.remote_device_count;i++) |
969 | menu_items[i]=bt_scanner.remote_device_name[i]; |
1408 | menu_items[i]=bt_scanner.remote_device_name[i]; |
970 | menu_items[bt_scanner.remote_device_count]="scan again"; |
1409 | menu_items[bt_scanner.remote_device_count]="scan again"; |
Line 971... | Line 1410... | ||
971 | lcd_lines=new String[bt_scanner.remote_device_count+1]; |
1410 | lcd_lines=new String[bt_scanner.remote_device_count+1]; |
972 | break; |
1411 | break; |
- | 1412 | ||
973 | 1413 | ||
- | 1414 | case STATEID_MAINMENU: |
|
- | 1415 | if (ufo_prober.is_navi()) |
|
974 | 1416 | { |
|
- | 1417 | menu_items=main_menu_items_navi; |
|
975 | case STATEID_MAINMENU: |
1418 | menu_actions=main_menu_actions_navi; |
- | 1419 | } |
|
- | 1420 | else if (ufo_prober.is_mk()) |
|
- | 1421 | { |
|
976 | if (ufo_prober.is_navi()) |
1422 | menu_items=main_menu_items_mk; |
977 | menu_items=main_menu_items_navi; |
1423 | menu_actions=main_menu_actions_mk; |
- | 1424 | } |
|
- | 1425 | else // no connection |
|
Line 978... | Line 1426... | ||
978 | else if (ufo_prober.is_mk()) |
1426 | { |
979 | menu_items=main_menu_items_mk; |
1427 | menu_items=main_menu_items_no_connection; |
Line 980... | Line 1428... | ||
980 | else |
1428 | menu_actions=main_menu_actions_no_connection; |
Line 990... | Line 1438... | ||
990 | menu_items[cnt]=settings_menu_items[cnt]; |
1438 | menu_items[cnt]=settings_menu_items[cnt]; |
Line 991... | Line 1439... | ||
991 | 1439 | ||
992 | menu_items[0]+=(act_skin==SKINID_DARK)?"Dark":"Light"; |
1440 | menu_items[0]+=(act_skin==SKINID_DARK)?"Dark":"Light"; |
993 | menu_items[1]+=(!do_sound)?"Off":"On"; |
1441 | menu_items[1]+=(!do_sound)?"Off":"On"; |
994 | menu_items[2]+=(!do_vibra)?"Off":"On"; |
1442 | menu_items[2]+=(!do_vibra)?"Off":"On"; |
995 | menu_items[3]+=(!do_graph)?"Off":"On"; |
1443 | menu_items[3]+=(!do_scrollbg)?"Off":"On"; |
996 | menu_items[4]+=(!fullscreen)?"Off":"On"; |
1444 | menu_items[4]+=(!fullscreen)?"Off":"On"; |
Line 997... | Line 1445... | ||
997 | menu_items[5]+=(!keep_lighton)?"Off":"On"; |
1445 | menu_items[5]+=(!keep_lighton)?"Off":"On"; |
998 | 1446 | ||
Line 999... | Line 1447... | ||
999 | lcd_lines=new String[menu_items.length]; |
1447 | lcd_lines=new String[menu_items.length]; |
1000 | break; |
1448 | break; |
1001 | 1449 | ||
Line -... | Line 1450... | ||
- | 1450 | case STATEID_RAWDEBUG: |
|
- | 1451 | user_intent=USER_INTENT_RAWDEBUG; |
|
- | 1452 | break; |
|
- | 1453 | ||
- | 1454 | ||
1002 | case STATEID_RAWDEBUG: |
1455 | case STATEID_GRAPH: |
Line 1100... | Line 1553... | ||
1100 | public void keyPressed(int keyCode) |
1553 | public void keyPressed(int keyCode) |
1101 | { |
1554 | { |
1102 | debug.process_key(keyCode); |
1555 | debug.process_key(keyCode); |
Line 1103... | Line 1556... | ||
1103 | 1556 | ||
1104 | 1557 | ||
1105 | if (keyCode==KEY_STAR) |
1558 | if ((keyCode==KEY_STAR) || (keyCode==113)) |
1106 | { |
1559 | { |
1107 | if (state==STATEID_EDIT_PARAMS) |
1560 | if (state==STATEID_EDIT_PARAMS) |
1108 | { |
1561 | { |
Line 1123... | Line 1576... | ||
1123 | setFullScreenMode(fullscreen); |
1576 | setFullScreenMode(fullscreen); |
1124 | return; |
1577 | return; |
1125 | } |
1578 | } |
1126 | switch(state) |
1579 | switch(state) |
1127 | { |
1580 | { |
- | 1581 | case STATEID_IPINPUT: |
|
- | 1582 | ||
- | 1583 | ||
- | 1584 | if ((keyCode>=KEY_NUM0)&&(keyCode<=KEY_NUM9)) |
|
- | 1585 | { |
|
- | 1586 | act_proxy_ip[ipinput_pos/4]=mod_decimal(act_proxy_ip[ipinput_pos/4],(ipinput_pos<15?2:3)-(ipinput_pos%4),0,(keyCode-KEY_NUM0),9); |
|
- | 1587 | ||
- | 1588 | if(ipinput_pos<19) ipinput_pos++; |
|
- | 1589 | if ((ipinput_pos<18)&&(((ipinput_pos+1)%4)==0))ipinput_pos++; |
|
- | 1590 | } |
|
- | 1591 | else |
|
- | 1592 | switch (getGameAction (keyCode)) |
|
- | 1593 | { |
|
- | 1594 | case LEFT: |
|
- | 1595 | if(ipinput_pos>0) ipinput_pos--; |
|
- | 1596 | if (((ipinput_pos+1)%4)==0)ipinput_pos--; |
|
- | 1597 | break; |
|
- | 1598 | ||
- | 1599 | case RIGHT: |
|
- | 1600 | if(ipinput_pos<19) ipinput_pos++; |
|
- | 1601 | if(ipinput_pos<18)if (((ipinput_pos+1)%4)==0)ipinput_pos++; |
|
- | 1602 | break; |
|
- | 1603 | ||
- | 1604 | case UP: |
|
- | 1605 | act_proxy_ip[ipinput_pos/4]=mod_decimal(act_proxy_ip[ipinput_pos/4],(ipinput_pos<15?2:3)-(ipinput_pos%4),1,-1,9); |
|
- | 1606 | ||
- | 1607 | break; |
|
- | 1608 | ||
- | 1609 | case DOWN: |
|
- | 1610 | act_proxy_ip[ipinput_pos/4]=mod_decimal(act_proxy_ip[ipinput_pos/4],(ipinput_pos<15?2:3)-(ipinput_pos%4),-1,-1,9); |
|
- | 1611 | ||
- | 1612 | ||
- | 1613 | case FIRE: |
|
- | 1614 | mk.do_proxy("socket://"+ip_str(act_proxy_ip,false)); |
|
- | 1615 | chg_state(STATEID_PROXY); |
|
- | 1616 | ||
- | 1617 | break; |
|
- | 1618 | ||
- | 1619 | } |
|
- | 1620 | break; |
|
- | 1621 | ||
1128 | case STATEID_GPSVIEW: |
1622 | case STATEID_GPSVIEW: |
1129 | if (keyCode == this.KEY_NUM0) |
1623 | if (keyCode == this.KEY_NUM0) |
1130 | mk.set_gps_target(mk.gps_position.Latitude,mk.gps_position.Longitude); |
1624 | mk.set_gps_target(mk.gps_position.Latitude,mk.gps_position.Longitude); |
Line -... | Line 1625... | ||
- | 1625 | ||
- | 1626 | ||
1131 | 1627 | ||
1132 | if (keyCode == this.KEY_NUM1) |
1628 | if (keyCode == this.KEY_NUM1) |
- | 1629 | mk.gps_position.push_wp(); |
|
- | 1630 | if (keyCode == this.KEY_NUM2) |
|
- | 1631 | chg_state(STATEID_FILEOPEN); |
|
- | 1632 | if (keyCode == this.KEY_NUM3) |
|
- | 1633 | mk.set_gps_target(mk.gps_position.LatWP[act_wp],mk.gps_position.LongWP[act_wp]); |
|
- | 1634 | ||
- | 1635 | if (keyCode == this.KEY_NUM4) |
|
Line -... | Line 1636... | ||
- | 1636 | mk.gps_position.next_gps_format(); |
|
- | 1637 | ||
Line 1133... | Line 1638... | ||
1133 | mk.gps_position.push_wp(); |
1638 | if (keyCode == this.KEY_NUM5) |
1134 | 1639 | heading_offset= mk.debug_data.analog[26]; |
|
1135 | 1640 | ||
1136 | switch (getGameAction (keyCode)) |
1641 | switch (getGameAction (keyCode)) |
Line 1243... | Line 1748... | ||
1243 | } |
1748 | } |
Line 1244... | Line 1749... | ||
1244 | 1749 | ||
1245 | break; |
1750 | break; |
1246 | case STATEID_HANDLE_PARAMS: |
1751 | case STATEID_HANDLE_PARAMS: |
- | 1752 | if ( getGameAction (keyCode)==FIRE ) |
|
1247 | if ( getGameAction (keyCode)==FIRE ) |
1753 | { |
1248 | switch(act_menu_select) |
1754 | switch(act_menu_select) |
1249 | { |
1755 | { |
- | 1756 | case 0: |
|
1250 | case 0: |
1757 | |
- | 1758 | mk.write_params(); |
|
1251 | mk.write_params(); |
1759 | break; |
1252 | default: |
1760 | case 2: |
- | 1761 | mk.params.use_backup(); |
|
- | 1762 | break; |
|
1253 | chg_state(STATEID_MAINMENU); |
1763 | |
- | 1764 | } |
|
- | 1765 | chg_state(STATEID_MAINMENU); |
|
- | 1766 | } |
|
- | 1767 | else |
|
- | 1768 | menu_keypress(keyCode); |
|
- | 1769 | break; |
|
- | 1770 | ||
- | 1771 | case STATEID_FILEOPEN: |
|
- | 1772 | if ( getGameAction (keyCode)==FIRE ) |
|
- | 1773 | { |
|
- | 1774 | if ((act_menu_select==0)&&(act_path_depth!=0)) |
|
- | 1775 | { |
|
- | 1776 | act_path_depth--; |
|
- | 1777 | //act_path=act_path.substring(0,act_path.substring(0,act_path.length()-2).indexOf('/') ); |
|
- | 1778 | ||
- | 1779 | //act_path=last_path; |
|
- | 1780 | } |
|
- | 1781 | else |
|
- | 1782 | { |
|
- | 1783 | //last_path=act_path; |
|
- | 1784 | if (act_path_depth==0) |
|
- | 1785 | act_path_arr[act_path_depth++]=file_list[act_menu_select]; |
|
- | 1786 | else |
|
- | 1787 | act_path_arr[act_path_depth++]=file_list[act_menu_select-1]; |
|
- | 1788 | } |
|
- | 1789 | act_menu_select=0; |
|
- | 1790 | chg_state(STATEID_FILEOPEN); |
|
- | 1791 | ||
1254 | } |
1792 | } |
1255 | else |
1793 | else |
1256 | menu_keypress(keyCode); |
1794 | menu_keypress(keyCode); |
Line 1257... | Line 1795... | ||
1257 | break; |
1795 | break; |
Line 1274... | Line 1812... | ||
1274 | do_vibra=!do_vibra; |
1812 | do_vibra=!do_vibra; |
1275 | chg_state(STATEID_SETTINGSMENU); |
1813 | chg_state(STATEID_SETTINGSMENU); |
1276 | break; |
1814 | break; |
Line 1277... | Line 1815... | ||
1277 | 1815 | ||
1278 | case SETTINGSMENU_GRAPHTOGGLE: |
1816 | case SETTINGSMENU_GRAPHTOGGLE: |
1279 | do_graph=!do_graph; |
1817 | do_scrollbg=!do_scrollbg; |
1280 | chg_state(STATEID_SETTINGSMENU); |
1818 | chg_state(STATEID_SETTINGSMENU); |
Line 1281... | Line 1819... | ||
1281 | break; |
1819 | break; |
Line 1299... | Line 1837... | ||
1299 | } |
1837 | } |
1300 | else menu_keypress(keyCode); |
1838 | else menu_keypress(keyCode); |
1301 | break; |
1839 | break; |
Line 1302... | Line 1840... | ||
1302 | 1840 | ||
- | 1841 | case STATEID_MAINMENU: |
|
- | 1842 | if (keyCode == this.KEY_NUM2) |
|
- | 1843 | chg_state(STATEID_FILEOPEN); |
|
1303 | case STATEID_MAINMENU: |
1844 | |
1304 | if ( getGameAction (keyCode)==FIRE ) |
1845 | if ( getGameAction (keyCode)==FIRE ) |
Line 1305... | Line -... | ||
1305 | { |
- | |
1306 | 1846 | { |
|
1307 | if (ufo_prober.is_mk()) |
- | |
1308 | switch(act_menu_select) |
- | |
1309 | { |
- | |
1310 | case MAINMENU_MK_CAMMODE: |
1847 | |
Line 1311... | Line -... | ||
1311 | chg_state(STATEID_CAMMODE); |
- | |
1312 | break; |
- | |
1313 | - | ||
1314 | case MAINMENU_MK_SETTINGSMENU: |
- | |
1315 | chg_state(STATEID_SETTINGSMENU); |
- | |
1316 | break; |
- | |
Line 1317... | Line 1848... | ||
1317 | case MAINMENU_MK_STICKS: |
1848 | switch(menu_actions[act_menu_select]) |
1318 | chg_state(STATEID_STICKVIEW); |
1849 | { |
1319 | break; |
1850 | |
1320 | 1851 | ||
1321 | case MAINMENU_MK_KEYCONTROL: |
1852 | case ACTIONID_CONN_DETAILS: |
1322 | chg_state(STATEID_KEYCONTROL); |
1853 | chg_state(STATEID_CONN_DETAILS); |
1323 | break; |
1854 | break; |
Line -... | Line 1855... | ||
- | 1855 | ||
- | 1856 | case ACTIONID_QUIT: |
|
- | 1857 | quit=true; |
|
- | 1858 | break; |
|
- | 1859 | ||
- | 1860 | case ACTIONID_SWITCH_NC: |
|
- | 1861 | mk.switch_to_navi(); |
|
- | 1862 | break; |
|
- | 1863 | ||
- | 1864 | case ACTIONID_SWITCH_FC: |
|
- | 1865 | mk.switch_to_fc(); |
|
- | 1866 | break; |
|
1324 | 1867 | ||
1325 | case MAINMENU_MK_TELEMETRY : |
1868 | case ACTIONID_GRAPH: |
- | 1869 | chg_state(STATEID_GRAPH); |
|
- | 1870 | break; |
|
- | 1871 | ||
- | 1872 | case ACTIONID_KEYCONTROL: |
|
1326 | chg_state(STATEID_FLIGHTVIEW); |
1873 | chg_state(STATEID_KEYCONTROL); |
Line -... | Line 1874... | ||
- | 1874 | break; |
|
1327 | break; |
1875 | |
1328 | - | ||
1329 | case MAINMENU_MK_MOTORTEST : |
- | |
1330 | chg_state(STATEID_MOTORTEST); |
- | |
1331 | break; |
- | |
1332 | - | ||
Line -... | Line 1876... | ||
- | 1876 | case ACTIONID_LCD : |
|
- | 1877 | chg_state(STATEID_FLIGHTVIEW); |
|
- | 1878 | break; |
|
- | 1879 | ||
- | 1880 | ||
- | 1881 | case ACTIONID_PROXY: |
|
- | 1882 | ||
- | 1883 | chg_state(STATEID_IPINPUT); |
|
- | 1884 | break; |
|
- | 1885 | ||
- | 1886 | case ACTIONID_DEVICESELECT: |
|
- | 1887 | chg_state(STATEID_SCANNING); |
|
- | 1888 | break; |
|
- | 1889 | ||
- | 1890 | case ACTIONID_RAWDEBUG: |
|
- | 1891 | chg_state(STATEID_RAWDEBUG); |
|
- | 1892 | break; |
|
- | 1893 | ||
- | 1894 | case ACTIONID_SETTINGS: |
|
- | 1895 | chg_state(STATEID_SETTINGSMENU); |
|
- | 1896 | break; |
|
- | 1897 | ||
- | 1898 | case ACTIONID_RCDATA: |
|
- | 1899 | chg_state(STATEID_STICKVIEW); |
|
- | 1900 | break; |
|
- | 1901 | ||
- | 1902 | case ACTIONID_CAM: |
|
- | 1903 | chg_state(STATEID_CAMMODE); |
|
- | 1904 | break; |
|
- | 1905 | ||
- | 1906 | case ACTIONID_GPSDATA: |
|
- | 1907 | chg_state(STATEID_GPSVIEW); |
|
- | 1908 | break; |
|
- | 1909 | ||
- | 1910 | ||
- | 1911 | case ACTIONID_MOTORTEST : |
|
- | 1912 | chg_state(STATEID_MOTORTEST); |
|
- | 1913 | break; |
|
- | 1914 | ||
- | 1915 | ||
- | 1916 | case ACTIONID_EDIT_PARAMS: |
|
- | 1917 | if (mk.watchdog.act_paramset<5) |
|
- | 1918 | chg_state(STATEID_READ_PARAMS); |
|
- | 1919 | else |
|
- | 1920 | chg_state(STATEID_SELECT_PARAMSET); |
|
- | 1921 | ||
- | 1922 | break; |
|
- | 1923 | ||
- | 1924 | ||
- | 1925 | case ACTIONID_DEBUG: |
|
Line 1333... | Line -... | ||
1333 | case MAINMENU_MK_PARAMS : |
- | |
1334 | if (mk.watchdog.act_paramset<5) |
- | |
1335 | chg_state(STATEID_READ_PARAMS); |
- | |
Line 1336... | Line -... | ||
1336 | else |
- | |
1337 | chg_state(STATEID_SELECT_PARAMSET); |
- | |
1338 | break; |
- | |
Line 1339... | Line -... | ||
1339 | - | ||
1340 | - | ||
1341 | case MAINMENU_MK_PROXY: |
- | |
Line 1342... | Line -... | ||
1342 | mk.do_proxy("socket://192.168.1.42:2323"); |
- | |
1343 | break; |
- | |
1344 | - | ||
1345 | case MAINMENU_MK_DEVICESELECT: |
- | |
Line 1346... | Line 1926... | ||
1346 | chg_state(STATEID_SCANNING); |
1926 | debug.showing=true; |
1347 | break; |
1927 | break; |
1348 | 1928 | } |
|
1349 | case MAINMENU_MK_RAWDEBUG: |
1929 | /* |
1350 | chg_state(STATEID_RAWDEBUG); |
- | |
- | 1930 | if (ufo_prober.is_mk()) |
|
- | 1931 | switch(act_menu_select) |
|
Line -... | Line 1932... | ||
- | 1932 | { |
|
Line 1351... | Line 1933... | ||
1351 | break; |
1933 | |
1352 | 1934 | ||
1353 | case MAINMENU_MK_QUIT: |
1935 | |
Line 1402... | Line 1984... | ||
1402 | 1984 | ||
1403 | case MAINMENU_NO_CONN_DEVICESELECT: |
1985 | case MAINMENU_NO_CONN_DEVICESELECT: |
1404 | chg_state(STATEID_SCANNING); |
1986 | chg_state(STATEID_SCANNING); |
Line -... | Line 1987... | ||
- | 1987 | break; |
|
- | 1988 | ||
- | 1989 | ||
- | 1990 | case MAINMENU_NO_CONN_DEBUG: |
|
- | 1991 | debug.showing=true; |
|
Line 1405... | Line 1992... | ||
1405 | break; |
1992 | break; |
1406 | 1993 | ||
1407 | 1994 | |
|
1408 | case MAINMENU_NO_CONN_QUIT: |
1995 | case MAINMENU_NO_CONN_QUIT: |
Line 1409... | Line 1996... | ||
1409 | // set quit Flag |
1996 | // set quit Flag |
1410 | quit=true; |
1997 | quit=true; |
- | 1998 | break; |
|
1411 | break; |
1999 | |
- | 2000 | |
|
1412 | 2001 | } */ |
|
Line 1413... | Line 2002... | ||
1413 | 2002 | } |
|
1414 | } |
2003 | |
1415 | } |
2004 | else menu_keypress(keyCode); |
Line 1435... | Line 2024... | ||
1435 | chg_state(STATEID_MAINMENU); |
2024 | chg_state(STATEID_MAINMENU); |
1436 | } |
2025 | } |
1437 | else |
2026 | else |
1438 | */ |
2027 | */ |
Line -... | Line 2028... | ||
- | 2028 | ||
1439 | 2029 | ||
1440 | if ( getGameAction (keyCode)==FIRE ) |
2030 | if ( getGameAction (keyCode)==FIRE ) |
Line 1441... | Line 2031... | ||
1441 | { |
2031 | { |
1442 | 2032 |