Bsongis/companion r9m fixes (#5914)

* Cosmetics

* First part ...

* First part ...

* Second part ...

* End?

* Handle new  R9M and R9M lite

* Display 'mini' module in case of R9M and xlite
This commit is contained in:
Bertrand Songis
2018-06-02 18:16:51 +02:00
committed by GitHub
parent 0e1a6bd60b
commit 806715e166
9 changed files with 536 additions and 67 deletions
+37 -7
View File
@@ -23,7 +23,6 @@
#include "ui_setup_timer.h"
#include "ui_setup_module.h"
#include "switchitemmodel.h"
#include "helpers.h"
#include "appdata.h"
#include "modelprinter.h"
#include "multiprotocols.h"
@@ -228,8 +227,11 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
// The protocols available on this board
for (int i=0; i<PULSES_PROTOCOL_LAST; i++) {
if (firmware->isAvailable((PulsesProtocol)i, moduleIdx)) {
ui->protocol->addItem(ModelPrinter::printModuleProtocol(i), (QVariant)i);
if (firmware->isAvailable((PulsesProtocol) i, moduleIdx)) {
if (IS_TARANIS_XLITE(firmware->getBoard()) && i == PULSES_PXX_R9M) //TODO remove when mini are handled as a different module type
ui->protocol->addItem("FrSky R9M Mini", (QVariant) i);
else
ui->protocol->addItem(ModelPrinter::printModuleProtocol(i), (QVariant) i);
if (i == module.protocol)
ui->protocol->setCurrentIndex(ui->protocol->count()-1);
}
@@ -476,9 +478,37 @@ void ModulePanel::update()
ui->antennaMode->setCurrentIndex(module.pxx.external_antenna);
// R9M options
ui->r9mPower->setVisible((mask & MASK_R9M) && module.subType == 0);
ui->label_r9mPower->setVisible((mask & MASK_R9M) && module.subType == 0);
ui->r9mPower->setVisible(mask & MASK_R9M);
ui->label_r9mPower->setVisible(mask & MASK_R9M);
ui->warning_r9mPower->setVisible((mask & MASK_R9M) && module.subType == R9M_LBT);
if (mask & MASK_R9M) {
ui->r9mPower->clear();
Board::Type board = firmware->getBoard();
if (IS_TARANIS_XLITE(board)) {
if (module.subType == R9M_FCC) {
ui->r9mPower->addItem(tr("100 mW - 16CH"));
}
else {
ui->r9mPower->addItem(tr("25 mW - 8CH"));
ui->r9mPower->addItem(tr("25 mW - 16CH"));
ui->r9mPower->addItem(tr("100 mW - 16CH, no telemetry"));
}
}
else {
if (module.subType == R9M_FCC) {
ui->r9mPower->addItem(tr("10 mW - 16CH"));
ui->r9mPower->addItem(tr("100 mW - 16CH"));
ui->r9mPower->addItem(tr("500 mW - 16CH"));
ui->r9mPower->addItem(tr("1000 mW - 16CH"));
}
else {
ui->r9mPower->addItem(tr("25 mW - 8CH"));
ui->r9mPower->addItem(tr("25 mW - 16CH"));
ui->r9mPower->addItem(tr("200 mW - 16CH"));
ui->r9mPower->addItem(tr("500 mW - 16CH"));
}
}
ui->r9mPower->setCurrentIndex(module.pxx.power);
}
@@ -508,8 +538,8 @@ void ModulePanel::update()
if (mask & MASK_MULTIMODULE) {
ui->multiProtocol->setCurrentIndex(module.multi.rfProtocol);
ui->autoBind->setChecked(module.multi.autoBindMode ? Qt::Checked : Qt::Unchecked);
ui->lowPower->setChecked(module.multi.lowPowerMode ? Qt::Checked : Qt::Unchecked);
ui->autoBind->setChecked(module.multi.autoBindMode);
ui->lowPower->setChecked(module.multi.lowPowerMode);
}
if (mask & MASK_MULTIOPTION) {
+439 -51
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>708</width>
<height>259</height>
<width>1042</width>
<height>315</height>
</rect>
</property>
<property name="windowTitle">
@@ -237,30 +237,9 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="r9mPower">
<item>
<property name="text">
<string>10 mW</string>
</property>
</item>
<item>
<property name="text">
<string>100 mW</string>
</property>
</item>
<item>
<property name="text">
<string>500 mW</string>
</property>
</item>
<item>
<property name="text">
<string>1000 mW</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="r9mPower"/>
</item>
<item row="4" column="0" colspan="2">
<item row="5" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="autoBind">
@@ -278,6 +257,428 @@
</item>
</layout>
</item>
<item row="4" column="1">
<widget class="QLabel" name="warning_r9mPower">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>63</green>
<blue>63</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>170</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>63</green>
<blue>63</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>170</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>63</green>
<blue>63</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>170</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>WARNING: changing RF Output Power needs RE-BIND</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
@@ -707,6 +1108,19 @@
</item>
</layout>
</item>
<item row="2" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3">
<widget class="QGroupBox" name="failsafesGroupBox">
<property name="styleSheet">
@@ -796,32 +1210,6 @@ QGroupBox::title { subcontrol-origin: margin; subcontrol-position: top left; pad
</layout>
</widget>
</item>
<item row="2" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3" rowspan="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>