From c9fff7e16e0cb52d44e8dff3b4c4297cee8301a4 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sat, 16 Apr 2016 09:04:18 +0200 Subject: [PATCH 1/3] LP-151 OPLink: Allow custom Device ID or auto generated. --- flight/pios/common/pios_rfm22b.c | 61 +- flight/pios/inc/pios_rfm22b.h | 4 +- flight/pios/inc/pios_rfm22b_priv.h | 2 +- .../discoveryf4bare/firmware/pios_board.c | 8 +- .../boards/oplinkmini/firmware/pios_board.c | 8 +- .../boards/revolution/firmware/pios_board.c | 5 +- .../src/plugins/config/configoplinkwidget.cpp | 21 +- .../src/plugins/config/configoplinkwidget.h | 14 +- ground/gcs/src/plugins/config/oplink.ui | 777 ++++++++++-------- shared/uavobjectdefinition/oplinksettings.xml | 1 + 10 files changed, 513 insertions(+), 388 deletions(-) diff --git a/flight/pios/common/pios_rfm22b.c b/flight/pios/common/pios_rfm22b.c index 89724c563..7a3929607 100644 --- a/flight/pios/common/pios_rfm22b.c +++ b/flight/pios/common/pios_rfm22b.c @@ -7,7 +7,8 @@ * @{ * * @file pios_rfm22b.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. + * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @brief Implements a driver the the RFM22B driver * @see The GNU Public License (GPL) Version 3 * @@ -187,6 +188,7 @@ static enum pios_radio_event rfm22_fatal_error(struct pios_rfm22b_dev *rfm22b_de static void rfm22b_add_rx_status(struct pios_rfm22b_dev *rfm22b_dev, enum pios_rfm22b_rx_packet_status status); static void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev, uint8_t init_chan); static bool rfm22_setFreqHopChannel(struct pios_rfm22b_dev *rfm22b_dev, uint8_t channel); +static void rfm22_generateDeviceID(struct pios_rfm22b_dev *rfm22b_dev); static void rfm22_updatePairStatus(struct pios_rfm22b_dev *radio_dev); static void rfm22_updateStats(struct pios_rfm22b_dev *rfm22b_dev); static bool rfm22_checkTimeOut(struct pios_rfm22b_dev *rfm22b_dev); @@ -446,18 +448,8 @@ int32_t PIOS_RFM22B_Init(uint32_t *rfm22b_id, uint32_t spi_id, uint32_t slave_nu // Create a semaphore to know if an ISR needs responding to vSemaphoreCreateBinary(rfm22b_dev->isrPending); - // Create our (hopefully) unique 32 bit id from the processor serial number. - uint8_t crcs[] = { 0, 0, 0, 0 }; - { - char serial_no_str[33]; - PIOS_SYS_SerialNumberGet(serial_no_str); - // Create a 32 bit value using 4 8 bit CRC values. - for (uint8_t i = 0; serial_no_str[i] != 0; ++i) { - crcs[i % 4] = PIOS_CRC_updateByte(crcs[i % 4], serial_no_str[i]); - } - } - rfm22b_dev->deviceID = crcs[0] | crcs[1] << 8 | crcs[2] << 16 | crcs[3] << 24; - DEBUG_PRINTF(2, "RF device ID: %x\n\r", rfm22b_dev->deviceID); + // Create default (hopefully) unique 32 bit id from the processor serial number. + rfm22_generateDeviceID(rfm22b_dev); // Initialize the external interrupt. PIOS_EXTI_Init(cfg->exti_cfg); @@ -510,6 +502,26 @@ bool PIOS_RFM22_EXT_Int(void) return false; } + +/** + * Set the device ID for the RFM22B device. + * + * @param[in] rfm22b_id The RFM22B device index. + * + */ +void PIOS_RFM22B_SetDeviceID(uint32_t rfm22b_id, uint32_t custom_device_id) +{ + struct pios_rfm22b_dev *rfm22b_dev = (struct pios_rfm22b_dev *)rfm22b_id; + + if (custom_device_id > 0) { + rfm22b_dev->deviceID = custom_device_id; + } else { + rfm22_generateDeviceID(rfm22b_dev); + } + + DEBUG_PRINTF(2, "RF device ID: %x\n\r", rfm22b_dev->deviceID); +} + /** * Returns the unique device ID for the RFM22B device. * @@ -1711,6 +1723,29 @@ static bool rfm22_setFreqHopChannel(struct pios_rfm22b_dev *rfm22b_dev, uint8_t return true; } +/** + * Generate the unique device ID for the RFM22B device. + * + * @param[in] rfm22b_id The RFM22B device index. + * + */ +void rfm22_generateDeviceID(struct pios_rfm22b_dev *rfm22b_dev) +{ + // Create our (hopefully) unique 32 bit id from the processor serial number. + uint8_t crcs[] = { 0, 0, 0, 0 }; + { + char serial_no_str[33]; + PIOS_SYS_SerialNumberGet(serial_no_str); + // Create a 32 bit value using 4 8 bit CRC values. + for (uint8_t i = 0; serial_no_str[i] != 0; ++i) { + crcs[i % 4] = PIOS_CRC_updateByte(crcs[i % 4], serial_no_str[i]); + } + } + + rfm22b_dev->deviceID = crcs[0] | crcs[1] << 8 | crcs[2] << 16 | crcs[3] << 24; + DEBUG_PRINTF(2, "Generated RF device ID: %x\n\r", rfm22b_dev->deviceID); +} + /** * Read the RFM22B interrupt and device status registers * diff --git a/flight/pios/inc/pios_rfm22b.h b/flight/pios/inc/pios_rfm22b.h index 0c4593262..ec5d9d41e 100644 --- a/flight/pios/inc/pios_rfm22b.h +++ b/flight/pios/inc/pios_rfm22b.h @@ -7,7 +7,8 @@ * @{ * * @file pios_rfm22b.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. + * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @brief RFM22B functions header. * @see The GNU Public License (GPL) Version 3 * @@ -105,6 +106,7 @@ extern void PIOS_RFM22B_Reinit(uint32_t rfb22b_id); extern void PIOS_RFM22B_SetTxPower(uint32_t rfm22b_id, enum rfm22b_tx_power tx_pwr); extern void PIOS_RFM22B_SetChannelConfig(uint32_t rfm22b_id, enum rfm22b_datarate datarate, uint8_t min_chan, uint8_t max_chan, bool coordinator, bool oneway, bool ppm_mode, bool ppm_only); extern void PIOS_RFM22B_SetCoordinatorID(uint32_t rfm22b_id, uint32_t coord_id); +extern void PIOS_RFM22B_SetDeviceID(uint32_t rfm22b_id, uint32_t device_id); extern uint32_t PIOS_RFM22B_DeviceID(uint32_t rfb22b_id); extern void PIOS_RFM22B_GetStats(uint32_t rfm22b_id, struct rfm22b_stats *stats); extern uint8_t PIOS_RFM22B_GetPairStats(uint32_t rfm22b_id, uint32_t *device_ids, int8_t *RSSIs, uint8_t max_pairs); diff --git a/flight/pios/inc/pios_rfm22b_priv.h b/flight/pios/inc/pios_rfm22b_priv.h index 47cf9d5c0..25cb754a0 100644 --- a/flight/pios/inc/pios_rfm22b_priv.h +++ b/flight/pios/inc/pios_rfm22b_priv.h @@ -674,7 +674,7 @@ struct pios_rfm22b_dev { // The device ID uint32_t deviceID; - // The coodinator ID (0 if this modem is a coordinator). + // The coordinator ID (0 if this modem is a coordinator). uint32_t coordinatorID; // The task handle diff --git a/flight/targets/boards/discoveryf4bare/firmware/pios_board.c b/flight/targets/boards/discoveryf4bare/firmware/pios_board.c index 9414d7f33..328e43a8a 100644 --- a/flight/targets/boards/discoveryf4bare/firmware/pios_board.c +++ b/flight/targets/boards/discoveryf4bare/firmware/pios_board.c @@ -1,8 +1,9 @@ /** ****************************************************************************** * @file pios_board.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011. - * @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012 + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. + * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011. + * PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012 * @addtogroup OpenPilotSystem OpenPilot System * @{ * @addtogroup OpenPilotCore OpenPilot Core @@ -804,6 +805,7 @@ void PIOS_Board_Init(void) } /* Set the radio configuration parameters. */ + PIOS_RFM22B_SetDeviceID(pios_rfm22b_id, oplinkSettings.CustomDeviceID); PIOS_RFM22B_SetChannelConfig(pios_rfm22b_id, datarate, oplinkSettings.MinChannel, oplinkSettings.MaxChannel, is_coordinator, is_oneway, ppm_mode, ppm_only); PIOS_RFM22B_SetCoordinatorID(pios_rfm22b_id, oplinkSettings.CoordID); @@ -812,7 +814,7 @@ void PIOS_Board_Init(void) PIOS_RFM22B_SetPPMCallback(pios_rfm22b_id, PIOS_Board_PPM_callback); } - /* Set the modem Tx poer level */ + /* Set the modem Tx power level */ switch (oplinkSettings.MaxRFPower) { case OPLINKSETTINGS_MAXRFPOWER_125: PIOS_RFM22B_SetTxPower(pios_rfm22b_id, RFM22_tx_pwr_txpow_0); diff --git a/flight/targets/boards/oplinkmini/firmware/pios_board.c b/flight/targets/boards/oplinkmini/firmware/pios_board.c index 34d033db3..9ea6af908 100644 --- a/flight/targets/boards/oplinkmini/firmware/pios_board.c +++ b/flight/targets/boards/oplinkmini/firmware/pios_board.c @@ -6,7 +6,8 @@ * @{ * * @file pios_board.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. + * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief Defines board specific static initializers for hardware for the OpenPilot board. * @see The GNU Public License (GPL) Version 3 * @@ -406,7 +407,7 @@ void PIOS_Board_Init(void) break; } - /* Set the modem Tx poer level */ + /* Set the modem Tx power level */ switch (oplinkSettings.MaxRFPower) { case OPLINKSETTINGS_MAXRFPOWER_125: PIOS_RFM22B_SetTxPower(pios_rfm22b_id, RFM22_tx_pwr_txpow_0); @@ -438,6 +439,7 @@ void PIOS_Board_Init(void) } // Set the radio configuration parameters. + PIOS_RFM22B_SetDeviceID(pios_rfm22b_id, oplinkSettings.CustomDeviceID); PIOS_RFM22B_SetCoordinatorID(pios_rfm22b_id, oplinkSettings.CoordID); PIOS_RFM22B_SetChannelConfig(pios_rfm22b_id, datarate, oplinkSettings.MinChannel, oplinkSettings.MaxChannel, is_coordinator, is_oneway, ppm_mode, ppm_only); @@ -446,7 +448,7 @@ void PIOS_Board_Init(void) PIOS_RFM22B_SetPPMCallback(pios_rfm22b_id, PIOS_Board_PPM_callback); } - // Reinitilize the modem to affect te changes. + // Reinitialize the modem to affect the changes. PIOS_RFM22B_Reinit(pios_rfm22b_id); } else { oplinkStatus.LinkState = OPLINKSTATUS_LINKSTATE_DISABLED; diff --git a/flight/targets/boards/revolution/firmware/pios_board.c b/flight/targets/boards/revolution/firmware/pios_board.c index 018d7a397..08b792f6b 100644 --- a/flight/targets/boards/revolution/firmware/pios_board.c +++ b/flight/targets/boards/revolution/firmware/pios_board.c @@ -1,7 +1,7 @@ /** ****************************************************************************** * @file pios_board.c - * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015. + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016. * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011. * PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012 * @addtogroup OpenPilotSystem OpenPilot System @@ -885,6 +885,7 @@ void PIOS_Board_Init(void) } /* Set the radio configuration parameters. */ + PIOS_RFM22B_SetDeviceID(pios_rfm22b_id, oplinkSettings.CustomDeviceID); PIOS_RFM22B_SetCoordinatorID(pios_rfm22b_id, oplinkSettings.CoordID); PIOS_RFM22B_SetChannelConfig(pios_rfm22b_id, datarate, oplinkSettings.MinChannel, oplinkSettings.MaxChannel, is_coordinator, is_oneway, ppm_mode, ppm_only); @@ -893,7 +894,7 @@ void PIOS_Board_Init(void) PIOS_RFM22B_SetPPMCallback(pios_rfm22b_id, PIOS_Board_PPM_callback); } - /* Set the modem Tx poer level */ + /* Set the modem Tx power level */ switch (oplinkSettings.MaxRFPower) { case OPLINKSETTINGS_MAXRFPOWER_125: PIOS_RFM22B_SetTxPower(pios_rfm22b_id, RFM22_tx_pwr_txpow_0); diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index 31b45dbe3..8417aca4e 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -1,14 +1,14 @@ /** ****************************************************************************** * - * @file configtxpidswidget.cpp - * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015. + * @file configoplinkwidget.cpp + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016. * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @addtogroup GCSPlugins GCS Plugins * @{ * @addtogroup ConfigPlugin Config Plugin * @{ - * @brief The Configuration Gadget used to configure the PipXtreme + * @brief The Configuration Gadget used to configure the OPLink and Revo modem *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify @@ -80,6 +80,7 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren addWidgetBinding("OPLinkSettings", "PPMOnly", m_oplink->PPMOnly); addWidgetBinding("OPLinkSettings", "PPM", m_oplink->PPM); addWidgetBinding("OPLinkSettings", "ComSpeed", m_oplink->ComSpeed); + addWidgetBinding("OPLinkSettings", "CustomDeviceID", m_oplink->CustomDeviceID); addWidgetBinding("OPLinkStatus", "DeviceID", m_oplink->DeviceID); addWidgetBinding("OPLinkStatus", "RxGood", m_oplink->Good); @@ -112,6 +113,9 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren connect(m_oplink->PPMOnly, SIGNAL(toggled(bool)), this, SLOT(ppmOnlyChanged())); connect(m_oplink->MinimumChannel, SIGNAL(valueChanged(int)), this, SLOT(minChannelChanged())); connect(m_oplink->MaximumChannel, SIGNAL(valueChanged(int)), this, SLOT(maxChannelChanged())); + connect(m_oplink->CustomDeviceID, SIGNAL(editingFinished()), this, SLOT(updateCustomDeviceID())); + + m_oplink->CustomDeviceID->setInputMask("HHHHHHHH"); m_oplink->MinimumChannel->setKeyboardTracking(false); m_oplink->MaximumChannel->setKeyboardTracking(false); @@ -247,7 +251,6 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object) if (!settingsUpdated) { settingsUpdated = true; - // Enable components based on the board type connected. UAVObjectField *board_type_field = oplinkStatusObj->getField("BoardType"); switch (board_type_field->getValue().toInt()) { @@ -294,6 +297,7 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object) void ConfigOPLinkWidget::updateEnableControls() { + updateCustomDeviceID(); enableControls(true); ppmOnlyChanged(); } @@ -384,6 +388,15 @@ void ConfigOPLinkWidget::channelChanged(bool isMax) m_oplink->MaxFreq->setText("(" + QString::number(maxFrequency, 'f', 3) + " MHz)"); } +void ConfigOPLinkWidget::updateCustomDeviceID() +{ + bool customDeviceIDNotSet = (m_oplink->CustomDeviceID->text() == "0"); + + if (settingsUpdated && customDeviceIDNotSet) { + m_oplink->CustomDeviceID->clear(); + m_oplink->CustomDeviceID->setPlaceholderText(m_oplink->DeviceID->text()); + } +} /** @} @} diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.h b/ground/gcs/src/plugins/config/configoplinkwidget.h index 032722099..620b1c52d 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.h +++ b/ground/gcs/src/plugins/config/configoplinkwidget.h @@ -1,13 +1,14 @@ /** ****************************************************************************** * - * @file configpipxtremewidget.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + * @file configoplinkwidget.h + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. + * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @addtogroup GCSPlugins GCS Plugins * @{ * @addtogroup ConfigPlugin Config Plugin * @{ - * @brief The Configuration Gadget used to configure PipXtreme + * @brief The Configuration Gadget used to configure the OPLink and Revo modem *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify @@ -24,8 +25,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef CONFIGPIPXTREMEWIDGET_H -#define CONFIGPIPXTREMEWIDGET_H +#ifndef CONFIGOPLINKWIDGET_H +#define CONFIGOPLINKWIDGET_H #include "configtaskwidget.h" @@ -65,7 +66,8 @@ private slots: void ppmOnlyChanged(); void minChannelChanged(); void maxChannelChanged(); + void updateCustomDeviceID(); void channelChanged(bool isMax); }; -#endif // CONFIGTXPIDWIDGET_H +#endif // CONFIGOPLINKWIDGET_H diff --git a/ground/gcs/src/plugins/config/oplink.ui b/ground/gcs/src/plugins/config/oplink.ui index 9ee795fdb..db795b7ce 100644 --- a/ground/gcs/src/plugins/config/oplink.ui +++ b/ground/gcs/src/plugins/config/oplink.ui @@ -54,360 +54,6 @@ - - - - - 0 - 0 - - - - - 50 - false - - - - Configuration - - - - - - Com speed in bps. - - - - - - - - 50 - false - - - - Com Speed - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - VCP Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the flexi port - - - - - - - - 50 - false - - - - Main Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the main port - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the USB virtual com port - - - - - - - - 16777215 - 16777215 - - - - Set the maximum TX output power the modem will use (mW) - - - Qt::LeftToRight - - - 0 - - - - - - - - 50 - false - - - - Max Power - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - 50 - false - - - - FlexiIO Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 60 - 16777215 - - - - - 50 - false - - - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - - - 250 - - - - - - - - 50 - false - - - - Flexi Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Max Chan - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Min Chan - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 60 - 16777215 - - - - - 50 - false - - - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - - - 250 - - - - - - - - 50 - false - - - - This modem will be a coordinator and other modems will bind to it. - - - Coordinator - - - - - - - - 110 - 16777215 - - - - 440.000 (MHz) - - - - - - - - 110 - 16777215 - - - - 430.000 (MHz) - - - - - - - - 50 - false - - - - false - - - If selected, data will only be transmitted from the coordinator to the Rx modem. - - - One-Way - - - - - - - - 50 - false - - - - Only PPM packets will be transmitted. - - - PPM Only - - - - - - - - 50 - false - - - - PPM packets will be received by this modem. Must be selected if Coordinator modem is configured for PPM. - - - PPM - - - - - - @@ -759,6 +405,9 @@ false + + 8 + false @@ -769,7 +418,7 @@ true - 12345678 + AA00FF99 @@ -1789,6 +1438,424 @@ + + + + + 0 + 0 + + + + + 50 + false + + + + Configuration + + + + + + + 50 + false + + + + This modem will be a coordinator and other modems will bind to it. + + + Coordinator + + + + + + + Com speed in bps. + + + + + + + + 50 + false + + + + Com Speed + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + VCP Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the flexi port + + + + + + + + 50 + false + + + + Main Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the main port + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the USB virtual com port + + + + + + + + + + + 16777215 + 16777215 + + + + Set the maximum TX output power the modem will use (mW) + + + Qt::LeftToRight + + + 0 + + + + + + + + 50 + false + + + + Max Power + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 60 + 16777215 + + + + + 50 + false + + + + Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. + + + 250 + + + + + + + + 50 + false + + + + FlexiIO Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Flexi Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 60 + 16777215 + + + + + 50 + false + + + + Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. + + + 250 + + + + + + + + 50 + false + + + + Max Chan + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Min Chan + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 110 + 16777215 + + + + 430.000 (MHz) + + + + + + + + 50 + false + + + + false + + + If selected, data will only be transmitted from the coordinator to the Rx modem. + + + One-Way + + + + + + + + 50 + false + + + + Only PPM packets will be transmitted. + + + PPM Only + + + + + + + + 50 + false + + + + PPM packets will be received by this modem. Must be selected if Coordinator modem is configured for PPM. + + + PPM + + + + + + + + 110 + 16777215 + + + + 440.000 (MHz) + + + + + + + + 0 + 0 + + + + + 101 + 16777215 + + + + + 50 + false + + + + Enter your custom ID for this device as hexadecimal value, +this allow device clones. Be sure only one same Device ID transmit once! +Leave blank for Device ID autogenerated. + + + 8 + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + AA00FF99 + + + Qt::LogicalMoveStyle + + + false + + + + + + + + 50 + false + + + + Device ID + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + diff --git a/shared/uavobjectdefinition/oplinksettings.xml b/shared/uavobjectdefinition/oplinksettings.xml index 6e5674c8f..cc2b46a0e 100644 --- a/shared/uavobjectdefinition/oplinksettings.xml +++ b/shared/uavobjectdefinition/oplinksettings.xml @@ -13,6 +13,7 @@ + From 8ac0bc38aa0621492922dcb6fee739bf3873168f Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Wed, 20 Apr 2016 18:23:10 +0200 Subject: [PATCH 2/3] LP-292 Oplink tab cleanup, remove unused buttons, remote monitoring. Update statusTip to toolTip. --- .../src/plugins/config/configoplinkwidget.cpp | 95 +- .../src/plugins/config/configoplinkwidget.h | 2 +- ground/gcs/src/plugins/config/oplink.ui | 1014 ++++++++--------- 3 files changed, 465 insertions(+), 646 deletions(-) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index 8417aca4e..0a744de04 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -103,19 +103,15 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren addWidgetBinding("OPLinkStatus", "RXPacketRate", m_oplink->RXPacketRate); addWidgetBinding("OPLinkStatus", "TXPacketRate", m_oplink->TXPacketRate); - // Connect the bind buttons - connect(m_oplink->Bind1, SIGNAL(clicked()), this, SLOT(bind())); - connect(m_oplink->Bind2, SIGNAL(clicked()), this, SLOT(bind())); - connect(m_oplink->Bind3, SIGNAL(clicked()), this, SLOT(bind())); - connect(m_oplink->Bind4, SIGNAL(clicked()), this, SLOT(bind())); - // Connect the selection changed signals. connect(m_oplink->PPMOnly, SIGNAL(toggled(bool)), this, SLOT(ppmOnlyChanged())); + connect(m_oplink->Coordinator, SIGNAL(toggled(bool)), this, SLOT(updateCoordID())); connect(m_oplink->MinimumChannel, SIGNAL(valueChanged(int)), this, SLOT(minChannelChanged())); connect(m_oplink->MaximumChannel, SIGNAL(valueChanged(int)), this, SLOT(maxChannelChanged())); connect(m_oplink->CustomDeviceID, SIGNAL(editingFinished()), this, SLOT(updateCustomDeviceID())); m_oplink->CustomDeviceID->setInputMask("HHHHHHHH"); + m_oplink->CoordID->setInputMask("HHHHHHHH"); m_oplink->MinimumChannel->setKeyboardTracking(false); m_oplink->MaximumChannel->setKeyboardTracking(false); @@ -148,53 +144,10 @@ void ConfigOPLinkWidget::updateStatus(UAVObject *object) UAVObjectField *linkField = object->getField("LinkState"); m_oplink->LinkState->setText(linkField->getValue().toString()); bool linkConnected = (linkField->getValue() == linkField->getOptions().at(OPLinkStatus::LINKSTATE_CONNECTED)); - bool modemEnabled = linkConnected || (linkField->getValue() == linkField->getOptions().at(OPLinkStatus::LINKSTATE_DISCONNECTED)) || - (linkField->getValue() == linkField->getOptions().at(OPLinkStatus::LINKSTATE_ENABLED)); - UAVObjectField *pairRssiField = object->getField("PairSignalStrengths"); - - bool bound; - bool ok; - quint32 boundPairId = m_oplink->CoordID->text().toUInt(&ok, 16); - - // Update the detected devices. - UAVObjectField *pairIdField = object->getField("PairIDs"); - quint32 pairid = pairIdField->getValue(0).toUInt(); - bound = (pairid == boundPairId); - m_oplink->PairID1->setText(QString::number(pairid, 16).toUpper()); - m_oplink->PairID1->setEnabled(false); - m_oplink->Bind1->setText(bound ? tr("Unbind") : tr("Bind")); - m_oplink->Bind1->setEnabled(pairid && modemEnabled); - m_oplink->PairSignalStrengthBar1->setValue(((bound && !linkConnected) || !modemEnabled) ? -127 : pairRssiField->getValue(0).toInt()); + m_oplink->PairSignalStrengthBar1->setValue(linkConnected ? m_oplink->RSSI->text().toInt() : -127); m_oplink->PairSignalStrengthLabel1->setText(QString("%1dB").arg(m_oplink->PairSignalStrengthBar1->value())); - pairid = pairIdField->getValue(1).toUInt(); - bound = (pairid == boundPairId); - m_oplink->PairID2->setText(QString::number(pairid, 16).toUpper()); - m_oplink->PairID2->setEnabled(false); - m_oplink->Bind2->setText(bound ? tr("Unbind") : tr("Bind")); - m_oplink->Bind2->setEnabled(pairid && modemEnabled); - m_oplink->PairSignalStrengthBar2->setValue(((bound && !linkConnected) || !modemEnabled) ? -127 : pairRssiField->getValue(1).toInt()); - m_oplink->PairSignalStrengthLabel2->setText(QString("%1dB").arg(m_oplink->PairSignalStrengthBar2->value())); - - pairid = pairIdField->getValue(2).toUInt(); - bound = (pairid == boundPairId); - m_oplink->PairID3->setText(QString::number(pairid, 16).toUpper()); - m_oplink->PairID3->setEnabled(false); - m_oplink->Bind3->setText(bound ? tr("Unbind") : tr("Bind")); - m_oplink->Bind3->setEnabled(pairid && modemEnabled); - m_oplink->PairSignalStrengthBar3->setValue(((bound && !linkConnected) || !modemEnabled) ? -127 : pairRssiField->getValue(2).toInt()); - m_oplink->PairSignalStrengthLabel3->setText(QString("%1dB").arg(m_oplink->PairSignalStrengthBar3->value())); - - pairid = pairIdField->getValue(3).toUInt(); - bound = (pairid == boundPairId); - m_oplink->PairID4->setText(QString::number(pairid, 16).toUpper()); - m_oplink->PairID4->setEnabled(false); - m_oplink->Bind4->setText(bound ? tr("Unbind") : tr("Bind")); - m_oplink->Bind4->setEnabled(pairid && modemEnabled); - m_oplink->PairSignalStrengthBar4->setValue(((bound && !linkConnected) || !modemEnabled) ? -127 : pairRssiField->getValue(3).toInt()); - m_oplink->PairSignalStrengthLabel4->setText(QString("%1dB").arg(m_oplink->PairSignalStrengthBar4->value())); - // Update the Description field // TODO use UAVObjectUtilManager::descriptionToStructure() UAVObjectField *descField = object->getField("Description"); @@ -297,6 +250,7 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object) void ConfigOPLinkWidget::updateEnableControls() { + updateCoordID(); updateCustomDeviceID(); enableControls(true); ppmOnlyChanged(); @@ -309,32 +263,6 @@ void ConfigOPLinkWidget::disconnected() } } -void ConfigOPLinkWidget::bind() -{ - QPushButton *bindButton = qobject_cast(sender()); - - if (bindButton) { - QLineEdit *editField = NULL; - if (bindButton == m_oplink->Bind1) { - editField = m_oplink->PairID1; - } else if (bindButton == m_oplink->Bind2) { - editField = m_oplink->PairID2; - } else if (bindButton == m_oplink->Bind3) { - editField = m_oplink->PairID3; - } else if (bindButton == m_oplink->Bind4) { - editField = m_oplink->PairID4; - } - Q_ASSERT(editField); - bool ok; - quint32 pairid = editField->text().toUInt(&ok, 16); - if (ok) { - quint32 boundPairId = m_oplink->CoordID->text().toUInt(&ok, 16); - (pairid != boundPairId) ? m_oplink->CoordID->setText(QString::number(pairid, 16).toUpper()) : m_oplink->CoordID->setText("0"); - } - QMessageBox::information(this, tr("Information"), tr("To apply the changes when binding/unbinding the board must be rebooted or power cycled."), QMessageBox::Ok); - } -} - void ConfigOPLinkWidget::ppmOnlyChanged() { bool is_ppm_only = m_oplink->PPMOnly->isChecked(); @@ -388,13 +316,26 @@ void ConfigOPLinkWidget::channelChanged(bool isMax) m_oplink->MaxFreq->setText("(" + QString::number(maxFrequency, 'f', 3) + " MHz)"); } +void ConfigOPLinkWidget::updateCoordID() +{ + bool is_coordinator = m_oplink->Coordinator->isChecked(); + bool coordinatorNotSet = (m_oplink->CoordID->text() == "0"); + + if (settingsUpdated && coordinatorNotSet) { + m_oplink->CoordID->clear(); + m_oplink->CoordID->setPlaceholderText("SetCoordID"); + } + m_oplink->CoordID->setVisible(!is_coordinator); + m_oplink->CoordIDLabel->setVisible(!is_coordinator); +} + void ConfigOPLinkWidget::updateCustomDeviceID() { bool customDeviceIDNotSet = (m_oplink->CustomDeviceID->text() == "0"); if (settingsUpdated && customDeviceIDNotSet) { m_oplink->CustomDeviceID->clear(); - m_oplink->CustomDeviceID->setPlaceholderText(m_oplink->DeviceID->text()); + m_oplink->CustomDeviceID->setPlaceholderText("AutoGenerated"); } } /** diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.h b/ground/gcs/src/plugins/config/configoplinkwidget.h index 620b1c52d..feeb529aa 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.h +++ b/ground/gcs/src/plugins/config/configoplinkwidget.h @@ -62,10 +62,10 @@ protected: private slots: void disconnected(); - void bind(); void ppmOnlyChanged(); void minChannelChanged(); void maxChannelChanged(); + void updateCoordID(); void updateCustomDeviceID(); void channelChanged(bool isMax); }; diff --git a/ground/gcs/src/plugins/config/oplink.ui b/ground/gcs/src/plugins/config/oplink.ui index db795b7ce..9a03a10ad 100644 --- a/ground/gcs/src/plugins/config/oplink.ui +++ b/ground/gcs/src/plugins/config/oplink.ui @@ -54,303 +54,6 @@ - - - - Remote modems - - - - - - - 50 - false - - - - -100dB - - - - - - - -127 - - - 0 - - - 0 - - - false - - - %v dBm - - - - - - - - 50 - false - - - - -100dB - - - - - - - - 100 - 16777215 - - - - - 50 - false - - - - - - - - -127 - - - 0 - - - 0 - - - false - - - %v dBm - - - - - - - - 100 - 16777215 - - - - - 50 - false - - - - - - - - -127 - - - 0 - - - -127 - - - false - - - %v dBm - - - - - - - - 50 - false - - - - -100dB - - - - - - - -127 - - - 0 - - - 0 - - - false - - - %v dBm - - - - - - - - 50 - false - - - - -100dB - - - - - - - - 100 - 16777215 - - - - - 50 - false - - - - - - - - - 100 - 16777215 - - - - - 50 - false - - - - 12345678 - - - - - - - - 50 - false - - - - Bind - - - - - - - - 50 - false - - - - Bind - - - - - - - - 50 - false - - - - Bind - - - - - - - - 50 - false - - - - Bind - - - - - - - - 50 - false - - - - Qt::LeftToRight - - - Coordinator ID - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 100 - 16777215 - - - - - 50 - false - - - - <html><head/><body><p>This is the coordinator id we currently are bound to.</p><p>To manually bind to a specific coordinator, just type</p><p>or paste its device id in this box and save.</p><p>The device must be rebooted for the binding to take place.</p></body></html> - - - 8 - - - - - - @@ -1441,7 +1144,7 @@ - + 0 0 @@ -1456,209 +1159,7 @@ Configuration - - - - - 50 - false - - - - This modem will be a coordinator and other modems will bind to it. - - - Coordinator - - - - - - - Com speed in bps. - - - - - - - - 50 - false - - - - Com Speed - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - VCP Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the flexi port - - - - - - - - 50 - false - - - - Main Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the main port - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the USB virtual com port - - - - - - - - - - - 16777215 - 16777215 - - - - Set the maximum TX output power the modem will use (mW) - - - Qt::LeftToRight - - - 0 - - - - - - - - 50 - false - - - - Max Power - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 60 - 16777215 - - - - - 50 - false - - - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - - - 250 - - - - - - - - 50 - false - - - - FlexiIO Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Flexi Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + @@ -1680,8 +1181,54 @@ - - + + + + Com speed in bps. + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the main port + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the USB virtual com port + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the flexi port + + + + + 50 @@ -1689,15 +1236,37 @@ - Max Chan + FlexiIO Port Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + + + + + 50 + false + + + + Flexi Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 0 + 0 + + 50 @@ -1712,7 +1281,7 @@ - + @@ -1725,58 +1294,7 @@ - - - - - 50 - false - - - - false - - - If selected, data will only be transmitted from the coordinator to the Rx modem. - - - One-Way - - - - - - - - 50 - false - - - - Only PPM packets will be transmitted. - - - PPM Only - - - - - - - - 50 - false - - - - PPM packets will be received by this modem. Must be selected if Coordinator modem is configured for PPM. - - - PPM - - - - + @@ -1789,7 +1307,242 @@ - + + + + + + + + 60 + 16777215 + + + + + 50 + false + + + + Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. + + + 250 + + + + + + + + 50 + false + + + + VCP Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Com Speed + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Main Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Set the maximum TX output power the modem will use (mW) +0 to disable the modem. + + + Qt::LeftToRight + + + 0 + + + + + + + + 50 + false + + + + Max Power + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Max Chan + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Only PPM packets will be transmitted and baudrate is set to 9600bauds by default + + + PPM Only + + + + + + + + 50 + false + + + + This modem will be a coordinator and other modems will bind to it. + + + Coordinator + + + + + + + + 50 + false + + + + Qt::LeftToRight + + + Coordinator ID + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 110 + 16777215 + + + + + 50 + false + + + + <html><head/><body><p>This is the coordinator id we currently are bound to.</p><p>To manually bind to a specific coordinator, just type</p><p>or paste its device id in this box and save.</p><p>The device must be rebooted for the binding to take place.</p></body></html> + + + 8 + + + FFFFFFFF + + + Qt::LogicalMoveStyle + + + false + + + + + + + + 50 + false + + + + Device ID + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + @@ -1799,7 +1552,7 @@ - 101 + 110 16777215 @@ -1837,8 +1590,81 @@ Leave blank for Device ID autogenerated. - - + + + + + 50 + false + + + + false + + + If selected, data will only be transmitted from the coordinator to the Rx modem. + + + One-Way + + + + + + + + 50 + false + + + + PPM packets will be received by this modem. +Must be selected if Coordinator modem is configured for PPM. + + + PPM + + + + + + + + + + + 0 + 0 + + + + Remote modem + + + + + + RX level + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + 50 @@ -1846,13 +1672,69 @@ Leave blank for Device ID autogenerated. - Device ID + -100dB - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignCenter + + + + + + + 0 + 0 + + + + + 30 + 16777215 + + + + + 0 + 0 + + + + Qt::RightToLeft + + + false + + + -127 + + + 0 + + + -127 + + + Qt::AlignCenter + + + false + + + Qt::Vertical + + + false + + + %v dBm + + + + + @@ -1953,10 +1835,6 @@ Leave blank for Device ID autogenerated. - PairID1 - PairID2 - PairID3 - PairID4 FirmwareVersion SerialNumber Apply From 553f2e90bba5e01eebf8e259b916bdb57d17f9a7 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Thu, 21 Apr 2016 14:11:49 +0200 Subject: [PATCH 3/3] LP-292 Move Rx level to the right, fix alignements and typos. --- .../src/plugins/config/configoplinkwidget.cpp | 57 +- .../src/plugins/config/configoplinkwidget.h | 1 + ground/gcs/src/plugins/config/oplink.ui | 1145 +++++++++-------- 3 files changed, 684 insertions(+), 519 deletions(-) diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index 0a744de04..8fea81c2f 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -216,7 +216,7 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object) m_oplink->VCPPortLabel->setVisible(false); m_oplink->FlexiIOPort->setVisible(false); m_oplink->FlexiIOPortLabel->setVisible(false); - m_oplink->PPM->setVisible(true); + m_oplink->PPM->setEnabled(true); break; case 0x03: // OPLinkMini m_oplink->MainPort->setVisible(true); @@ -227,7 +227,9 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object) m_oplink->VCPPortLabel->setVisible(true); m_oplink->FlexiIOPort->setVisible(false); m_oplink->FlexiIOPortLabel->setVisible(false); - m_oplink->PPM->setVisible(false); + m_oplink->PPM->setEnabled(false); + connect(m_oplink->MainPort, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePPMOptions())); + connect(m_oplink->FlexiPort, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePPMOptions())); break; case 0x0A: // OPLink? m_oplink->MainPort->setVisible(true); @@ -238,7 +240,9 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object) m_oplink->VCPPortLabel->setVisible(true); m_oplink->FlexiIOPort->setVisible(true); m_oplink->FlexiIOPortLabel->setVisible(true); - m_oplink->PPM->setVisible(false); + m_oplink->PPM->setEnabled(false); + connect(m_oplink->MainPort, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePPMOptions())); + connect(m_oplink->FlexiPort, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePPMOptions())); break; default: // This shouldn't happen. @@ -250,9 +254,10 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object) void ConfigOPLinkWidget::updateEnableControls() { - updateCoordID(); - updateCustomDeviceID(); enableControls(true); + updatePPMOptions(); + updateCustomDeviceID(); + updateCoordID(); ppmOnlyChanged(); } @@ -263,11 +268,45 @@ void ConfigOPLinkWidget::disconnected() } } +void ConfigOPLinkWidget::updatePPMOptions() +{ + bool is_oplm = m_oplink->MainPort->isVisible(); + + if (!is_oplm) { + return; + } + + bool is_coordinator = m_oplink->Coordinator->isChecked(); + bool is_ppm_active = ((isComboboxOptionSelected(m_oplink->MainPort, OPLinkSettings::MAINPORT_PPM)) || + (isComboboxOptionSelected(m_oplink->FlexiPort, OPLinkSettings::FLEXIPORT_PPM))); + + m_oplink->PPM->setEnabled(false); + m_oplink->PPM->setChecked(is_ppm_active); + m_oplink->PPMOnly->setEnabled(is_ppm_active); + + if (!is_ppm_active) { + m_oplink->PPMOnly->setChecked(false); + QString selectPort = tr("Please select a port for PPM function."); + m_oplink->PPMOnly->setToolTip(selectPort); + m_oplink->PPM->setToolTip(selectPort); + } else { + if (is_coordinator) { + m_oplink->PPMOnly->setToolTip(tr("Only PPM packets will be transmitted and baudrate set to 9600 bauds by default.")); + m_oplink->PPM->setToolTip(tr("PPM packets will be transmitted by this modem.")); + } else { + m_oplink->PPMOnly->setToolTip(tr("Only PPM packets will be received and baudrate set to 9600 bauds by default.")); + m_oplink->PPM->setToolTip(tr("PPM packets will be received by this modem.")); + } + } +} + + void ConfigOPLinkWidget::ppmOnlyChanged() { bool is_ppm_only = m_oplink->PPMOnly->isChecked(); + bool is_oplm = m_oplink->MainPort->isVisible(); - m_oplink->PPM->setEnabled(!is_ppm_only); + m_oplink->PPM->setEnabled(!is_ppm_only && !is_oplm); m_oplink->OneWayLink->setEnabled(!is_ppm_only); m_oplink->ComSpeed->setEnabled(!is_ppm_only); } @@ -323,10 +362,8 @@ void ConfigOPLinkWidget::updateCoordID() if (settingsUpdated && coordinatorNotSet) { m_oplink->CoordID->clear(); - m_oplink->CoordID->setPlaceholderText("SetCoordID"); } - m_oplink->CoordID->setVisible(!is_coordinator); - m_oplink->CoordIDLabel->setVisible(!is_coordinator); + m_oplink->CoordID->setEnabled(!is_coordinator); } void ConfigOPLinkWidget::updateCustomDeviceID() @@ -335,7 +372,7 @@ void ConfigOPLinkWidget::updateCustomDeviceID() if (settingsUpdated && customDeviceIDNotSet) { m_oplink->CustomDeviceID->clear(); - m_oplink->CustomDeviceID->setPlaceholderText("AutoGenerated"); + m_oplink->CustomDeviceID->setPlaceholderText("AutoGen"); } } /** diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.h b/ground/gcs/src/plugins/config/configoplinkwidget.h index feeb529aa..ce0cc6643 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.h +++ b/ground/gcs/src/plugins/config/configoplinkwidget.h @@ -62,6 +62,7 @@ protected: private slots: void disconnected(); + void updatePPMOptions(); void ppmOnlyChanged(); void minChannelChanged(); void maxChannelChanged(); diff --git a/ground/gcs/src/plugins/config/oplink.ui b/ground/gcs/src/plugins/config/oplink.ui index 9a03a10ad..c09733857 100644 --- a/ground/gcs/src/plugins/config/oplink.ui +++ b/ground/gcs/src/plugins/config/oplink.ui @@ -18,7 +18,7 @@ - OPLink configuration + OPLink Configuration @@ -36,7 +36,7 @@ 0 - + QFrame::NoFrame @@ -54,7 +54,20 @@ - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -62,6 +75,12 @@ 0 + + + 1050 + 16777215 + + 50 @@ -168,7 +187,7 @@ - The modems current state + The modems current state. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -860,7 +879,7 @@ - Tx Failure + TX Failure Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -1141,495 +1160,7 @@ - - - - - 0 - 0 - - - - - 50 - false - - - - Configuration - - - - - - - 60 - 16777215 - - - - - 50 - false - - - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - - - 250 - - - - - - - Com speed in bps. - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the main port - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the USB virtual com port - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the flexi port - - - - - - - - 50 - false - - - - FlexiIO Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Flexi Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 50 - false - - - - Min Chan - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 110 - 16777215 - - - - 430.000 (MHz) - - - - - - - - 110 - 16777215 - - - - 440.000 (MHz) - - - - - - - - - - - 60 - 16777215 - - - - - 50 - false - - - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - - - 250 - - - - - - - - 50 - false - - - - VCP Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Com Speed - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Main Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Set the maximum TX output power the modem will use (mW) -0 to disable the modem. - - - Qt::LeftToRight - - - 0 - - - - - - - - 50 - false - - - - Max Power - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 50 - false - - - - Max Chan - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Only PPM packets will be transmitted and baudrate is set to 9600bauds by default - - - PPM Only - - - - - - - - 50 - false - - - - This modem will be a coordinator and other modems will bind to it. - - - Coordinator - - - - - - - - 50 - false - - - - Qt::LeftToRight - - - Coordinator ID - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 110 - 16777215 - - - - - 50 - false - - - - <html><head/><body><p>This is the coordinator id we currently are bound to.</p><p>To manually bind to a specific coordinator, just type</p><p>or paste its device id in this box and save.</p><p>The device must be rebooted for the binding to take place.</p></body></html> - - - 8 - - - FFFFFFFF - - - Qt::LogicalMoveStyle - - - false - - - - - - - - 50 - false - - - - Device ID - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 110 - 16777215 - - - - - 50 - false - - - - Enter your custom ID for this device as hexadecimal value, -this allow device clones. Be sure only one same Device ID transmit once! -Leave blank for Device ID autogenerated. - - - 8 - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - AA00FF99 - - - Qt::LogicalMoveStyle - - - false - - - - - - - - 50 - false - - - - false - - - If selected, data will only be transmitted from the coordinator to the Rx modem. - - - One-Way - - - - - - - - 50 - false - - - - PPM packets will be received by this modem. -Must be selected if Coordinator modem is configured for PPM. - - - PPM - - - - - - - + @@ -1637,20 +1168,19 @@ Must be selected if Coordinator modem is configured for PPM. 0 + + + 150 + 16777215 + + - Remote modem + RX Level + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - RX level - - - Qt::AlignCenter - - - @@ -1661,7 +1191,7 @@ Must be selected if Coordinator modem is configured for PPM. - 0 + 100 0 @@ -1684,7 +1214,7 @@ Must be selected if Coordinator modem is configured for PPM. - + 0 0 @@ -1738,6 +1268,603 @@ Must be selected if Coordinator modem is configured for PPM. + + + + true + + + + 0 + 0 + + + + + 900 + 16777215 + + + + + 50 + false + + + + Configuration + + + + + + Com speed in bps. + + + + + + + + 50 + false + + + + FlexiIO Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the main port. + + + + + + + + 16777215 + 16777215 + + + + Set the maximum TX output power the modem will use (mW) +0 to disable the modem. + + + Qt::LeftToRight + + + 0 + + + + + + + + 50 + false + + + + Main Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Max Power + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Com Speed + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 50 + false + + + + Only PPM packets will be transmitted and baudrate set to 9600bauds by default. + + + PPM Only + + + + + + + + 0 + 0 + + + + + 50 + false + + + + PPM packets will be received by this modem. +Must be selected if Coordinator modem is configured for PPM. + + + PPM + + + + + + + + 50 + false + + + + Qt::LeftToRight + + + Coordinator ID + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Device ID + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 90 + 16777215 + + + + + 50 + false + + + + 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 + + + AA00FF99 + + + Qt::LogicalMoveStyle + + + false + + + + + + + + 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 + + + + + 50 + false + + + + false + + + If selected, data will only be transmitted from the coordinator to the Rx modem. + + + One-Way + + + + + + + + 0 + 0 + + + + + 0 + 32 + + + + + 50 + false + + + + This modem will be a coordinator and other modems will bind to it. + + + Coordinator + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the flexi port. + + + + + + + + 50 + false + + + + Flexi Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the USB virtual com port. + + + + + + + + 50 + false + + + + VCP Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + + 50 + false + + + + Max Chan + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + + 50 + false + + + + Min Chan + + + 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) + + + + + + + + + + + + 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::Horizontal + + + + 40 + 20 + + + + + + + @@ -1810,7 +1937,7 @@ Must be selected if Coordinator modem is configured for PPM. - Send settings to the board but do not save to the non-volatile memory + Send settings to the board but do not save to the non-volatile memory. Apply @@ -1820,7 +1947,7 @@ Must be selected if Coordinator modem is configured for PPM. - Send settings to the board and save to the non-volatile memory + Send settings to the board and save to the non-volatile memory. Save