From faaa60862f6c157ec061742e2f39f5851cae3999 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Mon, 1 May 2017 00:22:08 +0200 Subject: [PATCH 1/9] LP-505 Refactor OPlink tab GUI --- .../src/plugins/config/configoplinkwidget.cpp | 28 +- .../src/plugins/config/configoplinkwidget.h | 2 +- ground/gcs/src/plugins/config/oplink.ui | 2049 +++++++++-------- 3 files changed, 1065 insertions(+), 1014 deletions(-) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index 89d57c4d6..ad42e8264 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -113,8 +113,8 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren addWidgetBinding("OPLinkStatus", "TXPacketRate", m_oplink->TXPacketRate); addWidgetBinding("OPLinkStatus", "AFCCorrection", m_oplink->AFCCorrection); - // initially hide port combo boxes - setPortsVisible(false); + // initially hide Oplink Mini options + setOPLMOptionsVisible(false); // Connect the selection changed signals. connect(m_oplink->Protocol, SIGNAL(currentIndexChanged(int)), this, SLOT(protocolChanged())); @@ -189,10 +189,10 @@ void ConfigOPLinkWidget::updateStatus() switch (oplinkStatusObj->boardType()) { case 0x09: // Revolution, DiscoveryF4Bare, RevoNano, RevoProto case 0x92: // Sparky2 - setPortsVisible(false); + setOPLMOptionsVisible(false); break; case 0x03: // OPLinkMini - setPortsVisible(true); + setOPLMOptionsVisible(true); break; default: // This shouldn't happen. @@ -206,24 +206,10 @@ void ConfigOPLinkWidget::updateStatus() } } -void ConfigOPLinkWidget::setPortsVisible(bool visible) +void ConfigOPLinkWidget::setOPLMOptionsVisible(bool visible) { - m_oplink->UartsLabel->setVisible(visible); - m_oplink->MainPort->setVisible(visible); - m_oplink->MainPortLabel->setVisible(visible); - m_oplink->FlexiPort->setVisible(visible); - m_oplink->FlexiPortLabel->setVisible(visible); - m_oplink->ConnectionsLabel->setVisible(visible); - m_oplink->RadioPriStream->setVisible(visible); - m_oplink->RadioPriStreamLabel->setVisible(visible); - m_oplink->RadioAuxStream->setVisible(visible); - m_oplink->RadioAuxStreamLabel->setVisible(visible); - m_oplink->MainComSpeed->setVisible(visible); - m_oplink->MainComSpeedLabel->setVisible(visible); - m_oplink->FlexiComSpeed->setVisible(visible); - m_oplink->FlexiComSpeedLabel->setVisible(visible); - m_oplink->VCPBridge->setVisible(visible); - m_oplink->VCPBridgeLabel->setVisible(visible); + m_oplink->UartsGroupBox->setVisible(visible); + m_oplink->ConnectionsGroupBox->setVisible(visible); } void ConfigOPLinkWidget::updateInfo() diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.h b/ground/gcs/src/plugins/config/configoplinkwidget.h index 25e9a1b7c..f8b72d4cb 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.h +++ b/ground/gcs/src/plugins/config/configoplinkwidget.h @@ -62,7 +62,7 @@ private: void updateInfo(); void updateSettings(); - void setPortsVisible(bool visible); + void setOPLMOptionsVisible(bool visible); private slots: void connected(); diff --git a/ground/gcs/src/plugins/config/oplink.ui b/ground/gcs/src/plugins/config/oplink.ui index 0ce5929db..7616704e2 100644 --- a/ground/gcs/src/plugins/config/oplink.ui +++ b/ground/gcs/src/plugins/config/oplink.ui @@ -55,885 +55,12 @@ 0 0 - 926 - 647 + 936 + 754 - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - - 0 - 0 - - - - - 900 - 16777215 - - - - - 50 - false - - - - Configuration - - - - - - - 0 - 0 - - - - - 90 - 16777215 - - - - - 50 - false - - - - This is the coordinator ID we currently are bound to. -To manually bind to a specific coordinator, just type -or paste its device ID in this box and save. -The device must be rebooted for the binding to take place. - - - 8 - - - Qt::LogicalMoveStyle - - - false - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 90 - 16777215 - - - - - 50 - false - - - - Qt::StrongFocus - - - Enter your custom ID for this device as a hexadecimal value, -this allows device clones. Be sure only one device with this -ID transmits at the same time! -Leave blank to use autogenerated Device ID. - - - 8 - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - - Qt::LogicalMoveStyle - - - false - - - - - - - - 0 - 0 - - - - - 50 - true - - - - Serial Ports - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Main Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Choose a function for the main port. - - - - - - - - 50 - false - - - - Speed - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Choose the baud rate for the main com port. - - - - - - - - 50 - false - - - - Flexi Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Choose a function for the flexi port. - - - - - - - - 50 - false - - - - Speed - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Choose the baud rate for the main com port. - - - - - - - - 0 - 0 - - - - - 50 - true - - - - Connections - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Radio Primary - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Choose a destination for the primary radio stream. - - - - - - - - 50 - false - - - - Air Data Rate - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 90 - 16777215 - - - - Choose the over-the-air baud rate for the radio. - - - - - - - - 50 - false - - - - Radio Auxiliary - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Choose a destination for the auxiliary radio stream. - - - - - - - - 50 - false - - - - VCP Bridge - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Choose a destination for the Virtual Com Port bridge connection. - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 50 - false - - - - Max Chan - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Set the modem protocol - - - Qt::LeftToRight - - - 0 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - 50 - false - - - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - - - 250 - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - 440.000 (MHz) - - - - - - - - - Qt::NoFocus - - - Clear the binding/coordinator ID - - - Unbind - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 50 - false - - - - Min Chan - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Protocol - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Link Type - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - 50 - false - - - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - - - 250 - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - 430.000 (MHz) - - - - - - - - - - 50 - false - - - - Device ID - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Qt::LeftToRight - - - Coordinator ID - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Configure what type of packets will be sent over the link - - - Qt::LeftToRight - - - 0 - - - - - - - - 0 - 0 - - - - - 50 - false - - - - Max Power - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 90 - 16777215 - - - - Set the maximum TX output power the modem will use (mW) -0 to disable the modem. - - - Qt::LeftToRight - - - 0 - - - - - - - - 50 - false - - - - RF Band - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 90 - 16777215 - - - - Set the RF Band used. - - - Qt::LeftToRight - - - 0 - - - - - - - - - - - 0 - 0 - - - - - 150 - 16777215 - - - - RX Level - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 50 - false - - - - -100dBm - - - Qt::AlignCenter - - - - - - - - - - 0 - 0 - - - - - 30 - 16777215 - - - - - 0 - 0 - - - - Qt::RightToLeft - - - false - - - -127 - - - 0 - - - -127 - - - Qt::AlignCenter - - - false - - - Qt::Vertical - - - false - - - %v dBm - - - - - - - - - - - + Qt::Vertical @@ -946,7 +73,7 @@ Leave blank to use autogenerated Device ID. - + @@ -2079,6 +1206,22 @@ Leave blank to use autogenerated Device ID. + + + + + 101 + 16777215 + + + + Qt::NoFocus + + + The automatic frequency correction in Hz. + + + @@ -2102,26 +1245,10 @@ Leave blank to use autogenerated Device ID. - - - - - 101 - 16777215 - - - - Qt::NoFocus - - - The automatic frequency correction in Hz. - - - - + Qt::Horizontal @@ -2134,100 +1261,1037 @@ Leave blank to use autogenerated Device ID. - - - - Frequency Tuning + + + + 0 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - Qt::NoFocus + + + + Frequency Settings + + + + 9 - - Adjust the xtal capacitor value to fine tune frequency and + + 9 + + + 9 + + + 9 + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + 50 + false + + + + Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. + + + 250 + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + 430.000 (MHz) + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 50 + false + + + + From Channel + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + RF Band + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 90 + 16777215 + + + + Set the RF Band used. + + + Qt::LeftToRight + + + 0 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + 50 + false + + + + Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. + + + 250 + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + 440.000 (MHz) + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 50 + false + + + + To Channel + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + true + + + + 0 + 0 + + + + + 900 + 16777215 + + + + + 50 + false + + + + Configuration + + + + + + + 50 + false + + + + Device ID + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Qt::LeftToRight + + + Coordinator ID + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Link Type + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Configure what type of packets will be sent over the link + + + Qt::LeftToRight + + + 0 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 90 + 16777215 + + + + + 50 + false + + + + Qt::StrongFocus + + + Enter your custom ID for this device as a hexadecimal value, +this allows device clones. Be sure only one device with this +ID transmits at the same time! +Leave blank to use autogenerated Device ID. + + + 8 + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + Qt::LogicalMoveStyle + + + false + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Set the maximum TX output power the modem will use (mW) +0 to disable the modem. + + + Qt::LeftToRight + + + 0 + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Set the modem protocol + + + Qt::LeftToRight + + + 0 + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Max Power + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Mode + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Air Data Rate + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Choose the over-the-air baud rate for the radio. + + + + + + + + + + 0 + 0 + + + + + 90 + 16777215 + + + + + 50 + false + + + + This is the coordinator ID we currently are bound to. +To manually bind to a specific coordinator, just type +or paste its device ID in this box and save. +The device must be rebooted for the binding to take place. + + + 8 + + + Qt::LogicalMoveStyle + + + false + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + Clear the binding/coordinator ID + + + Unbind + + + + + + + + + + + + 0 + + + + + Connections + + + + + + + 0 + 0 + + + + + 50 + false + + + + Radio Primary + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + Choose a destination for the primary radio stream. + + + + + + + + 50 + false + + + + VCP Bridge + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Radio Auxiliary + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Choose a destination for the auxiliary radio stream. + + + + + + + + 16777215 + 16777215 + + + + Choose a destination for the Virtual Com Port bridge connection. + + + + + + + + + + Serial Ports + + + + + + + 16777215 + 16777215 + + + + Choose the baud rate for the main com port. + + + + + + + + 50 + false + + + + Speed + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Choose a function for the flexi port. + + + + + + + + 50 + false + + + + Main Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Speed + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Flexi Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Choose the baud rate for the main com port. + + + + + + + + 0 + 0 + + + + Choose a function for the main port. + + + + + + + + + + + + Frequency Tuning + + + + + + Xtal Capacitor + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + AFC Correction + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::NoFocus + + + Adjust the xtal capacitor value to fine tune frequency and get an AFC value close to zero. Default value is 127. - - - 171 - - - 1 - - - 127 - - - Qt::Horizontal - - - - - - - Adjust the xtal capacitor value to fine tune frequency and + + + 171 + + + 1 + + + 127 + + + Qt::Horizontal + + + + + + + Adjust the xtal capacitor value to fine tune frequency and get an AFC value close to zero. Default value is 127. - - - 171 - - - - - - - Xtal Capacitor - - - - - - - The Automatic Frequency Correction: How much the modem will correct + + + 171 + + + + + + + The Automatic Frequency Correction: How much the modem will correct a frequency misalignement between the two modems. - - - -50 - - - 50 - - - 0 - - - Qt::AlignCenter - - - true - - - %v KHz - - - - - - - AFC Correction - - - - - + + + -50 + + + 50 + + + 0 + + + Qt::AlignCenter + + + true + + + %v KHz + + + + + + + + + + + 0 + 0 + + + + + 150 + 16777215 + + + + RX Level + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 50 + false + + + + -100dBm + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 30 + 16777215 + + + + + 0 + 0 + + + + Qt::RightToLeft + + + false + + + -127 + + + 0 + + + -127 + + + Qt::AlignCenter + + + false + + + Qt::Vertical + + + false + + + %v dBm + + + + + + + + + @@ -2337,18 +2401,19 @@ a frequency misalignement between the two modems. Protocol MaxRFTxPower - LinkType - ComSpeed CustomDeviceID - CoordID - UnbindButton - RFBand - MaximumChannel - MinimumChannel + LinkType + AirDataRate + RadioPriStream + RadioAuxStream + VCPBridge MainPort + MainComSpeed FlexiPort - VCPPort - RadioAuxPort + FlexiComSpeed + RFBand + MinimumChannel + MaximumChannel RFXtalCapValue applyButton saveButton From 0b8fea6fe7e7ee56c8b1c8d5d22b295dd2c19666 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Mon, 1 May 2017 02:11:19 +0200 Subject: [PATCH 2/9] LP-505 Refine OPLM uart/speed visibility --- ground/gcs/src/plugins/config/configoplinkwidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index ad42e8264..8e0165954 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -267,10 +267,10 @@ void ConfigOPLinkWidget::updateSettings() bool is_vcp_flexi = isComboboxOptionSelected(m_oplink->VCPBridge, OPLinkSettings::VCPBRIDGE_FLEXI); bool is_bound = (m_oplink->CoordID->text() != ""); - m_oplink->MainPort->setEnabled(is_enabled || is_vcp_main); - m_oplink->FlexiPort->setEnabled(is_enabled || is_vcp_flexi); - m_oplink->MainComSpeed->setEnabled((is_enabled || is_vcp_main) && !is_ppm_only && !is_openlrs && (is_main_serial || is_main_telem)); - m_oplink->FlexiComSpeed->setEnabled((is_enabled || is_vcp_flexi) && !is_ppm_only && !is_openlrs && (is_flexi_serial || is_flexi_telem)); + m_oplink->MainPort->setEnabled((is_enabled && !is_openlrs) || is_vcp_main); + m_oplink->FlexiPort->setEnabled((is_enabled && !is_openlrs) || is_vcp_flexi); + m_oplink->MainComSpeed->setEnabled(is_enabled && !is_openlrs && !is_ppm_only && !is_vcp_main && (is_main_serial || is_main_telem)); + m_oplink->FlexiComSpeed->setEnabled(is_enabled && !is_openlrs && !is_ppm_only && !is_vcp_flexi && (is_flexi_serial || is_flexi_telem)); m_oplink->CoordID->setEnabled(is_enabled && is_receiver); m_oplink->UnbindButton->setEnabled(is_enabled && is_bound && !is_coordinator); m_oplink->CustomDeviceID->setEnabled(is_coordinator); From cac880794162e8a40151309bd7722355f8b57849 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Mon, 1 May 2017 04:30:58 +0200 Subject: [PATCH 3/9] LP-505 Fix AuxStreamFlexi typo --- ground/gcs/src/plugins/config/configoplinkwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index 8e0165954..b1149671d 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -503,7 +503,7 @@ void ConfigOPLinkWidget::radioAuxStreamChanged() if (isComboboxOptionSelected(m_oplink->RadioPriStream, OPLinkSettings::RADIOPRISTREAM_FLEXI)) { setComboboxSelectedOption(m_oplink->RadioPriStream, OPLinkSettings::RADIOPRISTREAM_DISABLED); } - if (isComboboxOptionSelected(m_oplink->VCPBridge, OPLinkSettings::VCPBRIDGE_MAIN)) { + if (isComboboxOptionSelected(m_oplink->VCPBridge, OPLinkSettings::VCPBRIDGE_FLEXI)) { setComboboxSelectedOption(m_oplink->VCPBridge, OPLinkSettings::VCPBRIDGE_DISABLED); } break; From f2cc267435da2b4023274b5377f0ef39df4fda4f Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Mon, 1 May 2017 04:32:34 +0200 Subject: [PATCH 4/9] LP-505 Disable serial-telemetry options per stream/vcp used --- .../src/plugins/config/configoplinkwidget.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index b1149671d..66e0f3856 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -267,6 +267,27 @@ void ConfigOPLinkWidget::updateSettings() bool is_vcp_flexi = isComboboxOptionSelected(m_oplink->VCPBridge, OPLinkSettings::VCPBRIDGE_FLEXI); bool is_bound = (m_oplink->CoordID->text() != ""); + bool is_stream_main = isComboboxOptionSelected(m_oplink->RadioPriStream, OPLinkSettings::RADIOPRISTREAM_MAIN) || + isComboboxOptionSelected(m_oplink->RadioAuxStream, OPLinkSettings::RADIOAUXSTREAM_MAIN); + bool is_stream_flexi = isComboboxOptionSelected(m_oplink->RadioPriStream, OPLinkSettings::RADIOPRISTREAM_FLEXI) || + isComboboxOptionSelected(m_oplink->RadioAuxStream, OPLinkSettings::RADIOAUXSTREAM_FLEXI); + + if (!is_stream_main && !is_vcp_main && (is_main_serial || is_main_telem)) { + setComboboxSelectedOption(m_oplink->MainPort, OPLinkSettings::MAINPORT_DISABLED); + is_main_serial = false; + is_main_telem = false; + } + if (!is_stream_flexi && !is_vcp_flexi && (is_flexi_serial || is_flexi_telem)) { + setComboboxSelectedOption(m_oplink->FlexiPort, OPLinkSettings::FLEXIPORT_DISABLED); + is_flexi_serial = false; + is_flexi_telem = false; + } + + enableComboBoxOptionItem(m_oplink->FlexiPort, OPLinkSettings::FLEXIPORT_TELEMETRY, is_stream_flexi); + enableComboBoxOptionItem(m_oplink->FlexiPort, OPLinkSettings::FLEXIPORT_SERIAL, (is_stream_flexi || is_vcp_flexi)); + enableComboBoxOptionItem(m_oplink->MainPort, OPLinkSettings::MAINPORT_TELEMETRY, is_stream_main); + enableComboBoxOptionItem(m_oplink->MainPort, OPLinkSettings::MAINPORT_SERIAL, (is_stream_main || is_vcp_main)); + m_oplink->MainPort->setEnabled((is_enabled && !is_openlrs) || is_vcp_main); m_oplink->FlexiPort->setEnabled((is_enabled && !is_openlrs) || is_vcp_flexi); m_oplink->MainComSpeed->setEnabled(is_enabled && !is_openlrs && !is_ppm_only && !is_vcp_main && (is_main_serial || is_main_telem)); From b42d6d0ecfff4672171c983fe79ce27a739d8a67 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Fri, 5 May 2017 23:48:33 +0200 Subject: [PATCH 5/9] LP-505 Change the channel tooltip according to the RFBand used. --- .../src/plugins/config/configoplinkwidget.cpp | 18 ++++++++++++------ .../src/plugins/config/configoplinkwidget.h | 1 + ground/gcs/src/plugins/config/oplink.ui | 6 ------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index 66e0f3856..bfb1b557d 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -332,16 +332,19 @@ void ConfigOPLinkWidget::rfBandChanged() { switch (getComboboxSelectedOption(m_oplink->RFBand)) { case OPLinkSettings::RFBAND_915MHZ: - frequency_base = 900.0f; - frequency_step = FREQUENCY_STEP * 2.0f; + frequency_base = 900.0f; + frequency_step = FREQUENCY_STEP * 2.0f; + channel_tooltip = tr("Channel 0 is 900 MHz, channel 250 is 920 MHz, and the channel spacing is 80 KHz."); break; case OPLinkSettings::RFBAND_868MHZ: - frequency_base = 860.0f; - frequency_step = FREQUENCY_STEP * 2.0f; + frequency_base = 860.0f; + frequency_step = FREQUENCY_STEP * 2.0f; + channel_tooltip = tr("Channel 0 is 860 MHz, channel 250 is 880 MHz, and the channel spacing is 80 KHz."); break; case OPLinkSettings::RFBAND_433MHZ: - frequency_base = 430.0f; - frequency_step = FREQUENCY_STEP; + frequency_base = 430.0f; + frequency_step = FREQUENCY_STEP; + channel_tooltip = tr("Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz."); break; } @@ -386,6 +389,9 @@ void ConfigOPLinkWidget::updateFrequencyDisplay() m_oplink->MinFreq->setText("(" + QString::number(minFrequency, 'f', 3) + " MHz)"); m_oplink->MaxFreq->setText("(" + QString::number(maxFrequency, 'f', 3) + " MHz)"); + + m_oplink->MinimumChannel->setToolTip(channel_tooltip); + m_oplink->MaximumChannel->setToolTip(channel_tooltip); } void ConfigOPLinkWidget::mainPortChanged() diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.h b/ground/gcs/src/plugins/config/configoplinkwidget.h index f8b72d4cb..7ea09347b 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.h +++ b/ground/gcs/src/plugins/config/configoplinkwidget.h @@ -54,6 +54,7 @@ private: // Frequency display settings float frequency_base; float frequency_step; + QString channel_tooltip; // Is the status current? bool statusUpdated; diff --git a/ground/gcs/src/plugins/config/oplink.ui b/ground/gcs/src/plugins/config/oplink.ui index 7616704e2..262419ae2 100644 --- a/ground/gcs/src/plugins/config/oplink.ui +++ b/ground/gcs/src/plugins/config/oplink.ui @@ -1306,9 +1306,6 @@ false - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - 250 @@ -1433,9 +1430,6 @@ false - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - 250 From d3280b0bbf734e0d1e49aa9d7ad17750e529233b Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sun, 7 May 2017 12:30:57 +0200 Subject: [PATCH 6/9] LP-505 Add erase/unbind button icon - Cleanup names and logic --- .../src/plugins/config/configoplinkwidget.cpp | 52 +++-- .../src/plugins/config/configoplinkwidget.h | 1 + ground/gcs/src/plugins/config/oplink.ui | 203 ++++++++++++------ ground/gcs/src/plugins/coreplugin/core.qrc | 1 + 4 files changed, 166 insertions(+), 91 deletions(-) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index bfb1b557d..cee73e36a 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -68,8 +68,9 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren addWidget(m_oplink->MinFreq); addWidget(m_oplink->MaxFreq); addWidget(m_oplink->UnbindButton); - addWidget(m_oplink->PairSignalStrengthBar1); - addWidget(m_oplink->PairSignalStrengthLabel1); + addWidget(m_oplink->ClearDeviceButton); + addWidget(m_oplink->SignalStrengthBar); + addWidget(m_oplink->SignalStrengthLabel); addWidgetBinding("OPLinkSettings", "Protocol", m_oplink->Protocol); addWidgetBinding("OPLinkSettings", "LinkType", m_oplink->LinkType); @@ -128,8 +129,9 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren connect(m_oplink->RadioAuxStream, SIGNAL(currentIndexChanged(int)), this, SLOT(radioAuxStreamChanged())); connect(m_oplink->VCPBridge, SIGNAL(currentIndexChanged(int)), this, SLOT(vcpBridgeChanged())); - // Connect the Unbind button + // Connect the Unbind and ClearDevice buttons connect(m_oplink->UnbindButton, SIGNAL(released()), this, SLOT(unbind())); + connect(m_oplink->ClearDeviceButton, SIGNAL(released()), this, SLOT(clearDeviceID())); // all upper case hex m_oplink->CustomDeviceID->setInputMask(">HHHHHHHH"); @@ -179,8 +181,8 @@ void ConfigOPLinkWidget::updateStatus() m_oplink->LinkState->setText(linkField->getValue().toString()); bool linkConnected = (oplinkStatusObj->linkState() == OPLinkStatus_LinkState::Connected); - m_oplink->PairSignalStrengthBar1->setValue(linkConnected ? m_oplink->RSSI->text().toInt() : -127); - m_oplink->PairSignalStrengthLabel1->setText(QString("%1dBm").arg(m_oplink->PairSignalStrengthBar1->value())); + m_oplink->SignalStrengthBar->setValue(linkConnected ? m_oplink->RSSI->text().toInt() : -127); + m_oplink->SignalStrengthLabel->setText(QString("%1dBm").arg(m_oplink->SignalStrengthBar->value())); int afc_valueKHz = m_oplink->AFCCorrection->text().toInt() / 1000; m_oplink->AFCCorrectionBar->setValue(afc_valueKHz); @@ -254,10 +256,9 @@ void ConfigOPLinkWidget::updateSettings() { // qDebug() << "ConfigOPLinkWidget::updateSettings"; - bool is_enabled = !isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_DISABLED); bool is_coordinator = isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_OPLINKCOORDINATOR); bool is_receiver = isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_OPLINKRECEIVER); - bool is_openlrs = isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_OPENLRS); + bool is_oplink = (is_receiver || is_coordinator); bool is_ppm_only = isComboboxOptionSelected(m_oplink->LinkType, OPLinkSettings::LINKTYPE_CONTROL); bool is_main_serial = isComboboxOptionSelected(m_oplink->MainPort, OPLinkSettings::MAINPORT_SERIAL); bool is_main_telem = isComboboxOptionSelected(m_oplink->MainPort, OPLinkSettings::MAINPORT_TELEMETRY); @@ -265,6 +266,7 @@ void ConfigOPLinkWidget::updateSettings() bool is_flexi_telem = isComboboxOptionSelected(m_oplink->FlexiPort, OPLinkSettings::FLEXIPORT_TELEMETRY); bool is_vcp_main = isComboboxOptionSelected(m_oplink->VCPBridge, OPLinkSettings::VCPBRIDGE_MAIN); bool is_vcp_flexi = isComboboxOptionSelected(m_oplink->VCPBridge, OPLinkSettings::VCPBRIDGE_FLEXI); + bool is_custom_id = (m_oplink->CustomDeviceID->text() != ""); bool is_bound = (m_oplink->CoordID->text() != ""); bool is_stream_main = isComboboxOptionSelected(m_oplink->RadioPriStream, OPLinkSettings::RADIOPRISTREAM_MAIN) || @@ -288,24 +290,25 @@ void ConfigOPLinkWidget::updateSettings() enableComboBoxOptionItem(m_oplink->MainPort, OPLinkSettings::MAINPORT_TELEMETRY, is_stream_main); enableComboBoxOptionItem(m_oplink->MainPort, OPLinkSettings::MAINPORT_SERIAL, (is_stream_main || is_vcp_main)); - m_oplink->MainPort->setEnabled((is_enabled && !is_openlrs) || is_vcp_main); - m_oplink->FlexiPort->setEnabled((is_enabled && !is_openlrs) || is_vcp_flexi); - m_oplink->MainComSpeed->setEnabled(is_enabled && !is_openlrs && !is_ppm_only && !is_vcp_main && (is_main_serial || is_main_telem)); - m_oplink->FlexiComSpeed->setEnabled(is_enabled && !is_openlrs && !is_ppm_only && !is_vcp_flexi && (is_flexi_serial || is_flexi_telem)); - m_oplink->CoordID->setEnabled(is_enabled && is_receiver); - m_oplink->UnbindButton->setEnabled(is_enabled && is_bound && !is_coordinator); + m_oplink->MainPort->setEnabled(is_oplink || is_vcp_main); + m_oplink->FlexiPort->setEnabled(is_oplink || is_vcp_flexi); + m_oplink->MainComSpeed->setEnabled(is_oplink && !is_ppm_only && !is_vcp_main && (is_main_serial || is_main_telem)); + m_oplink->FlexiComSpeed->setEnabled(is_oplink && !is_ppm_only && !is_vcp_flexi && (is_flexi_serial || is_flexi_telem)); + m_oplink->CoordID->setEnabled(is_receiver); + m_oplink->UnbindButton->setEnabled(is_receiver && is_bound); m_oplink->CustomDeviceID->setEnabled(is_coordinator); + m_oplink->ClearDeviceButton->setEnabled(is_coordinator && is_custom_id); - m_oplink->RadioPriStream->setEnabled((is_receiver || is_coordinator) && !is_ppm_only); - m_oplink->RadioAuxStream->setEnabled((is_receiver || is_coordinator) && !is_ppm_only); + m_oplink->RadioPriStream->setEnabled(is_oplink && !is_ppm_only); + m_oplink->RadioAuxStream->setEnabled(is_oplink && !is_ppm_only); - m_oplink->AirDataRate->setEnabled((is_receiver || is_coordinator) && !is_ppm_only); - m_oplink->RFBand->setEnabled(is_receiver || is_coordinator); - m_oplink->MinimumChannel->setEnabled(is_receiver || is_coordinator); - m_oplink->MaximumChannel->setEnabled(is_receiver || is_coordinator); + m_oplink->AirDataRate->setEnabled(is_oplink && !is_ppm_only); + m_oplink->RFBand->setEnabled(is_oplink); + m_oplink->MinimumChannel->setEnabled(is_oplink); + m_oplink->MaximumChannel->setEnabled(is_oplink); - m_oplink->LinkType->setEnabled(is_enabled && !is_openlrs); - m_oplink->MaxRFTxPower->setEnabled(is_enabled && !is_openlrs); + m_oplink->LinkType->setEnabled(is_oplink); + m_oplink->MaxRFTxPower->setEnabled(is_oplink); } void ConfigOPLinkWidget::protocolChanged() @@ -598,3 +601,10 @@ void ConfigOPLinkWidget::unbind() oplinkSettingsObj->setModemParams((quint16)0); oplinkSettingsObj->setFlags((quint16)0); } + +void ConfigOPLinkWidget::clearDeviceID() +{ + // Clear the device ID + oplinkSettingsObj->setCustomDeviceID(0); + m_oplink->CustomDeviceID->clear(); +} diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.h b/ground/gcs/src/plugins/config/configoplinkwidget.h index 7ea09347b..74a4f58c1 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.h +++ b/ground/gcs/src/plugins/config/configoplinkwidget.h @@ -84,6 +84,7 @@ private slots: void vcpBridgeChanged(); void unbind(); + void clearDeviceID(); }; #endif // CONFIGOPLINKWIDGET_H diff --git a/ground/gcs/src/plugins/config/oplink.ui b/ground/gcs/src/plugins/config/oplink.ui index 262419ae2..dddcebb76 100644 --- a/ground/gcs/src/plugins/config/oplink.ui +++ b/ground/gcs/src/plugins/config/oplink.ui @@ -1543,7 +1543,7 @@ - + @@ -1578,7 +1578,7 @@ - + @@ -1603,65 +1603,7 @@ - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 90 - 16777215 - - - - - 50 - false - - - - Qt::StrongFocus - - - Enter your custom ID for this device as a hexadecimal value, -this allows device clones. Be sure only one device with this -ID transmits at the same time! -Leave blank to use autogenerated Device ID. - - - 8 - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - - Qt::LogicalMoveStyle - - - false - - - - + @@ -1687,7 +1629,7 @@ Leave blank to use autogenerated Device ID. - + @@ -1712,7 +1654,7 @@ Leave blank to use autogenerated Device ID. - + @@ -1756,7 +1698,7 @@ Leave blank to use autogenerated Device ID. - + @@ -1772,7 +1714,7 @@ Leave blank to use autogenerated Device ID. - + @@ -1791,7 +1733,7 @@ Leave blank to use autogenerated Device ID. - + @@ -1833,7 +1775,7 @@ The device must be rebooted for the binding to take place. - + 0 0 @@ -1845,10 +1787,128 @@ The device must be rebooted for the binding to take place. Clear the binding/coordinator ID - Unbind + + + + + :/core/images/clear_left.png:/core/images/clear_left.png + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 10 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 90 + 16777215 + + + + + 50 + false + + + + Qt::StrongFocus + + + Enter your custom ID for this device as a hexadecimal value, +this allows device clones. Be sure only one device with this +ID transmits at the same time! +Leave blank to use autogenerated Device ID. + + + 8 + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + Qt::LogicalMoveStyle + + + false + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + Clear the device ID and leave it autogenerated + + + + + + + :/core/images/clear_left.png:/core/images/clear_left.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -2199,7 +2259,7 @@ a frequency misalignement between the two modems. - + 0 @@ -2229,7 +2289,7 @@ a frequency misalignement between the two modems. - + 0 @@ -2396,6 +2456,9 @@ a frequency misalignement between the two modems. Protocol MaxRFTxPower CustomDeviceID + ClearDeviceButton + CoordID + UnbindButton LinkType AirDataRate RadioPriStream diff --git a/ground/gcs/src/plugins/coreplugin/core.qrc b/ground/gcs/src/plugins/coreplugin/core.qrc index 0a7e4c4a4..a0ce8099a 100644 --- a/ground/gcs/src/plugins/coreplugin/core.qrc +++ b/ground/gcs/src/plugins/coreplugin/core.qrc @@ -7,6 +7,7 @@ images/librepilot_logo_32.png images/clean_pane_small.png images/clear.png + images/clear_left.png images/closebutton.png images/dir.png images/editcopy.png From eb59d7381f21151f7a68147ad6b00c583001e3ed Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sun, 7 May 2017 22:01:12 +0200 Subject: [PATCH 7/9] LP-505 Check customID and coordID changes - Use isEmpty() --- .../src/plugins/config/configoplinkwidget.cpp | 16 ++++++++++++++-- .../gcs/src/plugins/config/configoplinkwidget.h | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index cee73e36a..438b88dc8 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -120,6 +120,8 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren // Connect the selection changed signals. connect(m_oplink->Protocol, SIGNAL(currentIndexChanged(int)), this, SLOT(protocolChanged())); connect(m_oplink->LinkType, SIGNAL(currentIndexChanged(int)), this, SLOT(linkTypeChanged())); + connect(m_oplink->CustomDeviceID, SIGNAL(textChanged(QString)), this, SLOT(customIDChanged())); + connect(m_oplink->CoordID, SIGNAL(textChanged(QString)), this, SLOT(coordIDChanged())); connect(m_oplink->RFBand, SIGNAL(currentIndexChanged(int)), this, SLOT(rfBandChanged())); connect(m_oplink->MinimumChannel, SIGNAL(valueChanged(int)), this, SLOT(minChannelChanged())); connect(m_oplink->MaximumChannel, SIGNAL(valueChanged(int)), this, SLOT(maxChannelChanged())); @@ -266,8 +268,8 @@ void ConfigOPLinkWidget::updateSettings() bool is_flexi_telem = isComboboxOptionSelected(m_oplink->FlexiPort, OPLinkSettings::FLEXIPORT_TELEMETRY); bool is_vcp_main = isComboboxOptionSelected(m_oplink->VCPBridge, OPLinkSettings::VCPBRIDGE_MAIN); bool is_vcp_flexi = isComboboxOptionSelected(m_oplink->VCPBridge, OPLinkSettings::VCPBRIDGE_FLEXI); - bool is_custom_id = (m_oplink->CustomDeviceID->text() != ""); - bool is_bound = (m_oplink->CoordID->text() != ""); + bool is_custom_id = !m_oplink->CustomDeviceID->text().isEmpty(); + bool is_bound = !m_oplink->CoordID->text().isEmpty(); bool is_stream_main = isComboboxOptionSelected(m_oplink->RadioPriStream, OPLinkSettings::RADIOPRISTREAM_MAIN) || isComboboxOptionSelected(m_oplink->RadioAuxStream, OPLinkSettings::RADIOAUXSTREAM_MAIN); @@ -321,6 +323,16 @@ void ConfigOPLinkWidget::linkTypeChanged() updateSettings(); } +void ConfigOPLinkWidget::customIDChanged() +{ + updateSettings(); +} + +void ConfigOPLinkWidget::coordIDChanged() +{ + updateSettings(); +} + void ConfigOPLinkWidget::minChannelChanged() { channelChanged(false); diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.h b/ground/gcs/src/plugins/config/configoplinkwidget.h index 74a4f58c1..156b8a3bb 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.h +++ b/ground/gcs/src/plugins/config/configoplinkwidget.h @@ -70,6 +70,8 @@ private slots: void protocolChanged(); void linkTypeChanged(); + void customIDChanged(); + void coordIDChanged(); void minChannelChanged(); void maxChannelChanged(); From ba5e5695db89c3d7a6b8f1b2d2c8eca3a56e9f67 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Tue, 9 May 2017 22:10:57 +0200 Subject: [PATCH 8/9] LP-505 Handle OpenLRS unbinding --- .../src/plugins/config/configoplinkwidget.cpp | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index 438b88dc8..9ded0884e 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -258,6 +258,7 @@ void ConfigOPLinkWidget::updateSettings() { // qDebug() << "ConfigOPLinkWidget::updateSettings"; + bool is_openlrs = isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_OPENLRS); bool is_coordinator = isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_OPLINKCOORDINATOR); bool is_receiver = isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_OPLINKRECEIVER); bool is_oplink = (is_receiver || is_coordinator); @@ -296,8 +297,10 @@ void ConfigOPLinkWidget::updateSettings() m_oplink->FlexiPort->setEnabled(is_oplink || is_vcp_flexi); m_oplink->MainComSpeed->setEnabled(is_oplink && !is_ppm_only && !is_vcp_main && (is_main_serial || is_main_telem)); m_oplink->FlexiComSpeed->setEnabled(is_oplink && !is_ppm_only && !is_vcp_flexi && (is_flexi_serial || is_flexi_telem)); - m_oplink->CoordID->setEnabled(is_receiver); - m_oplink->UnbindButton->setEnabled(is_receiver && is_bound); + m_oplink->CoordID->setEnabled(is_receiver || is_openlrs); + m_oplink->CoordID->setReadOnly(is_openlrs); + m_oplink->UnbindButton->setEnabled((is_receiver && is_bound) || is_openlrs); + m_oplink->CustomDeviceID->setEnabled(is_coordinator); m_oplink->ClearDeviceButton->setEnabled(is_coordinator && is_custom_id); @@ -601,22 +604,22 @@ void ConfigOPLinkWidget::vcpBridgeChanged() void ConfigOPLinkWidget::unbind() { // Clear the coordinator ID - oplinkSettingsObj->setCoordID(0); m_oplink->CoordID->clear(); - // Clear the OpenLRS settings - oplinkSettingsObj->setVersion((quint16)0); - oplinkSettingsObj->setSerialBaudrate(0); - oplinkSettingsObj->setRFFrequency(0); - oplinkSettingsObj->setRFPower((quint16)0); - oplinkSettingsObj->setRFChannelSpacing((quint16)0); - oplinkSettingsObj->setModemParams((quint16)0); - oplinkSettingsObj->setFlags((quint16)0); + // Clear the OpenLRS settings when needed + if (isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_OPENLRS)) { + oplinkSettingsObj->setVersion((quint16)0); + oplinkSettingsObj->setSerialBaudrate(0); + oplinkSettingsObj->setRFFrequency(0); + oplinkSettingsObj->setRFPower((quint16)0); + oplinkSettingsObj->setRFChannelSpacing((quint16)0); + oplinkSettingsObj->setModemParams((quint16)0); + oplinkSettingsObj->setFlags((quint16)0); + } } void ConfigOPLinkWidget::clearDeviceID() { - // Clear the device ID - oplinkSettingsObj->setCustomDeviceID(0); + // Clear the OPLM device ID m_oplink->CustomDeviceID->clear(); } From 289285cadb5a830204b83b8d806c2643e7dca5b2 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Wed, 10 May 2017 15:13:32 +0200 Subject: [PATCH 9/9] LP-505 Use clear() for OpenLRS settings reset --- .../gcs/src/plugins/config/configoplinkwidget.cpp | 14 +++++++------- ground/gcs/src/plugins/uavobjects/uavobjectfield.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index 9ded0884e..cb53e3444 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -608,13 +608,13 @@ void ConfigOPLinkWidget::unbind() // Clear the OpenLRS settings when needed if (isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_OPENLRS)) { - oplinkSettingsObj->setVersion((quint16)0); - oplinkSettingsObj->setSerialBaudrate(0); - oplinkSettingsObj->setRFFrequency(0); - oplinkSettingsObj->setRFPower((quint16)0); - oplinkSettingsObj->setRFChannelSpacing((quint16)0); - oplinkSettingsObj->setModemParams((quint16)0); - oplinkSettingsObj->setFlags((quint16)0); + QStringList openLRS_settings; + openLRS_settings << "Version" << "SerialBaudrate" << "ModemParams" << "Flags" \ + << "RFFrequency" << "RFPower" << "RFChannelSpacing" << "HopChannel"; + + for (int i = 0; i < openLRS_settings.size(); ++i) { + oplinkSettingsObj->getField(openLRS_settings[i])->clear(); + } } } diff --git a/ground/gcs/src/plugins/uavobjects/uavobjectfield.h b/ground/gcs/src/plugins/uavobjects/uavobjectfield.h index 42a3de076..2c82cce95 100644 --- a/ground/gcs/src/plugins/uavobjects/uavobjectfield.h +++ b/ground/gcs/src/plugins/uavobjects/uavobjectfield.h @@ -80,6 +80,8 @@ public: bool isText(); QString toString(); + void clear(); + void toXML(QXmlStreamWriter *xmlWriter); void fromXML(QXmlStreamReader *xmlReader); @@ -106,7 +108,6 @@ protected: quint8 *data; UAVObject *obj; QMap > elementLimits; - void clear(); void constructorInitialize(const QString & name, const QString & description, const QString & units, FieldType type, const QStringList & elementNames, const QStringList & options, const QString &limits); void limitsInitialize(const QString &limits); };