1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Merged in f5soh/librepilot/LP-151_Settable_DeviceID (pull request #227)

LP-151 OPLink: Allow custom Device ID or auto generated.
This commit is contained in:
Alessio Morale 2016-05-02 22:38:36 +02:00
commit 953310ad81
10 changed files with 877 additions and 768 deletions

View File

@ -7,7 +7,8 @@
* @{ * @{
* *
* @file pios_rfm22b.c * @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 * @brief Implements a driver the the RFM22B driver
* @see The GNU Public License (GPL) Version 3 * @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 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 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 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_updatePairStatus(struct pios_rfm22b_dev *radio_dev);
static void rfm22_updateStats(struct pios_rfm22b_dev *rfm22b_dev); static void rfm22_updateStats(struct pios_rfm22b_dev *rfm22b_dev);
static bool rfm22_checkTimeOut(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 // Create a semaphore to know if an ISR needs responding to
vSemaphoreCreateBinary(rfm22b_dev->isrPending); vSemaphoreCreateBinary(rfm22b_dev->isrPending);
// Create our (hopefully) unique 32 bit id from the processor serial number. // Create default (hopefully) unique 32 bit id from the processor serial number.
uint8_t crcs[] = { 0, 0, 0, 0 }; rfm22_generateDeviceID(rfm22b_dev);
{
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);
// Initialize the external interrupt. // Initialize the external interrupt.
PIOS_EXTI_Init(cfg->exti_cfg); PIOS_EXTI_Init(cfg->exti_cfg);
@ -510,6 +502,26 @@ bool PIOS_RFM22_EXT_Int(void)
return false; 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. * 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; 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 * Read the RFM22B interrupt and device status registers
* *

View File

@ -7,7 +7,8 @@
* @{ * @{
* *
* @file pios_rfm22b.h * @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. * @brief RFM22B functions header.
* @see The GNU Public License (GPL) Version 3 * @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_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_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_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 uint32_t PIOS_RFM22B_DeviceID(uint32_t rfb22b_id);
extern void PIOS_RFM22B_GetStats(uint32_t rfm22b_id, struct rfm22b_stats *stats); 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); extern uint8_t PIOS_RFM22B_GetPairStats(uint32_t rfm22b_id, uint32_t *device_ids, int8_t *RSSIs, uint8_t max_pairs);

View File

@ -674,7 +674,7 @@ struct pios_rfm22b_dev {
// The device ID // The device ID
uint32_t deviceID; 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; uint32_t coordinatorID;
// The task handle // The task handle

View File

@ -1,8 +1,9 @@
/** /**
****************************************************************************** ******************************************************************************
* @file pios_board.c * @file pios_board.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011. * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
* PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
* @addtogroup OpenPilotSystem OpenPilot System * @addtogroup OpenPilotSystem OpenPilot System
* @{ * @{
* @addtogroup OpenPilotCore OpenPilot Core * @addtogroup OpenPilotCore OpenPilot Core
@ -804,6 +805,7 @@ void PIOS_Board_Init(void)
} }
/* Set the radio configuration parameters. */ /* 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_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); 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); 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) { switch (oplinkSettings.MaxRFPower) {
case OPLINKSETTINGS_MAXRFPOWER_125: case OPLINKSETTINGS_MAXRFPOWER_125:
PIOS_RFM22B_SetTxPower(pios_rfm22b_id, RFM22_tx_pwr_txpow_0); PIOS_RFM22B_SetTxPower(pios_rfm22b_id, RFM22_tx_pwr_txpow_0);

View File

@ -6,7 +6,8 @@
* @{ * @{
* *
* @file pios_board.c * @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. * @brief Defines board specific static initializers for hardware for the OpenPilot board.
* @see The GNU Public License (GPL) Version 3 * @see The GNU Public License (GPL) Version 3
* *
@ -406,7 +407,7 @@ void PIOS_Board_Init(void)
break; break;
} }
/* Set the modem Tx poer level */ /* Set the modem Tx power level */
switch (oplinkSettings.MaxRFPower) { switch (oplinkSettings.MaxRFPower) {
case OPLINKSETTINGS_MAXRFPOWER_125: case OPLINKSETTINGS_MAXRFPOWER_125:
PIOS_RFM22B_SetTxPower(pios_rfm22b_id, RFM22_tx_pwr_txpow_0); 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. // Set the radio configuration parameters.
PIOS_RFM22B_SetDeviceID(pios_rfm22b_id, oplinkSettings.CustomDeviceID);
PIOS_RFM22B_SetCoordinatorID(pios_rfm22b_id, oplinkSettings.CoordID); 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); 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); 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); PIOS_RFM22B_Reinit(pios_rfm22b_id);
} else { } else {
oplinkStatus.LinkState = OPLINKSTATUS_LINKSTATE_DISABLED; oplinkStatus.LinkState = OPLINKSTATUS_LINKSTATE_DISABLED;

View File

@ -1,7 +1,7 @@
/** /**
****************************************************************************** ******************************************************************************
* @file pios_board.c * @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. * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
* PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012 * PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
* @addtogroup OpenPilotSystem OpenPilot System * @addtogroup OpenPilotSystem OpenPilot System
@ -885,6 +885,7 @@ void PIOS_Board_Init(void)
} }
/* Set the radio configuration parameters. */ /* Set the radio configuration parameters. */
PIOS_RFM22B_SetDeviceID(pios_rfm22b_id, oplinkSettings.CustomDeviceID);
PIOS_RFM22B_SetCoordinatorID(pios_rfm22b_id, oplinkSettings.CoordID); 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); 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); 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) { switch (oplinkSettings.MaxRFPower) {
case OPLINKSETTINGS_MAXRFPOWER_125: case OPLINKSETTINGS_MAXRFPOWER_125:
PIOS_RFM22B_SetTxPower(pios_rfm22b_id, RFM22_tx_pwr_txpow_0); PIOS_RFM22B_SetTxPower(pios_rfm22b_id, RFM22_tx_pwr_txpow_0);

View File

@ -1,14 +1,14 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file configtxpidswidget.cpp * @file configoplinkwidget.cpp
* @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) 2012. * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins * @addtogroup GCSPlugins GCS Plugins
* @{ * @{
* @addtogroup ConfigPlugin Config Plugin * @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 * 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", "PPMOnly", m_oplink->PPMOnly);
addWidgetBinding("OPLinkSettings", "PPM", m_oplink->PPM); addWidgetBinding("OPLinkSettings", "PPM", m_oplink->PPM);
addWidgetBinding("OPLinkSettings", "ComSpeed", m_oplink->ComSpeed); addWidgetBinding("OPLinkSettings", "ComSpeed", m_oplink->ComSpeed);
addWidgetBinding("OPLinkSettings", "CustomDeviceID", m_oplink->CustomDeviceID);
addWidgetBinding("OPLinkStatus", "DeviceID", m_oplink->DeviceID); addWidgetBinding("OPLinkStatus", "DeviceID", m_oplink->DeviceID);
addWidgetBinding("OPLinkStatus", "RxGood", m_oplink->Good); addWidgetBinding("OPLinkStatus", "RxGood", m_oplink->Good);
@ -102,16 +103,15 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren
addWidgetBinding("OPLinkStatus", "RXPacketRate", m_oplink->RXPacketRate); addWidgetBinding("OPLinkStatus", "RXPacketRate", m_oplink->RXPacketRate);
addWidgetBinding("OPLinkStatus", "TXPacketRate", m_oplink->TXPacketRate); 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 the selection changed signals.
connect(m_oplink->PPMOnly, SIGNAL(toggled(bool)), this, SLOT(ppmOnlyChanged())); 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->MinimumChannel, SIGNAL(valueChanged(int)), this, SLOT(minChannelChanged()));
connect(m_oplink->MaximumChannel, SIGNAL(valueChanged(int)), this, SLOT(maxChannelChanged())); 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->MinimumChannel->setKeyboardTracking(false);
m_oplink->MaximumChannel->setKeyboardTracking(false); m_oplink->MaximumChannel->setKeyboardTracking(false);
@ -144,53 +144,10 @@ void ConfigOPLinkWidget::updateStatus(UAVObject *object)
UAVObjectField *linkField = object->getField("LinkState"); UAVObjectField *linkField = object->getField("LinkState");
m_oplink->LinkState->setText(linkField->getValue().toString()); m_oplink->LinkState->setText(linkField->getValue().toString());
bool linkConnected = (linkField->getValue() == linkField->getOptions().at(OPLinkStatus::LINKSTATE_CONNECTED)); 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"); m_oplink->PairSignalStrengthBar1->setValue(linkConnected ? m_oplink->RSSI->text().toInt() : -127);
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->PairSignalStrengthLabel1->setText(QString("%1dB").arg(m_oplink->PairSignalStrengthBar1->value())); 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 // Update the Description field
// TODO use UAVObjectUtilManager::descriptionToStructure() // TODO use UAVObjectUtilManager::descriptionToStructure()
UAVObjectField *descField = object->getField("Description"); UAVObjectField *descField = object->getField("Description");
@ -247,7 +204,6 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object)
if (!settingsUpdated) { if (!settingsUpdated) {
settingsUpdated = true; settingsUpdated = true;
// Enable components based on the board type connected. // Enable components based on the board type connected.
UAVObjectField *board_type_field = oplinkStatusObj->getField("BoardType"); UAVObjectField *board_type_field = oplinkStatusObj->getField("BoardType");
switch (board_type_field->getValue().toInt()) { switch (board_type_field->getValue().toInt()) {
@ -260,7 +216,7 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object)
m_oplink->VCPPortLabel->setVisible(false); m_oplink->VCPPortLabel->setVisible(false);
m_oplink->FlexiIOPort->setVisible(false); m_oplink->FlexiIOPort->setVisible(false);
m_oplink->FlexiIOPortLabel->setVisible(false); m_oplink->FlexiIOPortLabel->setVisible(false);
m_oplink->PPM->setVisible(true); m_oplink->PPM->setEnabled(true);
break; break;
case 0x03: // OPLinkMini case 0x03: // OPLinkMini
m_oplink->MainPort->setVisible(true); m_oplink->MainPort->setVisible(true);
@ -271,7 +227,9 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object)
m_oplink->VCPPortLabel->setVisible(true); m_oplink->VCPPortLabel->setVisible(true);
m_oplink->FlexiIOPort->setVisible(false); m_oplink->FlexiIOPort->setVisible(false);
m_oplink->FlexiIOPortLabel->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; break;
case 0x0A: // OPLink? case 0x0A: // OPLink?
m_oplink->MainPort->setVisible(true); m_oplink->MainPort->setVisible(true);
@ -282,7 +240,9 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object)
m_oplink->VCPPortLabel->setVisible(true); m_oplink->VCPPortLabel->setVisible(true);
m_oplink->FlexiIOPort->setVisible(true); m_oplink->FlexiIOPort->setVisible(true);
m_oplink->FlexiIOPortLabel->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; break;
default: default:
// This shouldn't happen. // This shouldn't happen.
@ -295,6 +255,9 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object)
void ConfigOPLinkWidget::updateEnableControls() void ConfigOPLinkWidget::updateEnableControls()
{ {
enableControls(true); enableControls(true);
updatePPMOptions();
updateCustomDeviceID();
updateCoordID();
ppmOnlyChanged(); ppmOnlyChanged();
} }
@ -305,37 +268,45 @@ void ConfigOPLinkWidget::disconnected()
} }
} }
void ConfigOPLinkWidget::bind() void ConfigOPLinkWidget::updatePPMOptions()
{ {
QPushButton *bindButton = qobject_cast<QPushButton *>(sender()); bool is_oplm = m_oplink->MainPort->isVisible();
if (bindButton) { if (!is_oplm) {
QLineEdit *editField = NULL; return;
if (bindButton == m_oplink->Bind1) { }
editField = m_oplink->PairID1;
} else if (bindButton == m_oplink->Bind2) { bool is_coordinator = m_oplink->Coordinator->isChecked();
editField = m_oplink->PairID2; bool is_ppm_active = ((isComboboxOptionSelected(m_oplink->MainPort, OPLinkSettings::MAINPORT_PPM)) ||
} else if (bindButton == m_oplink->Bind3) { (isComboboxOptionSelected(m_oplink->FlexiPort, OPLinkSettings::FLEXIPORT_PPM)));
editField = m_oplink->PairID3;
} else if (bindButton == m_oplink->Bind4) { m_oplink->PPM->setEnabled(false);
editField = m_oplink->PairID4; 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."));
} }
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() void ConfigOPLinkWidget::ppmOnlyChanged()
{ {
bool is_ppm_only = m_oplink->PPMOnly->isChecked(); 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->OneWayLink->setEnabled(!is_ppm_only);
m_oplink->ComSpeed->setEnabled(!is_ppm_only); m_oplink->ComSpeed->setEnabled(!is_ppm_only);
} }
@ -384,6 +355,26 @@ void ConfigOPLinkWidget::channelChanged(bool isMax)
m_oplink->MaxFreq->setText("(" + QString::number(maxFrequency, 'f', 3) + " MHz)"); 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->setEnabled(!is_coordinator);
}
void ConfigOPLinkWidget::updateCustomDeviceID()
{
bool customDeviceIDNotSet = (m_oplink->CustomDeviceID->text() == "0");
if (settingsUpdated && customDeviceIDNotSet) {
m_oplink->CustomDeviceID->clear();
m_oplink->CustomDeviceID->setPlaceholderText("AutoGen");
}
}
/** /**
@} @}
@} @}

View File

@ -1,13 +1,14 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file configpipxtremewidget.h * @file configoplinkwidget.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.
* @addtogroup GCSPlugins GCS Plugins * @addtogroup GCSPlugins GCS Plugins
* @{ * @{
* @addtogroup ConfigPlugin Config Plugin * @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 * 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., * with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef CONFIGPIPXTREMEWIDGET_H #ifndef CONFIGOPLINKWIDGET_H
#define CONFIGPIPXTREMEWIDGET_H #define CONFIGOPLINKWIDGET_H
#include "configtaskwidget.h" #include "configtaskwidget.h"
@ -61,11 +62,13 @@ protected:
private slots: private slots:
void disconnected(); void disconnected();
void bind(); void updatePPMOptions();
void ppmOnlyChanged(); void ppmOnlyChanged();
void minChannelChanged(); void minChannelChanged();
void maxChannelChanged(); void maxChannelChanged();
void updateCoordID();
void updateCustomDeviceID();
void channelChanged(bool isMax); void channelChanged(bool isMax);
}; };
#endif // CONFIGTXPIDWIDGET_H #endif // CONFIGOPLINKWIDGET_H

View File

@ -18,7 +18,7 @@
<widget class="QTabWidget" name="tabWidget_3"> <widget class="QTabWidget" name="tabWidget_3">
<widget class="QWidget" name="tabWidget_3Page1"> <widget class="QWidget" name="tabWidget_3Page1">
<attribute name="title"> <attribute name="title">
<string>OPLink configuration</string> <string>OPLink Configuration</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin"> <property name="leftMargin">
@ -36,7 +36,7 @@
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0" colspan="2"> <item row="0" column="0">
<widget class="QScrollArea" name="scrollArea"> <widget class="QScrollArea" name="scrollArea">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
@ -54,658 +54,20 @@
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="1"> <item row="0" column="3">
<widget class="QGroupBox" name="groupBox"> <spacer name="horizontalSpacer_3">
<property name="sizePolicy"> <property name="orientation">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <enum>Qt::Horizontal</enum>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="font"> <property name="sizeHint" stdset="0">
<font> <size>
<weight>50</weight> <width>40</width>
<bold>false</bold> <height>20</height>
</font> </size>
</property> </property>
<property name="title"> </spacer>
<string>Configuration</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="4" column="4">
<widget class="QComboBox" name="ComSpeed">
<property name="statusTip">
<string>Com speed in bps.</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="ComSpeedLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Com Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="3">
<widget class="QLabel" name="VCPPortLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>VCP Port</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="4">
<widget class="QComboBox" name="FlexiPort">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Choose the function for the flexi port</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QLabel" name="MainPortLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Main Port</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QComboBox" name="MainPort">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Choose the function for the main port</string>
</property>
</widget>
</item>
<item row="9" column="4">
<widget class="QComboBox" name="VCPPort">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Choose the function for the USB virtual com port</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QComboBox" name="MaxRFTxPower">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the maximum TX output power the modem will use (mW)</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="modelColumn">
<number>0</number>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="MaxRFTxPowerLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Max Power</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="10" column="4">
<widget class="QComboBox" name="FlexiIOPort"/>
</item>
<item row="10" column="3">
<widget class="QLabel" name="FlexiIOPortLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>FlexiIO Port</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="MaximumChannel">
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz.</string>
</property>
<property name="maximum">
<number>250</number>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QLabel" name="FlexiPortLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Flexi Port</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="MaximumChannelLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Max Chan</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="MinimumChannelLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Min Chan</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QSpinBox" name="MinimumChannel">
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz.</string>
</property>
<property name="maximum">
<number>250</number>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<widget class="QCheckBox" name="Coordinator">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="statusTip">
<string>This modem will be a coordinator and other modems will bind to it.</string>
</property>
<property name="text">
<string>Coordinator</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="MaxFreq">
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>440.000 (MHz)</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="MinFreq">
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>430.000 (MHz)</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="OneWayLink">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="statusTip">
<string>If selected, data will only be transmitted from the coordinator to the Rx modem.</string>
</property>
<property name="text">
<string>One-Way</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="PPMOnly">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="statusTip">
<string>Only PPM packets will be transmitted.</string>
</property>
<property name="text">
<string>PPM Only</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="PPM">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="statusTip">
<string>PPM packets will be received by this modem. Must be selected if Coordinator modem is configured for PPM.</string>
</property>
<property name="text">
<string>PPM</string>
</property>
</widget>
</item>
</layout>
</widget>
</item> </item>
<item row="0" column="0"> <item row="1" column="0" colspan="3">
<widget class="QGroupBox" name="PairingGroupBox">
<property name="title">
<string>Remote modems</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="5" column="3">
<widget class="QLabel" name="PairSignalStrengthLabel4">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>-100dB</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QProgressBar" name="PairSignalStrengthBar4">
<property name="minimum">
<number>-127</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
<property name="format">
<string>%v dBm</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="PairSignalStrengthLabel2">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>-100dB</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="PairID2">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QProgressBar" name="PairSignalStrengthBar2">
<property name="minimum">
<number>-127</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
<property name="format">
<string>%v dBm</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="PairID4">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QProgressBar" name="PairSignalStrengthBar1">
<property name="minimum">
<number>-127</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>-127</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
<property name="format">
<string>%v dBm</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="PairSignalStrengthLabel1">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>-100dB</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QProgressBar" name="PairSignalStrengthBar3">
<property name="minimum">
<number>-127</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
<property name="format">
<string>%v dBm</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="PairSignalStrengthLabel3">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>-100dB</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="PairID3">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="PairID1">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="placeholderText">
<string>12345678</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="Bind2">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Bind</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="Bind1">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Bind</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="Bind4">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Bind</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="Bind3">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Bind</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="CoordIDLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Coordinator ID</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="CoordID">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is the coordinator id we currently are bound to.&lt;/p&gt;&lt;p&gt;To manually bind to a specific coordinator, just type&lt;/p&gt;&lt;p&gt;or paste its device id in this box and save.&lt;/p&gt;&lt;p&gt;The device must be rebooted for the binding to take place.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="maxLength">
<number>8</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_3"> <widget class="QGroupBox" name="groupBox_3">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -713,6 +75,12 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>1050</width>
<height>16777215</height>
</size>
</property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
@ -759,6 +127,9 @@
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
<property name="maxLength">
<number>8</number>
</property>
<property name="frame"> <property name="frame">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -769,7 +140,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="placeholderText"> <property name="placeholderText">
<string>12345678</string> <string>AA00FF99</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -816,7 +187,7 @@
</font> </font>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>The modems current state</string> <string>The modems current state.</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@ -1508,7 +879,7 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Tx Failure</string> <string>TX Failure</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -1789,6 +1160,711 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="2">
<widget class="QGroupBox" name="PairingGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>RX Level</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="PairSignalStrengthLabel1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>-100dB</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QProgressBar" name="PairSignalStrengthBar1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="minimum">
<number>-127</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>-127</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="format">
<string>%v dBm</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>900</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="title">
<string>Configuration</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="7">
<widget class="QComboBox" name="ComSpeed">
<property name="toolTip">
<string>Com speed in bps.</string>
</property>
</widget>
</item>
<item row="18" column="6">
<widget class="QLabel" name="FlexiIOPortLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>FlexiIO Port</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="7">
<widget class="QComboBox" name="MainPort">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Choose the function for the main port.</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QComboBox" name="MaxRFTxPower">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the maximum TX output power the modem will use (mW)
0 to disable the modem.</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="modelColumn">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="6">
<widget class="QLabel" name="MainPortLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Main Port</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="18" column="7">
<widget class="QComboBox" name="FlexiIOPort"/>
</item>
<item row="0" column="6">
<widget class="QLabel" name="MaxRFTxPowerLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Max Power</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QLabel" name="ComSpeedLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Com Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="PPMOnly">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>Only PPM packets will be transmitted and baudrate set to 9600bauds by default.</string>
</property>
<property name="text">
<string>PPM Only</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="PPM">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>PPM packets will be received by this modem.
Must be selected if Coordinator modem is configured for PPM.</string>
</property>
<property name="text">
<string>PPM</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="CoordIDLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Coordinator ID</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="customDeviceIDLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Device ID</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="CustomDeviceID">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>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.</string>
</property>
<property name="maxLength">
<number>8</number>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
<property name="placeholderText">
<string>AA00FF99</string>
</property>
<property name="cursorMoveStyle">
<enum>Qt::LogicalMoveStyle</enum>
</property>
<property name="clearButtonEnabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="CoordID">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>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.</string>
</property>
<property name="maxLength">
<number>8</number>
</property>
<property name="cursorMoveStyle">
<enum>Qt::LogicalMoveStyle</enum>
</property>
<property name="clearButtonEnabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="OneWayLink">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTip">
<string>If selected, data will only be transmitted from the coordinator to the Rx modem.</string>
</property>
<property name="text">
<string>One-Way</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="Coordinator">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>This modem will be a coordinator and other modems will bind to it.</string>
</property>
<property name="text">
<string>Coordinator</string>
</property>
</widget>
</item>
<item row="3" column="7">
<widget class="QComboBox" name="FlexiPort">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Choose the function for the flexi port.</string>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QLabel" name="FlexiPortLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Flexi Port</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="7">
<widget class="QComboBox" name="VCPPort">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Choose the function for the USB virtual com port.</string>
</property>
</widget>
</item>
<item row="4" column="6">
<widget class="QLabel" name="VCPPortLabel">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>VCP Port</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="MaximumChannelLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Max Chan</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="MinimumChannelLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Min Chan</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSpinBox" name="MinimumChannel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz.</string>
</property>
<property name="maximum">
<number>250</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="MinFreq">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>430.000 (MHz)</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSpinBox" name="MaximumChannel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz.</string>
</property>
<property name="maximum">
<number>250</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="MaxFreq">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>440.000 (MHz)</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
@ -1861,7 +1937,7 @@
<item> <item>
<widget class="QPushButton" name="Apply"> <widget class="QPushButton" name="Apply">
<property name="toolTip"> <property name="toolTip">
<string>Send settings to the board but do not save to the non-volatile memory</string> <string>Send settings to the board but do not save to the non-volatile memory.</string>
</property> </property>
<property name="text"> <property name="text">
<string>Apply</string> <string>Apply</string>
@ -1871,7 +1947,7 @@
<item> <item>
<widget class="QPushButton" name="Save"> <widget class="QPushButton" name="Save">
<property name="toolTip"> <property name="toolTip">
<string>Send settings to the board and save to the non-volatile memory</string> <string>Send settings to the board and save to the non-volatile memory.</string>
</property> </property>
<property name="text"> <property name="text">
<string>Save</string> <string>Save</string>
@ -1886,10 +1962,6 @@
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>PairID1</tabstop>
<tabstop>PairID2</tabstop>
<tabstop>PairID3</tabstop>
<tabstop>PairID4</tabstop>
<tabstop>FirmwareVersion</tabstop> <tabstop>FirmwareVersion</tabstop>
<tabstop>SerialNumber</tabstop> <tabstop>SerialNumber</tabstop>
<tabstop>Apply</tabstop> <tabstop>Apply</tabstop>

View File

@ -13,6 +13,7 @@
<field name="MaxRFPower" units="mW" type="enum" elements="1" options="0,1.25,1.6,3.16,6.3,12.6,25,50,100" defaultvalue="0"/> <field name="MaxRFPower" units="mW" type="enum" elements="1" options="0,1.25,1.6,3.16,6.3,12.6,25,50,100" defaultvalue="0"/>
<field name="MinChannel" units="" type="uint8" elements="1" defaultvalue="0"/> <field name="MinChannel" units="" type="uint8" elements="1" defaultvalue="0"/>
<field name="MaxChannel" units="" type="uint8" elements="1" defaultvalue="250"/> <field name="MaxChannel" units="" type="uint8" elements="1" defaultvalue="250"/>
<field name="CustomDeviceID" units="hex" type="uint32" elements="1" defaultvalue="0"/>
<access gcs="readwrite" flight="readwrite"/> <access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/> <telemetrygcs acked="true" updatemode="onchange" period="0"/>