Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4 | ligi | 1 | /********************************************* |
2 | * |
||
3 | * class representing the DebugData Structure |
||
4 | * |
||
5 | * Author: Marcus -LiGi- Bueschleb |
||
6 | * |
||
7 | * see README for further Infos |
||
8 | * |
||
9 | ********************************************/ |
||
10 | |||
11 | public class MKDebugData |
||
12 | |||
13 | { |
||
14 | |||
15 | public int[] analog; |
||
16 | public String[] names; |
||
17 | public boolean[] got_name; |
||
18 | public int motor_complete=-1; |
||
19 | |||
20 | |||
21 | private int i; |
||
22 | |||
23 | public int motor_val(int id) { return analog[12+id]; } |
||
24 | public int nick_int() { return analog[1]; } |
||
25 | public int roll_int() { return analog[2]; } |
||
26 | public int accnick() { return analog[3]; } |
||
27 | public int accroll() { return analog[4]; } |
||
28 | |||
29 | |||
30 | public int UBatt() { return analog[9]; } |
||
31 | public int SenderOkay() { return analog[10]; } |
||
32 | |||
33 | |||
34 | |||
35 | |||
36 | public MKDebugData() |
||
37 | { |
||
38 | names=new String[32]; |
||
39 | analog=new int[32]; |
||
40 | got_name=new boolean[32]; |
||
41 | for (i=0;i<32;i++) |
||
42 | { |
||
43 | analog[i]=-1; |
||
44 | names[i]="-#"+i+"->"; |
||
45 | got_name[i]=false; |
||
46 | } |
||
47 | |||
48 | } |
||
49 | |||
50 | public void set_names_by_mk_data(int id,int[] in_arr) |
||
51 | { |
||
52 | names[id]=""; |
||
53 | for (i=0;i<16;i++) |
||
54 | { |
||
55 | if ((char)in_arr[i]!=' ') |
||
56 | names[id]+=(char)in_arr[i]; |
||
57 | got_name[id]=true; |
||
58 | } |
||
59 | names[id]+=":"; |
||
60 | } |
||
61 | |||
62 | public void set_by_mk_data(int[] in_arr,MKVersion version) |
||
63 | { |
||
64 | |||
65 | if (version.compare(-1,-1)==version.VERSION_EQUAL) |
||
66 | return; |
||
67 | |||
68 | if (version.compare(0,60)==version.VERSION_PREVIOUS) |
||
69 | { |
||
70 | for (i=0;i<32;i++) |
||
71 | { |
||
72 | analog[i]=(int)((in_arr[1+i*2]<<8) | in_arr[2+i*2]); |
||
31 | ligi | 73 | if ((analog[i]&(1<<15))!=0) |
4 | ligi | 74 | analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1); |
75 | } |
||
76 | } |
||
77 | else |
||
78 | { |
||
79 | for (i=0;i<16;i++) |
||
80 | { |
||
81 | analog[i]=(int)((in_arr[17+i*2]<<8) | in_arr[18+i*2]); |
||
31 | ligi | 82 | if ((analog[i]&(1<<15))!=0) |
4 | ligi | 83 | analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1); |
84 | } |
||
85 | } |
||
86 | |||
87 | motor_complete=motor_val(0)+motor_val(1)+motor_val(2)+motor_val(3); |
||
88 | |||
89 | |||
90 | } |
||
91 | |||
92 | |||
93 | |||
94 | } |