Re #2239: PPM output type added for 9XR-PRO (open drain or push-pull)

This commit is contained in:
Damjan Adamic
2015-05-04 20:35:29 +02:00
parent 1609b1236d
commit 60b2a378dd
20 changed files with 198 additions and 25 deletions
+1
View File
@@ -821,6 +821,7 @@ class ModuleData {
int failsafeChannels[C9X_NUM_CHNOUT];
int ppmDelay;
bool ppmPulsePol; // false = positive
bool ppmOutputType; // false = open drain, true = push pull
int ppmFrameLength;
void clear() { memset(this, 0, sizeof(ModuleData)); }
QString polarityToString() { return ppmPulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); }
@@ -2983,7 +2983,16 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new SignedField<16>(modelData.moduleData[module].failsafeChannels[i]));
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[module].ppmDelay, exportPpmDelay, importPpmDelay));
internalField.Append(new SignedField<8>(modelData.moduleData[module].ppmFrameLength));
internalField.Append(new BoolField<8>(modelData.moduleData[module].ppmPulsePol));
if (IS_9XRPRO(board)) {
internalField.Append(new BoolField<1>(modelData.moduleData[module].ppmPulsePol));
internalField.Append(new BoolField<1>(modelData.moduleData[module].ppmOutputType));
internalField.Append(new SpareBitsField<6>());
}
else {
internalField.Append(new BoolField<1>(modelData.moduleData[module].ppmPulsePol));
internalField.Append(new SpareBitsField<7>());
}
}
}
+13
View File
@@ -204,6 +204,7 @@ ModulePanel::~ModulePanel()
#define MASK_CHANNELS_RANGE 8
#define MASK_PPM_FIELDS 16
#define MASK_FAILSAFES 32
#define MASK_OPEN_DRAIN 64
void ModulePanel::update()
{
@@ -230,6 +231,9 @@ void ModulePanel::update()
break;
case PPM:
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT;
if (IS_9XRPRO(firmware->getBoard())) {
mask |= MASK_OPEN_DRAIN;
}
break;
case OFF:
default:
@@ -259,6 +263,9 @@ void ModulePanel::update()
ui->label_ppmPolarity->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmPolarity->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmPolarity->setCurrentIndex(module.ppmPulsePol);
ui->label_ppmOutputType->setVisible(mask & MASK_OPEN_DRAIN);
ui->ppmOutputType->setVisible(mask & MASK_OPEN_DRAIN);
ui->ppmOutputType->setCurrentIndex(module.ppmOutputType);
ui->label_ppmDelay->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmDelay->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmDelay->setValue(module.ppmDelay);
@@ -306,6 +313,12 @@ void ModulePanel::on_ppmPolarity_currentIndexChanged(int index)
emit modified();
}
void ModulePanel::on_ppmOutputType_currentIndexChanged(int index)
{
module.ppmOutputType = index;
emit modified();
}
void ModulePanel::on_channelsCount_editingFinished()
{
if (!lock) {
+1
View File
@@ -55,6 +55,7 @@ class ModulePanel : public ModelPanel
void on_channelsCount_editingFinished();
void on_channelsStart_editingFinished();
void on_ppmPolarity_currentIndexChanged(int index);
void on_ppmOutputType_currentIndexChanged(int index);
void on_ppmFrameLength_editingFinished();
void on_rxNumber_editingFinished();
void on_failsafeMode_currentIndexChanged(int value);
+23 -1
View File
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>692</width>
<width>737</width>
<height>300</height>
</rect>
</property>
@@ -545,6 +545,27 @@
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="label_ppmOutputType">
<property name="text">
<string>Output type</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QComboBox" name="ppmOutputType">
<item>
<property name="text">
<string>Open Drain</string>
</property>
</item>
<item>
<property name="text">
<string>Push Pull</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
@@ -559,6 +580,7 @@
<tabstop>ppmPolarity</tabstop>
<tabstop>ppmDelay</tabstop>
<tabstop>failsafeMode</tabstop>
<tabstop>ppmOutputType</tabstop>
<tabstop>rxNumber</tabstop>
</tabstops>
<resources/>