mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
LP-525 More work on hw pages. Added PikoBLX.
This commit is contained in:
parent
4df72a2f5f
commit
4f22425cc2
@ -25,19 +25,32 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "commonhwsettingswidget.h"
|
||||
|
||||
#include "ui_commonhwsettingswidget.h"
|
||||
#include "hwsettings.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include "uavobjectmanager.h"
|
||||
|
||||
|
||||
CommonHWSettingsWidget::CommonHWSettingsWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
m_ui = new Ui_CommonHWSettingsWidget();
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->cbDSMxBind->addItem(tr("Disabled"), 0);
|
||||
|
||||
m_ui->cbDSMxBind->addItem(tr("DSM2 1024bit/22ms"), 3);
|
||||
m_ui->cbDSMxBind->addItem(tr("DSM2 2048bit/11ms"), 5);
|
||||
m_ui->cbDSMxBind->addItem(tr("DSMX 1024bit/22ms"), 7);
|
||||
m_ui->cbDSMxBind->addItem(tr("DSMX 2048bit/22ms"), 8);
|
||||
m_ui->cbDSMxBind->addItem(tr("DSMX 2048bit/11ms"), 9);
|
||||
|
||||
m_ui->cbDSMxBind->setCurrentIndex(0);
|
||||
|
||||
setFeatures(0);
|
||||
|
||||
/* Relay signals from private members */
|
||||
// Relay signals from private members
|
||||
connect(m_ui->cbUSBHID, SIGNAL(currentIndexChanged(int)), this, SIGNAL(USBHIDFunctionChanged(int)));
|
||||
connect(m_ui->cbUSBVCP, SIGNAL(currentIndexChanged(int)), this, SIGNAL(USBVCPFunctionChanged(int)));
|
||||
}
|
||||
@ -49,10 +62,6 @@ CommonHWSettingsWidget::~CommonHWSettingsWidget()
|
||||
|
||||
void CommonHWSettingsWidget::registerWidgets(ConfigTaskWidget &ct)
|
||||
{
|
||||
// addAutoBindings();
|
||||
|
||||
// ct.addUAVObject("HwSettings");
|
||||
|
||||
ct.addWidgetBinding("HwSettings", "USB_HIDPort", m_ui->cbUSBHID);
|
||||
ct.addWidgetBinding("HwSettings", "USB_VCPPort", m_ui->cbUSBVCP);
|
||||
|
||||
@ -60,11 +69,25 @@ void CommonHWSettingsWidget::registerWidgets(ConfigTaskWidget &ct)
|
||||
ct.addWidgetBinding("HwSettings", "GPSSpeed", m_ui->cbGPSSpeed);
|
||||
ct.addWidgetBinding("HwSettings", "DebugConsoleSpeed", m_ui->cbDebugConsoleSpeed);
|
||||
ct.addWidgetBinding("HwSettings", "SBusMode", m_ui->cbSBUSMode);
|
||||
|
||||
ct.addWidgetBinding("HwSettings", "DSMxBind", m_ui->cbDSMxBind, 0, 1, true);
|
||||
|
||||
ct.addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbGPSProtocol);
|
||||
}
|
||||
|
||||
void CommonHWSettingsWidget::refreshWidgetsValues(UAVObject *obj)
|
||||
{
|
||||
Q_UNUSED(obj);
|
||||
|
||||
UAVObjectManager *objMngr = ExtensionSystem::PluginManager::instance()->getObject<UAVObjectManager>();
|
||||
|
||||
int option = HwSettings::GetInstance(objMngr)->getDSMxBind();
|
||||
|
||||
if(m_ui->cbDSMxBind->findData(option) == -1) {
|
||||
m_ui->cbDSMxBind->addItem(tr("%1 Pulses").arg(option), option);
|
||||
m_ui->cbDSMxBind->setCurrentIndex(-1);
|
||||
}
|
||||
}
|
||||
|
||||
void CommonHWSettingsWidget::setFeatures(quint32 features)
|
||||
{
|
||||
|
@ -46,7 +46,8 @@ public:
|
||||
virtual ~CommonHWSettingsWidget();
|
||||
|
||||
void registerWidgets(ConfigTaskWidget &ct);
|
||||
|
||||
void refreshWidgetsValues(UAVObject *obj);
|
||||
|
||||
void setFeatures(quint32 features);
|
||||
|
||||
QComboBox *USBVCPComboBox();
|
||||
|
@ -51,6 +51,7 @@ HEADERS += \
|
||||
configrevohwwidget.h \
|
||||
configspracingf3evohwwidget.h \
|
||||
configtinyfishhwwidget.h \
|
||||
configpikoblxhwwidget.h \
|
||||
commonhwsettingswidget.h \
|
||||
calibration/calibrationutils.h \
|
||||
calibration/wizardstate.h \
|
||||
@ -101,6 +102,7 @@ SOURCES += \
|
||||
configrevohwwidget.cpp \
|
||||
configspracingf3evohwwidget.cpp \
|
||||
configtinyfishhwwidget.cpp \
|
||||
configpikoblxhwwidget.cpp \
|
||||
commonhwsettingswidget.cpp \
|
||||
calibration/calibrationutils.cpp \
|
||||
calibration/wizardstate.cpp \
|
||||
@ -141,6 +143,7 @@ FORMS += \
|
||||
autotune.ui \
|
||||
configspracingf3evohwwidget.ui \
|
||||
configtinyfishhwwidget.ui \
|
||||
configpikoblxhwwidget.ui \
|
||||
commonhwsettingswidget.ui \
|
||||
oplink.ui \
|
||||
configrevonanohwwidget.ui \
|
||||
|
191
ground/gcs/src/plugins/config/configpikoblxhwwidget.cpp
Normal file
191
ground/gcs/src/plugins/config/configpikoblxhwwidget.cpp
Normal file
@ -0,0 +1,191 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configpikoblxhwwidget.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016-2017.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
* @{
|
||||
* @brief PikoBLX hardware configuration panel
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "configpikoblxhwwidget.h"
|
||||
|
||||
#include "ui_configpikoblxhwwidget.h"
|
||||
|
||||
#include "hwsettings.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
ConfigPikoBLXHWWidget::ConfigPikoBLXHWWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
{
|
||||
m_ui = new Ui_PikoBLXHWWidget();
|
||||
m_ui->setupUi(this);
|
||||
|
||||
// must be done before auto binding !
|
||||
setWikiURL("PikoBLX+Configuration");
|
||||
|
||||
addAutoBindings();
|
||||
|
||||
addUAVObject("HwSettings");
|
||||
addUAVObject("HwPikoBLXSettings");
|
||||
|
||||
addWidgetBinding("HwPikoBLXSettings", "UARTPort", m_ui->cbUART1, 0, 1, true);
|
||||
addWidgetBinding("HwPikoBLXSettings", "UARTPort", m_ui->cbUART2, 1, 1, true);
|
||||
addWidgetBinding("HwPikoBLXSettings", "UARTPort", m_ui->cbUART3, 2, 1, true);
|
||||
addWidgetBinding("HwPikoBLXSettings", "LEDPort", m_ui->cbLEDPort);
|
||||
|
||||
m_cbUART[0] = m_ui->cbUART1;
|
||||
m_cbUART[1] = m_ui->cbUART2;
|
||||
m_cbUART[2] = m_ui->cbUART3;
|
||||
|
||||
for(quint32 i = 0; i < HwPikoBLXSettings::UARTPORT_NUMELEM; ++i) {
|
||||
connect(m_cbUART[i], static_cast<void(QComboBox::*) (int)>(&QComboBox::currentIndexChanged), this, &ConfigPikoBLXHWWidget::UARTxChanged);
|
||||
}
|
||||
|
||||
m_ui->commonHWSettings->registerWidgets(*this);
|
||||
|
||||
connect(m_ui->commonHWSettings, &CommonHWSettingsWidget::USBVCPFunctionChanged, this, &ConfigPikoBLXHWWidget::USBVCPFunctionChanged);
|
||||
|
||||
updateFeatures();
|
||||
}
|
||||
|
||||
ConfigPikoBLXHWWidget::~ConfigPikoBLXHWWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ConfigPikoBLXHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
|
||||
{
|
||||
// is this needed? This is to force sane state
|
||||
// UART1Changed(0);
|
||||
// UART2Changed(0);
|
||||
// UART3Changed(0);
|
||||
|
||||
m_ui->commonHWSettings->refreshWidgetsValues(obj);
|
||||
}
|
||||
|
||||
void ConfigPikoBLXHWWidget::updateObjectsFromWidgetsImpl()
|
||||
{
|
||||
updateFeatures();
|
||||
}
|
||||
|
||||
void ConfigPikoBLXHWWidget::updateFeatures()
|
||||
{
|
||||
quint32 features = CommonHWSettingsWidget::F_USB;
|
||||
|
||||
for(quint32 i = 0; i < HwPikoBLXSettings::UARTPORT_NUMELEM; ++i) {
|
||||
switch (getComboboxSelectedOption(m_cbUART[i])) {
|
||||
case HwPikoBLXSettings::UARTPORT_TELEMETRY:
|
||||
features |= CommonHWSettingsWidget::F_TELEMETRY;
|
||||
break;
|
||||
case HwPikoBLXSettings::UARTPORT_DSM:
|
||||
features |= CommonHWSettingsWidget::F_DSM;
|
||||
break;
|
||||
case HwPikoBLXSettings::UARTPORT_SBUS:
|
||||
features |= CommonHWSettingsWidget::F_SBUS;
|
||||
break;
|
||||
case HwPikoBLXSettings::UARTPORT_GPS:
|
||||
features |= CommonHWSettingsWidget::F_GPS;
|
||||
break;
|
||||
case HwPikoBLXSettings::UARTPORT_DEBUGCONSOLE:
|
||||
features |= CommonHWSettingsWidget::F_DEBUGCONSOLE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_ui->commonHWSettings->setFeatures(features);
|
||||
|
||||
HwSettings::GetInstance(getObjectManager())
|
||||
->setOptionalModules(HwSettings::OPTIONALMODULES_GPS,
|
||||
(features & CommonHWSettingsWidget::F_GPS)
|
||||
? HwSettings::OPTIONALMODULES_ENABLED : HwSettings::OPTIONALMODULES_DISABLED);
|
||||
}
|
||||
|
||||
bool ConfigPikoBLXHWWidget::optionConflict(int uartOption, int vcpOption)
|
||||
{
|
||||
return (vcpOption == HwSettings::USB_VCPPORT_DEBUGCONSOLE
|
||||
&& uartOption == HwPikoBLXSettings::UARTPORT_DEBUGCONSOLE)
|
||||
|| (vcpOption == HwSettings::USB_VCPPORT_MAVLINK
|
||||
&& uartOption == HwPikoBLXSettings::UARTPORT_MAVLINK);
|
||||
}
|
||||
|
||||
void ConfigPikoBLXHWWidget::UARTxChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
||||
QComboBox *cbUARTx = qobject_cast<QComboBox *>(sender());
|
||||
|
||||
if(!cbUARTx) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Everything except HwPikoBLXSettings::UARTPORT_DISABLED and HwPikoBLXSettings::UARTPORT_DSM
|
||||
// is allowed on single port only.
|
||||
// HoTT SUMD & SUMH belong to the same receiver group, therefore cannot be configure at the same time
|
||||
//
|
||||
|
||||
int option = getComboboxSelectedOption(cbUARTx);
|
||||
|
||||
if (option == HwPikoBLXSettings::UARTPORT_HOTTSUMD) {
|
||||
option = HwPikoBLXSettings::UARTPORT_HOTTSUMH;
|
||||
}
|
||||
|
||||
if (option != HwPikoBLXSettings::UARTPORT_DISABLED && option != HwPikoBLXSettings::UARTPORT_DSM) {
|
||||
|
||||
for(quint32 i = 0; i < HwPikoBLXSettings::UARTPORT_NUMELEM; ++i) {
|
||||
if (m_cbUART[i] == cbUARTx) {
|
||||
continue;
|
||||
}
|
||||
int other = getComboboxSelectedOption(m_cbUART[i]);
|
||||
if (other == HwPikoBLXSettings::UARTPORT_HOTTSUMD) {
|
||||
other = HwPikoBLXSettings::UARTPORT_HOTTSUMH;
|
||||
}
|
||||
if (other == option) {
|
||||
setComboboxSelectedOption(m_cbUART[i], HwPikoBLXSettings::UARTPORT_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
QComboBox *cbUSBVCP = m_ui->commonHWSettings->USBVCPComboBox();
|
||||
|
||||
if (optionConflict(option, getComboboxSelectedOption(cbUSBVCP))) {
|
||||
setComboboxSelectedOption(cbUSBVCP, HwSettings::USB_VCPPORT_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
updateFeatures();
|
||||
}
|
||||
|
||||
void ConfigPikoBLXHWWidget::USBVCPFunctionChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
||||
int vcpOption = getComboboxSelectedOption(m_ui->commonHWSettings->USBVCPComboBox());
|
||||
|
||||
for(quint32 i = 0; i < HwPikoBLXSettings::UARTPORT_NUMELEM; ++i) {
|
||||
if (optionConflict(getComboboxSelectedOption(m_cbUART[i]), vcpOption)) {
|
||||
setComboboxSelectedOption(m_cbUART[i], HwPikoBLXSettings::UARTPORT_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
updateFeatures();
|
||||
}
|
||||
|
65
ground/gcs/src/plugins/config/configpikoblxhwwidget.h
Normal file
65
ground/gcs/src/plugins/config/configpikoblxhwwidget.h
Normal file
@ -0,0 +1,65 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configpikoblxhwwidget.h
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
* @{
|
||||
* @brief PikoBLX hardware configuration panel
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef CONFIGPIKOBLXHWWIDGET_H
|
||||
#define CONFIGPIKOBLXHWWIDGET_H
|
||||
|
||||
#include "../uavobjectwidgetutils/configtaskwidget.h"
|
||||
|
||||
#include "hwpikoblxsettings.h"
|
||||
|
||||
class Ui_PikoBLXHWWidget;
|
||||
|
||||
class UAVObject;
|
||||
|
||||
class QWidget;
|
||||
|
||||
class ConfigPikoBLXHWWidget : public ConfigTaskWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConfigPikoBLXHWWidget(QWidget *parent = 0);
|
||||
~ConfigPikoBLXHWWidget();
|
||||
|
||||
protected:
|
||||
virtual void refreshWidgetsValuesImpl(UAVObject *obj);
|
||||
virtual void updateObjectsFromWidgetsImpl();
|
||||
|
||||
private:
|
||||
Ui_PikoBLXHWWidget *m_ui;
|
||||
|
||||
QComboBox *m_cbUART[HwPikoBLXSettings::UARTPORT_NUMELEM];
|
||||
|
||||
void updateFeatures();
|
||||
|
||||
bool optionConflict(int uartOption, int vcpOption);
|
||||
|
||||
private slots:
|
||||
void UARTxChanged(int index);
|
||||
void USBVCPFunctionChanged(int index);
|
||||
};
|
||||
|
||||
#endif // CONFIGPIKOBLXHWWIDGET_H
|
663
ground/gcs/src/plugins/config/configpikoblxhwwidget.ui
Normal file
663
ground/gcs/src/plugins/config/configpikoblxhwwidget.ui
Normal file
@ -0,0 +1,663 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PikoBLXHWWidget</class>
|
||||
<widget class="QWidget" name="PikoBLXHWWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1680</width>
|
||||
<height>1050</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>HW settings</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<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="0">
|
||||
<red>232</red>
|
||||
<green>232</green>
|
||||
<blue>232</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<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="0">
|
||||
<red>232</red>
|
||||
<green>232</green>
|
||||
<blue>232</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="0">
|
||||
<red>232</red>
|
||||
<green>232</green>
|
||||
<blue>232</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="0">
|
||||
<red>232</red>
|
||||
<green>232</green>
|
||||
<blue>232</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border-color: rgb(255, 0, 0);</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1650</width>
|
||||
<height>950</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item row="3" column="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Changes on this page only take effect after board reset or power cycle</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0">
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="4" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
|
||||
<widget class="QLabel" name="lbBoardImage">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>350</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="configgadget.qrc">:/configgadget/images/pikoblx_top.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="cbUART3"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>115</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbUART3">
|
||||
<property name="text">
|
||||
<string>Receiver</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbLEDPort">
|
||||
<property name="text">
|
||||
<string>LED Strip</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cbLEDPort"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbUART2">
|
||||
<property name="text">
|
||||
<string>UART2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbUART1">
|
||||
<property name="text">
|
||||
<string>UART1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cbUART1"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="cbUART2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="6">
|
||||
<widget class="CommonHWSettingsWidget" name="commonHWSettings" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>369</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="helpButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Takes you to the wiki page</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../coreplugin/core.qrc">
|
||||
<normaloff>:/core/images/helpicon.svg</normaloff>:/core/images/helpicon.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<string notr="true">button:help</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="applyButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="0">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>232</red>
|
||||
<green>232</green>
|
||||
<blue>232</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="0">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>232</red>
|
||||
<green>232</green>
|
||||
<blue>232</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>232</red>
|
||||
<green>232</green>
|
||||
<blue>232</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>232</red>
|
||||
<green>232</green>
|
||||
<blue>232</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Send to board but don't write in SD.
|
||||
Beware of not locking yourself out!</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<string notr="true">button:apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Applies and Saves all settings to SD.
|
||||
Beware of not locking yourself out!</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<string notr="true">button:save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CommonHWSettingsWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>commonhwsettingswidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../coreplugin/core.qrc"/>
|
||||
<include location="configgadget.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -30,7 +30,6 @@
|
||||
#include "ui_configspracingf3evohwwidget.h"
|
||||
|
||||
#include "hwsettings.h"
|
||||
#include "hwspracingf3evosettings.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -52,11 +51,15 @@ ConfigSPRacingF3EVOHWWidget::ConfigSPRacingF3EVOHWWidget(QWidget *parent) : Conf
|
||||
addWidgetBinding("HwSPRacingF3EVOSettings", "UARTPort", m_ui->cbUART3, 2, 1, true);
|
||||
addWidgetBinding("HwSPRacingF3EVOSettings", "LEDPort", m_ui->cbLEDPort);
|
||||
addWidgetBinding("HwSPRacingF3EVOSettings", "I2CPort", m_ui->cbI2C1);
|
||||
|
||||
connect(m_ui->cbUART1, static_cast<void(QComboBox::*) (int)>(&QComboBox::currentIndexChanged), this, &ConfigSPRacingF3EVOHWWidget::UART1Changed);
|
||||
connect(m_ui->cbUART2, static_cast<void(QComboBox::*) (int)>(&QComboBox::currentIndexChanged), this, &ConfigSPRacingF3EVOHWWidget::UART2Changed);
|
||||
connect(m_ui->cbUART3, static_cast<void(QComboBox::*) (int)>(&QComboBox::currentIndexChanged), this, &ConfigSPRacingF3EVOHWWidget::UART3Changed);
|
||||
|
||||
|
||||
m_cbUART[0] = m_ui->cbUART1;
|
||||
m_cbUART[1] = m_ui->cbUART2;
|
||||
m_cbUART[2] = m_ui->cbUART3;
|
||||
|
||||
for(quint32 i = 0; i < HwSPRacingF3EVOSettings::UARTPORT_NUMELEM; ++i) {
|
||||
connect(m_cbUART[i], static_cast<void(QComboBox::*) (int)>(&QComboBox::currentIndexChanged), this, &ConfigSPRacingF3EVOHWWidget::UARTxChanged);
|
||||
}
|
||||
|
||||
m_ui->commonHWSettings->registerWidgets(*this);
|
||||
|
||||
connect(m_ui->commonHWSettings, &CommonHWSettingsWidget::USBVCPFunctionChanged, this, &ConfigSPRacingF3EVOHWWidget::USBVCPFunctionChanged);
|
||||
@ -66,16 +69,17 @@ ConfigSPRacingF3EVOHWWidget::ConfigSPRacingF3EVOHWWidget(QWidget *parent) : Conf
|
||||
|
||||
ConfigSPRacingF3EVOHWWidget::~ConfigSPRacingF3EVOHWWidget()
|
||||
{
|
||||
// Do nothing
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ConfigSPRacingF3EVOHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
|
||||
{
|
||||
Q_UNUSED(obj);
|
||||
|
||||
UART1Changed(0);
|
||||
UART2Changed(0);
|
||||
UART3Changed(0);
|
||||
// is this needed? This is to force sane state
|
||||
// UART1Changed(0);
|
||||
// UART2Changed(0);
|
||||
// UART3Changed(0);
|
||||
|
||||
m_ui->commonHWSettings->refreshWidgetsValues(obj);
|
||||
}
|
||||
|
||||
void ConfigSPRacingF3EVOHWWidget::updateObjectsFromWidgetsImpl()
|
||||
@ -87,10 +91,8 @@ void ConfigSPRacingF3EVOHWWidget::updateFeatures()
|
||||
{
|
||||
quint32 features = CommonHWSettingsWidget::F_USB;
|
||||
|
||||
QComboBox *ports[3] = { m_ui->cbUART1, m_ui->cbUART2, m_ui->cbUART3 };
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
switch (getComboboxSelectedOption(ports[i])) {
|
||||
for(quint32 i = 0; i < HwSPRacingF3EVOSettings::UARTPORT_NUMELEM; ++i) {
|
||||
switch (getComboboxSelectedOption(m_cbUART[i])) {
|
||||
case HwSPRacingF3EVOSettings::UARTPORT_TELEMETRY:
|
||||
features |= CommonHWSettingsWidget::F_TELEMETRY;
|
||||
break;
|
||||
@ -127,12 +129,20 @@ bool ConfigSPRacingF3EVOHWWidget::optionConflict(int uartOption, int vcpOption)
|
||||
&& uartOption == HwSPRacingF3EVOSettings::UARTPORT_MAVLINK);
|
||||
}
|
||||
|
||||
void ConfigSPRacingF3EVOHWWidget::UARTxChanged(QComboBox *cbUARTx)
|
||||
void ConfigSPRacingF3EVOHWWidget::UARTxChanged(int index)
|
||||
{
|
||||
/* Everything except HwSPRacingF3EVOSettings::UARTPORT_DISABLED and HwSPRacingF3EVOSettings::UARTPORT_DSM
|
||||
* is allowed on single port only.
|
||||
* HoTT SUMD & SUMH belong to the same receiver group, therefore cannot be configure at the same time
|
||||
*/
|
||||
Q_UNUSED(index);
|
||||
|
||||
QComboBox *cbUARTx = qobject_cast<QComboBox *>(sender());
|
||||
|
||||
if(!cbUARTx) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Everything except HwSPRacingF3EVOSettings::UARTPORT_DISABLED and HwSPRacingF3EVOSettings::UARTPORT_DSM
|
||||
// is allowed on single port only.
|
||||
// HoTT SUMD & SUMH belong to the same receiver group, therefore cannot be configure at the same time
|
||||
//
|
||||
|
||||
int option = getComboboxSelectedOption(cbUARTx);
|
||||
|
||||
@ -141,18 +151,17 @@ void ConfigSPRacingF3EVOHWWidget::UARTxChanged(QComboBox *cbUARTx)
|
||||
}
|
||||
|
||||
if (option != HwSPRacingF3EVOSettings::UARTPORT_DISABLED && option != HwSPRacingF3EVOSettings::UARTPORT_DSM) {
|
||||
QComboBox *ports[3] = { m_ui->cbUART1, m_ui->cbUART2, m_ui->cbUART3 };
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (ports[i] == cbUARTx) {
|
||||
for(quint32 i = 0; i < HwSPRacingF3EVOSettings::UARTPORT_NUMELEM; ++i) {
|
||||
if (m_cbUART[i] == cbUARTx) {
|
||||
continue;
|
||||
}
|
||||
int other = getComboboxSelectedOption(ports[i]);
|
||||
int other = getComboboxSelectedOption(m_cbUART[i]);
|
||||
if (other == HwSPRacingF3EVOSettings::UARTPORT_HOTTSUMD) {
|
||||
other = HwSPRacingF3EVOSettings::UARTPORT_HOTTSUMH;
|
||||
}
|
||||
if (other == option) {
|
||||
setComboboxSelectedOption(ports[i], HwSPRacingF3EVOSettings::UARTPORT_DISABLED);
|
||||
setComboboxSelectedOption(m_cbUART[i], HwSPRacingF3EVOSettings::UARTPORT_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,31 +181,12 @@ void ConfigSPRacingF3EVOHWWidget::USBVCPFunctionChanged(int index)
|
||||
|
||||
int vcpOption = getComboboxSelectedOption(m_ui->commonHWSettings->USBVCPComboBox());
|
||||
|
||||
QComboBox *ports[3] = { m_ui->cbUART1, m_ui->cbUART2, m_ui->cbUART3 };
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (optionConflict(getComboboxSelectedOption(ports[i]), vcpOption)) {
|
||||
setComboboxSelectedOption(ports[i], HwSPRacingF3EVOSettings::UARTPORT_DISABLED);
|
||||
for(quint32 i = 0; i < HwSPRacingF3EVOSettings::UARTPORT_NUMELEM; ++i) {
|
||||
if (optionConflict(getComboboxSelectedOption(m_cbUART[i]), vcpOption)) {
|
||||
setComboboxSelectedOption(m_cbUART[i], HwSPRacingF3EVOSettings::UARTPORT_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
updateFeatures();
|
||||
}
|
||||
|
||||
void ConfigSPRacingF3EVOHWWidget::UART1Changed(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
UARTxChanged(m_ui->cbUART1);
|
||||
}
|
||||
|
||||
void ConfigSPRacingF3EVOHWWidget::UART2Changed(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
UARTxChanged(m_ui->cbUART2);
|
||||
}
|
||||
|
||||
void ConfigSPRacingF3EVOHWWidget::UART3Changed(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
UARTxChanged(m_ui->cbUART3);
|
||||
}
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
#include "../uavobjectwidgetutils/configtaskwidget.h"
|
||||
|
||||
#include "hwspracingf3evosettings.h"
|
||||
|
||||
class Ui_SPRacingF3EVOHWWidget;
|
||||
|
||||
class UAVObject;
|
||||
@ -49,15 +51,15 @@ protected:
|
||||
|
||||
private:
|
||||
Ui_SPRacingF3EVOHWWidget *m_ui;
|
||||
void UARTxChanged(QComboBox *cbUARTx);
|
||||
|
||||
QComboBox *m_cbUART[HwSPRacingF3EVOSettings::UARTPORT_NUMELEM];
|
||||
|
||||
void updateFeatures();
|
||||
|
||||
bool optionConflict(int uartOption, int vcpOption);
|
||||
|
||||
private slots:
|
||||
void UART1Changed(int index);
|
||||
void UART2Changed(int index);
|
||||
void UART3Changed(int index);
|
||||
void UARTxChanged(int index);
|
||||
void USBVCPFunctionChanged(int index);
|
||||
};
|
||||
|
||||
|
@ -49,7 +49,7 @@ ConfigTinyFISHHWWidget::ConfigTinyFISHHWWidget(QWidget *parent) : ConfigTaskWidg
|
||||
addWidgetBinding("HwTinyFISHSettings", "UART3Port", m_ui->cbUART3, 0, 1, true);
|
||||
addWidgetBinding("HwTinyFISHSettings", "LEDPort", m_ui->cbLEDPort);
|
||||
|
||||
connect(m_ui->cbUART3, static_cast<void(QComboBox::*) (int)>(&QComboBox::currentIndexChanged), this, &ConfigTinyFISHHWWidget::UART3Changed);
|
||||
connect(m_ui->cbUART3, static_cast<void(QComboBox::*) (int)>(&QComboBox::currentIndexChanged), this, &ConfigTinyFISHHWWidget::UARTxChanged);
|
||||
|
||||
m_ui->commonHWSettings->registerWidgets(*this);
|
||||
|
||||
@ -60,14 +60,14 @@ ConfigTinyFISHHWWidget::ConfigTinyFISHHWWidget(QWidget *parent) : ConfigTaskWidg
|
||||
|
||||
ConfigTinyFISHHWWidget::~ConfigTinyFISHHWWidget()
|
||||
{
|
||||
// Do nothing
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ConfigTinyFISHHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
|
||||
{
|
||||
Q_UNUSED(obj);
|
||||
|
||||
UART3Changed(0);
|
||||
// UART3Changed(0);
|
||||
|
||||
m_ui->commonHWSettings->refreshWidgetsValues(obj);
|
||||
}
|
||||
|
||||
void ConfigTinyFISHHWWidget::updateObjectsFromWidgetsImpl()
|
||||
@ -115,12 +115,15 @@ bool ConfigTinyFISHHWWidget::optionConflict(int uartOption, int vcpOption)
|
||||
&& uartOption == HwTinyFISHSettings::UART3PORT_MAVLINK);
|
||||
}
|
||||
|
||||
void ConfigTinyFISHHWWidget::UARTxChanged(QComboBox *cbUARTx)
|
||||
void ConfigTinyFISHHWWidget::UARTxChanged(int index)
|
||||
{
|
||||
/* Everything except HwTinyFISHSettings::UARTPORT_DISABLED and HwTinyFISHSettings::UARTPORT_DSM
|
||||
* is allowed on single port only.
|
||||
* HoTT SUMD & SUMH belong to the same receiver group, therefore cannot be configure at the same time
|
||||
*/
|
||||
Q_UNUSED(index);
|
||||
|
||||
QComboBox *cbUARTx = qobject_cast<QComboBox *>(sender());
|
||||
|
||||
if(!cbUARTx) {
|
||||
return;
|
||||
}
|
||||
|
||||
int option = getComboboxSelectedOption(cbUARTx);
|
||||
|
||||
@ -149,9 +152,3 @@ void ConfigTinyFISHHWWidget::USBVCPFunctionChanged(int index)
|
||||
|
||||
updateFeatures();
|
||||
}
|
||||
|
||||
void ConfigTinyFISHHWWidget::UART3Changed(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
UARTxChanged(m_ui->cbUART3);
|
||||
}
|
||||
|
@ -48,13 +48,12 @@ protected:
|
||||
|
||||
private:
|
||||
Ui_TinyFISHHWWidget *m_ui;
|
||||
void UARTxChanged(QComboBox *cbUARTx);
|
||||
void updateFeatures();
|
||||
|
||||
bool optionConflict(int uartOption, int vcpOption);
|
||||
|
||||
private slots:
|
||||
void UART3Changed(int index);
|
||||
void UARTxChanged(int index);
|
||||
void USBVCPFunctionChanged(int index);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user