Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
403 | ligi | 1 | /********************************************* |
2 | * |
||
3 | * class representing the DebugData Structure |
||
4 | * |
||
5 | * Author: Marcus -LiGi- Bueschleb |
||
6 | * |
||
7 | * see README for further Infos |
||
8 | * |
||
9 | ********************************************/ |
||
181 | ligi | 10 | |
164 | ligi | 11 | public class MKDebugData |
12 | |||
13 | { |
||
14 | |||
208 | ligi | 15 | public int[] analog; |
16 | public int motor_complete=-1; |
||
17 | |||
164 | ligi | 18 | |
208 | ligi | 19 | private int i; |
20 | |||
21 | public int motor_val(int id) { return analog[12+id]; } |
||
221 | ligi | 22 | public int nick_int() { return analog[1]; } |
23 | public int roll_int() { return analog[2]; } |
||
24 | public int accnick() { return analog[3]; } |
||
25 | public int accroll() { return analog[4]; } |
||
208 | ligi | 26 | |
27 | |||
221 | ligi | 28 | |
208 | ligi | 29 | public MKDebugData() |
181 | ligi | 30 | { |
210 | ligi | 31 | analog=new int[32]; |
32 | for (i=0;i<32;i++) |
||
181 | ligi | 33 | analog[i]=-1; |
34 | |||
35 | } |
||
36 | |||
210 | ligi | 37 | public void set_by_mk_data(int[] in_arr,MKVersion version) |
164 | ligi | 38 | { |
39 | |||
210 | ligi | 40 | if (version.compare(-1,-1)==version.VERSION_EQUAL) |
41 | return; |
||
208 | ligi | 42 | |
210 | ligi | 43 | if (version.compare(0,60)==version.VERSION_PREVIOUS) |
44 | { |
||
45 | for (i=0;i<16;i++) |
||
221 | ligi | 46 | { |
47 | analog[i]=(int)((in_arr[1+i*2]<<8) | in_arr[2+i*2]); |
||
48 | if ((analog[i]&(2<<14))!=0) |
||
49 | analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1); |
||
50 | } |
||
210 | ligi | 51 | } |
52 | else |
||
53 | { |
||
54 | for (i=0;i<16;i++) |
||
221 | ligi | 55 | { |
56 | analog[i]=(int)((in_arr[17+i*2]<<8) | in_arr[18+i*2]); |
||
57 | if ((analog[i]&(2<<14))!=0) |
||
58 | analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1); |
||
59 | } |
||
210 | ligi | 60 | } |
164 | ligi | 61 | |
208 | ligi | 62 | motor_complete=motor_val(0)+motor_val(1)+motor_val(2)+motor_val(3); |
210 | ligi | 63 | |
64 | |||
164 | ligi | 65 | } |
66 | |||
67 | |||
210 | ligi | 68 | |
164 | ligi | 69 | } |