External antenna configuration: proposal for #4285 (#6656)

External antenna configuration
This commit is contained in:
Bertrand Songis
2019-09-06 11:26:18 +02:00
committed by GitHub
parent 5d2aefaefb
commit 6c530c6f7b
80 changed files with 1669 additions and 1253 deletions
+10 -16
View File
@@ -400,7 +400,7 @@ void ModulePanel::update()
else if (protocol==PULSES_ACCESS_ISRM || protocol==PULSES_ACCESS_R9M ||
protocol==PULSES_ACCESS_R9M_LITE || protocol==PULSES_ACCESS_R9M_LITE_PRO)
mask |= MASK_RX_NUMBER | MASK_ACCESS;
if ((IS_HORUS(board) || board == Board::BOARD_TARANIS_XLITE) && moduleIdx == 0)
if (moduleIdx == 0 && HAS_EXTERNAL_ANTENNA(board) && generalSettings.antennaMode == 0 /* per model */)
mask |= MASK_ANTENNA;
break;
case PULSES_LP45:
@@ -486,16 +486,18 @@ void ModulePanel::update()
ui->ppmFrameLength->setMaximum(firmware->getCapability(PPMFrameLength));
ui->ppmFrameLength->setValue(22.5+((double)module.ppm.frameLength)*0.5);
// Antenna selection on Horus and xlite
ui->label_antenna->setVisible(mask & MASK_ANTENNA);
ui->antennaMode->setVisible(mask & MASK_ANTENNA);
if IS_HORUS_X12S(board) {
ui->antennaMode->setItemText(1,tr("Ext. + Int"));
// Antenna mode on Horus and XLite
if (mask & MASK_ANTENNA) {
ui->antennaMode->clear();
ui->antennaMode->addItem(tr("Ask"), -1);
ui->antennaMode->addItem(tr("Internal"), 0);
ui->antennaMode->addItem(IS_HORUS_X12S(board) ? tr("Internal + External") : tr("External"), 1);
ui->antennaMode->setField(module.pxx.antennaMode, this);
}
else {
ui->antennaMode->setItemText(1,tr("External"));
ui->antennaLabel->hide();
ui->antennaMode->hide();
}
ui->antennaMode->setCurrentIndex(module.pxx.external_antenna);
// R9M options
ui->r9mPower->setVisible(mask & MASK_R9M);
@@ -642,14 +644,6 @@ void ModulePanel::on_ppmPolarity_currentIndexChanged(int index)
}
}
void ModulePanel::on_antennaMode_currentIndexChanged(int index)
{
if (!lock && module.pxx.external_antenna != (bool)index) {
module.pxx.external_antenna = index;
emit modified();
}
}
void ModulePanel::on_r9mPower_currentIndexChanged(int index)
{
if (!lock && module.pxx.power != (unsigned int)index) {
-1
View File
@@ -80,7 +80,6 @@ class ModulePanel : public ModelPanel
void on_ppmPolarity_currentIndexChanged(int index);
void on_ppmOutputType_currentIndexChanged(int index);
void on_ppmFrameLength_editingFinished();
void on_antennaMode_currentIndexChanged(int index);
void on_rxNumber_editingFinished();
void on_failsafeMode_currentIndexChanged(int value);
void onMultiProtocolChanged(int index);
+76 -79
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1042</width>
<height>375</height>
<width>1075</width>
<height>434</height>
</rect>
</property>
<property name="windowTitle">
@@ -252,7 +252,7 @@
<item row="4" column="1">
<layout class="QHBoxLayout" name="rx1Layout">
<property name="spacing">
<number>-1</number>
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
@@ -595,7 +595,7 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_antenna">
<widget class="QLabel" name="antennaLabel">
<property name="maximumSize">
<size>
<width>16777215</width>
@@ -611,7 +611,7 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="antennaMode">
<widget class="AutoComboBox" name="antennaMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -621,16 +621,6 @@
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<item>
<property name="text">
<string>Internal</string>
</property>
</item>
<item>
<property name="text">
<string>Ext. + Int.</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
@@ -732,6 +722,26 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="registrationIdLabel">
<property name="text">
<string>Registration ID</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="registrationId">
<property name="inputMask">
<string notr="true"/>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_multiProtocol">
<property name="text">
@@ -775,6 +785,50 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="warning_r9mFlex">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>198</red>
<green>17</green>
<blue>36</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>198</red>
<green>17</green>
<blue>36</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>106</red>
<green>104</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>WARNING: Requires non-certified firmware!</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_failsafeMode">
<property name="maximumSize">
@@ -883,70 +937,6 @@
</item>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="warning_r9mFlex">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>198</red>
<green>17</green>
<blue>36</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>198</red>
<green>17</green>
<blue>36</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>106</red>
<green>104</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>WARNING: Requires non-certified firmware!</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="registrationIdLabel">
<property name="text">
<string>Registration ID</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="registrationId">
<property name="inputMask">
<string notr="true"/>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
@@ -1069,6 +1059,13 @@ QGroupBox::title { subcontrol-origin: margin; subcontrol-position: top left; pad
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AutoComboBox</class>
<extends>QComboBox</extends>
<header>autocombobox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>protocol</tabstop>
<tabstop>channelsStart</tabstop>