Rev 1698 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1698 | Rev 1699 | ||
---|---|---|---|
1 | package dongfang.mkt.frames; |
1 | package dongfang.mkt.frames; |
2 | 2 | ||
3 | import java.io.IOException; |
3 | import java.io.IOException; |
4 | 4 | ||
5 | import dongfang.mkt.RequestFrameVisitor; |
5 | import dongfang.mkt.RequestFrameVisitor; |
6 | - | ||
7 | - | ||
8 | /* |
- | |
9 | uint8_t digital[2]; |
- | |
10 | uint8_t remoteButtons; |
- | |
11 | int8_t pitch; |
- | |
12 | int8_t roll; |
- | |
13 | int8_t yaw; |
- | |
14 | uint8_t throttle; |
- | |
15 | int8_t height; |
- | |
16 | uint8_t free; |
- | |
17 | uint8_t frame; |
- | |
18 | uint8_t config; |
- | |
19 | */ |
6 | |
20 | public class ExternalControlRequestFrame extends RequestFrame { |
7 | public class ExternalControlRequestFrame extends RequestFrame { |
21 | public static final int COMMAND_NONE = 0; |
8 | public static final int COMMAND_NONE = 0; |
22 | public static final int COMMAND_START = 6; |
9 | public static final int COMMAND_GYROCAL = 1; |
23 | public static final int COMMAND_STOP = 8; |
10 | public static final int COMMAND_ACCCAL = 2; |
- | 11 | public static final int COMMAND_GYRO_ACC_CAL = 3; |
|
24 | public static final int COMMAND_GYROCAL = 2; |
12 | public static final int COMMAND_STOP = 10; |
25 | public static final int COMMAND_ACCCAL = 4; |
13 | public static final int COMMAND_START = 11; |
26 | 14 | ||
27 | int[] digital = new int[2];// unsigned byte. |
15 | int[] digital = new int[2];// unsigned byte. |
28 | int remoteButtons; // unsigned byte. |
16 | int remoteButtons; // unsigned byte. |
29 | int pitch; // signed byte. |
17 | int pitch; // signed byte. |
30 | int roll; // signed byte. |
18 | int roll; // signed byte. |
31 | int yaw; // signed byte. |
19 | int yaw; // signed byte. |
32 | int throttle; // unsigned byte. |
20 | int throttle; // unsigned byte. |
33 | int height; // signed byte (!). |
21 | int height; // signed byte (!). |
34 | int command; // unsigned byte. Called "free" in MK code. |
22 | int command; // unsigned byte. Called "free" in MK code. |
35 | int frameNum; // unsigned byte. |
23 | int frameNum; // unsigned byte. |
36 | int argument; // unsigned byte. Called "config" in MK code. |
24 | int argument; // unsigned byte. Called "config" in MK code. |
37 | 25 | ||
38 | public ExternalControlRequestFrame() { |
26 | public ExternalControlRequestFrame() { |
39 | super(FC_ADDRESS); |
27 | super(FC_ADDRESS); |
40 | } |
28 | } |
41 | 29 | ||
42 | public int[] getDigital() { |
30 | public int[] getDigital() { |
43 | return digital; |
31 | return digital; |
44 | } |
32 | } |
45 | 33 | ||
46 | public void setDigital(int[] digital) { |
34 | public void setDigital(int[] digital) { |
47 | this.digital = digital; |
35 | this.digital = digital; |
48 | } |
36 | } |
49 | 37 | ||
50 | public int getRemoteButtons() { |
38 | public int getRemoteButtons() { |
51 | return remoteButtons; |
39 | return remoteButtons; |
52 | } |
40 | } |
53 | 41 | ||
54 | public void setRemoteButtons(int remoteButtons) { |
42 | public void setRemoteButtons(int remoteButtons) { |
55 | this.remoteButtons = remoteButtons; |
43 | this.remoteButtons = remoteButtons; |
56 | } |
44 | } |
57 | 45 | ||
58 | public int getPitch() { |
46 | public int getPitch() { |
59 | return pitch; |
47 | return pitch; |
60 | } |
48 | } |
61 | 49 | ||
62 | public void setPitch(int pitch) { |
50 | public void setPitch(int pitch) { |
63 | this.pitch = pitch; |
51 | this.pitch = pitch; |
64 | } |
52 | } |
65 | 53 | ||
66 | public int getRoll() { |
54 | public int getRoll() { |
67 | return roll; |
55 | return roll; |
68 | } |
56 | } |
69 | 57 | ||
70 | public void setRoll(int roll) { |
58 | public void setRoll(int roll) { |
71 | this.roll = roll; |
59 | this.roll = roll; |
72 | } |
60 | } |
73 | 61 | ||
74 | public int getYaw() { |
62 | public int getYaw() { |
75 | return yaw; |
63 | return yaw; |
76 | } |
64 | } |
77 | 65 | ||
78 | public void setYaw(int yaw) { |
66 | public void setYaw(int yaw) { |
79 | this.yaw = yaw; |
67 | this.yaw = yaw; |
80 | } |
68 | } |
81 | 69 | ||
82 | public int getThrottle() { |
70 | public int getThrottle() { |
83 | return throttle; |
71 | return throttle; |
84 | } |
72 | } |
85 | 73 | ||
86 | public void setThrottle(int throttle) { |
74 | public void setThrottle(int throttle) { |
87 | this.throttle = throttle; |
75 | this.throttle = throttle; |
88 | } |
76 | } |
89 | 77 | ||
90 | public int getHeight() { |
78 | public int getHeight() { |
91 | return height; |
79 | return height; |
92 | } |
80 | } |
93 | 81 | ||
94 | public void setHeight(int height) { |
82 | public void setHeight(int height) { |
95 | this.height = height; |
83 | this.height = height; |
96 | } |
84 | } |
97 | 85 | ||
98 | public int getCommand() { |
86 | public int getCommand() { |
99 | return command; |
87 | return command; |
100 | } |
88 | } |
101 | 89 | ||
102 | public void setCommand(int command) { |
90 | public void setCommand(int command) { |
103 | this.command = command; |
91 | this.command = command; |
104 | } |
92 | } |
105 | 93 | ||
106 | public int getFrameNum() { |
94 | public int getFrameNum() { |
107 | return frameNum; |
95 | return frameNum; |
108 | } |
96 | } |
109 | 97 | ||
110 | public void setFrameNum(int frameNum) { |
98 | public void setFrameNum(int frameNum) { |
111 | this.frameNum = frameNum; |
99 | this.frameNum = frameNum; |
112 | } |
100 | } |
113 | 101 | ||
114 | public int getArgument() { |
102 | public int getArgument() { |
115 | return argument; |
103 | return argument; |
116 | } |
104 | } |
117 | 105 | ||
118 | public void setArgument(int argument) { |
106 | public void setArgument(int argument) { |
119 | this.argument = argument; |
107 | this.argument = argument; |
120 | } |
108 | } |
121 | 109 | ||
122 | public void start() { |
110 | public void start() { |
123 | command = COMMAND_START; |
111 | command = COMMAND_START; |
124 | } |
112 | } |
125 | 113 | ||
126 | public void stop() { |
114 | public void stop() { |
127 | command = COMMAND_STOP; |
115 | command = COMMAND_STOP; |
128 | } |
116 | } |
129 | 117 | ||
130 | public void gyroCal() { |
118 | public void gyroCal() { |
131 | command = COMMAND_GYROCAL; |
119 | command = COMMAND_GYROCAL; |
132 | } |
120 | } |
133 | 121 | ||
134 | public void accCal() { |
122 | public void accCal() { |
135 | command = COMMAND_ACCCAL; |
123 | command = COMMAND_ACCCAL; |
136 | } |
124 | } |
137 | 125 | ||
138 | @Override |
126 | @Override |
139 | public void accept(RequestFrameVisitor o) throws IOException { |
127 | public void accept(RequestFrameVisitor o) throws IOException { |
140 | o.visit(this); |
128 | o.visit(this); |
141 | } |
129 | } |
142 | } |
130 | } |