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 | |||
475 | ligi | 28 | public int UBatt() { return analog[9]; } |
29 | public int SenderOkay() { return analog[10]; } |
||
221 | ligi | 30 | |
475 | ligi | 31 | |
32 | |||
33 | |||
208 | ligi | 34 | public MKDebugData() |
181 | ligi | 35 | { |
210 | ligi | 36 | analog=new int[32]; |
37 | for (i=0;i<32;i++) |
||
181 | ligi | 38 | analog[i]=-1; |
39 | |||
40 | } |
||
41 | |||
210 | ligi | 42 | public void set_by_mk_data(int[] in_arr,MKVersion version) |
164 | ligi | 43 | { |
44 | |||
210 | ligi | 45 | if (version.compare(-1,-1)==version.VERSION_EQUAL) |
46 | return; |
||
208 | ligi | 47 | |
210 | ligi | 48 | if (version.compare(0,60)==version.VERSION_PREVIOUS) |
49 | { |
||
475 | ligi | 50 | for (i=0;i<32;i++) |
221 | ligi | 51 | { |
52 | analog[i]=(int)((in_arr[1+i*2]<<8) | in_arr[2+i*2]); |
||
53 | if ((analog[i]&(2<<14))!=0) |
||
54 | analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1); |
||
55 | } |
||
210 | ligi | 56 | } |
57 | else |
||
58 | { |
||
59 | for (i=0;i<16;i++) |
||
221 | ligi | 60 | { |
61 | analog[i]=(int)((in_arr[17+i*2]<<8) | in_arr[18+i*2]); |
||
62 | if ((analog[i]&(2<<14))!=0) |
||
63 | analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1); |
||
64 | } |
||
210 | ligi | 65 | } |
164 | ligi | 66 | |
208 | ligi | 67 | motor_complete=motor_val(0)+motor_val(1)+motor_val(2)+motor_val(3); |
210 | ligi | 68 | |
69 | |||
164 | ligi | 70 | } |
71 | |||
72 | |||
210 | ligi | 73 | |
164 | ligi | 74 | } |