1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Merged in mindnever/librepilot/LP-525-GCS_Hardware_pages_for_F3_boards (pull request #455)

Add GCS Hardware pages for F3 boards

Approved-by: Mateusz Kaduk <mateusz.kaduk@gmail.com>
Approved-by: Vladimir Zidar <mr_w@mindnever.org>
Approved-by: Lalanne Laurent <f5soh@free.fr>
Approved-by: Philippe Renon <philippe_renon@yahoo.fr>
This commit is contained in:
Vladimir Zidar 2017-11-27 10:39:13 +00:00 committed by Lalanne Laurent
commit 213893e298
17 changed files with 2747 additions and 992 deletions

View File

@ -221,7 +221,9 @@ void PIOS_Board_Init(void)
} }
#ifdef PIOS_INCLUDE_PPM #ifdef PIOS_INCLUDE_PPM
PIOS_BOARD_IO_Configure_PPM_RCVR(&pios_ppm_cfg); if (boardHwSettings.PPMPort == HWPIKOBLXSETTINGS_PPMPORT_ENABLED) {
PIOS_BOARD_IO_Configure_PPM_RCVR(&pios_ppm_cfg);
}
#endif #endif
#ifdef PIOS_INCLUDE_GCSRCVR #ifdef PIOS_INCLUDE_GCSRCVR

View File

@ -0,0 +1,171 @@
/**
******************************************************************************
*
* @file commonhwsettingswidget.cpp
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief Common 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 "commonhwsettingswidget.h"
#include "ui_commonhwsettingswidget.h"
#include "hwsettings.h"
#include <QDebug>
#include <extensionsystem/pluginmanager.h>
#include "uavobjectmanager.h"
CommonHWSettingsWidget::CommonHWSettingsWidget(QWidget *parent) : ConfigTaskWidget(parent, Child)
{
m_ui = new Ui_CommonHWSettingsWidget();
m_ui->setupUi(this);
m_ui->cbDSMxBind->addItem(tr("Disabled"), 0);
setFeatures(0);
// 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)));
// And these are here to handle conflicting VCP & HID options (such as USBTelemetry).
connect(m_ui->cbUSBHID, SIGNAL(currentIndexChanged(int)), this, SLOT(USBHIDComboChanged(int)));
connect(m_ui->cbUSBVCP, SIGNAL(currentIndexChanged(int)), this, SLOT(USBVCPComboChanged(int)));
}
CommonHWSettingsWidget::~CommonHWSettingsWidget()
{
delete m_ui;
}
void CommonHWSettingsWidget::registerWidgets(ConfigTaskWidget &ct)
{
ct.addWidgetBinding("HwSettings", "USB_HIDPort", m_ui->cbUSBHID);
ct.addWidgetBinding("HwSettings", "USB_VCPPort", m_ui->cbUSBVCP);
ct.addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbTelemetrySpeed);
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);
int option = HwSettings::GetInstance(getObjectManager())->getDSMxBind();
if (m_ui->cbDSMxBind->count() == 0) {
m_ui->cbDSMxBind->addItem(tr("None"), 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);
}
int index = m_ui->cbDSMxBind->findData(option);
if (index == -1) {
m_ui->cbDSMxBind->addItem(tr("%1 Pulses").arg(option), option);
m_ui->cbDSMxBind->setCurrentIndex(m_ui->cbDSMxBind->count() - 1);
} else {
m_ui->cbDSMxBind->setCurrentIndex(index);
}
}
void CommonHWSettingsWidget::setFeatures(quint32 features)
{
bool flag = features != 0;
setVisible(flag);
flag = (features & F_USB) != 0;
m_ui->lbUSBHID->setVisible(flag);
m_ui->cbUSBHID->setVisible(flag);
m_ui->lbUSBVCP->setVisible(flag);
m_ui->cbUSBVCP->setVisible(flag);
flag = (features & F_SBUS) != 0;
m_ui->lbSBUSMode->setVisible(flag);
m_ui->cbSBUSMode->setVisible(flag);
flag = (features & F_DSM) != 0;
m_ui->lbDSMxBind->setVisible(flag);
m_ui->cbDSMxBind->setVisible(flag);
flag = (features & F_TELEMETRY) != 0;
m_ui->lbTelemetrySpeed->setVisible(flag);
m_ui->cbTelemetrySpeed->setVisible(flag);
flag = (features & F_DEBUGCONSOLE) != 0;
m_ui->lbDebugConsoleSpeed->setVisible(flag);
m_ui->cbDebugConsoleSpeed->setVisible(flag);
flag = (features & F_GPS) != 0;
m_ui->lbGPSSpeed->setVisible(flag);
m_ui->cbGPSSpeed->setVisible(flag);
m_ui->lbGPSProtocol->setVisible(flag);
m_ui->cbGPSProtocol->setVisible(flag);
}
QComboBox *CommonHWSettingsWidget::USBVCPComboBox()
{
return m_ui->cbUSBVCP;
}
bool CommonHWSettingsWidget::USBFunctionConflict()
{
return (getComboboxSelectedOption(m_ui->cbUSBHID) == HwSettings::USB_HIDPORT_USBTELEMETRY)
&& (getComboboxSelectedOption(m_ui->cbUSBVCP) == HwSettings::USB_VCPPORT_USBTELEMETRY);
}
void CommonHWSettingsWidget::USBHIDComboChanged(int index)
{
Q_UNUSED(index);
if (USBFunctionConflict()) {
setComboboxSelectedOption(m_ui->cbUSBVCP, HwSettings::USB_VCPPORT_DISABLED);
} else if (getComboboxSelectedOption(m_ui->cbUSBHID) != HwSettings::USB_HIDPORT_USBTELEMETRY) {
setComboboxSelectedOption(m_ui->cbUSBVCP, HwSettings::USB_VCPPORT_USBTELEMETRY);
}
}
void CommonHWSettingsWidget::USBVCPComboChanged(int index)
{
Q_UNUSED(index);
if (USBFunctionConflict()) {
setComboboxSelectedOption(m_ui->cbUSBHID, HwSettings::USB_HIDPORT_DISABLED);
} else if (getComboboxSelectedOption(m_ui->cbUSBVCP) != HwSettings::USB_VCPPORT_USBTELEMETRY) {
setComboboxSelectedOption(m_ui->cbUSBHID, HwSettings::USB_HIDPORT_USBTELEMETRY);
}
}

View File

@ -0,0 +1,69 @@
/**
******************************************************************************
*
* @file commonhwsettingswidget.h
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief Common 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 COMMONHWSETTINGSWIDGET_H
#define COMMONHWSETTINGSWIDGET_H
#include "../uavobjectwidgetutils/configtaskwidget.h"
class Ui_CommonHWSettingsWidget;
class CommonHWSettingsWidget : public ConfigTaskWidget {
Q_OBJECT
public:
static const quint32 F_USB = (1 << 0);
static const quint32 F_SBUS = (1 << 1);
static const quint32 F_DSM = (1 << 2);
static const quint32 F_TELEMETRY = (1 << 3);
static const quint32 F_DEBUGCONSOLE = (1 << 4);
static const quint32 F_GPS = (1 << 5);
CommonHWSettingsWidget(QWidget *parent = 0);
virtual ~CommonHWSettingsWidget();
void registerWidgets(ConfigTaskWidget &ct);
void refreshWidgetsValues(UAVObject *obj);
void setFeatures(quint32 features);
QComboBox *USBVCPComboBox();
signals:
void USBHIDFunctionChanged(int index);
void USBVCPFunctionChanged(int index);
private slots:
void USBHIDComboChanged(int index);
void USBVCPComboChanged(int index);
private:
Ui_CommonHWSettingsWidget *m_ui;
bool USBFunctionConflict();
};
#endif // COMMONHWSETTINGSWIDGET_H

View File

@ -0,0 +1,358 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CommonHWSettingsWidget</class>
<widget class="QWidget" name="CommonHWSettingsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>746</width>
<height>200</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_10">
<item row="4" column="0">
<spacer name="horizontalSpacer_10">
<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="3" rowspan="5" colspan="2">
<layout class="QGridLayout" name="gridLayout_2">
<property name="verticalSpacing">
<number>-1</number>
</property>
<item row="4" column="1">
<widget class="QComboBox" name="cbTelemetrySpeed">
<property name="enabled">
<bool>true</bool>
</property>
<property name="frame">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lbTelemetrySpeed">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Telemetry Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="cbGPSSpeed">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>250</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="cbDebugConsoleSpeed">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lbDebugConsoleSpeed">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>DebugConsole Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="lbGPSSpeed">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>GPS Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="lbGPSProtocol">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>GPS Protocol</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="cbGPSProtocol">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>150</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>180</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="1" rowspan="5" colspan="2">
<layout class="QGridLayout" name="gridLayout_3">
<property name="verticalSpacing">
<number>-1</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lbUSBHID">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>USB HID</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="cbUSBVCP">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="cbSBUSMode">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cbUSBHID">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbDSMxBind">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>DSMx Bind</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbUSBVCP">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>USB VCP</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lbSBUSMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SBus Mode</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="cbDSMxBind">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>250</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>150</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1">
<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>180</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="5">
<spacer name="horizontalSpacer_11">
<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="1" colspan="4">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QLabel" name="label">
<property name="text">
<string>Options</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -49,7 +49,10 @@ HEADERS += \
mixercurve.h \ mixercurve.h \
dblspindelegate.h \ dblspindelegate.h \
configrevohwwidget.h \ configrevohwwidget.h \
configspracingf3hwwidget.h \ configspracingf3evohwwidget.h \
configtinyfishhwwidget.h \
configpikoblxhwwidget.h \
commonhwsettingswidget.h \
calibration/calibrationutils.h \ calibration/calibrationutils.h \
calibration/wizardstate.h \ calibration/wizardstate.h \
calibration/wizardmodel.h \ calibration/wizardmodel.h \
@ -97,7 +100,10 @@ SOURCES += \
mixercurve.cpp \ mixercurve.cpp \
dblspindelegate.cpp \ dblspindelegate.cpp \
configrevohwwidget.cpp \ configrevohwwidget.cpp \
configspracingf3hwwidget.cpp \ configspracingf3evohwwidget.cpp \
configtinyfishhwwidget.cpp \
configpikoblxhwwidget.cpp \
commonhwsettingswidget.cpp \
calibration/calibrationutils.cpp \ calibration/calibrationutils.cpp \
calibration/wizardstate.cpp \ calibration/wizardstate.cpp \
calibration/wizardmodel.cpp \ calibration/wizardmodel.cpp \
@ -134,8 +140,11 @@ FORMS += \
txpid.ui \ txpid.ui \
mixercurve.ui \ mixercurve.ui \
configrevohwwidget.ui \ configrevohwwidget.ui \
configspracingf3hwwidget.ui \
autotune.ui \ autotune.ui \
configspracingf3evohwwidget.ui \
configtinyfishhwwidget.ui \
configpikoblxhwwidget.ui \
commonhwsettingswidget.ui \
oplink.ui \ oplink.ui \
configrevonanohwwidget.ui \ configrevonanohwwidget.ui \
configsparky2hwwidget.ui \ configsparky2hwwidget.ui \

View File

@ -42,7 +42,9 @@
#include "configrevowidget.h" #include "configrevowidget.h"
#include "configrevonanohwwidget.h" #include "configrevonanohwwidget.h"
#include "configsparky2hwwidget.h" #include "configsparky2hwwidget.h"
#include "configspracingf3hwwidget.h" #include "configspracingf3evohwwidget.h"
#include "configtinyfishhwwidget.h"
#include "configpikoblxhwwidget.h"
#include "defaultconfigwidget.h" #include "defaultconfigwidget.h"
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
@ -252,8 +254,7 @@ void ConfigGadgetWidget::onAutopilotConnect()
widget = new ConfigSparky2HWWidget(this); widget = new ConfigSparky2HWWidget(this);
widget->bind(); widget->bind();
stackWidget->replaceTab(ConfigGadgetWidget::Hardware, widget); stackWidget->replaceTab(ConfigGadgetWidget::Hardware, widget);
} else if ((board & 0xff00) == 0x1000) { } else if ((board & 0xff00) == 0x1000) { // F3 boards
// SPRacingF3
ConfigTaskWidget *widget; ConfigTaskWidget *widget;
widget = new ConfigRevoWidget(this); widget = new ConfigRevoWidget(this);
widget->bind(); widget->bind();
@ -261,15 +262,22 @@ void ConfigGadgetWidget::onAutopilotConnect()
widget = 0; widget = 0;
if (board == 0x1001) { switch (board) {
widget = new ConfigSPRacingF3HWWidget(this); case 0x1001:
} else if (board == 0x1002 || board == 0x1003) { // SpracingF3 EVO or NucleoF303RE // widget = new ConfigSPRacingF3HWWidget(this);
// widget = new ConfigSPRacingF3EVOHWWidget(this); break;
} else if (board == 0x1005) { case 0x1002:
// widget = new ConfigPikoBLXHWWidget(this); case 0x1003:
} else if (board == 0x1006) { widget = new ConfigSPRacingF3EVOHWWidget(this);
// widget = new ConfigTinyFISHHWWidget(this); break;
case 0x1005:
widget = new ConfigPikoBLXHWWidget(this);
break;
case 0x1006:
widget = new ConfigTinyFISHHWWidget(this);
break;
} }
if (widget) { if (widget) {
widget->bind(); widget->bind();
stackWidget->replaceTab(ConfigGadgetWidget::Hardware, widget); stackWidget->replaceTab(ConfigGadgetWidget::Hardware, widget);

View File

@ -0,0 +1,190 @@
/**
******************************************************************************
*
* @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);
addWidgetBinding("HwPikoBLXSettings", "PPMPort", m_ui->cbPPMPort);
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();
}

View 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

View File

@ -0,0 +1,673 @@
<?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="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>
<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="6" 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="5" column="0">
<widget class="QLabel" name="lblPPM">
<property name="text">
<string>PPM Port (pad)</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="cbPPMPort"/>
</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>

View File

@ -0,0 +1,190 @@
/**
******************************************************************************
*
* @file configspracingf3evohwwidget.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 SPRacingF3EVO 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 "configspracingf3evohwwidget.h"
#include "ui_configspracingf3evohwwidget.h"
#include "hwsettings.h"
#include <QDebug>
ConfigSPRacingF3EVOHWWidget::ConfigSPRacingF3EVOHWWidget(QWidget *parent) : ConfigTaskWidget(parent)
{
m_ui = new Ui_SPRacingF3EVOHWWidget();
m_ui->setupUi(this);
// must be done before auto binding !
setWikiURL("SPRacingF3EVO+Configuration");
addAutoBindings();
addUAVObject("HwSettings");
addUAVObject("HwSPRacingF3EVOSettings");
addWidgetBinding("HwSPRacingF3EVOSettings", "UARTPort", m_ui->cbUART1, 0, 1, true);
addWidgetBinding("HwSPRacingF3EVOSettings", "UARTPort", m_ui->cbUART2, 1, 1, true);
addWidgetBinding("HwSPRacingF3EVOSettings", "UARTPort", m_ui->cbUART3, 2, 1, true);
addWidgetBinding("HwSPRacingF3EVOSettings", "LEDPort", m_ui->cbLEDPort);
addWidgetBinding("HwSPRacingF3EVOSettings", "I2CPort", m_ui->cbI2C1);
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);
updateFeatures();
}
ConfigSPRacingF3EVOHWWidget::~ConfigSPRacingF3EVOHWWidget()
{
delete m_ui;
}
void ConfigSPRacingF3EVOHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
{
// is this needed? This is to force sane state
// UART1Changed(0);
// UART2Changed(0);
// UART3Changed(0);
m_ui->commonHWSettings->refreshWidgetsValues(obj);
}
void ConfigSPRacingF3EVOHWWidget::updateObjectsFromWidgetsImpl()
{
updateFeatures();
}
void ConfigSPRacingF3EVOHWWidget::updateFeatures()
{
quint32 features = CommonHWSettingsWidget::F_USB;
for (quint32 i = 0; i < HwSPRacingF3EVOSettings::UARTPORT_NUMELEM; ++i) {
switch (getComboboxSelectedOption(m_cbUART[i])) {
case HwSPRacingF3EVOSettings::UARTPORT_TELEMETRY:
features |= CommonHWSettingsWidget::F_TELEMETRY;
break;
case HwSPRacingF3EVOSettings::UARTPORT_DSM:
features |= CommonHWSettingsWidget::F_DSM;
break;
case HwSPRacingF3EVOSettings::UARTPORT_SBUS:
features |= CommonHWSettingsWidget::F_SBUS;
break;
case HwSPRacingF3EVOSettings::UARTPORT_GPS:
features |= CommonHWSettingsWidget::F_GPS;
break;
case HwSPRacingF3EVOSettings::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 ConfigSPRacingF3EVOHWWidget::optionConflict(int uartOption, int vcpOption)
{
return (vcpOption == HwSettings::USB_VCPPORT_DEBUGCONSOLE
&& uartOption == HwSPRacingF3EVOSettings::UARTPORT_DEBUGCONSOLE)
|| (vcpOption == HwSettings::USB_VCPPORT_MAVLINK
&& uartOption == HwSPRacingF3EVOSettings::UARTPORT_MAVLINK);
}
void ConfigSPRacingF3EVOHWWidget::UARTxChanged(int index)
{
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);
if (option == HwSPRacingF3EVOSettings::UARTPORT_HOTTSUMD) {
option = HwSPRacingF3EVOSettings::UARTPORT_HOTTSUMH;
}
if (option != HwSPRacingF3EVOSettings::UARTPORT_DISABLED && option != HwSPRacingF3EVOSettings::UARTPORT_DSM) {
for (quint32 i = 0; i < HwSPRacingF3EVOSettings::UARTPORT_NUMELEM; ++i) {
if (m_cbUART[i] == cbUARTx) {
continue;
}
int other = getComboboxSelectedOption(m_cbUART[i]);
if (other == HwSPRacingF3EVOSettings::UARTPORT_HOTTSUMD) {
other = HwSPRacingF3EVOSettings::UARTPORT_HOTTSUMH;
}
if (other == option) {
setComboboxSelectedOption(m_cbUART[i], HwSPRacingF3EVOSettings::UARTPORT_DISABLED);
}
}
QComboBox *cbUSBVCP = m_ui->commonHWSettings->USBVCPComboBox();
if (optionConflict(option, getComboboxSelectedOption(cbUSBVCP))) {
setComboboxSelectedOption(cbUSBVCP, HwSettings::USB_VCPPORT_DISABLED);
}
}
updateFeatures();
}
void ConfigSPRacingF3EVOHWWidget::USBVCPFunctionChanged(int index)
{
Q_UNUSED(index);
int vcpOption = getComboboxSelectedOption(m_ui->commonHWSettings->USBVCPComboBox());
for (quint32 i = 0; i < HwSPRacingF3EVOSettings::UARTPORT_NUMELEM; ++i) {
if (optionConflict(getComboboxSelectedOption(m_cbUART[i]), vcpOption)) {
setComboboxSelectedOption(m_cbUART[i], HwSPRacingF3EVOSettings::UARTPORT_DISABLED);
}
}
updateFeatures();
}

View File

@ -0,0 +1,66 @@
/**
******************************************************************************
*
* @file configspracingf3evohwwidget.h
* @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 SPRacingF3EVO 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 CONFIGSPRACINGF3EVOHWWIDGET_H
#define CONFIGSPRACINGF3EVOHWWIDGET_H
#include "../uavobjectwidgetutils/configtaskwidget.h"
#include "hwspracingf3evosettings.h"
class Ui_SPRacingF3EVOHWWidget;
class UAVObject;
class QWidget;
class ConfigSPRacingF3EVOHWWidget : public ConfigTaskWidget {
Q_OBJECT
public:
ConfigSPRacingF3EVOHWWidget(QWidget *parent = 0);
~ConfigSPRacingF3EVOHWWidget();
protected:
virtual void refreshWidgetsValuesImpl(UAVObject *obj);
virtual void updateObjectsFromWidgetsImpl();
private:
Ui_SPRacingF3EVOHWWidget *m_ui;
QComboBox *m_cbUART[HwSPRacingF3EVOSettings::UARTPORT_NUMELEM];
void updateFeatures();
bool optionConflict(int uartOption, int vcpOption);
private slots:
void UARTxChanged(int index);
void USBVCPFunctionChanged(int index);
};
#endif // CONFIGSPRACINGF3EVOHWWIDGET_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>SPRacingF3HWWidget</class> <class>SPRacingF3EVOHWWidget</class>
<widget class="QWidget" name="SPRacingF3HWWidget"> <widget class="QWidget" name="SPRacingF3EVOHWWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -139,22 +139,6 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>12</number> <number>12</number>
</property> </property>
<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="3" column="2"> <item row="3" column="2">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
@ -168,8 +152,8 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="0"> <item row="2" column="3">
<spacer name="horizontalSpacer_4"> <spacer name="horizontalSpacer_5">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -181,6 +165,22 @@
</property> </property>
</spacer> </spacer>
</item> </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"> <item row="0" column="2">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="sizePolicy"> <property name="sizePolicy">
@ -218,8 +218,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="3"> <item row="2" column="0">
<spacer name="horizontalSpacer_5"> <spacer name="horizontalSpacer_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -232,239 +232,8 @@
</spacer> </spacer>
</item> </item>
<item row="2" column="2"> <item row="2" column="2">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0"> <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0">
<item row="0" column="2"> <item row="2" column="1" colspan="5" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QLabel" name="lbUART3">
<property name="text">
<string>UART3
(bottom)</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="0" column="6">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>120</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="4">
<widget class="QComboBox" name="cbUART2"/>
</item>
<item row="0" column="4">
<widget class="QLabel" name="lbUART2">
<property name="text">
<string>UART2</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="cbUART3"/>
</item>
<item row="2" column="6">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QComboBox" name="cbUART1"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lbUART1">
<property name="text">
<string>UART1
(bottom)</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="5">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>120</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="2">
<widget class="QComboBox" name="cbI2C1"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lbI2C1">
<property name="text">
<string>I2C1
(bottom)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>90</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<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="3" column="6">
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QComboBox" name="cbSonar"/>
</item>
<item row="2" column="0">
<widget class="QComboBox" name="cbADC1"/>
</item>
<item row="3" column="0">
<widget class="QComboBox" name="cbADC2"/>
</item>
<item row="0" column="0">
<widget class="QComboBox" name="cbIO2"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lbIO2">
<property name="text">
<string>IO-2</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lbSonar">
<property name="text">
<string>Sonar</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="lbADC2">
<property name="text">
<string>ADC2</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lbADC1">
<property name="text">
<string>ADC1</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" 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>10</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="1" rowspan="3" colspan="5" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QLabel" name="lbBoardImage"> <widget class="QLabel" name="lbBoardImage">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -482,7 +251,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="configgadget.qrc">:/configgadget/images/spracingf3_top.png</pixmap> <pixmap resource="configgadget.qrc">:/configgadget/images/spracingf3evo_top.png</pixmap>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>false</bool> <bool>false</bool>
@ -495,271 +264,163 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="0" column="3">
<layout class="QGridLayout" name="gridLayout_6"> <spacer name="horizontalSpacer_2">
<item row="0" column="1"> <property name="orientation">
<widget class="QComboBox" name="cbIO1"/> <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="2" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QComboBox" name="cbUART3"/>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="lbIO1"> <spacer name="verticalSpacer_3">
<property name="text">
<string>IO-1</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="cbLEDPort"/>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Maximum</enum> <enum>QSizePolicy::Fixed</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>50</height> <height>75</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="3" column="0">
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="2" 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>
</layout>
</item>
<item row="4" column="0">
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="1">
<widget class="QComboBox" name="cbADC3"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbADC3">
<property name="text">
<string>VBAT</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<spacer name="verticalSpacer_5"> <widget class="QLabel" name="lbUART3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>70</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="6">
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="1">
<widget class="QLabel" name="lbBuzzer">
<property name="text"> <property name="text">
<string>Buzzer</string> <string>UART3
</property> (headers)</string>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QComboBox" name="cbBuzzer"/>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>70</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="7" column="0" colspan="7">
<layout class="QGridLayout" name="gridLayout_10">
<item row="3" column="6">
<spacer name="horizontalSpacer_11">
<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="3" column="4">
<widget class="QLabel" name="lbSBUSInverted">
<property name="text">
<string>SBUS Inverted</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="lbGPSProtocol">
<property name="text">
<string>GPS Protocol</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QComboBox" name="comboBox"/>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="cbTelemetrySpeed"/>
</item>
<item row="4" column="1">
<widget class="QLabel" name="lbGPSSpeed">
<property name="text">
<string>GPS Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lbTelemetrySpeed">
<property name="text">
<string>Telemetry Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QComboBox" name="cbGPSSpeed"/>
</item>
<item row="3" column="0">
<spacer name="horizontalSpacer_10">
<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="5" column="1">
<widget class="QLabel" name="lbDebugConsoleSpeed">
<property name="text">
<string>DebugConsole Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="cbGPSProtocol"/>
</item>
<item row="2" column="4">
<widget class="QLabel" name="lbDSMBind">
<property name="text">
<string>DSMx Bind</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer_9">
<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="5">
<widget class="QComboBox" name="cbDSMxBind"/>
</item>
<item row="3" column="5">
<widget class="QComboBox" name="cbSBUSInverted"/>
</item>
<item row="1" column="1" colspan="5">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="1" colspan="5">
<widget class="QLabel" name="label">
<property name="text">
<string>Options</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" 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>
</layout> </layout>
</item> </item>
<item row="6" column="2"> <item row="4" column="0" colspan="7">
<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="6">
<layout class="QGridLayout" name="gridLayout_4">
<item row="3" column="0">
<widget class="QComboBox" name="cbLEDPort"/>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lbUART1">
<property name="text">
<string>UART1
(headers)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="cbUART1"/>
</item>
<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="2" column="0">
<spacer name="verticalSpacer_8">
<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>35</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QLabel" name="lbLEDPort">
<property name="text">
<string>IR/LED</string>
</property>
</widget>
</item>
<item row="4" 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>
<item row="3" column="0">
<spacer name="verticalSpacer_7"> <spacer name="verticalSpacer_7">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
@ -768,6 +429,39 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="1" colspan="2">
<widget class="QLabel" name="lbUART2">
<property name="text">
<string>UART2</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="0" column="4" colspan="2">
<widget class="QLabel" name="lbI2C1">
<property name="text">
<string>I2C1</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="cbUART2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="4" colspan="2">
<widget class="QComboBox" name="cbI2C1"/>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -981,6 +675,14 @@ Beware of not locking yourself out!</string>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>CommonHWSettingsWidget</class>
<extends>QWidget</extends>
<header>commonhwsettingswidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="../coreplugin/core.qrc"/> <include location="../coreplugin/core.qrc"/>
<include location="configgadget.qrc"/> <include location="configgadget.qrc"/>

View File

@ -1,467 +0,0 @@
/**
******************************************************************************
*
* @file configspracingf3hwwidget.cpp
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief SPRacingF3 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 "configspracingf3hwwidget.h"
#include "ui_configspracingf3hwwidget.h"
#include "hwsettings.h"
#include "hwspracingf3settings.h"
#include <QDebug>
ConfigSPRacingF3HWWidget::ConfigSPRacingF3HWWidget(QWidget *parent) : ConfigTaskWidget(parent)
{
m_ui = new Ui_SPRacingF3HWWidget();
m_ui->setupUi(this);
// must be done before auto binding !
setWikiURL("SPRacingF3+Configuration");
addAutoBindings();
addUAVObject("HwSettings");
// addWidgetBinding("HwSettings", "RM_FlexiPort", m_ui->cbFlexi);
// addWidgetBinding("HwSettings", "RM_MainPort", m_ui->cbMain);
// addWidgetBinding("HwSettings", "RM_RcvrPort", m_ui->cbRcvr);
//
// addWidgetBinding("HwSettings", "USB_HIDPort", m_ui->cbUSBHIDFunction);
// addWidgetBinding("HwSettings", "USB_VCPPort", m_ui->cbUSBVCPFunction);
//
// addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbFlexiTelemSpeed);
// addWidgetBinding("HwSettings", "GPSSpeed", m_ui->cbFlexiGPSSpeed);
//
// addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbMainTelemSpeed);
// addWidgetBinding("HwSettings", "GPSSpeed", m_ui->cbMainGPSSpeed);
//
// addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbRcvrTelemSpeed);
// addWidgetBinding("HwSettings", "GPSSpeed", m_ui->cbRcvrGPSSpeed);
//
//// Add Gps protocol configuration
// addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol);
// addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbFlexiGPSProtocol);
// addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbRcvrGPSProtocol);
setupCustomCombos();
}
ConfigSPRacingF3HWWidget::~ConfigSPRacingF3HWWidget()
{
// Do nothing
}
void ConfigSPRacingF3HWWidget::setupCustomCombos()
{
// connect(m_ui->cbUSBHIDFunction, SIGNAL(currentIndexChanged(int)), this, SLOT(usbHIDPortChanged(int)));
// connect(m_ui->cbUSBVCPFunction, SIGNAL(currentIndexChanged(int)), this, SLOT(usbVCPPortChanged(int)));
//
// m_ui->cbSonar->addItem(tr("Disabled"));
// m_ui->cbSonar->setCurrentIndex(0);
// m_ui->cbSonar->setEnabled(false);
//
// connect(m_ui->cbFlexi, SIGNAL(currentIndexChanged(int)), this, SLOT(flexiPortChanged(int)));
// connect(m_ui->cbMain, SIGNAL(currentIndexChanged(int)), this, SLOT(mainPortChanged(int)));
// connect(m_ui->cbRcvr, SIGNAL(currentIndexChanged(int)), this, SLOT(rcvrPortChanged(int)));
}
void ConfigSPRacingF3HWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
{
Q_UNUSED(obj);
// usbVCPPortChanged(0);
// mainPortChanged(0);
// flexiPortChanged(0);
// rcvrPortChanged(0);
}
void ConfigSPRacingF3HWWidget::updateObjectsFromWidgetsImpl()
{
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
// Otherwise disable GPS module.
// quint8 enableModule = HwSettings::OPTIONALMODULES_DISABLED;
//
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
// || isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
// enableModule = HwSettings::OPTIONALMODULES_ENABLED;
// }
//
// HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
// hwSettings->setOptionalModules(HwSettings::OPTIONALMODULES_GPS, enableModule);
}
void ConfigSPRacingF3HWWidget::usbVCPPortChanged(int index)
{
Q_UNUSED(index);
// bool vcpComBridgeEnabled = isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_COMBRIDGE);
//
// if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// enableComboBoxOptionItem(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE, vcpComBridgeEnabled);
//
// if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// enableComboBoxOptionItem(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE, vcpComBridgeEnabled);
//
// if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMCOMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
//
// enableComboBoxOptionItem(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE, vcpComBridgeEnabled);
// enableComboBoxOptionItem(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMCOMBRIDGE, vcpComBridgeEnabled);
//
//// _DEBUGCONSOLE modes are mutual exclusive
// if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DEBUGCONSOLE)) {
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMDEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// }
//
//// _USBTELEMETRY modes are mutual exclusive
// if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_USBTELEMETRY)
// && isComboboxOptionSelected(m_ui->cbUSBHIDFunction, HwSettings::USB_HIDPORT_USBTELEMETRY)) {
// setComboboxSelectedOption(m_ui->cbUSBHIDFunction, HwSettings::USB_HIDPORT_DISABLED);
// }
}
void ConfigSPRacingF3HWWidget::usbHIDPortChanged(int index)
{
Q_UNUSED(index);
//// _USBTELEMETRY modes are mutual exclusive
// if (isComboboxOptionSelected(m_ui->cbUSBHIDFunction, HwSettings::USB_HIDPORT_USBTELEMETRY)
// && isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_USBTELEMETRY)) {
// setComboboxSelectedOption(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DISABLED);
// }
}
// void ConfigSPRacingF3HWWidget::flexiPortChanged(int index)
// {
// Q_UNUSED(index);
//
// m_ui->cbFlexiTelemSpeed->setVisible(false);
// m_ui->cbFlexiGPSSpeed->setVisible(false);
// m_ui->lblFlexiSpeed->setVisible(true);
//
//// Add Gps protocol configuration
// m_ui->cbFlexiGPSProtocol->setVisible(false);
// m_ui->lbFlexiGPSProtocol->setVisible(false);
//
// switch (getComboboxSelectedOption(m_ui->cbFlexi)) {
// case HwSettings::RM_FLEXIPORT_TELEMETRY:
// m_ui->cbFlexiTelemSpeed->setVisible(true);
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_TELEMETRY)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMTELEMETRY)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_TELEMETRY)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// break;
// case HwSettings::RM_FLEXIPORT_GPS:
//// Add Gps protocol configuration
// m_ui->cbFlexiGPSProtocol->setVisible(true);
// m_ui->lbFlexiGPSProtocol->setVisible(true);
//
// m_ui->cbFlexiGPSSpeed->setVisible(true);
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMGPS)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_GPS)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
//
// break;
// case HwSettings::RM_FLEXIPORT_COMBRIDGE:
// m_ui->lblFlexiSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMCOMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// break;
// case HwSettings::RM_FLEXIPORT_DEBUGCONSOLE:
// m_ui->lblFlexiSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMDEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// break;
// case HwSettings::RM_FLEXIPORT_OSDHK:
// m_ui->lblFlexiSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_OSDHK)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// break;
// case HwSettings::RM_FLEXIPORT_MSP:
// m_ui->lblFlexiSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_MSP)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_MSP)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMMSP)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// break;
// case HwSettings::RM_FLEXIPORT_MAVLINK:
// m_ui->lblFlexiSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_MAVLINK)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_MAVLINK)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMMAVLINK)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// break;
// default:
// m_ui->lblFlexiSpeed->setVisible(false);
// break;
// }
// }
//
// void ConfigSPRacingF3HWWidget::mainPortChanged(int index)
// {
// Q_UNUSED(index);
//
// m_ui->cbMainTelemSpeed->setVisible(false);
// m_ui->cbMainGPSSpeed->setVisible(false);
// m_ui->lblMainSpeed->setVisible(true);
//
//// Add Gps protocol configuration
// m_ui->cbMainGPSProtocol->setVisible(false);
// m_ui->lbMainGPSProtocol->setVisible(false);
//
// switch (getComboboxSelectedOption(m_ui->cbMain)) {
// case HwSettings::RM_MAINPORT_TELEMETRY:
// m_ui->cbMainTelemSpeed->setVisible(true);
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_TELEMETRY)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMTELEMETRY)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_TELEMETRY)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// break;
// case HwSettings::RM_MAINPORT_GPS:
//// Add Gps protocol configuration
// m_ui->cbMainGPSProtocol->setVisible(true);
// m_ui->lbMainGPSProtocol->setVisible(true);
//
// m_ui->cbMainGPSSpeed->setVisible(true);
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMGPS)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_GPS)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// break;
// case HwSettings::RM_MAINPORT_COMBRIDGE:
// m_ui->lblMainSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMCOMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// break;
// case HwSettings::RM_MAINPORT_DEBUGCONSOLE:
// m_ui->lblMainSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMDEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// break;
// case HwSettings::RM_MAINPORT_OSDHK:
// m_ui->lblMainSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_OSDHK)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// break;
// case HwSettings::RM_MAINPORT_MSP:
// m_ui->lblMainSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_MSP)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_MSP)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMMSP)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// break;
// case HwSettings::RM_MAINPORT_MAVLINK:
// m_ui->lblMainSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_MAVLINK)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_MAVLINK)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMMAVLINK)) {
// setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPM);
// }
// break;
// default:
// m_ui->lblMainSpeed->setVisible(false);
// break;
// }
// }
//
// void ConfigSPRacingF3HWWidget::rcvrPortChanged(int index)
// {
// Q_UNUSED(index);
// m_ui->lblRcvrSpeed->setVisible(true);
// m_ui->cbRcvrTelemSpeed->setVisible(false);
// m_ui->cbRcvrGPSSpeed->setVisible(false);
//
//// Add Gps protocol configuration
// m_ui->cbRcvrGPSProtocol->setVisible(false);
// m_ui->lblRcvrGPSProtocol->setVisible(false);
//
// switch (getComboboxSelectedOption(m_ui->cbRcvr)) {
// case HwSettings::RM_RCVRPORT_TELEMETRY:
// case HwSettings::RM_RCVRPORT_PPMTELEMETRY:
// m_ui->cbRcvrTelemSpeed->setVisible(true);
//
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_TELEMETRY)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_TELEMETRY)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// break;
// case HwSettings::RM_RCVRPORT_COMBRIDGE:
// case HwSettings::RM_RCVRPORT_PPMCOMBRIDGE:
// m_ui->lblRcvrSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// break;
// case HwSettings::RM_RCVRPORT_DEBUGCONSOLE:
// case HwSettings::RM_RCVRPORT_PPMDEBUGCONSOLE:
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_DEBUGCONSOLE)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// break;
// case HwSettings::RM_RCVRPORT_GPS:
// case HwSettings::RM_RCVRPORT_PPMGPS:
//// Add Gps protocol configuration
// m_ui->cbRcvrGPSProtocol->setVisible(true);
// m_ui->lblRcvrGPSProtocol->setVisible(true);
//
// m_ui->cbRcvrGPSSpeed->setVisible(true);
//
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// break;
// case HwSettings::RM_RCVRPORT_MSP:
// case HwSettings::RM_RCVRPORT_PPMMSP:
// m_ui->lblRcvrSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_MSP)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_MSP)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// break;
// case HwSettings::RM_RCVRPORT_MAVLINK:
// case HwSettings::RM_RCVRPORT_PPMMAVLINK:
// m_ui->lblRcvrSpeed->setVisible(false);
// if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_MAVLINK)) {
// setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
// }
// if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_MAVLINK)) {
// setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
// }
// break;
// default:
// m_ui->lblRcvrSpeed->setVisible(false);
// break;
// }
// }

View File

@ -0,0 +1,154 @@
/**
******************************************************************************
*
* @file configtinyfishhwwidget.cpp
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief TinyFISH FC 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 "configtinyfishhwwidget.h"
#include "ui_configtinyfishhwwidget.h"
#include "hwsettings.h"
#include "hwtinyfishsettings.h"
#include <QDebug>
ConfigTinyFISHHWWidget::ConfigTinyFISHHWWidget(QWidget *parent) : ConfigTaskWidget(parent)
{
m_ui = new Ui_TinyFISHHWWidget();
m_ui->setupUi(this);
// must be done before auto binding !
setWikiURL("TinyFISH+Configuration");
addAutoBindings();
addUAVObject("HwSettings");
addUAVObject("HwTinyFISHSettings");
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::UARTxChanged);
m_ui->commonHWSettings->registerWidgets(*this);
connect(m_ui->commonHWSettings, &CommonHWSettingsWidget::USBVCPFunctionChanged, this, &ConfigTinyFISHHWWidget::USBVCPFunctionChanged);
updateFeatures();
}
ConfigTinyFISHHWWidget::~ConfigTinyFISHHWWidget()
{
delete m_ui;
}
void ConfigTinyFISHHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
{
// UART3Changed(0);
m_ui->commonHWSettings->refreshWidgetsValues(obj);
}
void ConfigTinyFISHHWWidget::updateObjectsFromWidgetsImpl()
{
updateFeatures();
}
void ConfigTinyFISHHWWidget::updateFeatures()
{
quint32 features = CommonHWSettingsWidget::F_USB;
switch (getComboboxSelectedOption(m_ui->cbUART3)) {
case HwTinyFISHSettings::UART3PORT_TELEMETRY:
features |= CommonHWSettingsWidget::F_TELEMETRY;
break;
case HwTinyFISHSettings::UART3PORT_DSM:
features |= CommonHWSettingsWidget::F_DSM;
break;
case HwTinyFISHSettings::UART3PORT_SBUS:
features |= CommonHWSettingsWidget::F_SBUS;
break;
case HwTinyFISHSettings::UART3PORT_GPS:
features |= CommonHWSettingsWidget::F_GPS;
break;
case HwTinyFISHSettings::UART3PORT_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 ConfigTinyFISHHWWidget::optionConflict(int uartOption, int vcpOption)
{
return (vcpOption == HwSettings::USB_VCPPORT_DEBUGCONSOLE
&& uartOption == HwTinyFISHSettings::UART3PORT_DEBUGCONSOLE)
|| (vcpOption == HwSettings::USB_VCPPORT_MAVLINK
&& uartOption == HwTinyFISHSettings::UART3PORT_MAVLINK);
}
void ConfigTinyFISHHWWidget::UARTxChanged(int index)
{
Q_UNUSED(index);
QComboBox *cbUARTx = qobject_cast<QComboBox *>(sender());
if (!cbUARTx) {
return;
}
int option = getComboboxSelectedOption(cbUARTx);
if (option != HwTinyFISHSettings::UART3PORT_DISABLED && option != HwTinyFISHSettings::UART3PORT_DSM) {
QComboBox *cbUSBVCP = m_ui->commonHWSettings->USBVCPComboBox();
if (optionConflict(option, getComboboxSelectedOption(cbUSBVCP))) {
setComboboxSelectedOption(cbUSBVCP, HwSettings::USB_VCPPORT_DISABLED);
}
}
updateFeatures();
}
void ConfigTinyFISHHWWidget::USBVCPFunctionChanged(int index)
{
Q_UNUSED(index);
int vcpOption = getComboboxSelectedOption(m_ui->commonHWSettings->USBVCPComboBox());
for (int i = 0; i < 3; ++i) {
if (optionConflict(getComboboxSelectedOption(m_ui->cbUART3), vcpOption)) {
setComboboxSelectedOption(m_ui->cbUART3, HwTinyFISHSettings::UART3PORT_DISABLED);
}
}
updateFeatures();
}

View File

@ -1,14 +1,13 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file configspracingf3hwwidget.h * @file configtinyfishhwwidget.h
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins * @addtogroup GCSPlugins GCS Plugins
* @{ * @{
* @addtogroup ConfigPlugin Config Plugin * @addtogroup ConfigPlugin Config Plugin
* @{ * @{
* @brief SPRacingF3 hardware configuration panel * @brief TinyFISH FC hardware configuration panel
*****************************************************************************/ *****************************************************************************/
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -25,36 +24,37 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef CONFIGSPRACINGF3HWWIDGET_H #ifndef CONFIGTINYFISHHWWIDGET_H
#define CONFIGSPRACINGF3HWWIDGET_H #define CONFIGTINYFISHHWWIDGET_H
#include "../uavobjectwidgetutils/configtaskwidget.h" #include "../uavobjectwidgetutils/configtaskwidget.h"
class Ui_SPRacingF3HWWidget; class Ui_TinyFISHHWWidget;
class UAVObject; class UAVObject;
class QWidget; class QWidget;
class ConfigSPRacingF3HWWidget : public ConfigTaskWidget { class ConfigTinyFISHHWWidget : public ConfigTaskWidget {
Q_OBJECT Q_OBJECT
public: public:
ConfigSPRacingF3HWWidget(QWidget *parent = 0); ConfigTinyFISHHWWidget(QWidget *parent = 0);
~ConfigSPRacingF3HWWidget(); ~ConfigTinyFISHHWWidget();
protected: protected:
virtual void refreshWidgetsValuesImpl(UAVObject *obj); virtual void refreshWidgetsValuesImpl(UAVObject *obj);
virtual void updateObjectsFromWidgetsImpl(); virtual void updateObjectsFromWidgetsImpl();
private: private:
Ui_SPRacingF3HWWidget *m_ui; Ui_TinyFISHHWWidget *m_ui;
void updateFeatures();
void setupCustomCombos(); bool optionConflict(int uartOption, int vcpOption);
private slots: private slots:
void usbVCPPortChanged(int index); void UARTxChanged(int index);
void usbHIDPortChanged(int index); void USBVCPFunctionChanged(int index);
}; };
#endif // CONFIGSPRACINGF3HWWIDGET_H #endif // CONFIGTINYFISHHWWIDGET_H

View File

@ -0,0 +1,565 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TinyFISHHWWidget</class>
<widget class="QWidget" name="TinyFISHHWWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>969</width>
<height>886</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>939</width>
<height>786</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">
<item row="0" column="3">
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="0">
<widget class="QComboBox" name="cbLEDPort"/>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lbUART3">
<property name="text">
<string>UART3</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="verticalSpacer_5">
<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>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::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>80</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QComboBox" name="cbUART3"/>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lbLEDPort">
<property name="text">
<string>IR/LED</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1" colspan="2" 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/tinyfish_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="0" column="0">
<layout class="QGridLayout" name="gridLayout_2"/>
</item>
<item row="1" column="0" colspan="4">
<widget class="CommonHWSettingsWidget" name="commonHWSettings" native="true">
<property name="minimumSize">
<size>
<width>20</width>
<height>80</height>
</size>
</property>
</widget>
</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>

View File

@ -1,9 +1,9 @@
<xml> <xml>
<object name="HwPikoBLXSettings" singleinstance="true" settings="true" category="System"> <object name="HwPikoBLXSettings" singleinstance="true" settings="true" category="System">
<description>Furious FPV Piko BLX Micro Flight Controller hardware configuration</description> <description>Furious FPV Piko BLX Micro Flight Controller hardware configuration</description>
<field name="UARTPort" units="function" type="enum" elements="3" options="Disabled,Telemetry,GPS,S.Bus,DSM,EX.Bus,HoTT SUMD,HoTT SUMH,SRXL,IBus,DebugConsole,ComBridge,MSP,MAVLink,HoTT Telemetry,FrskySensorHub" defaultvalue="Disabled"/> <field name="UARTPort" units="function" type="enum" elements="3" options="Disabled,Telemetry,GPS,S.Bus,DSM,EX.Bus,HoTT SUMD,HoTT SUMH,SRXL,IBus,DebugConsole,ComBridge,MSP,MAVLink,HoTT Telemetry,FrskySensorHub" defaultvalue="Disabled" limits=";;%EQ:Disabled:S.Bus:DSM:EX.Bus:HoTT SUMD:HoTT SUMH:SRXL:IBus"/>
<field name="LEDPort" units="function" type="enum" elements="1" options="Disabled,WS281x" defaultvalue="Disabled"/> <field name="LEDPort" units="function" type="enum" elements="1" options="Disabled,WS281x" defaultvalue="Disabled"/>
<field name="PPMPort" units="function" type="enum" elements="1" options="Disabled,Enabled" defaultvalue="Disabled"/>
<access gcs="readwrite" flight="readwrite"/> <access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/> <telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/> <telemetryflight acked="true" updatemode="onchange" period="0"/>