Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
181 | ligi | 1 | /********************************************************************************************************************************* |
2 | * * |
||
3 | * class representing the DebugData Structure * |
||
4 | * * |
||
5 | * Author: Marcus -LiGi- Bueschleb * |
||
6 | * Project-Start: 9/2007 * |
||
7 | |||
8 | * Mailto: ligi@smart4mobile.de * |
||
9 | * Licence: Creative Commons / Non Commercial * |
||
10 | * Big Up: Holger&Ingo * |
||
11 | *********************************************************************************************************************************/ |
||
12 | |||
164 | ligi | 13 | public class MKDebugData |
14 | |||
15 | { |
||
16 | |||
208 | ligi | 17 | public int[] analog; |
18 | public int motor_complete=-1; |
||
19 | |||
164 | ligi | 20 | |
208 | ligi | 21 | private int i; |
22 | |||
23 | public int motor_val(int id) { return analog[12+id]; } |
||
221 | ligi | 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]; } |
||
208 | ligi | 28 | |
29 | |||
221 | ligi | 30 | |
208 | ligi | 31 | public MKDebugData() |
181 | ligi | 32 | { |
210 | ligi | 33 | analog=new int[32]; |
34 | for (i=0;i<32;i++) |
||
181 | ligi | 35 | analog[i]=-1; |
36 | |||
37 | } |
||
38 | |||
210 | ligi | 39 | public void set_by_mk_data(int[] in_arr,MKVersion version) |
164 | ligi | 40 | { |
41 | |||
210 | ligi | 42 | if (version.compare(-1,-1)==version.VERSION_EQUAL) |
43 | return; |
||
208 | ligi | 44 | |
210 | ligi | 45 | if (version.compare(0,60)==version.VERSION_PREVIOUS) |
46 | { |
||
47 | for (i=0;i<16;i++) |
||
221 | ligi | 48 | { |
49 | analog[i]=(int)((in_arr[1+i*2]<<8) | in_arr[2+i*2]); |
||
50 | if ((analog[i]&(2<<14))!=0) |
||
51 | analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1); |
||
52 | } |
||
210 | ligi | 53 | } |
54 | else |
||
55 | { |
||
56 | for (i=0;i<16;i++) |
||
221 | ligi | 57 | { |
58 | analog[i]=(int)((in_arr[17+i*2]<<8) | in_arr[18+i*2]); |
||
59 | if ((analog[i]&(2<<14))!=0) |
||
60 | analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1); |
||
61 | } |
||
210 | ligi | 62 | } |
164 | ligi | 63 | |
208 | ligi | 64 | motor_complete=motor_val(0)+motor_val(1)+motor_val(2)+motor_val(3); |
210 | ligi | 65 | |
66 | |||
164 | ligi | 67 | } |
68 | |||
69 | |||
210 | ligi | 70 | |
164 | ligi | 71 | } |