Gyro added, dead code removed

This commit is contained in:
Bertrand Songis
2019-05-10 16:45:42 +02:00
parent f7622f6503
commit dab0bd30d9
8 changed files with 10 additions and 966 deletions
@@ -28,13 +28,12 @@ RawSourceItemModel::RawSourceItemModel(const GeneralSettings * const generalSett
{
const Boards board = Boards(getCurrentBoard());
Firmware * fw = getCurrentFirmware();
const int anasCount = CPN_MAX_STICKS + board.getCapability(Board::Pots) + board.getCapability(Board::Sliders) + board.getCapability(Board::MouseAnalogs);
addItems(SOURCE_TYPE_NONE, RawSource::NoneGroup, 1);
for (int i=0; i < fw->getCapability(LuaScripts); i++)
addItems(SOURCE_TYPE_LUA_OUTPUT, RawSource::ScriptsGroup, fw->getCapability(LuaOutputsPerScript), i * 16);
addItems(SOURCE_TYPE_VIRTUAL_INPUT, RawSource::InputsGroup, fw->getCapability(VirtualInputs));
addItems(SOURCE_TYPE_STICK, RawSource::SourcesGroup, anasCount);
addItems(SOURCE_TYPE_STICK, RawSource::SourcesGroup, board.getCapability(Board::MaxAnalogs));
addItems(SOURCE_TYPE_ROTARY_ENCODER, RawSource::SourcesGroup, fw->getCapability(RotaryEncoders));
addItems(SOURCE_TYPE_TRIM, RawSource::TrimsGroup, board.getCapability(Board::NumTrims));
addItems(SOURCE_TYPE_MAX, RawSource::SourcesGroup, 1);
+7 -1
View File
@@ -260,8 +260,14 @@ const int Boards::getCapability(Board::Type board, Board::Capability capability)
else
return 0;
case GyroAnalogs:
if (IS_HORUS_X12S(board) || IS_TARANIS_XLITES(board))
return 2;
else
return 0;
case MaxAnalogs:
return getCapability(board, Board::Sticks) + getCapability(board, Board::Pots) + getCapability(board, Board::Sliders) + getCapability(board, Board::MouseAnalogs);
return getCapability(board, Board::Sticks) + getCapability(board, Board::Pots) + getCapability(board, Board::Sliders) + getCapability(board, Board::MouseAnalogs) + getCapability(board, Board::GyroAnalogs);
case MultiposPots:
return IS_HORUS_OR_TARANIS(board) ? getCapability(board, Board::Pots) : 0;
+1
View File
@@ -114,6 +114,7 @@ namespace Board {
FactoryInstalledPots,
Sliders,
MouseAnalogs,
GyroAnalogs,
MaxAnalogs,
MultiposPots,
MultiposPotsPositions,
-1
View File
@@ -24,7 +24,6 @@
#include <QtWidgets>
#include "eeprominterface.h"
#include "firmwareinterface.h"
#include "xmlinterface.h"
namespace Ui
{
+1 -1
View File
@@ -44,7 +44,7 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
headerLabels << tr("Negative span") << tr("Mid value") << tr("Positive span");
tableWidget->setHorizontalHeaderLabels(headerLabels);
int rows = CPN_MAX_STICKS + getBoardCapability(getCurrentBoard(), Board::Pots) + getBoardCapability(getCurrentBoard(), Board::Sliders) + getBoardCapability(getCurrentBoard(), Board::MouseAnalogs);
int rows = getBoardCapability(getCurrentBoard(), Board::MaxAnalogs);
tableWidget->setRowCount(rows);
for(int i = 0; i < rows; ++i) {
-691
View File
@@ -1,691 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation xml:lang="en">
Radio data schema for companion9x.
</xs:documentation>
</xs:annotation>
<xs:simpleType name="CalibrationValue">
<xs:restriction base="xs:int">
<xs:minInclusive value="-125"/>
<xs:maxInclusive value="125"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Calibration">
<xs:attribute name="middle" type="CalibrationValue" use="required"/>
<xs:attribute name="negative" type="CalibrationValue" use="required"/>
<xs:attribute name="positive" type="CalibrationValue" use="required"/>
</xs:complexType>
<xs:complexType name="PPMCalibration">
<xs:attribute name="middle" type="CalibrationValue" use="required"/>
</xs:complexType>
<xs:simpleType name="Switch">
<xs:restriction base="xs:string">
<!-- TODO accepter minuscules/majuscules -->
<xs:enumeration value="OFF"/>
<xs:enumeration value="!SWC"/>
<xs:enumeration value="!SWB"/>
<xs:enumeration value="!SWA"/>
<xs:enumeration value="!SW9"/>
<xs:enumeration value="!SW8"/>
<xs:enumeration value="!SW7"/>
<xs:enumeration value="!SW6"/>
<xs:enumeration value="!SW5"/>
<xs:enumeration value="!SW4"/>
<xs:enumeration value="!SW3"/>
<xs:enumeration value="!SW2"/>
<xs:enumeration value="!SW1"/>
<xs:enumeration value="!TRN"/>
<xs:enumeration value="!GEA"/>
<xs:enumeration value="!AIL"/>
<xs:enumeration value="!ID2"/>
<xs:enumeration value="!ID1"/>
<xs:enumeration value="!ID0"/>
<xs:enumeration value="!ELE"/>
<xs:enumeration value="!RUD"/>
<xs:enumeration value="!THR"/>
<!-- 0 -->
<xs:enumeration value="THR"/>
<xs:enumeration value="RUD"/>
<xs:enumeration value="ELE"/>
<xs:enumeration value="ID0"/>
<xs:enumeration value="ID1"/>
<xs:enumeration value="ID2"/>
<xs:enumeration value="AIL"/>
<xs:enumeration value="GEA"/>
<xs:enumeration value="TRN"/>
<xs:enumeration value="SW1"/>
<xs:enumeration value="SW2"/>
<xs:enumeration value="SW3"/>
<xs:enumeration value="SW4"/>
<xs:enumeration value="SW5"/>
<xs:enumeration value="SW6"/>
<xs:enumeration value="SW7"/>
<xs:enumeration value="SW8"/>
<xs:enumeration value="SW9"/>
<xs:enumeration value="SWA"/>
<xs:enumeration value="SWB"/>
<xs:enumeration value="SWC"/>
<xs:enumeration value="ON"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimerSwitch">
<xs:restriction base="xs:string">
<xs:enumeration value="!mSWC"/>
<xs:enumeration value="!mSWB"/>
<xs:enumeration value="!mSWA"/>
<xs:enumeration value="!mSW9"/>
<xs:enumeration value="!mSW8"/>
<xs:enumeration value="!mSW7"/>
<xs:enumeration value="!mSW6"/>
<xs:enumeration value="!mSW5"/>
<xs:enumeration value="!mSW4"/>
<xs:enumeration value="!mSW3"/>
<xs:enumeration value="!mSW2"/>
<xs:enumeration value="!mSW1"/>
<xs:enumeration value="!mTRN"/>
<xs:enumeration value="!mGEA"/>
<xs:enumeration value="!mAIL"/>
<xs:enumeration value="!mID2"/>
<xs:enumeration value="!mID1"/>
<xs:enumeration value="!mID0"/>
<xs:enumeration value="!mELE"/>
<xs:enumeration value="!mRUD"/>
<xs:enumeration value="!mTHR"/>
<xs:enumeration value="!SWC"/>
<xs:enumeration value="!SWB"/>
<xs:enumeration value="!SWA"/>
<xs:enumeration value="!SW9"/>
<xs:enumeration value="!SW8"/>
<xs:enumeration value="!SW7"/>
<xs:enumeration value="!SW6"/>
<xs:enumeration value="!SW5"/>
<xs:enumeration value="!SW4"/>
<xs:enumeration value="!SW3"/>
<xs:enumeration value="!SW2"/>
<xs:enumeration value="!SW1"/>
<xs:enumeration value="!TRN"/>
<xs:enumeration value="!GEA"/>
<xs:enumeration value="!AIL"/>
<xs:enumeration value="!ID2"/>
<xs:enumeration value="!ID1"/>
<xs:enumeration value="!ID0"/>
<xs:enumeration value="!ELE"/>
<xs:enumeration value="!RUD"/>
<xs:enumeration value="!THR"/>
<xs:enumeration value="!P3%"/>
<xs:enumeration value="!P3"/>
<xs:enumeration value="!P2%"/>
<xs:enumeration value="!P2"/>
<xs:enumeration value="!P1%"/>
<xs:enumeration value="!P1"/>
<xs:enumeration value="!AL%"/>
<xs:enumeration value="!ALs"/>
<xs:enumeration value="!TH%"/>
<xs:enumeration value="!THs"/>
<xs:enumeration value="!EL%"/>
<xs:enumeration value="!ELs"/>
<xs:enumeration value="!RU%"/>
<xs:enumeration value="!RUs"/>
<xs:enumeration value="!ABS"/>
<!-- TODO on affiche 2x ABS -->
<xs:enumeration value="OFF"/>
<!-- TODO a retirer + decalage -->
<xs:enumeration value="ABS"/>
<xs:enumeration value="RUs"/>
<xs:enumeration value="RU%"/>
<xs:enumeration value="ELs"/>
<xs:enumeration value="EL%"/>
<xs:enumeration value="THs"/>
<xs:enumeration value="TH%"/>
<xs:enumeration value="ALs"/>
<xs:enumeration value="AL%"/>
<xs:enumeration value="P1"/>
<xs:enumeration value="P1%"/>
<xs:enumeration value="P2"/>
<xs:enumeration value="P2%"/>
<xs:enumeration value="P3"/>
<xs:enumeration value="P3%"/>
<xs:enumeration value="THR"/>
<xs:enumeration value="RUD"/>
<xs:enumeration value="ELE"/>
<xs:enumeration value="ID0"/>
<xs:enumeration value="ID1"/>
<xs:enumeration value="ID2"/>
<xs:enumeration value="AIL"/>
<xs:enumeration value="GEA"/>
<xs:enumeration value="TRN"/>
<xs:enumeration value="SW1"/>
<xs:enumeration value="SW2"/>
<xs:enumeration value="SW3"/>
<xs:enumeration value="SW4"/>
<xs:enumeration value="SW5"/>
<xs:enumeration value="SW6"/>
<xs:enumeration value="SW7"/>
<xs:enumeration value="SW8"/>
<xs:enumeration value="SW9"/>
<xs:enumeration value="SWA"/>
<xs:enumeration value="SWB"/>
<xs:enumeration value="SWC"/>
<xs:enumeration value="mTHR"/>
<xs:enumeration value="mRUD"/>
<xs:enumeration value="mELE"/>
<xs:enumeration value="mID0"/>
<xs:enumeration value="mID1"/>
<xs:enumeration value="mID2"/>
<xs:enumeration value="mAIL"/>
<xs:enumeration value="mGEA"/>
<xs:enumeration value="mTRN"/>
<xs:enumeration value="mSW1"/>
<xs:enumeration value="mSW2"/>
<xs:enumeration value="mSW3"/>
<xs:enumeration value="mSW4"/>
<xs:enumeration value="mSW5"/>
<xs:enumeration value="mSW6"/>
<xs:enumeration value="mSW7"/>
<xs:enumeration value="mSW8"/>
<xs:enumeration value="mSW9"/>
<xs:enumeration value="mSWA"/>
<xs:enumeration value="mSWB"/>
<xs:enumeration value="mSWC"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Source">
<xs:restriction base="xs:string">
<!-- TODO accepter minuscules/majuscules -->
<xs:enumeration value="RUD"/>
<xs:enumeration value="THR"/>
<xs:enumeration value="ELE"/>
<xs:enumeration value="AIL"/>
<xs:enumeration value="P1"/>
<xs:enumeration value="P2"/>
<xs:enumeration value="P3"/>
<xs:enumeration value="MAX"/>
<xs:enumeration value="FULL"/>
<xs:enumeration value="CYC1"/>
<xs:enumeration value="CYC2"/>
<xs:enumeration value="CYC3"/>
<xs:enumeration value="PPM1"/>
<xs:enumeration value="PPM2"/>
<xs:enumeration value="PPM3"/>
<xs:enumeration value="PPM4"/>
<xs:enumeration value="PPM5"/>
<xs:enumeration value="PPM6"/>
<xs:enumeration value="PPM7"/>
<xs:enumeration value="PPM8"/>
<xs:enumeration value="CH1"/>
<xs:enumeration value="CH2"/>
<xs:enumeration value="CH3"/>
<xs:enumeration value="CH4"/>
<xs:enumeration value="CH5"/>
<xs:enumeration value="CH6"/>
<xs:enumeration value="CH7"/>
<xs:enumeration value="CH8"/>
<xs:enumeration value="CH9"/>
<xs:enumeration value="CH10"/>
<xs:enumeration value="CH11"/>
<xs:enumeration value="CH12"/>
<xs:enumeration value="CH13"/>
<xs:enumeration value="CH14"/>
<xs:enumeration value="CH15"/>
<xs:enumeration value="CH16"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Output">
<xs:restriction base="xs:string">
<xs:enumeration value="CH1"/>
<xs:enumeration value="CH2"/>
<xs:enumeration value="CH3"/>
<xs:enumeration value="CH4"/>
<xs:enumeration value="CH5"/>
<xs:enumeration value="CH6"/>
<xs:enumeration value="CH7"/>
<xs:enumeration value="CH8"/>
<xs:enumeration value="CH9"/>
<xs:enumeration value="CH10"/>
<xs:enumeration value="CH11"/>
<xs:enumeration value="CH12"/>
<xs:enumeration value="CH13"/>
<xs:enumeration value="CH14"/>
<xs:enumeration value="CH15"/>
<xs:enumeration value="CH16"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Stick">
<xs:restriction base="xs:string">
<xs:enumeration value="rudder"/>
<xs:enumeration value="aileron"/>
<xs:enumeration value="elevator"/>
<xs:enumeration value="throttle"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Weight100">
<xs:restriction base="xs:int">
<xs:minInclusive value="-100"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Weight125">
<xs:restriction base="xs:int">
<xs:minInclusive value="-125"/>
<xs:maxInclusive value="125"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TrimValue">
<xs:restriction base="xs:int">
<xs:minInclusive value="-1024"/>
<xs:maxInclusive value="+1024"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="TrimType">
<xs:attribute name="phaseRef" type="xs:int"/>
<!-- TODO either phaseRef or value -->
<xs:attribute name="value" type="TrimValue"/>
</xs:complexType>
<!-- TODO <xs:key name="phaseRef">
<xs:selector xpath="model/phases/phase"/>
<xs:field xpath="@id"/>
</xs:key> -->
<xs:element name="radio">
<xs:complexType>
<xs:sequence>
<xs:element name="global-settings" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="calibration" minOccurs="0">
<xs:complexType>
<xs:all>
<xs:element name="rudder" type="Calibration"/>
<xs:element name="throttle" type="Calibration"/>
<xs:element name="aileron" type="Calibration"/>
<xs:element name="elevator" type="Calibration"/>
<xs:element name="p1" type="Calibration"/>
<xs:element name="p2" type="Calibration"/>
<xs:element name="p3" type="Calibration"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="contrast" type="xs:unsignedByte" minOccurs="0"/>
<xs:element name="battery" minOccurs="0">
<xs:complexType>
<xs:attribute name="calibration" type="xs:unsignedByte" use="required"/>
<xs:attribute name="warning" type="xs:unsignedByte" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="light-switch" type="Switch" minOccurs="0"/>
<xs:element name="ppm-input-calibration" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="multiplier" type="xs:int"/>
<xs:element name="ch1" type="PPMCalibration"/>
<xs:element name="ch2" type="PPMCalibration"/>
<xs:element name="ch3" type="PPMCalibration"/>
<xs:element name="ch4" type="PPMCalibration"/>
<!-- <xs:element name="ch5" type="PPMCalibration"/>
<xs:element name="ch6" type="PPMCalibration"/>
<xs:element name="ch7" type="PPMCalibration"/>
<xs:element name="ch8" type="PPMCalibration"/> //-->
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="view" type="xs:unsignedByte" minOccurs="0"/>
<!-- switch -->
<xs:element name="beeper" type="xs:unsignedByte" minOccurs="0"/>
<!-- switch -->
<xs:element name="inactivity-timer" type="xs:byte" minOccurs="0"/>
<xs:element name="timer-beeps" minOccurs="0">
<xs:complexType>
<xs:attribute name="minute" type="xs:boolean"/>
<xs:attribute name="countdown" type="xs:boolean"/>
<xs:attribute name="screen-flash" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="splash-screen" type="xs:boolean" minOccurs="0"/>
<xs:element name="filter-input" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="single"/>
<xs:enumeration value="oversample"/>
<xs:enumeration value="filter"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="light-auto-off-timer" type="xs:unsignedByte" minOccurs="0"/>
<xs:element name="default-channel-order" type="xs:unsignedByte" minOccurs="0"/>
<xs:element name="PPM_Multiplier" type="xs:byte" minOccurs="0"/>
<xs:element name="owner-name" type="xs:string" minOccurs="0"/>
<xs:element name="sticks" minOccurs="0">
<xs:complexType>
<xs:attribute name="mode" type="xs:unsignedByte" use="required"/>
<xs:attribute name="throttle-reverse" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="warnings" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="warning" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" use="required" >
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="throttle"/>
<xs:enumeration value="switchs"/>
<xs:enumeration value="memory"/>
<xs:enumeration value="silent"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="value" type="xs:boolean" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="models" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="model" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:normalizedString"/>
<xs:element name="timer" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="mode" type="TimerSwitch" use="required"/>
<xs:attribute name="direction" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="down"/>
<xs:enumeration value="up"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="value" type="xs:time" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="modulation" minOccurs="0">
<xs:complexType>
<xs:attribute name="type">
<xs:simpleType>
<xs:restriction base="xs:string">
<!-- TODO accepter minuscules/majuscules -->
<xs:enumeration value="PPM"/>
<xs:enumeration value="PCM"/>
<xs:enumeration value="Silver A"/>
<xs:enumeration value="Silver B"/>
<xs:enumeration value="Silver C"/>
<xs:enumeration value="Trac 09"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="channels">
<xs:simpleType>
<xs:restriction base="xs:nonNegativeInteger">
<xs:maxExclusive value="17"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="delay" type="xs:nonNegativeInteger"/>
<xs:attribute name="polarity">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="positive"/>
<xs:enumeration value="negative"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="trims" minOccurs="0">
<xs:complexType>
<xs:attribute name="extended" type="xs:boolean"/>
<xs:attribute name="inc">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="exponential"/>
<xs:enumeration value="extra-fine"/>
<xs:enumeration value="fine"/>
<xs:enumeration value="medium"/>
<xs:enumeration value="coarse"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="throttleTrim" type="xs:boolean"/>
<xs:attribute name="throttleTrimExpo" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="centerBeep" minOccurs="0">
<xs:complexType>
<xs:attribute name="rudder" type="xs:boolean"/>
<xs:attribute name="elevator" type="xs:boolean"/>
<xs:attribute name="throttle" type="xs:boolean"/>
<xs:attribute name="aileron" type="xs:boolean"/>
<xs:attribute name="p1" type="xs:boolean"/>
<xs:attribute name="p2" type="xs:boolean"/>
<xs:attribute name="p3" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="heliSwashplate" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="invert">
<xs:complexType>
<xs:sequence>
<xs:element name="aileron" type="xs:boolean"/>
<xs:element name="collective" type="xs:boolean"/>
<xs:element name="elevator" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="type">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="off"/>
<xs:enumeration value="120"/>
<xs:enumeration value="120Xfine"/>
<xs:enumeration value="140"/>
<xs:enumeration value="90"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="source" type="Source"/>
<xs:attribute name="value" type="xs:int"/>
</xs:complexType>
</xs:element>
<xs:element name="phases" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="phase" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="trims">
<xs:complexType>
<xs:sequence>
<xs:element name="rudder" type="TrimType"/>
<xs:element name="elevator" type="TrimType"/>
<xs:element name="throttle" type="TrimType"/>
<xs:element name="aileron" type="TrimType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:int" use="required"/>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="switch" type="Switch"/>
<xs:attribute name="fadeIn" type="xs:int"/>
<xs:attribute name="fadeOut" type="xs:int"/>
</xs:complexType>
<xs:unique name="uniquePhaseId">
<xs:selector xpath="model/phases/phase"/>
<xs:field xpath="@id"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="outputs" minOccurs="0">
<!-- TODO pas de minOccurs -->
<xs:complexType>
<xs:sequence>
<xs:element name="curve" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="point">
<xs:complexType>
<xs:attribute name="x" type="Weight100"/>
<xs:attribute name="y" type="Weight100"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
<xs:unique name="uniqueCurveForEachModel">
<xs:selector xpath="model/outputs/curve"/>
<xs:field xpath="@id"/>
</xs:unique>
</xs:element>
<xs:element name="output" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="limit">
<xs:complexType>
<xs:attribute name="min" type="Weight100"/>
<xs:attribute name="max" type="Weight100"/>
</xs:complexType>
</xs:element>
<xs:element name="revert" type="xs:boolean"/>
<xs:element name="offset" type="Weight100"/>
<xs:element name="mixer" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="source" type="Source"/>
<xs:element name="weight" type="Weight125"/>
<xs:element name="offset" type="Weight125"/>
<xs:element name="switch" type="Switch"/>
<xs:element name="curve" type="xs:string"/>
<xs:element name="delay">
<xs:complexType>
<xs:attribute name="up" type="xs:int"/>
<xs:attribute name="down" type="xs:int"/>
</xs:complexType>
</xs:element>
<xs:element name="speed">
<xs:complexType>
<xs:attribute name="up" type="xs:int"/>
<xs:attribute name="down" type="xs:int"/>
</xs:complexType>
</xs:element>
<xs:element name="trim" type="xs:boolean"/>
<xs:element name="warning">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attribute name="method">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="add"/>
<xs:enumeration value="replace"/>
<xs:enumeration value="multiply"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:key name="curveKeyRef">
<xs:selector xpath="model/outputs/curve"/>
<xs:field xpath="@id"/>
</xs:key>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="Output"/>
</xs:complexType>
<xs:unique name="uniqueOutputForEachModel">
<xs:selector xpath="model/outputs/output"/>
<xs:field xpath="@id"/>
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="extendedLimits" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="inputs" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="input">
<xs:complexType>
<xs:sequence>
<xs:element name="switch">
<xs:complexType>
<xs:sequence>
<xs:element name="expo">
<xs:complexType>
<xs:attribute name="left" type="Weight100"/>
<xs:attribute name="right" type="Weight100"/>
</xs:complexType>
</xs:element>
<xs:element name="max">
<xs:complexType>
<xs:attribute name="left" type="Weight100"/>
<xs:attribute name="right" type="Weight100"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="value" type="Switch"/>
</xs:complexType>
</xs:element>
<xs:element name="trim" type="TrimValue"/>
</xs:sequence>
<xs:attribute name="id" type="Stick"/>
</xs:complexType>
<xs:unique name="uniqueInputForEachModel">
<xs:selector xpath="model/inputs/input"/>
<xs:field xpath="@id"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
-223
View File
@@ -1,223 +0,0 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <iostream>
#include <stdio.h> // TODO BSS remove
#include "xmlinterface.h"
#include "radio.hxx"
using namespace std;
XmlInterface::XmlInterface(QTextStream &stream):
stream(stream)
{
}
bool XmlInterface::load(RadioData &radioData)
{
try
{
// auto_ptr<radio> r ( radio());
//r->global_settings().ownerName("Bertrand");
/* for (hello_t::name_const_iterator i (h->name ().begin ());
i != h->name ().end ();
++i)
{
cerr << h->greeting () << ", " << *i << "!" << endl;
}
*/
return true;
}
catch (const xml_schema::exception& e)
{
cerr << e << endl;
return false;
}
}
bool XmlInterface::loadxml(RadioData &radioData, QDomDocument &doc)
{
return false;
}
void saveRadioSettings(GeneralSettings & settings, global_settings & gs)
{
Calibration rudderCalib(settings.calibMid[0], settings.calibSpanNeg[0], settings.calibSpanPos[0]);
Calibration throttleCalib(settings.calibMid[1], settings.calibSpanNeg[1], settings.calibSpanPos[1]);
Calibration aileronCalib(settings.calibMid[2], settings.calibSpanNeg[2], settings.calibSpanPos[2]);
Calibration elevatorCalib(settings.calibMid[3], settings.calibSpanNeg[3], settings.calibSpanPos[3]);
Calibration p1Calib(settings.calibMid[4], settings.calibSpanNeg[4], settings.calibSpanPos[4]);
Calibration p2Calib(settings.calibMid[5], settings.calibSpanNeg[5], settings.calibSpanPos[5]);
Calibration p3Calib(settings.calibMid[6], settings.calibSpanNeg[6], settings.calibSpanPos[6]);
gs.calibration(calibration(rudderCalib, throttleCalib, aileronCalib, elevatorCalib, p1Calib, p2Calib, p3Calib));
// TODO BSS settings.currModelIndex;
gs.contrast(settings.contrast);
gs.battery(battery(settings.txVoltageCalibration, settings.vBatWarn));
gs.ppm_input_calibration(ppm_input_calibration(settings.PPM_Multiplier,
PPMCalibration(settings.trainer.calib[0]),
PPMCalibration(settings.trainer.calib[1]),
PPMCalibration(settings.trainer.calib[2]),
PPMCalibration(settings.trainer.calib[3])));
gs.view(settings.view);
warnings warns;
warnings::warning_sequence & ws (warns.warning());
if (settings.disableThrottleWarning)
ws.push_back(warning("throttle", false));
/* TODO if (settings.disableSwitchWarning)
ws.push_back(warning("switchs", false)); */
if (settings.disableMemoryWarning)
ws.push_back(warning("memory", false));
if (settings.disableAlarmWarning)
ws.push_back(warning("silent", false));
if (!ws.empty())
gs.warnings(warns);
gs.beeper(settings.beeperMode);
sticks stks(settings.stickMode);
gs.sticks(stks);
gs.inactivity_timer(settings.inactivityTimer);
if (settings.minuteBeep || settings.preBeep || settings.flashBeep) {
timer_beeps tb;
if (settings.minuteBeep)
tb.minute(true);
if (settings.preBeep)
tb.countdown(true);
if (settings.flashBeep)
tb.screen_flash(true);
gs.timer_beeps(tb);
}
/* TODO if (settings.disableSplashScreen)
gs.splash_screen(false); */
/* TODO if (settings.backlightDelay)
gs.light_auto_off_timer(settings.lightAutoOff); */
gs.default_channel_order(settings.templateSetup);
if (strlen(settings.ownerName))
gs.owner_name(settings.ownerName);
}
void saveModel(ModelData & m, model & xm)
{
/* TODO
model::timer_sequence & timer_sequence (xm.timer());
for (int i=0; i<2; i++) {
TimerData & t = m.timers[i];
if (t.mode) {
timer xt(TimerSwitch::value(t.mode+TMR_NUM_OPTION), direction::value(t.dir), timer::value_type(t.val/3600, (t.val%3600)/60, t.val%60));
timer_sequence.push_back(xt);
}
}
*/
if (m.moduleData[0].protocol != PULSES_PPM || m.moduleData[0].channelsCount != 8 || m.moduleData[0].ppm.delay != 300 || m.moduleData[0].ppm.pulsePol != 0) {
modulation mod;
mod.type(modulation::type_type::value(m.moduleData[0].protocol));
mod.channels(m.moduleData[0].channelsCount);
mod.delay(m.moduleData[0].ppm.delay);
mod.polarity(modulation::polarity_type::value(m.moduleData[0].ppm.pulsePol));
xm.modulation(mod);
}
{
trims xtrims;
xtrims.extended(m.extendedTrims);
xtrims.throttleTrim(m.thrTrim);
xm.trims(xtrims);
}
if (m.beepANACenter) {
centerBeep xcb;
if (m.beepANACenter & (1 << 0)) xcb.rudder(true);
if (m.beepANACenter & (1 << 1)) xcb.elevator(true);
if (m.beepANACenter & (1 << 2)) xcb.throttle(true);
if (m.beepANACenter & (1 << 3)) xcb.aileron(true);
if (m.beepANACenter & (1 << 4)) xcb.p1(true);
if (m.beepANACenter & (1 << 5)) xcb.p2(true);
if (m.beepANACenter & (1 << 6)) xcb.p3(true);
xm.centerBeep(xcb);
}
phases xphases;
phases::phase_sequence & phases_sequence (xphases.phase());
for (int i=0; i<CPN_MAX_FLIGHT_MODES; i++) {
FlightModeData & p = m.flightModeData[i];
if (i == 0 || p.swtch.type!=Board::SWITCH_TYPE_NONE) {
TrimType xtrim[4];
for (int j=0; j<4; j++) {
if (m.flightModeData[i].trimRef[j] >= 0)
xtrim[j].phaseRef(m.flightModeData[i].trimRef[j]);
else
xtrim[j].value(m.flightModeData[i].trim[j]);
}
trims1 xtrims(xtrim[0], xtrim[1], xtrim[2], xtrim[3]);
phase xphase(xtrims, i);
if (p.fadeIn) xphase.fadeIn(p.fadeIn);
if (p.fadeOut) xphase.fadeOut(p.fadeOut);
phases_sequence.push_back(xphase);
}
}
xm.phases(xphases);
}
bool XmlInterface::save(RadioData &radioData)
{
GeneralSettings &settings = radioData.generalSettings;
try
{
xml_schema::namespace_infomap map;
map[""].name = "";
map[""].schema = "radio.xsd";
radio r;
// the general settings
global_settings gs;
saveRadioSettings(settings, gs);
r.global_settings(gs);
// the models
models xml_models;
models::model_sequence & model_sequence (xml_models.model());
for (int i=0; i<radioData.models.size(); i++) {
ModelData & m = radioData.models[i];
if (m.used) {
model xm(m.name);
saveModel(m, xm);
model_sequence.push_back(xm);
}
}
if (!model_sequence.empty())
r.models(xml_models);
std::stringstream ss;
radio_(ss, r, map);
stream << QString::fromStdString(ss.str());
return true;
}
catch (const xml_schema::exception& e)
{
cerr << e << endl;
return false;
}
}
-47
View File
@@ -1,47 +0,0 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _XMLINTERFACE_H_
#define _XMLINTERFACE_H_
#include "eeprominterface.h"
#include <QTextStream>
#include <QDomDocument>
class XmlInterface
{
public:
XmlInterface(QTextStream & stream);
bool load(RadioData &);
virtual bool loadxml(RadioData & radioData, QDomDocument & doc);
bool save(RadioData &radioData);
protected:
QTextStream & stream;
};
#endif // _XMLINTERFACE_H_