diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp
index 6b6ff816b..002b81fff 100644
--- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp
@@ -79,17 +79,23 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) :
unsigned int indexRT = 0;
foreach(QString name, manualSettingsObj->getField("ChannelNumber")->getElementNames()) {
Q_ASSERT(index < ManualControlSettings::CHANNELGROUPS_NUMELEM);
- inputChannelForm *inpForm = new inputChannelForm(this, index == 0);
+ InputChannelForm *inpForm = new InputChannelForm(this, index == 0);
ui->channelSettings->layout()->addWidget(inpForm); // Add the row to the UI
inpForm->setName(name);
addWidgetBinding("ManualControlSettings", "ChannelGroups", inpForm->ui->channelGroup, index);
addWidgetBinding("ManualControlSettings", "ChannelNumber", inpForm->ui->channelNumber, index);
- addWidgetBinding("ManualControlSettings", "ChannelMin", inpForm->ui->channelMin, index);
+
+ // The order of the following three binding calls is important. Since the values will be populated
+ // in reverse order of the binding order otherwise the 'Reversed' logic will floor the neutral value
+ // to the max value ( which is smaller than the neutral value when reversed )
addWidgetBinding("ManualControlSettings", "ChannelNeutral", inpForm->ui->channelNeutral, index);
+ addWidgetBinding("ManualControlSettings", "ChannelNeutral", inpForm->ui->neutralValue, index);
+ addWidgetBinding("ManualControlSettings", "ChannelMin", inpForm->ui->channelMin, index);
addWidgetBinding("ManualControlSettings", "ChannelMax", inpForm->ui->channelMax, index);
+
addWidget(inpForm->ui->channelNumberDropdown);
- addWidget(inpForm->ui->channelRev);
addWidget(inpForm->ui->channelResponseTime);
+ addWidget(inpForm->ui->channelRev);
// Input filter response time fields supported for some channels only
switch (index) {
diff --git a/ground/openpilotgcs/src/plugins/config/input.ui b/ground/openpilotgcs/src/plugins/config/input.ui
index 2fdf932e3..5e867e15a 100644
--- a/ground/openpilotgcs/src/plugins/config/input.ui
+++ b/ground/openpilotgcs/src/plugins/config/input.ui
@@ -128,8 +128,8 @@
0
0
- 768
- 742
+ 766
+ 745
@@ -151,7 +151,7 @@
-
-
+ Input Channel Configuration
@@ -277,13 +277,6 @@
- -
-
-
- Qt::Horizontal
-
-
-
@@ -388,6 +381,12 @@
-
+
+
+ 210
+ 0
+
+
Start Configuration Wizard
@@ -559,8 +558,8 @@
0
0
- 768
- 742
+ 766
+ 745
@@ -2183,8 +2182,8 @@ Setup the flight mode channel on the RC Input tab if you have not done so alread
0
0
- 504
- 156
+ 766
+ 745
diff --git a/ground/openpilotgcs/src/plugins/config/inputchannelform.cpp b/ground/openpilotgcs/src/plugins/config/inputchannelform.cpp
index 0a573adce..0d77b4f15 100644
--- a/ground/openpilotgcs/src/plugins/config/inputchannelform.cpp
+++ b/ground/openpilotgcs/src/plugins/config/inputchannelform.cpp
@@ -4,9 +4,9 @@
#include "manualcontrolsettings.h"
#include "gcsreceiver.h"
-inputChannelForm::inputChannelForm(QWidget *parent, bool showlegend) :
+InputChannelForm::InputChannelForm(QWidget *parent, bool showlegend) :
ConfigTaskWidget(parent),
- ui(new Ui::inputChannelForm)
+ ui(new Ui::InputChannelForm)
{
ui->setupUi(this);
@@ -19,6 +19,7 @@ inputChannelForm::inputChannelForm(QWidget *parent, bool showlegend) :
layout()->removeWidget(ui->legend4);
layout()->removeWidget(ui->legend5);
layout()->removeWidget(ui->legend6);
+ layout()->removeWidget(ui->legend7);
delete ui->legend0;
delete ui->legend1;
delete ui->legend2;
@@ -26,12 +27,14 @@ inputChannelForm::inputChannelForm(QWidget *parent, bool showlegend) :
delete ui->legend4;
delete ui->legend5;
delete ui->legend6;
+ delete ui->legend7;
}
connect(ui->channelMin, SIGNAL(valueChanged(int)), this, SLOT(minMaxUpdated()));
connect(ui->channelMax, SIGNAL(valueChanged(int)), this, SLOT(minMaxUpdated()));
+ connect(ui->neutralValue, SIGNAL(valueChanged(int)), this, SLOT(neutralUpdated()));
connect(ui->channelGroup, SIGNAL(currentIndexChanged(int)), this, SLOT(groupUpdated()));
- connect(ui->channelNeutral, SIGNAL(valueChanged(int)), this, SLOT(neutralUpdated(int)));
+ connect(ui->channelRev, SIGNAL(toggled(bool)), this, SLOT(reversedUpdated()));
// This is awkward but since we want the UI to be a dropdown but the field is not an enum
// it breaks the UAUVObject widget relation of the task gadget. Running the data through
@@ -43,17 +46,17 @@ inputChannelForm::inputChannelForm(QWidget *parent, bool showlegend) :
}
-inputChannelForm::~inputChannelForm()
+InputChannelForm::~InputChannelForm()
{
delete ui;
}
-void inputChannelForm::setName(QString &name)
+void InputChannelForm::setName(QString &name)
{
ui->channelName->setText(name);
QFontMetrics metrics(ui->channelName->font());
int width = metrics.width(name) + 5;
- foreach(inputChannelForm * form, parent()->findChildren()) {
+ foreach(InputChannelForm * form, parent()->findChildren()) {
if (form == this) {
continue;
}
@@ -69,7 +72,7 @@ void inputChannelForm::setName(QString &name)
/**
* Update the direction of the slider and boundaries
*/
-void inputChannelForm::minMaxUpdated()
+void InputChannelForm::minMaxUpdated()
{
bool reverse = ui->channelMin->value() > ui->channelMax->value();
@@ -85,9 +88,43 @@ void inputChannelForm::minMaxUpdated()
ui->channelNeutral->setInvertedControls(reverse);
}
-void inputChannelForm::neutralUpdated(int newval)
+void InputChannelForm::neutralUpdated()
{
- ui->neutral->setText(QString::number(newval));
+ int neutralValue = ui->neutralValue->value();
+ if(ui->channelRev->isChecked()) {
+ if(neutralValue > ui->channelMin->value()) {
+ ui->channelMin->setValue(neutralValue);
+ } else if(neutralValue < ui->channelMax->value()) {
+ ui->channelMax->setValue(neutralValue);
+ }
+ } else {
+ if(neutralValue < ui->channelMin->value()) {
+ ui->channelMin->setValue(neutralValue);
+ } else if(neutralValue > ui->channelMax->value()) {
+ ui->channelMax->setValue(neutralValue);
+ }
+ }
+}
+
+void InputChannelForm::reversedUpdated()
+{
+ int value = ui->channelNeutral->value();
+ int min = ui->channelMin->value();
+ int max = ui->channelMax->value();
+
+ if(ui->channelRev->isChecked()) {
+ if(min < max) {
+ ui->channelMax->setValue(min);
+ ui->channelMin->setValue(max);
+ ui->channelNeutral->setValue(value);
+ }
+ } else {
+ if(min > max) {
+ ui->channelMax->setValue(min);
+ ui->channelMin->setValue(max);
+ ui->channelNeutral->setValue(value);
+ }
+ }
}
/**
@@ -96,7 +133,7 @@ void inputChannelForm::neutralUpdated(int newval)
* I fully admit this is terrible practice to embed data within UI
* like this. Open to suggestions. JC 2011-09-07
*/
-void inputChannelForm::groupUpdated()
+void InputChannelForm::groupUpdated()
{
ui->channelNumberDropdown->clear();
ui->channelNumberDropdown->addItem("Disabled");
@@ -140,7 +177,7 @@ void inputChannelForm::groupUpdated()
/**
* Update the dropdown from the hidden control
*/
-void inputChannelForm::channelDropdownUpdated(int newval)
+void InputChannelForm::channelDropdownUpdated(int newval)
{
ui->channelNumber->setValue(newval);
}
@@ -148,7 +185,7 @@ void inputChannelForm::channelDropdownUpdated(int newval)
/**
* Update the hidden control from the dropdown
*/
-void inputChannelForm::channelNumberUpdated(int newval)
+void InputChannelForm::channelNumberUpdated(int newval)
{
ui->channelNumberDropdown->setCurrentIndex(newval);
}
diff --git a/ground/openpilotgcs/src/plugins/config/inputchannelform.h b/ground/openpilotgcs/src/plugins/config/inputchannelform.h
index ffdb9898b..91d665b40 100644
--- a/ground/openpilotgcs/src/plugins/config/inputchannelform.h
+++ b/ground/openpilotgcs/src/plugins/config/inputchannelform.h
@@ -4,26 +4,27 @@
#include
#include "configinputwidget.h"
namespace Ui {
-class inputChannelForm;
+class InputChannelForm;
}
-class inputChannelForm : public ConfigTaskWidget {
+class InputChannelForm : public ConfigTaskWidget {
Q_OBJECT
public:
- explicit inputChannelForm(QWidget *parent = 0, bool showlegend = false);
- ~inputChannelForm();
+ explicit InputChannelForm(QWidget *parent = 0, bool showlegend = false);
+ ~InputChannelForm();
friend class ConfigInputWidget;
void setName(QString &name);
private slots:
void minMaxUpdated();
- void neutralUpdated(int);
+ void neutralUpdated();
+ void reversedUpdated();
void groupUpdated();
void channelDropdownUpdated(int);
void channelNumberUpdated(int);
private:
- Ui::inputChannelForm *ui;
+ Ui::InputChannelForm *ui;
};
#endif // INPUTCHANNELFORM_H
diff --git a/ground/openpilotgcs/src/plugins/config/inputchannelform.ui b/ground/openpilotgcs/src/plugins/config/inputchannelform.ui
index 7a111d080..d07f2ae3b 100644
--- a/ground/openpilotgcs/src/plugins/config/inputchannelform.ui
+++ b/ground/openpilotgcs/src/plugins/config/inputchannelform.ui
@@ -1,13 +1,13 @@
- inputChannelForm
-
+ InputChannelForm
+
0
0
828
- 69
+ 93
@@ -26,6 +26,169 @@
6
+
-
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 20
+
+
+
+
+ 75
+ false
+ true
+
+
+
+ Channel neutral
+
+
+ background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
+color: rgb(255, 255, 255);
+border-radius: 5;
+margin:1px;
+font:bold;
+
+
+ QFrame::StyledPanel
+
+
+ Neutral
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 25
+
+
+
+ Qt::StrongFocus
+
+
+ QAbstractSpinBox::UpDownArrows
+
+
+ 9999
+
+
+ 1000
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 30
+ 20
+
+
+
+
+ 75
+ false
+ true
+
+
+
+ Response time
+
+
+ background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
+color: rgb(255, 255, 255);
+border-radius: 5;
+margin:1px;
+font:bold;
+
+
+ QFrame::StyledPanel
+
+
+ 1
+
+
+ RT
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ 20
+
+
+
+
+ 75
+ false
+ true
+
+
+
+ Channel values are inverted
+
+
+ background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
+color: rgb(255, 255, 255);
+border-radius: 5;
+margin:1px;
+font:bold;
+
+
+ QFrame::StyledPanel
+
+
+ 1
+
+
+ Reversed
+
+
+ Qt::AlignCenter
+
+
+
-
@@ -50,6 +213,9 @@
true
+
+ Channel function
+
background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
@@ -92,6 +258,9 @@ font:bold;
true
+
+ Channel type
+
background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
@@ -134,6 +303,9 @@ font:bold;
true
+
+ Channel number
+
background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
@@ -176,6 +348,9 @@ font:bold;
true
+
+ Channel min
+
background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
@@ -194,48 +369,6 @@ font:bold;
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
- 0
- 20
-
-
-
-
- 75
- false
- true
-
-
-
- background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
-color: rgb(255, 255, 255);
-border-radius: 5;
-margin:1px;
-font:bold;
-
-
- QFrame::StyledPanel
-
-
- Neutral
-
-
- Qt::AlignCenter
-
-
-
-
@@ -255,31 +388,6 @@ font:bold;
- -
-
-
-
- 6
- 0
-
-
-
-
- 0
- 25
-
-
-
-
- 100
- 16777215
-
-
-
- Qt::StrongFocus
-
-
-
-
@@ -308,6 +416,31 @@ font:bold;
+ -
+
+
+
+ 6
+ 0
+
+
+
+
+ 0
+ 25
+
+
+
+
+ 100
+ 16777215
+
+
+
+ Qt::StrongFocus
+
+
+
-
@@ -320,7 +453,7 @@ font:bold;
Qt::StrongFocus
- QAbstractSpinBox::NoButtons
+ QAbstractSpinBox::UpDownArrows
9999
@@ -346,6 +479,70 @@ font:bold;
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 20
+
+
+
+
+ 75
+ false
+ true
+
+
+
+ Channel max
+
+
+ background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
+color: rgb(255, 255, 255);
+border-radius: 5;
+margin:1px;
+font:bold;
+
+
+ QFrame::StyledPanel
+
+
+ 1
+
+
+ Max
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 20
+
+
+
+
-
@@ -368,112 +565,13 @@ font:bold;
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 10
- 20
-
-
-
-
- -
-
-
-
- 0
- 25
-
-
-
- Qt::StrongFocus
-
-
- QAbstractSpinBox::NoButtons
-
-
- 9999
-
-
- 1000
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
- 0
- 20
-
-
-
-
- 75
- false
- true
-
-
-
- background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
-color: rgb(255, 255, 255);
-border-radius: 5;
-margin:1px;
-font:bold;
-
-
- QFrame::StyledPanel
-
-
- 1
-
-
- Max
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- false
-
-
-
- 0
- 20
-
-
-
- Rev
-
-
-
- -
+
-
true
-
+
0
0
@@ -501,71 +599,72 @@ even lead to crash. Use with caution.
true
- QAbstractSpinBox::NoButtons
+ QAbstractSpinBox::UpDownArrows
999
- -
-
-
-
- 0
- 0
-
-
+
-
+
- 30
- 26
-
-
-
-
- 75
- false
- true
-
-
-
- background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
-color: rgb(255, 255, 255);
-border-radius: 5;
-margin:5px;
-font:bold;
-
-
- RT
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 48
+ 75
0
-
+
+ QFrame::NoFrame
+
+
+ QFrame::Raised
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ true
+
+
+
+ 0
+ 20
+
+
+
+
+
+
+
+
+
+
+ -
+
+
- 45
- 16777215
+ 0
+ 25
-
-
+
+ 9999
+
+
+ 1000
diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp
index 5b3b402fe..66cdf495d 100644
--- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp
+++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp
@@ -467,6 +467,8 @@ bool UAVObjectUtilManager::descriptionToStructure(QByteArray desc, deviceDescrip
struc.fwHash = desc.mid(40, 20);
struc.uavoHash.clear();
struc.uavoHash = desc.mid(60, 20);
+
+ /*
qDebug() << __FUNCTION__ << ":description from board:";
foreach(char x, desc) {
qDebug() << QString::number(x, 16);
@@ -477,6 +479,7 @@ bool UAVObjectUtilManager::descriptionToStructure(QByteArray desc, deviceDescrip
foreach(char x, array2) {
qDebug() << QString::number(x, 16);
}
+ */
return true;
}
return false;