Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1629 → Rev 1630

/dongfang_FC_rewrite_tool/configsets/imu.xml
File deleted
\ No newline at end of file
/dongfang_FC_rewrite_tool/configsets/Extra_330_config.xml
10,28 → 10,31
<bit name="unused" value="0"/>
</parameter>
<parameter name="pitchGyroP" value="var1"/>
<parameter name="pitchGyroI" value="80"/>
<parameter name="pitchGyroD" value="40"/>
<parameter name="pitchGyroI" value="20"/>
<parameter name="pitchGyroD" value="0"/>
<parameter name="pitchGyroIMax" value="45"/>
 
<parameter name="rollGyroP" value="var2"/>
<parameter name="rollGyroI" value="60"/>
<parameter name="rollGyroD" value="40"/>
<parameter name="rollGyroI" value="20"/>
<parameter name="rollGyroD" value="0"/>
<parameter name="rollGyroIMax" value="45"/>
 
<parameter name="yawGyroP" value="200"/>
<parameter name="yawGyroI" value="80"/>
<parameter name="yawGyroD" value="40"/>
<parameter name="yawGyroI" value="20"/>
<parameter name="yawGyroD" value="0"/>
<parameter name="yawGyroIMax" value="45"/>
 
<parameter name="stickIElevator" value="40"/>
<parameter name="stickIAilerons" value="60"/>
<parameter name="stickIRudder" value="20"/>
<parameter name="IFactor" value="52"/>
<parameter name="externalControl" value="0"/>
<parameter name="batteryWarningVoltage" value="101"/>
<parameter name="airspeedCorrention" value="100"/>
<parameter name="isFlyingThreshold" value="100"/>
<parameter name="servoCount" value="7"/>
<parameter name="servosReverse">
<bit name="reverseElevator" value="1"/>
/dongfang_FC_rewrite_tool/configsets/T28_Trojan_config.xml
11,17 → 11,17
</parameter>
<parameter name="pitchGyroP" value="var1"/>
<parameter name="pitchGyroI" value="80"/>
<parameter name="pitchGyroD" value="40"/>
<parameter name="pitchGyroD" value="0"/>
<parameter name="pitchGyroIMax" value="45"/>
 
<parameter name="rollGyroP" value="var2"/>
<parameter name="rollGyroI" value="60"/>
<parameter name="rollGyroD" value="40"/>
<parameter name="rollGyroD" value="0"/>
<parameter name="rollGyroIMax" value="45"/>
 
<parameter name="yawGyroP" value="200"/>
<parameter name="yawGyroI" value="80"/>
<parameter name="yawGyroD" value="40"/>
<parameter name="yawGyroD" value="0"/>
<parameter name="yawGyroIMax" value="45"/>
 
<parameter name="stickIElevator" value="40"/>
30,8 → 30,10
<parameter name="IFactor" value="52"/>
<parameter name="externalControl" value="0"/>
<parameter name="batteryWarningVoltage" value="101"/>
<parameter name="airspeedCorrention" value="100"/>
 
<parameter name="airspeedCorrention" value="1"/>
<parameter name="isFlyingThreshold" value="100"/>
 
<parameter name="servoCount" value="7"/>
<parameter name="servosReverse">
<bit name="reverseElevator" value="1"/>
/dongfang_FC_rewrite_tool/configsets/templates/imuconfiguration_v1.xml
New file
0,0 → 1,30
<imuconfigurationtemplate eepromVersion="0" length="15" >
<parameter name="gyroQuadrant" />
<parameter name="accQuadrant" />
<parameter name="imuReversedFlags" type="bitset">
<bit name="IMU_REVERSE_GYRO_PR" />
<bit name="IMU_REVERSE_GYRO_YAW" />
<bit name="IMU_REVERSE_ACC_XY" />
<bit name="IMU_REVERSE_ACC_Z" />
<bit name="Unused" />
<bit name="Unused" />
<bit name="Unused" />
<bit name="Unused" />
</parameter>
 
<parameter name="gyroPIDFilterConstant" />
<parameter name="gyroDWindowLength" />
<parameter name="gyroDFilterConstant" />
<parameter name="accFilterConstant" />
<parameter name="zerothOrderCorrection" />
<parameter name="rateTolerance" />
<parameter name="gyroActivityDamping" />
<parameter name="driftCompDivider" />
<parameter name="driftCompLimit" />
<parameter name="pitchGyroCalibrationTweak" />
<parameter name="rollGyroCalibrationTweak" />
<parameter name="yawGyroCalibrationTweak" />
</imuconfigurationtemplate>
/dongfang_FC_rewrite_tool/configsets/T28_Trojan_imu.xml
New file
0,0 → 1,30
<imuconfiguration eepromVersion="1" length="15" >
<parameter name="gyroQuadrant" value="2" />
<parameter name="accQuadrant" value="0" />
<parameter name="imuReversedFlags" type="bitset">
<bit name="IMU_REVERSE_GYRO_PR" value="0"/>
<bit name="IMU_REVERSE_GYRO_YAW" value="0" />
<bit name="IMU_REVERSE_ACC_XY" value="0" />
<bit name="IMU_REVERSE_ACC_Z" value="0" />
<bit name="Unused" value="0" />
<bit name="Unused" value="0" />
<bit name="Unused" value="0" />
<bit name="Unused" value="0" />
</parameter>
 
<parameter name="gyroPIDFilterConstant" value="4" />
<parameter name="gyroDWindowLength" value="3" />
<parameter name="gyroDFilterConstant" value="1" />
<parameter name="accFilterConstant" value="10" />
<parameter name="zerothOrderCorrection" value="1" />
<parameter name="rateTolerance" value="120" />
<parameter name="gyroActivityDamping" value="8" />
<parameter name="driftCompDivider" value="2" />
<parameter name="driftCompLimit" value="5" />
<parameter name="gyroPitchCalibration" value="0" />
<parameter name="gyroRollCalibration" value="0" />
<parameter name="gyroYawCalibration" value="0" />
</imuconfiguration>
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/VariablesRequestFrame.java
6,7 → 6,7
 
 
public class VariablesRequestFrame extends RequestFrame {
VariablesRequestFrame(int address) {
public VariablesRequestFrame(int address) {
super(address);
}
 
/dongfang_FC_rewrite_tool/src/dongfang/mkt/main/VariablesReader.java
New file
0,0 → 1,40
package dongfang.mkt.main;
 
import java.io.IOException;
 
import dongfang.mkt.comm.FrameQueue;
import dongfang.mkt.comm.MKConnection;
import dongfang.mkt.comm.serial.RXTXSerialPort;
import dongfang.mkt.frames.RequestFrame;
import dongfang.mkt.frames.VariablesRequestFrame;
import dongfang.mkt.frames.VariablesResponseFrame;
 
public class VariablesReader {
private static int[] readVariables(String portIdentifier) throws IOException {
MKConnection port = new RXTXSerialPort();
port.init(portIdentifier);
FrameQueue q = new FrameQueue(port);
int[] variables = null;
VariablesRequestFrame frame = new VariablesRequestFrame(RequestFrame.FC_ADDRESS);
q.sendRequest(frame);
VariablesResponseFrame r = (VariablesResponseFrame) q.getResponseFor(frame, 5000);
if (r == null) {
System.err.println("ERROR. Timeout waiting for response.");
} else {
variables = r.getVariables();
}
q.kill();
return variables;
}
 
public static void main(String[] args) throws IOException {
String portIdentifier = null;
if (args.length > 0) portIdentifier = args[0];
int[] vars = readVariables(portIdentifier);
for (int i=0; i<vars.length; i++) {
System.out.println("var" + i + ": " + vars[i]);
}
System.exit(0);
}
}