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