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

LP-525 [PikoBLX] Cleaned up HW configuration, added PPM Port (pad) combo. Verified GCS HW page.

This commit is contained in:
Vladimir Zidar 2017-10-23 22:52:21 +02:00
parent 4f22425cc2
commit 1b0ceaeed7
5 changed files with 86 additions and 74 deletions

View File

@ -223,7 +223,9 @@ void PIOS_Board_Init(void)
}
#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
#ifdef PIOS_INCLUDE_GCSRCVR

View File

@ -44,6 +44,7 @@
#include "configsparky2hwwidget.h"
#include "configspracingf3evohwwidget.h"
#include "configtinyfishhwwidget.h"
#include "configpikoblxhwwidget.h"
#include "defaultconfigwidget.h"
#include <extensionsystem/pluginmanager.h>
@ -270,7 +271,7 @@ void ConfigGadgetWidget::onAutopilotConnect()
widget = new ConfigSPRacingF3EVOHWWidget(this);
break;
case 0x1005:
// widget = new ConfigPikoBLXHWWidget(this);
widget = new ConfigPikoBLXHWWidget(this);
break;
case 0x1006:
widget = new ConfigTinyFISHHWWidget(this);

View File

@ -50,15 +50,16 @@ ConfigPikoBLXHWWidget::ConfigPikoBLXHWWidget(QWidget *parent) : ConfigTaskWidget
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) {
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);
@ -74,10 +75,10 @@ ConfigPikoBLXHWWidget::~ConfigPikoBLXHWWidget()
void ConfigPikoBLXHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
{
// is this needed? This is to force sane state
// UART1Changed(0);
// UART2Changed(0);
// UART3Changed(0);
// UART1Changed(0);
// UART2Changed(0);
// UART3Changed(0);
m_ui->commonHWSettings->refreshWidgetsValues(obj);
}
@ -88,9 +89,9 @@ void ConfigPikoBLXHWWidget::updateObjectsFromWidgetsImpl()
void ConfigPikoBLXHWWidget::updateFeatures()
{
quint32 features = CommonHWSettingsWidget::F_USB;
quint32 features = CommonHWSettingsWidget::F_USB;
for(quint32 i = 0; i < HwPikoBLXSettings::UARTPORT_NUMELEM; ++i) {
for (quint32 i = 0; i < HwPikoBLXSettings::UARTPORT_NUMELEM; ++i) {
switch (getComboboxSelectedOption(m_cbUART[i])) {
case HwPikoBLXSettings::UARTPORT_TELEMETRY:
features |= CommonHWSettingsWidget::F_TELEMETRY;
@ -131,13 +132,13 @@ bool ConfigPikoBLXHWWidget::optionConflict(int uartOption, int vcpOption)
void ConfigPikoBLXHWWidget::UARTxChanged(int index)
{
Q_UNUSED(index);
QComboBox *cbUARTx = qobject_cast<QComboBox *>(sender());
if(!cbUARTx) {
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
@ -150,8 +151,7 @@ void ConfigPikoBLXHWWidget::UARTxChanged(int index)
}
if (option != HwPikoBLXSettings::UARTPORT_DISABLED && option != HwPikoBLXSettings::UARTPORT_DSM) {
for(quint32 i = 0; i < HwPikoBLXSettings::UARTPORT_NUMELEM; ++i) {
for (quint32 i = 0; i < HwPikoBLXSettings::UARTPORT_NUMELEM; ++i) {
if (m_cbUART[i] == cbUARTx) {
continue;
}
@ -180,7 +180,7 @@ void ConfigPikoBLXHWWidget::USBVCPFunctionChanged(int index)
int vcpOption = getComboboxSelectedOption(m_ui->commonHWSettings->USBVCPComboBox());
for(quint32 i = 0; i < HwPikoBLXSettings::UARTPORT_NUMELEM; ++i) {
for (quint32 i = 0; i < HwPikoBLXSettings::UARTPORT_NUMELEM; ++i) {
if (optionConflict(getComboboxSelectedOption(m_cbUART[i]), vcpOption)) {
setComboboxSelectedOption(m_cbUART[i], HwPikoBLXSettings::UARTPORT_DISABLED);
}
@ -188,4 +188,3 @@ void ConfigPikoBLXHWWidget::USBVCPFunctionChanged(int index)
updateFeatures();
}

View File

@ -282,58 +282,6 @@
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="4" column="1">
<widget class="QComboBox" name="cbUART3"/>
</item>
<item row="0" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>115</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lbUART3">
<property name="text">
<string>Receiver</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbLEDPort">
<property name="text">
<string>LED Strip</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cbLEDPort"/>
</item>
@ -370,6 +318,68 @@
</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">

View File

@ -1,9 +1,9 @@
<xml>
<object name="HwPikoBLXSettings" singleinstance="true" settings="true" category="System">
<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="PPMPort" units="function" type="enum" elements="1" options="Disabled,Enabled" defaultvalue="Disabled"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/>