mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
OP-1674 Changes from review : added constants and set limits - UI changes, Freq close to channel number.
This commit is contained in:
parent
c506fc93d6
commit
8f0c0407fb
@ -32,6 +32,12 @@
|
||||
#include <oplinkstatus.h>
|
||||
#include <QMessageBox>
|
||||
|
||||
// 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)");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,7 +64,7 @@ private slots:
|
||||
void ppmOnlyChanged();
|
||||
void minChannelChanged();
|
||||
void maxChannelChanged();
|
||||
void ChannelChanged(bool isMax);
|
||||
void channelChanged(bool isMax);
|
||||
};
|
||||
|
||||
#endif // CONFIGTXPIDWIDGET_H
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>834</width>
|
||||
<width>971</width>
|
||||
<height>652</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -49,8 +49,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>835</width>
|
||||
<height>545</height>
|
||||
<width>949</width>
|
||||
<height>558</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
@ -350,54 +350,6 @@
|
||||
</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="OneWayLink">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</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="4" column="0">
|
||||
<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>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="Coordinator">
|
||||
<property name="font">
|
||||
@ -418,12 +370,12 @@
|
||||
<widget class="QLabel" name="MaxFreq">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>440.000Mhz</string>
|
||||
<string>440.000 (MHz)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -431,12 +383,63 @@
|
||||
<widget class="QLabel" name="MinFreq">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>430.000Mhz</string>
|
||||
<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>
|
||||
|
Loading…
Reference in New Issue
Block a user