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