/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/VariablesResponseFrame.java |
---|
File deleted |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/VariablesRequestFrame.java |
---|
File deleted |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/FrameFactory.java |
---|
15,7 → 15,7 |
ReadParamSetRequestFrame createReadParamSetRequestFrame(int address); |
ResetRequestFrame createResetRequestFrame(int address); |
SingleDisplayRequestFrame createSingleDisplayRequestFrame(int address); |
VariablesRequestFrame createVariablesRequestFrame(int address); |
ReadVariablesRequestFrame createVariablesRequestFrame(int address); |
VersionRequestFrame createVersionRequestFrame(int address); |
// WriteParamSetRequestFrame createWriteParamSetRequestFrame(ParamSet paramSet); |
} |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/ReadMotorMixerRequestFrame.java |
---|
0,0 → 1,17 |
package dongfang.mkt.frames; |
import java.io.IOException; |
import dongfang.mkt.RequestFrameVisitor; |
public class ReadMotorMixerRequestFrame extends RequestFrame { |
public ReadMotorMixerRequestFrame() { |
super(FC_ADDRESS); |
} |
@Override |
public void accept(RequestFrameVisitor o) throws IOException { |
o.visit(this); |
} |
} |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/ReadMotorMixerResponseFrame.java |
---|
0,0 → 1,68 |
package dongfang.mkt.frames; |
public class ReadMotorMixerResponseFrame extends ResponseFrame { |
private int[][] matrix; |
// private int[] oppositeMotors; |
private int configurationVersion; |
private int dataLength; // not used really... |
public ReadMotorMixerResponseFrame() { |
super(FC_ADDRESS); |
} |
@Override |
public boolean isResponseTo(RequestFrame r) { |
return r instanceof ReadMotorMixerRequestFrame; |
} |
public int getConfigurationVersion() { |
return configurationVersion; |
} |
public void setConfigurationVersion(int configurationVersion) { |
this.configurationVersion = configurationVersion; |
} |
public int[][] getMatrix() { |
return matrix; |
} |
public void setMatrix(int[][] matrix) { |
this.matrix = matrix; |
} |
/* |
public int[] getOppositeMotors() { |
return oppositeMotors; |
} |
public void setOppositeMotors(int[] oppositeMotors) { |
this.oppositeMotors = oppositeMotors; |
} |
*/ |
public int getDataLength() { |
return dataLength; |
} |
public void setDataLength(int dataLength) { |
this.dataLength = dataLength; |
} |
public String toString() { |
StringBuilder result = new StringBuilder(getClass().getSimpleName() + ": "); |
if (matrix != null) { |
for (int i=0; i<matrix.length; i++) { |
result.append(i + "->"); |
result.append("Pitch: " + matrix[i][0]); |
result.append("Roll: " + matrix[i][1]); |
result.append("Throttle: " + matrix[i][2]); |
result.append("Yaw: " + matrix[i][3]); |
result.append("Opposite motor: " + matrix[i][4]); |
if (i<matrix.length-1) result.append("\n"); |
} |
} |
return result.toString(); |
} |
} |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/ReadVariablesRequestFrame.java |
---|
0,0 → 1,17 |
package dongfang.mkt.frames; |
import java.io.IOException; |
import dongfang.mkt.RequestFrameVisitor; |
public class ReadVariablesRequestFrame extends RequestFrame { |
public ReadVariablesRequestFrame(int address) { |
super(address); |
} |
@Override |
public void accept(RequestFrameVisitor o) throws IOException { |
o.visit(this); |
} |
} |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/ReadVariablesResponseFrame.java |
---|
0,0 → 1,34 |
package dongfang.mkt.frames; |
public class ReadVariablesResponseFrame extends ResponseFrame { |
private int[] variables; |
public ReadVariablesResponseFrame(int address) { |
super(address); |
} |
@Override |
public boolean isResponseTo(RequestFrame r) { |
return r instanceof ReadVariablesRequestFrame; |
} |
public int[] getVariables() { |
return variables; |
} |
public void setVariables(int[] variables) { |
this.variables = variables; |
} |
public String toString() { |
String result = getClass().getSimpleName() + ": "; |
if (variables != null) { |
for (int i=0; i<variables.length; i++) { |
result += i + "->" + variables[i]; |
if (i<variables.length-1) |
result += ", "; |
} |
} |
return result; |
} |
} |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/RequestFrameVisitor.java |
---|
2,7 → 2,7 |
import java.io.IOException; |
/* |
public interface RequestFrameVisitor { |
// void visit(RequestFrame f) throws IOException; |
void visit(AnalogDebugLabelRequestFrame f) throws IOException; |
13,7 → 13,7 |
void visit(AttitudeDataRequestFrame f) throws IOException; |
void visit(SingleDisplayRequestFrame f) throws IOException; |
void visit(AllDisplaysRequestFrame f) throws IOException; |
void visit(VariablesRequestFrame f) throws IOException; |
void visit(ReadVariablesRequestFrame f) throws IOException; |
void visit(ExternalControlRequestFrame f) throws IOException; |
void visit(ResetRequestFrame f) throws IOException; |
void visit(ChangeParameterSetRequestFrame f) throws IOException; |
23,4 → 23,5 |
void visit(ReadExternalControlRequestFrame f) throws IOException; |
void visit(OSDDataRequestFrame f) throws IOException; |
void visit(CompassHeadingRequestFrame f) throws IOException; |
} |
} |
*/ |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/WriteMotorMixerRequestFrame.java |
---|
0,0 → 1,51 |
package dongfang.mkt.frames; |
import java.io.IOException; |
import dongfang.mkt.RequestFrameVisitor; |
public class WriteMotorMixerRequestFrame extends RequestFrame { |
private int[][] matrix; |
// private int[] oppositeMotors; |
private int motorMixerVersionNumber; |
private int configurationVersion; |
public WriteMotorMixerRequestFrame(int motorMixerVersionNumber, int[][] matrix /*, int[] oppositeMotors*/) { |
super(FC_ADDRESS); |
this.motorMixerVersionNumber = motorMixerVersionNumber; |
this.matrix = matrix; |
// this.oppositeMotors = oppositeMotors; |
} |
@Override |
public void accept(RequestFrameVisitor o) throws IOException { |
o.visit(this); |
} |
public int getMotorMixerVersionNumber() { |
return motorMixerVersionNumber; |
} |
public int[][] getMatrix() { |
return matrix; |
} |
/* |
public int[] getOppositeMotors() { |
return oppositeMotors; |
} |
*/ |
public int getConfigurationVersion() { |
return configurationVersion; |
} |
public void setConfigurationVersion(int configurationVersion) { |
this.configurationVersion = configurationVersion; |
} |
public int getDataLength() { |
return matrix.length * 5; // return matrix.length * 4 + oppositeMotors.length;*/ |
} |
} |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/WriteMotorMixerResponseFrame.java |
---|
0,0 → 1,22 |
package dongfang.mkt.frames; |
public class WriteMotorMixerResponseFrame extends ResponseFrame { |
private boolean wasAccepted; |
public WriteMotorMixerResponseFrame(int address) { |
super(address); |
} |
@Override |
public boolean isResponseTo(RequestFrame r) { |
return r instanceof WriteMotorMixerRequestFrame; |
} |
public boolean wasAccepted() { |
return wasAccepted; |
} |
public void setWasAccepted(boolean wasAccepted) { |
this.wasAccepted = wasAccepted; |
} |
} |