Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1794 → Rev 1795

/dongfang_FC_rewrite_tool/configsets/Flyer1_parameterset.xml
New file
0,0 → 1,98
<parameterset eepromVersion="102" length="50">
<parameter name="bitConfig">
<bit name="CFG_GYRO_SATURATION_PREVENTION" value="1"/>
<bit name="CFG_USE_AIRSPEED_PID" value="0"/>
<bit name="unused" value="0"/>
<bit name="unused" 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="pitchGyroP" value="var1"/>
<parameter name="pitchGyroI" value="15"/>
<parameter name="pitchGyroD" value="20"/>
<parameter name="pitchGyroIMax" value="30"/>
<parameter name="rollGyroP" value="40"/>
<parameter name="rollGyroI" value="0"/>
<parameter name="rollGyroD" value="20"/>
<parameter name="rollGyroIMax" value="30"/>
<parameter name="yawGyroP" value="40"/>
<parameter name="yawGyroI" value="20"/>
<parameter name="yawGyroD" value="20"/>
<parameter name="yawGyroIMax" value="30"/>
<parameter name="stickIElevator" value="40"/>
<parameter name="stickIAilerons" value="60"/>
<parameter name="stickIRudder" value="20"/>
<parameter name="IFactor" value="0"/>
<parameter name="externalControl" value="52"/>
<parameter name="batteryWarningVoltage" value="101"/>
<parameter name="airspeedCorrention" value="1"/>
<parameter name="isFlyingThreshold" value="4"/>
<parameter name="minFlashAirspeed" value="5"/>
<parameter name="maxFlashAirspeed" value="9"/>
<parameter name="servoCount" value="6"/>
<parameter name="aileronsServoReverse" value="0"/>
<parameter name="aileronsServoMinValue" value="80"/>
<parameter name="aileronsServoMaxValue" value="80"/>
<parameter name="elevatorServoReverse" value="0"/>
<parameter name="elevatorServoMinValue" value="80"/>
<parameter name="elevatorServoMaxValue" value="80"/>
<parameter name="rudderServoReverse" value="0"/>
<parameter name="rudderServoMinValue" value="80"/>
<parameter name="rudderServoMaxValue" value="80"/>
<parameter name="throttleReverse" value="255"/>
<parameter name="throttleMinValue" value="80"/>
<parameter name="throttleMaxValue" value="80"/>
<parameter name="output0BitMask">
<bit name="t0" value="1"/>
<bit name="t1" value="0"/>
<bit name="t2" value="0"/>
<bit name="t3" value="0"/>
<bit name="t4" value="0"/>
<bit name="t5" value="0"/>
<bit name="t6" value="0"/>
<bit name="t7" value="0"/>
</parameter>
<parameter name="output0Timing" value="15"/>
<parameter name="output1BitMask">
<bit name="t0" value="1"/>
<bit name="t1" value="1"/>
<bit name="t2" value="0"/>
<bit name="t3" value="0"/>
<bit name="t4" value="0"/>
<bit name="t5" value="0"/>
<bit name="t6" value="0"/>
<bit name="t7" value="0"/>
</parameter>
<parameter name="output1Timing" value="15"/>
<parameter name="outputDebugMask">
<bit name="DEBUG_MAINLOOP_TIMER" value="0"/>
<bit name="DEBUG_HEIGHT_DIFF" value="0"/>
<bit name="DEBUG_HOVERTHROTTLE" value="0"/>
<bit name="DEBUG_ACC0THORDER" value="0"/>
<bit name="DEBUG_SIGNAL" value="0"/>
<bit name="DEBUG_PRESSURERANGE" value="0"/>
<bit name="DEBUG_CLIP" value="0"/>
<bit name="DEBUG_SENSORLIMIT" value="0"/>
</parameter>
<parameter name="outputFlags">
<bit name="INVERT_OUTPUT0" value="0"/>
<bit name="INVERT_OUTPUT1" value="0"/>
<bit name="FLASH_OUTPUT0_BEEPING" value="1"/>
<bit name="FLASH_OUTPUT1_BEEPING" value="1"/>
<bit name="USE_ONBOARD_LEDS" value="1"/>
<bit name="TEST_OFF" value="0"/>
<bit name="TEST_ON" value="0"/>
<bit name="UNUSED" value="0"/>
</parameter>
<parameter name="userparam0" value="0"/>
<parameter name="userparam1" value="1"/>
<parameter name="userparam2" value="2"/>
<parameter name="userparam3" value="3"/>
<parameter name="userparam4" value="4"/>
<parameter name="userparam5" value="5"/>
<parameter name="userparam6" value="6"/>
<parameter name="userparam7" value="7"/>
</parameterset>
 
/dongfang_FC_rewrite_tool/configsets/templates/parameterset_v101.xml
New file
0,0 → 1,109
<parametertemplate eepromVersion="100" length="50">
<section name="config" title="Configuration">
<parameter name="bitConfig" type="bitset">
<bit name="CFG_GYRO_SATURATION_PREVENTION" />
<bit name="CFG_USE_AIRSPEED_PID" />
<bit name="unused" />
<bit name="unused" />
<bit name="unused" />
<bit name="unused" />
<bit name="unused" />
<bit name="unused" />
</parameter>
</section>
 
<section name="imu" title="IMU (gyros, accelerometer and compass)">
<parameter name="pitchGyroP" />
<parameter name="pitchGyroI" />
<parameter name="pitchGyroD" />
<parameter name="pitchGyroIMax" />
 
<parameter name="rollGyroP" />
<parameter name="rollGyroI" />
<parameter name="rollGyroD" />
<parameter name="rollGyroIMax" />
 
<parameter name="yawGyroP" />
<parameter name="yawGyroI" />
<parameter name="yawGyroD" />
<parameter name="yawGyroIMax" />
 
<parameter name="stickIElevator" />
<parameter name="stickIAilerons" />
<parameter name="stickIRudder" />
 
<parameter name="IFactor" />
</section>
 
<section name="control" title="Control">
<parameter name="externalControl" type="dynamic" />
<parameter name="batteryWarningVoltage" />
 
<parameter name="airspeedCorrention" />
<parameter name="isFlyingThreshold" />
</section>
 
<section name="servos" title="Servos">
<parameter name="servoCount" description="Total number of servos"/>
<parameter name="elevatorServoReverse" />
<parameter name="elevatorServoMinValue" type="signed/>
<parameter name="elevatorServoReverse" />
<section name="output">
<parameter name="output0BitMask" type="bitset">
<bit name="t0" />
<bit name="t1" />
<bit name="t2" />
<bit name="t3" />
<bit name="t4" />
<bit name="t5" />
<bit name="t6" />
<bit name="t7" />
</parameter>
<parameter name="output0Timing" staticCodeName="outputFlash[0].timing" dynamicCodeName="output0Timing" type="dynamic"/>
<parameter name="output1BitMask" type="bitset">
<bit name="t0" />
<bit name="t1" />
<bit name="t2" />
<bit name="t3" />
<bit name="t4" />
<bit name="t5" />
<bit name="t6" />
<bit name="t7" />
</parameter>
<parameter name="output1Timing" staticCodeName="outputFlash[1].timing" dynamicCodeName="output1Timing" type="dynamic"/>
<parameter name="outputDebugMask" type="bitset">
<bit name="DEBUG_MAINLOOP_TIMER" />
<bit name="DEBUG_HEIGHT_DIFF" />
<bit name="DEBUG_HOVERTHROTTLE" />
<bit name="DEBUG_ACC0THORDER" />
<bit name="DEBUG_SIGNAL" />
<bit name="DEBUG_PRESSURERANGE" />
<bit name="DEBUG_CLIP" />
<bit name="DEBUG_SENSORLIMIT" />
</parameter>
 
<parameter name="outputFlags" type="bitset">
<bit name="INVERT_OUTPUT0" />
<bit name="INVERT_OUTPUT1" />
<bit name="FLASH_OUTPUT0_BEEPING" />
<bit name="FLASH_OUTPUT1_BEEPING" />
<bit name="USE_ONBOARD_LEDS" />
<bit name="TEST_OFF" />
<bit name="TEST_ON" />
<bit name="UNUSED" />
</parameter>
</section>
 
<section name="userparams" title="User Parameters">
<parameter name="userparam0" />
<parameter name="userparam1" />
<parameter name="userparam2" />
<parameter name="userparam3" />
<parameter name="userparam4" />
<parameter name="userparam5" />
<parameter name="userparam6" />
<parameter name="userparam7" />
</section>
</parametertemplate>
/dongfang_FC_rewrite_tool/src/dongfang/mk/ui/DebugItem.java
New file
0,0 → 1,29
package dongfang.mk.ui;
 
import java.awt.Dimension;
 
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
 
public class DebugItem extends JPanel {
private JLabel label = new JLabel("Fnyxxedness");
private JLabel value = new JLabel("12345");
public DebugItem() {
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
add(label);
add(value);
}
public static void main(String[] args) {
JFrame f = new JFrame();
DebugItem di = new DebugItem();
f.getContentPane().add(di);
f.pack();
f.setVisible(true);
}
}
/dongfang_FC_rewrite_tool/src/dongfang/mk/ui/DebugColors.java
New file
0,0 → 1,30
package dongfang.mk.ui;
 
import java.awt.Color;
 
import dongfang.mkt.MKGlobals;
 
public class DebugColors {
public static final Color[] debugColors = new Color[MKGlobals.NUM_DEBUG_CHANNELS];
static {
for (int i=0; i<debugColors.length; i++) {
int r = i % 3;
int g = i % 5;
int b = i % 7;
int offset = 100;
debugColors[i] = new Color(
offset + r * 10,
offset + g * 10,
offset + b * 10
);
}
}
public static Color[] getDebugColors() {
return debugColors;
}
public static Color getDebugColor(int index) {
return debugColors[index];
}
}
/dongfang_FC_rewrite_tool/src/dongfang/mk/ui/SelectionListener.java
New file
0,0 → 1,5
package dongfang.mk.ui;
 
public interface SelectionListener {
void notifySelected(boolean[] sel);
}
/dongfang_FC_rewrite_tool/src/dongfang/mk/ui/DebugTable.java
New file
0,0 → 1,172
package dongfang.mk.ui;
 
import java.awt.BorderLayout;
import java.awt.Component;
 
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableCellRenderer;
 
public class DebugTable extends JPanel {
private static final int NUMCHANNELS = 32;
private static final int NUMCOLSETS = 1;
private static final int NUMROWS = NUMCHANNELS / NUMCOLSETS;
private static final int NUMCOLS = NUMCOLSETS * 3;
private SelectionListener selectionListener;
 
private static final int LABELCOL=0;
private static final int VALUECOL=1;
private static final int SELECTCOL=2;
 
class DebugtableModel extends AbstractTableModel {
private String[] labels = new String[NUMCHANNELS];
private Integer[] values = new Integer[NUMCHANNELS];
private boolean[] selected = new boolean[NUMCHANNELS];
 
@Override
public Class<?> getColumnClass(int columnIndex) {
switch(columnIndex % 3) {
case LABELCOL: return String.class;
case VALUECOL: return Integer.class;
case SELECTCOL: return Boolean.class;
}
return null;
}
 
@Override
public String getColumnName(int column) {
switch(column % 3) {
case LABELCOL: return "Name";
case VALUECOL: return "Value";
case SELECTCOL: return "Show";
}
return null;
}
 
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return columnIndex % 3 == SELECTCOL;
}
 
@Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
if (columnIndex % 3 == SELECTCOL) {
int colnum = (columnIndex / 3);
setSelected(rowIndex + colnum * NUMROWS, (Boolean)value);
}
}
 
void setLabel(int index, String label) {
labels[index] = label;
int colnum = LABELCOL + (index / NUMROWS) * 3;
fireTableCellUpdated(index % NUMROWS, colnum);
}
 
void setValue(int index, int value) {
values[index] = value;
int colnum = VALUECOL + (index / NUMROWS) * 3;
fireTableCellUpdated(index % NUMROWS, colnum);
}
 
void setValues(int[] values) {
for (int i=0; i<values.length; i++) {
this.values[i] = values[i];
int colnum = VALUECOL + (i / NUMROWS) * 3;
fireTableCellUpdated(i % NUMROWS, colnum);
}
}
 
void setSelected(int index, boolean selected) {
this.selected[index] = selected;
notifySelectionListener(this.selected);
}
 
boolean isSelected(int index) {
return selected[index];
}
 
public int getColumnCount() {
return NUMCOLS;
}
 
public int getRowCount() {
return NUMROWS;
}
 
public Object getValueAt(int rowIndex, int columnIndex) {
int colnum = (columnIndex / 3);
switch(columnIndex % 3) {
case LABELCOL: return labels[rowIndex + colnum * NUMROWS];
case VALUECOL: return values[rowIndex + colnum * NUMROWS];
case SELECTCOL: return selected[rowIndex + colnum * NUMROWS];
}
return null;
}
}
private DebugtableModel model = new DebugtableModel();
private JTable table = new JTable() {
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
Component c = super.prepareRenderer(renderer, row, column);
if (column % 3 == SELECTCOL)
c.setBackground(DebugColors.getDebugColor(row));
return c;
}
};
public DebugTable() {
table.setModel(model);
setLayout(new BorderLayout());
add(table.getTableHeader(), BorderLayout.PAGE_START);
add(table, BorderLayout.CENTER);
}
public void setLabel(int index, String label) {
this.model.setLabel(index, label);
}
 
public void setValue(int index, int value) {
this.model.setValue(index, value);
}
 
public void setValues(int[] values) {
this.model.setValues(values);
}
 
public void setSelected(int index, boolean value) {
this.model.setSelected(index, value);
}
 
public boolean isSelected(int index) {
return this.model.isSelected(index);
}
 
public void setSelectionListener(SelectionListener l) {
this.selectionListener = l;
}
private void notifySelectionListener(boolean[] selected) {
if (selectionListener != null)
selectionListener.notifySelected(selected);
}
public static void main(String[] args) {
JFrame f = new JFrame();
DebugTable t = new DebugTable();
for (int i=0; i<NUMCHANNELS; i++) {
t.setLabel(i, "label "+i);
t.setValue(i, (int)(Math.random() * 10000));
t.setSelected(i, false);
}
f.getContentPane().add(t);
f.pack();
f.setVisible(true);
}
}