diff --git a/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.cpp b/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.cpp index 60073eb7a..684f32b78 100644 --- a/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.cpp @@ -32,6 +32,12 @@ #include #include +// Channel range and Frequency display +static const int MAX_CHANNEL_NUM = 250; +static const int MIN_CHANNEL_RANGE = 10; +static const float FIRST_FREQUENCY = 430.000; +static const float FREQUENCY_STEP = 0.040; + ConfigPipXtremeWidget::ConfigPipXtremeWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_oplink = new Ui_OPLinkWidget(); @@ -103,6 +109,9 @@ ConfigPipXtremeWidget::ConfigPipXtremeWidget(QWidget *parent) : ConfigTaskWidget m_oplink->MinimumChannel->setKeyboardTracking(false); m_oplink->MaximumChannel->setKeyboardTracking(false); + m_oplink->MaximumChannel->setMaximum(MAX_CHANNEL_NUM); + m_oplink->MinimumChannel->setMaximum(MAX_CHANNEL_NUM - MIN_CHANNEL_RANGE); + // Request and update of the setting object. settingsUpdated = false; autoLoadWidgets(); @@ -325,48 +334,46 @@ void ConfigPipXtremeWidget::ppmOnlyChanged() void ConfigPipXtremeWidget::minChannelChanged() { - ChannelChanged(false); + channelChanged(false); } void ConfigPipXtremeWidget::maxChannelChanged() { - ChannelChanged(true); + channelChanged(true); } -void ConfigPipXtremeWidget::ChannelChanged(bool isMax) +void ConfigPipXtremeWidget::channelChanged(bool isMax) { int minChannel = m_oplink->MinimumChannel->value(); int maxChannel = m_oplink->MaximumChannel->value(); - int minimalChannelRange = 10; - - if ((maxChannel - minChannel) < minimalChannelRange) { + if ((maxChannel - minChannel) < MIN_CHANNEL_RANGE) { if (isMax) { - minChannel = maxChannel - minimalChannelRange; + minChannel = maxChannel - MIN_CHANNEL_RANGE; } else { - maxChannel = minChannel + minimalChannelRange; + maxChannel = minChannel + MIN_CHANNEL_RANGE; } - if (maxChannel > 250) { - maxChannel = 250; - minChannel = 250 - minimalChannelRange; + if (maxChannel > MAX_CHANNEL_NUM) { + maxChannel = MAX_CHANNEL_NUM; + minChannel = MAX_CHANNEL_NUM - MIN_CHANNEL_RANGE; } if (minChannel < 0) { minChannel = 0; - maxChannel = minimalChannelRange; + maxChannel = MIN_CHANNEL_RANGE; } } m_oplink->MaximumChannel->setValue(maxChannel); m_oplink->MinimumChannel->setValue(minChannel); - // Calculate and Display frequency in Mhz - float minFrequency = 430 + (minChannel * 0.040); - float maxFrequency = 430 + (maxChannel * 0.040); + // Calculate and Display frequency in MHz + float minFrequency = FIRST_FREQUENCY + (minChannel * FREQUENCY_STEP); + float maxFrequency = FIRST_FREQUENCY + (maxChannel * FREQUENCY_STEP); - m_oplink->MinFreq->setText(QString::number(minFrequency, 'f', 3) + "Mhz"); - m_oplink->MaxFreq->setText(QString::number(maxFrequency, 'f', 3) + "Mhz"); + m_oplink->MinFreq->setText("(" + QString::number(minFrequency, 'f', 3) + " MHz)"); + m_oplink->MaxFreq->setText("(" + QString::number(maxFrequency, 'f', 3) + " MHz)"); } /** diff --git a/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.h b/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.h index 1d38183e1..bd2ebd0bf 100644 --- a/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.h +++ b/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.h @@ -64,7 +64,7 @@ private slots: void ppmOnlyChanged(); void minChannelChanged(); void maxChannelChanged(); - void ChannelChanged(bool isMax); + void channelChanged(bool isMax); }; #endif // CONFIGTXPIDWIDGET_H diff --git a/ground/openpilotgcs/src/plugins/config/pipxtreme.ui b/ground/openpilotgcs/src/plugins/config/pipxtreme.ui index e9393331f..9cbe0265c 100644 --- a/ground/openpilotgcs/src/plugins/config/pipxtreme.ui +++ b/ground/openpilotgcs/src/plugins/config/pipxtreme.ui @@ -6,7 +6,7 @@ 0 0 - 834 + 971 652 @@ -49,8 +49,8 @@ 0 0 - 835 - 545 + 949 + 558 @@ -350,54 +350,6 @@ - - - - - 50 - false - - - - Only PPM packets will be transmitted. - - - PPM Only - - - - - - - - 50 - 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 - - - @@ -418,12 +370,12 @@ - 105 + 110 16777215 - 440.000Mhz + 440.000 (MHz) @@ -431,12 +383,63 @@ - 105 + 110 16777215 - 430.000Mhz + 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