0,0 → 1,141 |
package dongfang.mkt.frames; |
|
import java.io.IOException; |
|
import dongfang.mkt.RequestFrameVisitor; |
|
/* |
uint8_t digital[2]; |
uint8_t remoteButtons; |
int8_t pitch; |
int8_t roll; |
int8_t yaw; |
uint8_t throttle; |
int8_t height; |
uint8_t free; |
uint8_t frame; |
uint8_t config; |
*/ |
public class ExternalControlRequestFrame extends RequestFrame { |
public static final int COMMAND_NONE = 0; |
public static final int COMMAND_START = 6; |
public static final int COMMAND_STOP = 8; |
public static final int COMMAND_GYROCAL = 2; |
public static final int COMMAND_ACCCAL = 4; |
|
int[] digital = new int[2];// unsigned byte. |
int remoteButtons; // unsigned byte. |
int pitch; // signed byte. |
int roll; // signed byte. |
int yaw; // signed byte. |
int throttle; // unsigned byte. |
int height; // signed byte (!). |
int command; // unsigned byte. Called "free" in MK code. |
int frameNum; // unsigned byte. |
int argument; // unsigned byte. Called "config" in MK code. |
|
ExternalControlRequestFrame(int address) { |
super(address); |
} |
|
public int[] getDigital() { |
return digital; |
} |
|
public void setDigital(int[] digital) { |
this.digital = digital; |
} |
|
public int getRemoteButtons() { |
return remoteButtons; |
} |
|
public void setRemoteButtons(int remoteButtons) { |
this.remoteButtons = remoteButtons; |
} |
|
public int getPitch() { |
return pitch; |
} |
|
public void setPitch(int pitch) { |
this.pitch = pitch; |
} |
|
public int getRoll() { |
return roll; |
} |
|
public void setRoll(int roll) { |
this.roll = roll; |
} |
|
public int getYaw() { |
return yaw; |
} |
|
public void setYaw(int yaw) { |
this.yaw = yaw; |
} |
|
public int getThrottle() { |
return throttle; |
} |
|
public void setThrottle(int throttle) { |
this.throttle = throttle; |
} |
|
public int getHeight() { |
return height; |
} |
|
public void setHeight(int height) { |
this.height = height; |
} |
|
public int getCommand() { |
return command; |
} |
|
public void setCommand(int command) { |
this.command = command; |
} |
|
public int getFrameNum() { |
return frameNum; |
} |
|
public void setFrameNum(int frameNum) { |
this.frameNum = frameNum; |
} |
|
public int getArgument() { |
return argument; |
} |
|
public void setArgument(int argument) { |
this.argument = argument; |
} |
|
public void start() { |
command = COMMAND_START; |
} |
|
public void stop() { |
command = COMMAND_STOP; |
} |
|
public void gyroCal() { |
command = COMMAND_GYROCAL; |
} |
|
public void accCal() { |
command = COMMAND_ACCCAL; |
} |
|
@Override |
public void accept(RequestFrameVisitor o) throws IOException { |
o.visit(this); |
} |
} |