Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1688 → Rev 1689

/dongfang_FC_rewrite_tool/src/dongfang/mkt/comm/MKInputStream.java
264,6 → 264,8
case 'M': {
WriteMotorMixerResponseFrame f = new WriteMotorMixerResponseFrame(address);
f.setWasAccepted(base64InputStream.readByte() != 0);
result = f;
break;
}
case 'N': {
int numMotors = 12;
271,18 → 273,21
f.setConfigurationVersion(base64InputStream.readByte());
int length = base64InputStream.readByte();
f.setDataLength(length);
int testLength = 0;
int testLength = 12; // the name is first!
char[] name = base64InputStream.readChars(12);
f.setName(name);
int[][] matrix = new int[numMotors][];
for(int i=0; i<numMotors; i++) {
int[] row = new int[4];
for(int j=0; j<4; j++) {
matrix[i][j] = base64InputStream.readByte();
int[] row = new int[5];
matrix[i] = row;
for(int j=0; j<5; j++) {
row[j] = base64InputStream.readSignedByte();
testLength++;
}
}
if (length != testLength)
throw new IOException("Length of motor mixer data was not as expected.");
throw new IOException("Length of motor mixer data was not as expected (" + testLength + " vs. " + length + ").");
/*
int[] opposite = new int[numMotors];
for(int i=0; i<numMotors; i++) {
289,10 → 294,9
opposite[i] = base64InputStream.readByte();
}
*/
f.setMatrix(matrix);
 
result = f;
break;
}
case 'O': {
OSDDataResponseFrame f = new OSDDataResponseFrame(address);
/dongfang_FC_rewrite_tool/src/dongfang/mkt/comm/MKOutputStream.java
39,6 → 39,11
inbuf[inbufptr++] = b;
}
 
void writeSignedByte(int b) throws IOException {
if (b<0) b+= 256;
writeByte(b);
}
 
public void writeBytes(int[] bs) throws IOException {
for (int i=0; i<bs.length; i++)
writeByte(bs[i]);
171,13 → 176,16
 
public void visit(WriteMotorMixerRequestFrame f) throws IOException {
writeByte('m');
writeByte(f.getConfigurationVersion());
writeByte(f.getDataLength());
base64OutputStream.writeByte(f.getMotorMixerVersionNumber());
base64OutputStream.writeByte(f.getDataLength());
base64OutputStream.writeChars(f.getName());
for(int i=0; i<f.getMatrix().length; i++) {
int[] row = f.getMatrix()[i];
for(int j=0; j<row.length; j++) {
base64OutputStream.writeByte(row[j]);
base64OutputStream.writeSignedByte(row[j]);
//System.out.print(row[j] + " ");
}
//System.out.println();
}
/*
for(int i=0; i<f.getOppositeMotors().length; i++) {