From 98d416c493bf26d2ca30c4d1a23868e59c146800 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Wed, 24 Feb 2016 00:16:03 +0100 Subject: [PATCH 1/6] LP-235 Adding GUI for failsafe configuration. TODO: Fix text in Failsafe tab to have information about how failsafe works and is intended to be configured. --- ground/gcs/src/plugins/config/config.pro | 9 +- .../src/plugins/config/configinputwidget.cpp | 71 ++++- .../src/plugins/config/configinputwidget.h | 6 +- .../plugins/config/failsafechannelform.cpp | 24 ++ .../src/plugins/config/failsafechannelform.h | 29 ++ .../src/plugins/config/failsafechannelform.ui | 284 ++++++++++++++++++ ground/gcs/src/plugins/config/input.ui | 268 ++++++++++++++++- .../uavobjectwidgetutils/configtaskwidget.cpp | 31 +- .../uavobjectwidgetutils/configtaskwidget.h | 3 +- 9 files changed, 689 insertions(+), 36 deletions(-) create mode 100644 ground/gcs/src/plugins/config/failsafechannelform.cpp create mode 100644 ground/gcs/src/plugins/config/failsafechannelform.h create mode 100644 ground/gcs/src/plugins/config/failsafechannelform.ui diff --git a/ground/gcs/src/plugins/config/config.pro b/ground/gcs/src/plugins/config/config.pro index 004c10d1c..97920995c 100644 --- a/ground/gcs/src/plugins/config/config.pro +++ b/ground/gcs/src/plugins/config/config.pro @@ -58,7 +58,8 @@ HEADERS += \ calibration/gyrobiascalibrationmodel.h \ calibration/calibrationuiutils.h \ configoplinkwidget.h \ - configrevonanohwwidget.h + configrevonanohwwidget.h \ + failsafechannelform.h SOURCES += \ configplugin.cpp \ @@ -99,7 +100,8 @@ SOURCES += \ calibration/levelcalibrationmodel.cpp \ calibration/gyrobiascalibrationmodel.cpp \ configoplinkwidget.cpp \ - configrevonanohwwidget.cpp + configrevonanohwwidget.cpp \ + failsafechannelform.cpp FORMS += \ airframe.ui \ @@ -124,6 +126,7 @@ FORMS += \ mixercurve.ui \ configrevohwwidget.ui \ oplink.ui \ - configrevonanohwwidget.ui + configrevonanohwwidget.ui \ + failsafechannelform.ui RESOURCES += configgadget.qrc diff --git a/ground/gcs/src/plugins/config/configinputwidget.cpp b/ground/gcs/src/plugins/config/configinputwidget.cpp index c1523e331..280fa57f4 100644 --- a/ground/gcs/src/plugins/config/configinputwidget.cpp +++ b/ground/gcs/src/plugins/config/configinputwidget.cpp @@ -42,6 +42,10 @@ #include #include #include +#include "inputchannelform.h" +#include "ui_inputchannelform.h" +#include "failsafechannelform.h" +#include "ui_failsafechannelform.h" #define ACCESS_MIN_MOVE -3 #define ACCESS_MAX_MOVE 3 @@ -101,37 +105,39 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : addApplySaveButtons(ui->saveRCInputToRAM, ui->saveRCInputToSD); // Generate the rows of buttons in the input channel form GUI - unsigned int index = 0; - unsigned int indexRT = 0; + quint32 index = 0; + quint32 indexRT = 0; foreach(QString name, manualSettingsObj->getField("ChannelNumber")->getElementNames()) { Q_ASSERT(index < ManualControlSettings::CHANNELGROUPS_NUMELEM); - InputChannelForm *form = new InputChannelForm(index, this); - form->setName(name); - form->moveTo(*(ui->channelLayout)); + // Input channel setup + InputChannelForm *inputChannelForm = new InputChannelForm(index, this); + inputChannelForm->setName(name); + + inputChannelForm->moveTo(*(ui->channelLayout)); // The order of the following 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 ) and the channel number // will not be set correctly. - addWidgetBinding("ManualControlSettings", "ChannelNumber", form->ui->channelNumber, index); - addWidgetBinding("ManualControlSettings", "ChannelGroups", form->ui->channelGroup, index); + addWidgetBinding("ManualControlSettings", "ChannelNumber", inputChannelForm->ui->channelNumber, index); + addWidgetBinding("ManualControlSettings", "ChannelGroups", inputChannelForm->ui->channelGroup, index); // Slider position based on real time Rcinput (allow monitoring) - addWidgetBinding("ManualControlCommand", "Channel", form->ui->channelNeutral, index); + addWidgetBinding("ManualControlCommand", "Channel", inputChannelForm->ui->channelNeutral, index); // Neutral value stored on board (SpinBox) - addWidgetBinding("ManualControlSettings", "ChannelNeutral", form->ui->neutralValue, index); - addWidgetBinding("ManualControlSettings", "ChannelMax", form->ui->channelMax, index); - addWidgetBinding("ManualControlSettings", "ChannelMin", form->ui->channelMin, index); - addWidgetBinding("ManualControlSettings", "ChannelMax", form->ui->channelMax, index); + addWidgetBinding("ManualControlSettings", "ChannelNeutral", inputChannelForm->ui->neutralValue, index); + addWidgetBinding("ManualControlSettings", "ChannelMax", inputChannelForm->ui->channelMax, index); + addWidgetBinding("ManualControlSettings", "ChannelMin", inputChannelForm->ui->channelMin, index); + addWidgetBinding("ManualControlSettings", "ChannelMax", inputChannelForm->ui->channelMax, index); - addWidget(form->ui->channelRev); + addWidget(inputChannelForm->ui->channelRev); // Reversing supported for some channels only bool reversable = ((index == ManualControlSettings::CHANNELGROUPS_THROTTLE) || (index == ManualControlSettings::CHANNELGROUPS_ROLL) || (index == ManualControlSettings::CHANNELGROUPS_PITCH) || (index == ManualControlSettings::CHANNELGROUPS_YAW)); - form->ui->channelRev->setVisible(reversable); + inputChannelForm->ui->channelRev->setVisible(reversable); // Input filter response time fields supported for some channels only switch (index) { @@ -143,21 +149,30 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : case ManualControlSettings::CHANNELGROUPS_ACCESSORY1: case ManualControlSettings::CHANNELGROUPS_ACCESSORY2: case ManualControlSettings::CHANNELGROUPS_ACCESSORY3: - addWidgetBinding("ManualControlSettings", "ResponseTime", form->ui->channelResponseTime, indexRT); + addWidgetBinding("ManualControlSettings", "ResponseTime", inputChannelForm->ui->channelResponseTime, indexRT); ++indexRT; break; case ManualControlSettings::CHANNELGROUPS_THROTTLE: case ManualControlSettings::CHANNELGROUPS_FLIGHTMODE: - form->ui->channelResponseTime->setVisible(false); + inputChannelForm->ui->channelResponseTime->setVisible(false); break; default: Q_ASSERT(0); break; } + // Failsafe channels setup + FailsafeChannelForm *failsafeChannelForm = new FailsafeChannelForm(index, this); + addWidget(failsafeChannelForm->ui->channelValueSpinner); + failsafeChannelForm->setName(name); + failsafeChannelForm->moveTo(*(ui->failsafeChannelsLayout)); + addWidgetBinding("ManualControlSettings", "FailsafeChannel", failsafeChannelForm->ui->channelValue, index, 0.01); + ++index; } + addWidgetBinding("ManualControlSettings", "FailsafeFlightModeSwitchPosition", ui->failsafeFlightMode, 0, 1, true); + addWidgetBinding("ManualControlSettings", "Deadband", ui->deadband, 0, 1); addWidgetBinding("ManualControlSettings", "DeadbandAssistedControl", ui->assistedControlDeadband, 0, 1); @@ -208,6 +223,9 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : connect(ManualControlCommand::GetInstance(getObjectManager()), SIGNAL(objectUpdated(UAVObject *)), this, SLOT(moveFMSlider())); connect(ManualControlSettings::GetInstance(getObjectManager()), SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updatePositionSlider())); + connect(ui->failsafeFlightMode, SIGNAL(currentIndexChanged(int)), this, SLOT(failsafeFlightModeChanged(int))); + connect(ui->failsafeFlightModeCb, SIGNAL(toggled(bool)), this, SLOT(failsafeFlightModeCbToggled(bool))); + addWidget(ui->configurationWizard); addWidget(ui->runCalibration); @@ -215,6 +233,7 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : populateWidgets(); refreshWidgetsValues(); + // Connect the help button connect(ui->inputHelp, SIGNAL(clicked()), this, SLOT(openHelp())); @@ -401,6 +420,15 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : updateEnableControls(); } +void ConfigInputWidget::buildOptionComboBox(QComboBox *combo, UAVObjectField *field, int index, bool applyLimits) +{ + if (combo == ui->failsafeFlightMode) { + ConfigTaskWidget::buildOptionComboBox(combo, flightModeSettingsObj->getField("FlightModePosition"), index, applyLimits); + } else { + ConfigTaskWidget::buildOptionComboBox(combo, field, index, applyLimits); + } +} + void ConfigInputWidget::resetTxControls() { m_txLeftStick->setTransform(m_txLeftStickOrig, false); @@ -1998,3 +2026,14 @@ void ConfigInputWidget::forceOneFlightMode() manualSettingsData.FlightModeNumber = 1; manualSettingsObj->setData(manualSettingsData); } + +void ConfigInputWidget::failsafeFlightModeChanged(int index) +{ + ui->failsafeFlightMode->setEnabled(index != -1); + ui->failsafeFlightModeCb->setChecked(index != -1); +} + +void ConfigInputWidget::failsafeFlightModeCbToggled(bool checked) +{ + ui->failsafeFlightMode->setCurrentIndex(checked ? 0 : -1); +} diff --git a/ground/gcs/src/plugins/config/configinputwidget.h b/ground/gcs/src/plugins/config/configinputwidget.h index 00e460f64..7157672fb 100644 --- a/ground/gcs/src/plugins/config/configinputwidget.h +++ b/ground/gcs/src/plugins/config/configinputwidget.h @@ -36,8 +36,6 @@ #include "uavobject.h" #include #include -#include "inputchannelform.h" -#include "ui_inputchannelform.h" #include #include "manualcontrolcommand.h" #include "manualcontrolsettings.h" @@ -229,8 +227,12 @@ private slots: void resetActuatorSettings(); void forceOneFlightMode(); + void failsafeFlightModeChanged(int index); + void failsafeFlightModeCbToggled(bool checked); + protected: void resizeEvent(QResizeEvent *event); + void buildOptionComboBox(QComboBox *combo, UAVObjectField *field, int index, bool applyLimits); }; #endif // ifndef CONFIGINPUTWIDGET_H diff --git a/ground/gcs/src/plugins/config/failsafechannelform.cpp b/ground/gcs/src/plugins/config/failsafechannelform.cpp new file mode 100644 index 000000000..5db5fdf0c --- /dev/null +++ b/ground/gcs/src/plugins/config/failsafechannelform.cpp @@ -0,0 +1,24 @@ +#include "failsafechannelform.h" +#include "ui_failsafechannelform.h" + +FailsafeChannelForm::FailsafeChannelForm(const int index, QWidget *parent) : + ChannelForm(index, parent), ui(new Ui::FailsafeChannelForm) +{ + ui->setupUi(this); + disableMouseWheelEvents(); +} + +FailsafeChannelForm::~FailsafeChannelForm() +{ + delete ui; +} + +QString FailsafeChannelForm::name() +{ + return ui->channelName->text(); +} + +void FailsafeChannelForm::setName(const QString &name) +{ + ui->channelName->setText(name); +} diff --git a/ground/gcs/src/plugins/config/failsafechannelform.h b/ground/gcs/src/plugins/config/failsafechannelform.h new file mode 100644 index 000000000..0e4f3b341 --- /dev/null +++ b/ground/gcs/src/plugins/config/failsafechannelform.h @@ -0,0 +1,29 @@ +#ifndef FAILSAFECHANNELFORM_H +#define FAILSAFECHANNELFORM_H + +#include "channelform.h" +#include "configinputwidget.h" + +#include + +namespace Ui { +class FailsafeChannelForm; +} + +class FailsafeChannelForm : public ChannelForm { + Q_OBJECT + +public: + explicit FailsafeChannelForm(const int index, QWidget *parent = NULL); + ~FailsafeChannelForm(); + + friend class ConfigInputWidget; + + virtual QString name(); + virtual void setName(const QString &name); + +private: + Ui::FailsafeChannelForm *ui; +}; + +#endif // FAILSAFECHANNELFORM_H diff --git a/ground/gcs/src/plugins/config/failsafechannelform.ui b/ground/gcs/src/plugins/config/failsafechannelform.ui new file mode 100644 index 000000000..e4aac81ec --- /dev/null +++ b/ground/gcs/src/plugins/config/failsafechannelform.ui @@ -0,0 +1,284 @@ + + + FailsafeChannelForm + + + + 0 + 0 + 993 + 57 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 12 + + + + + true + + + + 0 + 0 + + + + + 0 + 20 + + + + + -1 + 75 + false + true + + + + Channel value + + + 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; +font: bold 12px; +margin:1px; + + + QFrame::StyledPanel + + + Channel Value relative to channel Neutral + + + Qt::AlignCenter + + + + + + + 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; +font: bold 12px; +margin:1px; + + + Value + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + Qt::StrongFocus + + + Channel input value (µs) + + + + + + + + + Qt::ImhNone + + + -100 + + + 100 + + + Qt::Horizontal + + + QSlider::TicksBothSides + + + 10 + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + % + + + -100 + + + 100 + + + 0 + + + + + + + true + + + + 0 + 0 + + + + + 0 + 20 + + + + + -1 + 75 + false + 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); +border-radius: 5; +font: bold 12px; +margin:1px; + + + QFrame::StyledPanel + + + Function + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + Text + + + + + + + + TextBubbleSlider + QSlider +
utils/textbubbleslider.h
+
+
+ + channelValue + + + + + channelValue + valueChanged(int) + channelValueSpinner + setValue(int) + + + 530 + 43 + + + 965 + 43 + + + + + channelValueSpinner + valueChanged(int) + channelValue + setValue(int) + + + 965 + 43 + + + 530 + 43 + + + + +
diff --git a/ground/gcs/src/plugins/config/input.ui b/ground/gcs/src/plugins/config/input.ui index eb6f8113e..44c902b0d 100644 --- a/ground/gcs/src/plugins/config/input.ui +++ b/ground/gcs/src/plugins/config/input.ui @@ -21,7 +21,7 @@ - RC Input + Remote Control Input @@ -2125,6 +2125,272 @@ font:bold; + + + Failsafe Settings + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + 255 + 255 + 255 + + + + + + + 232 + 232 + 232 + + + + + + + + + 255 + 255 + 255 + + + + + + + 232 + 232 + 232 + + + + + + + + + 232 + 232 + 232 + + + + + + + 232 + 232 + 232 + + + + + + + + QFrame::NoFrame + + + true + + + + + 0 + 0 + 1220 + 655 + + + + + 12 + + + 12 + + + 12 + + + 12 + + + + + Failsafe Settings + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + + + + + On failsafe change flight mode to: + + + + + + + + 200 + 0 + + + + Qt::StrongFocus + + + When triggering failsafe switch to this flight mode. + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 10 + + + + + + + Channel input settings on failsafe: + + + + + + + + + + + 0 + 0 + + + + Failsafe Information + + + false + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QTextEdit::AutoNone + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">LibrePilot supports a security function to handle the situation when there is a loss of signal from the transmitter used to control the craft. This function is often called Failsafe.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The condition to trigger failsafe differs between the type of receiver used.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Bla bla bla...</p></body></html> + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Arming Settings diff --git a/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp b/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp index 312789479..de58e0479 100644 --- a/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp +++ b/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp @@ -1041,26 +1041,16 @@ void ConfigTaskWidget::checkWidgetsLimits(QWidget *widget, UAVObjectField *field } } -void ConfigTaskWidget::loadWidgetLimits(QWidget *widget, UAVObjectField *field, int index, bool hasLimits, double scale) +void ConfigTaskWidget::loadWidgetLimits(QWidget *widget, UAVObjectField *field, int index, bool applyLimits, double scale) { if (!widget || !field) { return; } if (QComboBox * cb = qobject_cast(widget)) { cb->clear(); - QStringList options = field->getOptions(); - - for (int optionIndex = 0; optionIndex < options.count(); optionIndex++) { - if (hasLimits) { - if (m_currentBoardId > -1 && field->isWithinLimits(options.at(optionIndex), index, m_currentBoardId)) { - cb->addItem(options.at(optionIndex), QVariant(optionIndex)); - } - } else { - cb->addItem(options.at(optionIndex), QVariant(optionIndex)); - } - } + buildOptionComboBox(cb, field, index, applyLimits); } - if (!hasLimits) { + if (!applyLimits) { return; } else if (QDoubleSpinBox * cb = qobject_cast(widget)) { if (field->getMaxLimit(index).isValid()) { @@ -1105,6 +1095,21 @@ void ConfigTaskWidget::updateEnableControls() enableControls(telMngr->isConnected()); } +void ConfigTaskWidget::buildOptionComboBox(QComboBox *combo, UAVObjectField *field, int index, bool applyLimits) +{ + QStringList options = field->getOptions(); + + for (int optionIndex = 0; optionIndex < options.count(); optionIndex++) { + if (applyLimits) { + if (m_currentBoardId > -1 && field->isWithinLimits(options.at(optionIndex), index, m_currentBoardId)) { + combo->addItem(options.at(optionIndex), QVariant(optionIndex)); + } + } else { + combo->addItem(options.at(optionIndex), QVariant(optionIndex)); + } + } +} + void ConfigTaskWidget::disableMouseWheelEvents() { // Disable mouse wheel events diff --git a/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h b/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h index 18fa3c3af..75290d53e 100644 --- a/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h +++ b/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h @@ -241,7 +241,7 @@ private: void connectWidgetUpdatesToSlot(QWidget *widget, const char *function); void disconnectWidgetUpdatesToSlot(QWidget *widget, const char *function); - void loadWidgetLimits(QWidget *widget, UAVObjectField *field, int index, bool hasLimits, double sclale); + void loadWidgetLimits(QWidget *widget, UAVObjectField *field, int index, bool applyLimits, double scale); int fieldIndexFromElementName(QString objectName, QString fieldName, QString elementName); @@ -262,6 +262,7 @@ protected: virtual void enableControls(bool enable); virtual QString mapObjectName(const QString objectName); virtual UAVObject *getObject(const QString name, quint32 instId = 0); + virtual void buildOptionComboBox(QComboBox *combo, UAVObjectField *field, int index, bool applyLimits); void checkWidgetsLimits(QWidget *widget, UAVObjectField *field, int index, bool hasLimits, QVariant value, double scale); void updateEnableControls(); }; From 8a96904e8a73822d5c3b512eabd543b6a1dae335 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Wed, 2 Mar 2016 09:07:30 +0100 Subject: [PATCH 2/6] LP-235 Changed so that the correct channels are laid out in GUI. Added default button to reset values. Re-factored some repeated code. --- .../src/plugins/config/configinputwidget.cpp | 36 +++++++++++++------ ground/gcs/src/plugins/config/input.ui | 19 ++++++++-- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/ground/gcs/src/plugins/config/configinputwidget.cpp b/ground/gcs/src/plugins/config/configinputwidget.cpp index 280fa57f4..eccef5caf 100644 --- a/ground/gcs/src/plugins/config/configinputwidget.cpp +++ b/ground/gcs/src/plugins/config/configinputwidget.cpp @@ -160,18 +160,28 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : Q_ASSERT(0); break; } + ++index; + } + + QList failsafeReloadGroup; + failsafeReloadGroup.append(555); + + addWidgetBinding("ManualControlSettings", "FailsafeFlightModeSwitchPosition", ui->failsafeFlightMode, 0, 1, true, new QList(failsafeReloadGroup)); + + // Generate the rows for the failsafe channel form GUI + index = 0; + foreach(QString name, manualSettingsObj->getField("FailsafeChannel")->getElementNames()) { + Q_ASSERT(index < ManualControlSettings::FAILSAFECHANNEL_NUMELEM); // Failsafe channels setup FailsafeChannelForm *failsafeChannelForm = new FailsafeChannelForm(index, this); addWidget(failsafeChannelForm->ui->channelValueSpinner); failsafeChannelForm->setName(name); failsafeChannelForm->moveTo(*(ui->failsafeChannelsLayout)); - addWidgetBinding("ManualControlSettings", "FailsafeChannel", failsafeChannelForm->ui->channelValue, index, 0.01); - + addWidgetBinding("ManualControlSettings", "FailsafeChannel", failsafeChannelForm->ui->channelValue, index, 0.01, true, new QList(failsafeReloadGroup)); ++index; } - - addWidgetBinding("ManualControlSettings", "FailsafeFlightModeSwitchPosition", ui->failsafeFlightMode, 0, 1, true); + addWidget(ui->failsafeDefault); addWidgetBinding("ManualControlSettings", "Deadband", ui->deadband, 0, 1); addWidgetBinding("ManualControlSettings", "DeadbandAssistedControl", ui->assistedControlDeadband, 0, 1); @@ -185,13 +195,11 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : connect(wizardUi->wzBack, SIGNAL(clicked()), this, SLOT(wzBack())); ui->stackedWidget->setCurrentIndex(0); - addWidgetBinding("FlightModeSettings", "FlightModePosition", ui->fmsModePos1, 0, 1, true); - addWidgetBinding("FlightModeSettings", "FlightModePosition", ui->fmsModePos2, 1, 1, true); - addWidgetBinding("FlightModeSettings", "FlightModePosition", ui->fmsModePos3, 2, 1, true); - addWidgetBinding("FlightModeSettings", "FlightModePosition", ui->fmsModePos4, 3, 1, true); - addWidgetBinding("FlightModeSettings", "FlightModePosition", ui->fmsModePos5, 4, 1, true); - addWidgetBinding("FlightModeSettings", "FlightModePosition", ui->fmsModePos6, 5, 1, true); - addWidgetBinding("ManualControlSettings", "FlightModeNumber", ui->fmsPosNum); + QList widgets = QList() << ui->fmsModePos1 << ui->fmsModePos2 << ui->fmsModePos3 << + ui->fmsModePos4 << ui->fmsModePos5 << ui->fmsModePos6; + foreach(QWidget* widget, widgets) { + addWidgetBinding("FlightModeSettings", "FlightModePosition", widget, 0, 1, true); + } addWidgetBinding("FlightModeSettings", "Stabilization1Settings", ui->fmsSsPos1Roll, "Roll", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization2Settings", ui->fmsSsPos2Roll, "Roll", 1, true); @@ -199,18 +207,21 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : addWidgetBinding("FlightModeSettings", "Stabilization4Settings", ui->fmsSsPos4Roll, "Roll", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization5Settings", ui->fmsSsPos5Roll, "Roll", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization6Settings", ui->fmsSsPos6Roll, "Roll", 1, true); + addWidgetBinding("FlightModeSettings", "Stabilization1Settings", ui->fmsSsPos1Pitch, "Pitch", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization2Settings", ui->fmsSsPos2Pitch, "Pitch", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization3Settings", ui->fmsSsPos3Pitch, "Pitch", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization4Settings", ui->fmsSsPos4Pitch, "Pitch", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization5Settings", ui->fmsSsPos5Pitch, "Pitch", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization6Settings", ui->fmsSsPos6Pitch, "Pitch", 1, true); + addWidgetBinding("FlightModeSettings", "Stabilization1Settings", ui->fmsSsPos1Yaw, "Yaw", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization2Settings", ui->fmsSsPos2Yaw, "Yaw", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization3Settings", ui->fmsSsPos3Yaw, "Yaw", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization4Settings", ui->fmsSsPos4Yaw, "Yaw", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization5Settings", ui->fmsSsPos5Yaw, "Yaw", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization6Settings", ui->fmsSsPos6Yaw, "Yaw", 1, true); + addWidgetBinding("FlightModeSettings", "Stabilization1Settings", ui->fmsSsPos1Thrust, "Thrust", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization2Settings", ui->fmsSsPos2Thrust, "Thrust", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization3Settings", ui->fmsSsPos3Thrust, "Thrust", 1, true); @@ -218,6 +229,8 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : addWidgetBinding("FlightModeSettings", "Stabilization5Settings", ui->fmsSsPos5Thrust, "Thrust", 1, true); addWidgetBinding("FlightModeSettings", "Stabilization6Settings", ui->fmsSsPos6Thrust, "Thrust", 1, true); + addWidgetBinding("ManualControlSettings", "FlightModeNumber", ui->fmsPosNum); + addWidgetBinding("FlightModeSettings", "Arming", ui->armControl); addWidgetBinding("FlightModeSettings", "ArmedTimeout", ui->armTimeout, 0, 1000); connect(ManualControlCommand::GetInstance(getObjectManager()), SIGNAL(objectUpdated(UAVObject *)), this, SLOT(moveFMSlider())); @@ -228,6 +241,7 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : addWidget(ui->configurationWizard); addWidget(ui->runCalibration); + addWidget(ui->failsafeFlightModeCb); autoLoadWidgets(); diff --git a/ground/gcs/src/plugins/config/input.ui b/ground/gcs/src/plugins/config/input.ui index 44c902b0d..f2f0ad6ca 100644 --- a/ground/gcs/src/plugins/config/input.ui +++ b/ground/gcs/src/plugins/config/input.ui @@ -2295,6 +2295,20 @@ font:bold; + + + + Default + + + + objname:ManualControlSettings + button:default + buttongroup:555 + + + + @@ -2360,9 +2374,8 @@ font:bold; <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">LibrePilot supports a security function to handle the situation when there is a loss of signal from the transmitter used to control the craft. This function is often called Failsafe.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The condition to trigger failsafe differs between the type of receiver used.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Bla bla bla...</p></body></html> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Failsafe is a function that is triggered when the connection between the transmitter and receiver is lost. Failsafe gives the user a chance to configure some basic behaviour and specify what input the flight controller should get even if no control signals from the transmitter is present.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The failsafe is triggered differently for different receivers. Failsafe should always be tested before every flight.</p></body></html> true From 0f7f268a0a7e8ac83934f1e3b72bf4ad3c57d1c8 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Wed, 2 Mar 2016 09:12:00 +0100 Subject: [PATCH 3/6] LP-235 Added some default buttons as widgets so that they are greyed out when board is disconnected. --- .../config/configstabilizationwidget.cpp | 3 +++ .../gcs/src/plugins/config/stabilization.ui | 20 +++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ground/gcs/src/plugins/config/configstabilizationwidget.cpp b/ground/gcs/src/plugins/config/configstabilizationwidget.cpp index 5c5f2ecdd..ec73b62ca 100644 --- a/ground/gcs/src/plugins/config/configstabilizationwidget.cpp +++ b/ground/gcs/src/plugins/config/configstabilizationwidget.cpp @@ -107,6 +107,9 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa addWidget(ui->pushButton_9); addWidget(ui->pushButton_10); addWidget(ui->pushButton_11); + addWidget(ui->pushButton_12); + addWidget(ui->pushButton_13); + addWidget(ui->pushButton_14); addWidget(ui->pushButton_20); addWidget(ui->pushButton_22); addWidget(ui->pushButton_23); diff --git a/ground/gcs/src/plugins/config/stabilization.ui b/ground/gcs/src/plugins/config/stabilization.ui index 8ae4efc37..4ab25b6d9 100644 --- a/ground/gcs/src/plugins/config/stabilization.ui +++ b/ground/gcs/src/plugins/config/stabilization.ui @@ -95,7 +95,7 @@ QTabWidget::Rounded - 0 + 1 false @@ -135,9 +135,9 @@ 0 - -104 - 866 - 767 + 0 + 877 + 764 @@ -7773,8 +7773,8 @@ border-radius: 5; 0 0 - 866 - 697 + 877 + 765 @@ -17192,8 +17192,8 @@ border-radius: 5; 0 0 - 879 - 663 + 877 + 671 @@ -23038,8 +23038,8 @@ font:bold; 0 0 - 879 - 663 + 877 + 671 From 41adb3e4c481c53441e0feb54fb13f31cb5598dd Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Wed, 2 Mar 2016 10:06:52 +0100 Subject: [PATCH 4/6] LP-235 Changed type of text field to avoid HTML encoding. --- ground/gcs/src/plugins/config/input.ui | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/ground/gcs/src/plugins/config/input.ui b/ground/gcs/src/plugins/config/input.ui index f2f0ad6ca..fd8ef13e4 100644 --- a/ground/gcs/src/plugins/config/input.ui +++ b/ground/gcs/src/plugins/config/input.ui @@ -2356,29 +2356,22 @@ font:bold; 0 - + 0 0 - - QTextEdit::AutoNone - true - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Failsafe is a function that is triggered when the connection between the transmitter and receiver is lost. Failsafe gives the user a chance to configure some basic behaviour and specify what input the flight controller should get even if no control signals from the transmitter is present.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The failsafe is triggered differently for different receivers. Failsafe should always be tested before every flight.</p></body></html> + + Failsafe is a function that is triggered when the connection between the transmitter and receiver is lost. Failsafe gives the user a chance to configure some basic behaviour and specify what input the flight controller should get even if no control signals from the transmitter is present. +The failsafe is triggered differently for different receivers. Failsafe should always be tested before every flight. - - true + + false From 24e2c400efd949bb685bc0418c865a768c235934 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Wed, 2 Mar 2016 10:08:28 +0100 Subject: [PATCH 5/6] LP-235 Fixed UI related issue. --- ground/gcs/src/plugins/config/stabilization.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/gcs/src/plugins/config/stabilization.ui b/ground/gcs/src/plugins/config/stabilization.ui index 4ab25b6d9..56ab3d919 100644 --- a/ground/gcs/src/plugins/config/stabilization.ui +++ b/ground/gcs/src/plugins/config/stabilization.ui @@ -95,7 +95,7 @@ QTabWidget::Rounded - 1 + 0 false From 3469b4d0cb5852fc615c342376b6cf477c624e44 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Wed, 2 Mar 2016 10:47:18 +0100 Subject: [PATCH 6/6] LP-235 Changed faulty tool tips. --- ground/gcs/src/plugins/config/failsafechannelform.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/gcs/src/plugins/config/failsafechannelform.ui b/ground/gcs/src/plugins/config/failsafechannelform.ui index e4aac81ec..5ee101f9e 100644 --- a/ground/gcs/src/plugins/config/failsafechannelform.ui +++ b/ground/gcs/src/plugins/config/failsafechannelform.ui @@ -78,7 +78,7 @@ margin:1px; - Channel neutral + Channel value 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)); @@ -113,7 +113,7 @@ margin:1px; Qt::StrongFocus - Channel input value (µs) + Channel value in %