mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
OP-311 New "Arming" tab in the config widget to setup how the airframe is armed.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2763 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
93ee2765be
commit
04ba1261f0
@ -1,980 +1,1001 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file configservowidget.cpp
|
* @file configservowidget.cpp
|
||||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||||
* @addtogroup GCSPlugins GCS Plugins
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
* @{
|
* @{
|
||||||
* @addtogroup ConfigPlugin Config Plugin
|
* @addtogroup ConfigPlugin Config Plugin
|
||||||
* @{
|
* @{
|
||||||
* @brief Servo input/output configuration panel for the config gadget
|
* @brief Servo input/output configuration panel for the config gadget
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
* for more details.
|
* for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* 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
|
||||||
*/
|
*/
|
||||||
#include "configservowidget.h"
|
#include "configservowidget.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QtGui/QTextEdit>
|
#include <QtGui/QTextEdit>
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ConfigServoWidget::ConfigServoWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
ConfigServoWidget::ConfigServoWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||||
{
|
{
|
||||||
m_config = new Ui_SettingsWidget();
|
m_config = new Ui_SettingsWidget();
|
||||||
m_config->setupUi(this);
|
m_config->setupUi(this);
|
||||||
|
|
||||||
// First of all, put all the channel widgets into lists, so that we can
|
// First of all, put all the channel widgets into lists, so that we can
|
||||||
// manipulate those:
|
// manipulate those:
|
||||||
|
|
||||||
// NOTE: for historical reasons, we have objects below called ch0 to ch7, but the
|
// NOTE: for historical reasons, we have objects below called ch0 to ch7, but the
|
||||||
// convention for OP is Channel 1 to Channel 8.
|
// convention for OP is Channel 1 to Channel 8.
|
||||||
outLabels << m_config->ch0OutValue
|
outLabels << m_config->ch0OutValue
|
||||||
<< m_config->ch1OutValue
|
<< m_config->ch1OutValue
|
||||||
<< m_config->ch2OutValue
|
<< m_config->ch2OutValue
|
||||||
<< m_config->ch3OutValue
|
<< m_config->ch3OutValue
|
||||||
<< m_config->ch4OutValue
|
<< m_config->ch4OutValue
|
||||||
<< m_config->ch5OutValue
|
<< m_config->ch5OutValue
|
||||||
<< m_config->ch6OutValue
|
<< m_config->ch6OutValue
|
||||||
<< m_config->ch7OutValue;
|
<< m_config->ch7OutValue;
|
||||||
outSliders << m_config->ch0OutSlider
|
outSliders << m_config->ch0OutSlider
|
||||||
<< m_config->ch1OutSlider
|
<< m_config->ch1OutSlider
|
||||||
<< m_config->ch2OutSlider
|
<< m_config->ch2OutSlider
|
||||||
<< m_config->ch3OutSlider
|
<< m_config->ch3OutSlider
|
||||||
<< m_config->ch4OutSlider
|
<< m_config->ch4OutSlider
|
||||||
<< m_config->ch5OutSlider
|
<< m_config->ch5OutSlider
|
||||||
<< m_config->ch6OutSlider
|
<< m_config->ch6OutSlider
|
||||||
<< m_config->ch7OutSlider;
|
<< m_config->ch7OutSlider;
|
||||||
outMin << m_config->ch0OutMin
|
outMin << m_config->ch0OutMin
|
||||||
<< m_config->ch1OutMin
|
<< m_config->ch1OutMin
|
||||||
<< m_config->ch2OutMin
|
<< m_config->ch2OutMin
|
||||||
<< m_config->ch3OutMin
|
<< m_config->ch3OutMin
|
||||||
<< m_config->ch4OutMin
|
<< m_config->ch4OutMin
|
||||||
<< m_config->ch5OutMin
|
<< m_config->ch5OutMin
|
||||||
<< m_config->ch6OutMin
|
<< m_config->ch6OutMin
|
||||||
<< m_config->ch7OutMin;
|
<< m_config->ch7OutMin;
|
||||||
outMax << m_config->ch0OutMax
|
outMax << m_config->ch0OutMax
|
||||||
<< m_config->ch1OutMax
|
<< m_config->ch1OutMax
|
||||||
<< m_config->ch2OutMax
|
<< m_config->ch2OutMax
|
||||||
<< m_config->ch3OutMax
|
<< m_config->ch3OutMax
|
||||||
<< m_config->ch4OutMax
|
<< m_config->ch4OutMax
|
||||||
<< m_config->ch5OutMax
|
<< m_config->ch5OutMax
|
||||||
<< m_config->ch6OutMax
|
<< m_config->ch6OutMax
|
||||||
<< m_config->ch7OutMax;
|
<< m_config->ch7OutMax;
|
||||||
reversals << m_config->ch0Rev
|
reversals << m_config->ch0Rev
|
||||||
<< m_config->ch1Rev
|
<< m_config->ch1Rev
|
||||||
<< m_config->ch2Rev
|
<< m_config->ch2Rev
|
||||||
<< m_config->ch3Rev
|
<< m_config->ch3Rev
|
||||||
<< m_config->ch4Rev
|
<< m_config->ch4Rev
|
||||||
<< m_config->ch5Rev
|
<< m_config->ch5Rev
|
||||||
<< m_config->ch6Rev
|
<< m_config->ch6Rev
|
||||||
<< m_config->ch7Rev;
|
<< m_config->ch7Rev;
|
||||||
inSliders << m_config->ch0Slider
|
inSliders << m_config->ch0Slider
|
||||||
<< m_config->ch1Slider
|
<< m_config->ch1Slider
|
||||||
<< m_config->ch2Slider
|
<< m_config->ch2Slider
|
||||||
<< m_config->ch3Slider
|
<< m_config->ch3Slider
|
||||||
<< m_config->ch4Slider
|
<< m_config->ch4Slider
|
||||||
<< m_config->ch5Slider
|
<< m_config->ch5Slider
|
||||||
<< m_config->ch6Slider
|
<< m_config->ch6Slider
|
||||||
<< m_config->ch7Slider;
|
<< m_config->ch7Slider;
|
||||||
|
|
||||||
|
|
||||||
// Now connect the widget to the ManualControlCommand / Channel UAVObject
|
// Now connect the widget to the ManualControlCommand / Channel UAVObject
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
|
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlCommand")));
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlCommand")));
|
||||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateChannels(UAVObject*)));
|
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateChannels(UAVObject*)));
|
||||||
|
|
||||||
// Get the receiver types supported by OpenPilot and fill the corresponding
|
// Get the receiver types supported by OpenPilot and fill the corresponding
|
||||||
// dropdown menu:
|
// dropdown menu:
|
||||||
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
|
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
|
||||||
QString fieldName = QString("InputMode");
|
QString fieldName = QString("InputMode");
|
||||||
UAVObjectField *field = obj->getField(fieldName);
|
UAVObjectField *field = obj->getField(fieldName);
|
||||||
m_config->receiverType->addItems(field->getOptions());
|
m_config->receiverType->addItems(field->getOptions());
|
||||||
m_config->receiverType->setDisabled(true); // This option does not work for now, it is a compile-time option.
|
m_config->receiverType->setDisabled(true); // This option does not work for now, it is a compile-time option.
|
||||||
|
|
||||||
// Fill in the dropdown menus for the channel RC Input assignement.
|
// Fill in the dropdown menus for the channel RC Input assignement.
|
||||||
QStringList channelsList;
|
QStringList channelsList;
|
||||||
channelsList << "None";
|
channelsList << "None";
|
||||||
QList<UAVObjectField*> fieldList = obj->getFields();
|
QList<UAVObjectField*> fieldList = obj->getFields();
|
||||||
foreach (UAVObjectField* field, fieldList) {
|
foreach (UAVObjectField* field, fieldList) {
|
||||||
if (field->getUnits().contains("channel")) {
|
if (field->getUnits().contains("channel")) {
|
||||||
channelsList.append(field->getName());
|
channelsList.append(field->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_config->ch0Assign->addItems(channelsList);
|
m_config->ch0Assign->addItems(channelsList);
|
||||||
m_config->ch1Assign->addItems(channelsList);
|
m_config->ch1Assign->addItems(channelsList);
|
||||||
m_config->ch2Assign->addItems(channelsList);
|
m_config->ch2Assign->addItems(channelsList);
|
||||||
m_config->ch3Assign->addItems(channelsList);
|
m_config->ch3Assign->addItems(channelsList);
|
||||||
m_config->ch4Assign->addItems(channelsList);
|
m_config->ch4Assign->addItems(channelsList);
|
||||||
m_config->ch5Assign->addItems(channelsList);
|
m_config->ch5Assign->addItems(channelsList);
|
||||||
m_config->ch6Assign->addItems(channelsList);
|
m_config->ch6Assign->addItems(channelsList);
|
||||||
m_config->ch7Assign->addItems(channelsList);
|
m_config->ch7Assign->addItems(channelsList);
|
||||||
|
|
||||||
// And for the channel output assignement options
|
// And for the channel output assignement options
|
||||||
m_config->ch0Output->addItem("None");
|
m_config->ch0Output->addItem("None");
|
||||||
m_config->ch1Output->addItem("None");
|
m_config->ch1Output->addItem("None");
|
||||||
m_config->ch2Output->addItem("None");
|
m_config->ch2Output->addItem("None");
|
||||||
m_config->ch3Output->addItem("None");
|
m_config->ch3Output->addItem("None");
|
||||||
m_config->ch4Output->addItem("None");
|
m_config->ch4Output->addItem("None");
|
||||||
m_config->ch5Output->addItem("None");
|
m_config->ch5Output->addItem("None");
|
||||||
m_config->ch6Output->addItem("None");
|
m_config->ch6Output->addItem("None");
|
||||||
m_config->ch7Output->addItem("None");
|
m_config->ch7Output->addItem("None");
|
||||||
|
|
||||||
// And the flight mode settings:
|
// And the flight mode settings:
|
||||||
field = obj->getField(QString("Pos1FlightMode"));
|
field = obj->getField(QString("Pos1FlightMode"));
|
||||||
m_config->fmsModePos1->addItems(field->getOptions());
|
m_config->fmsModePos1->addItems(field->getOptions());
|
||||||
m_config->fmsModePos2->addItems(field->getOptions());
|
m_config->fmsModePos2->addItems(field->getOptions());
|
||||||
m_config->fmsModePos3->addItems(field->getOptions());
|
m_config->fmsModePos3->addItems(field->getOptions());
|
||||||
field = obj->getField(QString("Pos1StabilizationSettings"));
|
field = obj->getField(QString("Pos1StabilizationSettings"));
|
||||||
channelsList.clear();
|
channelsList.clear();
|
||||||
channelsList.append(field->getOptions());
|
channelsList.append(field->getOptions());
|
||||||
m_config->fmsSsPos1Roll->addItems(channelsList);
|
m_config->fmsSsPos1Roll->addItems(channelsList);
|
||||||
m_config->fmsSsPos1Pitch->addItems(channelsList);
|
m_config->fmsSsPos1Pitch->addItems(channelsList);
|
||||||
m_config->fmsSsPos1Yaw->addItems(channelsList);
|
m_config->fmsSsPos1Yaw->addItems(channelsList);
|
||||||
m_config->fmsSsPos2Roll->addItems(channelsList);
|
m_config->fmsSsPos2Roll->addItems(channelsList);
|
||||||
m_config->fmsSsPos2Pitch->addItems(channelsList);
|
m_config->fmsSsPos2Pitch->addItems(channelsList);
|
||||||
m_config->fmsSsPos2Yaw->addItems(channelsList);
|
m_config->fmsSsPos2Yaw->addItems(channelsList);
|
||||||
m_config->fmsSsPos3Roll->addItems(channelsList);
|
m_config->fmsSsPos3Roll->addItems(channelsList);
|
||||||
m_config->fmsSsPos3Pitch->addItems(channelsList);
|
m_config->fmsSsPos3Pitch->addItems(channelsList);
|
||||||
m_config->fmsSsPos3Yaw->addItems(channelsList);
|
m_config->fmsSsPos3Yaw->addItems(channelsList);
|
||||||
|
|
||||||
|
// And the Armin configurations:
|
||||||
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
field = obj->getField(QString("Arming"));
|
||||||
fieldList = obj->getFields();
|
m_config->armControl->clear();
|
||||||
foreach (UAVObjectField* field, fieldList) {
|
m_config->armControl->addItems(field->getOptions());
|
||||||
if (field->getUnits().contains("channel")) {
|
|
||||||
m_config->ch0Output->addItem(field->getName());
|
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
||||||
m_config->ch1Output->addItem(field->getName());
|
fieldList = obj->getFields();
|
||||||
m_config->ch2Output->addItem(field->getName());
|
foreach (UAVObjectField* field, fieldList) {
|
||||||
m_config->ch3Output->addItem(field->getName());
|
if (field->getUnits().contains("channel")) {
|
||||||
m_config->ch4Output->addItem(field->getName());
|
m_config->ch0Output->addItem(field->getName());
|
||||||
m_config->ch5Output->addItem(field->getName());
|
m_config->ch1Output->addItem(field->getName());
|
||||||
m_config->ch6Output->addItem(field->getName());
|
m_config->ch2Output->addItem(field->getName());
|
||||||
m_config->ch7Output->addItem(field->getName());
|
m_config->ch3Output->addItem(field->getName());
|
||||||
}
|
m_config->ch4Output->addItem(field->getName());
|
||||||
}
|
m_config->ch5Output->addItem(field->getName());
|
||||||
|
m_config->ch6Output->addItem(field->getName());
|
||||||
for (int i = 0; i < 8; i++) {
|
m_config->ch7Output->addItem(field->getName());
|
||||||
connect(outMin[i], SIGNAL(editingFinished()), this, SLOT(setChOutRange()));
|
}
|
||||||
connect(outMax[i], SIGNAL(editingFinished()), this, SLOT(setChOutRange()));
|
}
|
||||||
connect(reversals[i], SIGNAL(toggled(bool)), this, SLOT(reverseChannel(bool)));
|
|
||||||
// Now connect the channel out sliders to our signal to send updates in test mode
|
for (int i = 0; i < 8; i++) {
|
||||||
connect(outSliders[i], SIGNAL(valueChanged(int)), this, SLOT(sendChannelTest(int)));
|
connect(outMin[i], SIGNAL(editingFinished()), this, SLOT(setChOutRange()));
|
||||||
}
|
connect(outMax[i], SIGNAL(editingFinished()), this, SLOT(setChOutRange()));
|
||||||
|
connect(reversals[i], SIGNAL(toggled(bool)), this, SLOT(reverseChannel(bool)));
|
||||||
connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool)));
|
// Now connect the channel out sliders to our signal to send updates in test mode
|
||||||
|
connect(outSliders[i], SIGNAL(valueChanged(int)), this, SLOT(sendChannelTest(int)));
|
||||||
requestRCInputUpdate();
|
}
|
||||||
requestRCOutputUpdate();
|
|
||||||
|
connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool)));
|
||||||
connect(m_config->saveRCInputToSD, SIGNAL(clicked()), this, SLOT(saveRCInputObject()));
|
|
||||||
connect(m_config->saveRCInputToRAM, SIGNAL(clicked()), this, SLOT(sendRCInputUpdate()));
|
requestRCInputUpdate();
|
||||||
connect(m_config->getRCInputCurrent, SIGNAL(clicked()), this, SLOT(requestRCInputUpdate()));
|
requestRCOutputUpdate();
|
||||||
|
|
||||||
// Flightmode panel is connected to the same as rcinput because
|
connect(m_config->saveRCInputToSD, SIGNAL(clicked()), this, SLOT(saveRCInputObject()));
|
||||||
// the underlying object is the same!
|
connect(m_config->saveRCInputToRAM, SIGNAL(clicked()), this, SLOT(sendRCInputUpdate()));
|
||||||
connect(m_config->saveFmsToSD, SIGNAL(clicked()), this, SLOT(saveRCInputObject()));
|
connect(m_config->getRCInputCurrent, SIGNAL(clicked()), this, SLOT(requestRCInputUpdate()));
|
||||||
connect(m_config->saveFmsToRAM, SIGNAL(clicked()), this, SLOT(sendRCInputUpdate()));
|
|
||||||
connect(m_config->getFmsCurrent, SIGNAL(clicked()), this, SLOT(requestRCInputUpdate()));
|
// Flightmode panel is connected to the same as rcinput because
|
||||||
|
// the underlying object is the same!
|
||||||
connect(m_config->saveRCOutputToSD, SIGNAL(clicked()), this, SLOT(saveRCOutputObject()));
|
connect(m_config->saveFmsToSD, SIGNAL(clicked()), this, SLOT(saveRCInputObject()));
|
||||||
connect(m_config->saveRCOutputToRAM, SIGNAL(clicked()), this, SLOT(sendRCOutputUpdate()));
|
connect(m_config->saveFmsToRAM, SIGNAL(clicked()), this, SLOT(sendRCInputUpdate()));
|
||||||
connect(m_config->getRCOutputCurrent, SIGNAL(clicked()), this, SLOT(requestRCOutputUpdate()));
|
connect(m_config->getFmsCurrent, SIGNAL(clicked()), this, SLOT(requestRCInputUpdate()));
|
||||||
|
|
||||||
|
connect(m_config->saveArmToSD, SIGNAL(clicked()), this, SLOT(saveRCInputObject()));
|
||||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCInputUpdate()));
|
connect(m_config->saveArmToRAM, SIGNAL(clicked()), this, SLOT(sendRCInputUpdate()));
|
||||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCOutputUpdate()));
|
connect(m_config->getArmCurrent, SIGNAL(clicked()), this, SLOT(requestRCInputUpdate()));
|
||||||
|
|
||||||
firstUpdate = true;
|
|
||||||
|
connect(m_config->saveRCOutputToSD, SIGNAL(clicked()), this, SLOT(saveRCOutputObject()));
|
||||||
}
|
connect(m_config->saveRCOutputToRAM, SIGNAL(clicked()), this, SLOT(sendRCOutputUpdate()));
|
||||||
|
connect(m_config->getRCOutputCurrent, SIGNAL(clicked()), this, SLOT(requestRCOutputUpdate()));
|
||||||
ConfigServoWidget::~ConfigServoWidget()
|
|
||||||
{
|
|
||||||
// Do nothing
|
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCInputUpdate()));
|
||||||
}
|
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCOutputUpdate()));
|
||||||
|
|
||||||
|
firstUpdate = true;
|
||||||
/**
|
|
||||||
Sends the channel value to the UAV to move the servo.
|
}
|
||||||
Returns immediately if we are not in testing mode
|
|
||||||
*/
|
ConfigServoWidget::~ConfigServoWidget()
|
||||||
void ConfigServoWidget::sendChannelTest(int value)
|
{
|
||||||
{
|
// Do nothing
|
||||||
// First of all, update the label:
|
}
|
||||||
QSlider *ob = (QSlider*)QObject::sender();
|
|
||||||
int index = outSliders.indexOf(ob);
|
|
||||||
if (reversals[index]->isChecked())
|
/**
|
||||||
value = outMin[index]->value()-value+outMax[index]->value();
|
Sends the channel value to the UAV to move the servo.
|
||||||
else
|
Returns immediately if we are not in testing mode
|
||||||
outLabels[index]->setText(QString::number(value));
|
*/
|
||||||
|
void ConfigServoWidget::sendChannelTest(int value)
|
||||||
outLabels[index]->setText(QString::number(value));
|
{
|
||||||
if (!m_config->channelOutTest->isChecked())
|
// First of all, update the label:
|
||||||
return;
|
QSlider *ob = (QSlider*)QObject::sender();
|
||||||
|
int index = outSliders.indexOf(ob);
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorCommand")));
|
if (reversals[index]->isChecked())
|
||||||
|
value = outMin[index]->value()-value+outMax[index]->value();
|
||||||
UAVObjectField * channel = obj->getField("Channel");
|
else
|
||||||
channel->setValue(value,index);
|
outLabels[index]->setText(QString::number(value));
|
||||||
obj->updated();
|
|
||||||
|
outLabels[index]->setText(QString::number(value));
|
||||||
}
|
if (!m_config->channelOutTest->isChecked())
|
||||||
|
return;
|
||||||
/**
|
|
||||||
Toggles the channel testing mode by making the GCS take over
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorCommand")));
|
||||||
the ActuatorCommand objects
|
|
||||||
*/
|
UAVObjectField * channel = obj->getField("Channel");
|
||||||
void ConfigServoWidget::runChannelTests(bool state)
|
channel->setValue(value,index);
|
||||||
{
|
obj->updated();
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
}
|
||||||
|
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorCommand")));
|
/**
|
||||||
UAVObject::Metadata mdata = obj->getMetadata();
|
Toggles the channel testing mode by making the GCS take over
|
||||||
if (state)
|
the ActuatorCommand objects
|
||||||
{
|
*/
|
||||||
accInitialData = mdata;
|
void ConfigServoWidget::runChannelTests(bool state)
|
||||||
mdata.flightAccess = UAVObject::ACCESS_READONLY;
|
{
|
||||||
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
mdata.gcsTelemetryAcked = false;
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
|
|
||||||
mdata.gcsTelemetryUpdatePeriod = 100;
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorCommand")));
|
||||||
}
|
UAVObject::Metadata mdata = obj->getMetadata();
|
||||||
else
|
if (state)
|
||||||
{
|
{
|
||||||
mdata = accInitialData; // Restore metadata
|
accInitialData = mdata;
|
||||||
}
|
mdata.flightAccess = UAVObject::ACCESS_READONLY;
|
||||||
obj->setMetadata(mdata);
|
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
|
||||||
|
mdata.gcsTelemetryAcked = false;
|
||||||
}
|
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
|
||||||
|
mdata.gcsTelemetryUpdatePeriod = 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
/********************************
|
{
|
||||||
* Output settings
|
mdata = accInitialData; // Restore metadata
|
||||||
*******************************/
|
}
|
||||||
|
obj->setMetadata(mdata);
|
||||||
/**
|
|
||||||
Request the current config from the board (RC Output)
|
}
|
||||||
*/
|
|
||||||
void ConfigServoWidget::requestRCOutputUpdate()
|
|
||||||
{
|
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
/********************************
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
* Output settings
|
||||||
|
*******************************/
|
||||||
// Get the Airframe type from the system settings:
|
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("SystemSettings")));
|
/**
|
||||||
Q_ASSERT(obj);
|
Request the current config from the board (RC Output)
|
||||||
obj->requestUpdate();
|
*/
|
||||||
UAVObjectField *field = obj->getField(QString("AirframeType"));
|
void ConfigServoWidget::requestRCOutputUpdate()
|
||||||
m_config->aircraftType->setText(QString("Aircraft type: ") + field->getValue().toString());
|
{
|
||||||
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
// Reset all channel assignements:
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
m_config->ch0Output->setCurrentIndex(0);
|
|
||||||
m_config->ch1Output->setCurrentIndex(0);
|
// Get the Airframe type from the system settings:
|
||||||
m_config->ch2Output->setCurrentIndex(0);
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("SystemSettings")));
|
||||||
m_config->ch3Output->setCurrentIndex(0);
|
Q_ASSERT(obj);
|
||||||
m_config->ch4Output->setCurrentIndex(0);
|
obj->requestUpdate();
|
||||||
m_config->ch5Output->setCurrentIndex(0);
|
UAVObjectField *field = obj->getField(QString("AirframeType"));
|
||||||
m_config->ch6Output->setCurrentIndex(0);
|
m_config->aircraftType->setText(QString("Aircraft type: ") + field->getValue().toString());
|
||||||
m_config->ch7Output->setCurrentIndex(0);
|
|
||||||
|
// Reset all channel assignements:
|
||||||
// Get the channel assignements:
|
m_config->ch0Output->setCurrentIndex(0);
|
||||||
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
m_config->ch1Output->setCurrentIndex(0);
|
||||||
Q_ASSERT(obj);
|
m_config->ch2Output->setCurrentIndex(0);
|
||||||
obj->requestUpdate();
|
m_config->ch3Output->setCurrentIndex(0);
|
||||||
QList<UAVObjectField*> fieldList = obj->getFields();
|
m_config->ch4Output->setCurrentIndex(0);
|
||||||
foreach (UAVObjectField* field, fieldList) {
|
m_config->ch5Output->setCurrentIndex(0);
|
||||||
if (field->getUnits().contains("channel")) {
|
m_config->ch6Output->setCurrentIndex(0);
|
||||||
assignOutputChannel(obj,field->getName());
|
m_config->ch7Output->setCurrentIndex(0);
|
||||||
}
|
|
||||||
}
|
// Get the channel assignements:
|
||||||
|
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
||||||
// Get Output rates for both banks
|
Q_ASSERT(obj);
|
||||||
field = obj->getField(QString("ChannelUpdateFreq"));
|
obj->requestUpdate();
|
||||||
m_config->outputRate1->setValue(field->getValue(0).toInt());
|
QList<UAVObjectField*> fieldList = obj->getFields();
|
||||||
m_config->outputRate2->setValue(field->getValue(1).toInt());
|
foreach (UAVObjectField* field, fieldList) {
|
||||||
|
if (field->getUnits().contains("channel")) {
|
||||||
// Get Channel ranges:
|
assignOutputChannel(obj,field->getName());
|
||||||
for (int i=0;i<8;i++) {
|
}
|
||||||
field = obj->getField(QString("ChannelMin"));
|
}
|
||||||
int minValue = field->getValue(i).toInt();
|
|
||||||
outMin[i]->setValue(minValue);
|
// Get Output rates for both banks
|
||||||
field = obj->getField(QString("ChannelMax"));
|
field = obj->getField(QString("ChannelUpdateFreq"));
|
||||||
int maxValue = field->getValue(i).toInt();
|
m_config->outputRate1->setValue(field->getValue(0).toInt());
|
||||||
outMax[i]->setValue(maxValue);
|
m_config->outputRate2->setValue(field->getValue(1).toInt());
|
||||||
if (maxValue>minValue) {
|
|
||||||
outSliders[i]->setMinimum(minValue);
|
// Get Channel ranges:
|
||||||
outSliders[i]->setMaximum(maxValue);
|
for (int i=0;i<8;i++) {
|
||||||
reversals[i]->setChecked(false);
|
field = obj->getField(QString("ChannelMin"));
|
||||||
} else {
|
int minValue = field->getValue(i).toInt();
|
||||||
outSliders[i]->setMinimum(maxValue);
|
outMin[i]->setValue(minValue);
|
||||||
outSliders[i]->setMaximum(minValue);
|
field = obj->getField(QString("ChannelMax"));
|
||||||
reversals[i]->setChecked(true);
|
int maxValue = field->getValue(i).toInt();
|
||||||
}
|
outMax[i]->setValue(maxValue);
|
||||||
}
|
if (maxValue>minValue) {
|
||||||
|
outSliders[i]->setMinimum(minValue);
|
||||||
field = obj->getField(QString("ChannelNeutral"));
|
outSliders[i]->setMaximum(maxValue);
|
||||||
for (int i=0; i<8; i++) {
|
reversals[i]->setChecked(false);
|
||||||
int value = field->getValue(i).toInt();
|
} else {
|
||||||
outSliders[i]->setValue(value);
|
outSliders[i]->setMinimum(maxValue);
|
||||||
outLabels[i]->setText(QString::number(value));
|
outSliders[i]->setMaximum(minValue);
|
||||||
}
|
reversals[i]->setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
field = obj->getField(QString("ChannelNeutral"));
|
||||||
/**
|
for (int i=0; i<8; i++) {
|
||||||
* Sends the config to the board, without saving to the SD card (RC Output)
|
int value = field->getValue(i).toInt();
|
||||||
*/
|
outSliders[i]->setValue(value);
|
||||||
void ConfigServoWidget::sendRCOutputUpdate()
|
outLabels[i]->setText(QString::number(value));
|
||||||
{
|
}
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
}
|
||||||
Q_ASSERT(obj);
|
|
||||||
|
/**
|
||||||
// Now send channel ranges:
|
* Sends the config to the board, without saving to the SD card (RC Output)
|
||||||
UAVObjectField * field = obj->getField(QString("ChannelMax"));
|
*/
|
||||||
for (int i = 0; i < 8; i++) {
|
void ConfigServoWidget::sendRCOutputUpdate()
|
||||||
field->setValue(outMax[i]->value(),i);
|
{
|
||||||
}
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
field = obj->getField(QString("ChannelMin"));
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
||||||
for (int i = 0; i < 8; i++) {
|
Q_ASSERT(obj);
|
||||||
field->setValue(outMin[i]->value(),i);
|
|
||||||
}
|
// Now send channel ranges:
|
||||||
|
UAVObjectField * field = obj->getField(QString("ChannelMax"));
|
||||||
field = obj->getField(QString("ChannelNeutral"));
|
for (int i = 0; i < 8; i++) {
|
||||||
for (int i = 0; i < 8; i++) {
|
field->setValue(outMax[i]->value(),i);
|
||||||
field->setValue(outSliders[i]->value(),i);
|
}
|
||||||
}
|
|
||||||
|
field = obj->getField(QString("ChannelMin"));
|
||||||
field = obj->getField(QString("ChannelUpdateFreq"));
|
for (int i = 0; i < 8; i++) {
|
||||||
field->setValue(m_config->outputRate1->value(),0);
|
field->setValue(outMin[i]->value(),i);
|
||||||
field->setValue(m_config->outputRate2->value(),1);
|
}
|
||||||
|
|
||||||
// Set Actuator assignement for each channel:
|
field = obj->getField(QString("ChannelNeutral"));
|
||||||
// Rule: if two channels have the same setting (which is wrong!) the higher channel
|
for (int i = 0; i < 8; i++) {
|
||||||
// will get the setting.
|
field->setValue(outSliders[i]->value(),i);
|
||||||
|
}
|
||||||
// First, reset all channel assignements:
|
|
||||||
QList<UAVObjectField*> fieldList = obj->getFields();
|
field = obj->getField(QString("ChannelUpdateFreq"));
|
||||||
foreach (UAVObjectField* field, fieldList) {
|
field->setValue(m_config->outputRate1->value(),0);
|
||||||
// NOTE: we assume that all options in ActuatorSettings are a channel assignement
|
field->setValue(m_config->outputRate2->value(),1);
|
||||||
// except for the options called "ChannelXXX"
|
|
||||||
if (field->getUnits().contains("channel")) {
|
// Set Actuator assignement for each channel:
|
||||||
field->setValue(field->getOptions().last());
|
// Rule: if two channels have the same setting (which is wrong!) the higher channel
|
||||||
}
|
// will get the setting.
|
||||||
}
|
|
||||||
|
// First, reset all channel assignements:
|
||||||
if (m_config->ch0Output->currentIndex() != 0) {
|
QList<UAVObjectField*> fieldList = obj->getFields();
|
||||||
field = obj->getField(m_config->ch0Output->currentText());
|
foreach (UAVObjectField* field, fieldList) {
|
||||||
field->setValue(field->getOptions().at(0)); // -> This way we don't depend on channel naming convention
|
// NOTE: we assume that all options in ActuatorSettings are a channel assignement
|
||||||
}
|
// except for the options called "ChannelXXX"
|
||||||
if (m_config->ch1Output->currentIndex() != 0) {
|
if (field->getUnits().contains("channel")) {
|
||||||
field = obj->getField(m_config->ch1Output->currentText());
|
field->setValue(field->getOptions().last());
|
||||||
field->setValue(field->getOptions().at(1)); // -> This way we don't depend on channel naming convention
|
}
|
||||||
}
|
}
|
||||||
if (m_config->ch2Output->currentIndex() != 0) {
|
|
||||||
field = obj->getField(m_config->ch2Output->currentText());
|
if (m_config->ch0Output->currentIndex() != 0) {
|
||||||
field->setValue(field->getOptions().at(2)); // -> This way we don't depend on channel naming convention
|
field = obj->getField(m_config->ch0Output->currentText());
|
||||||
}
|
field->setValue(field->getOptions().at(0)); // -> This way we don't depend on channel naming convention
|
||||||
if (m_config->ch3Output->currentIndex() != 0) {
|
}
|
||||||
field = obj->getField(m_config->ch3Output->currentText());
|
if (m_config->ch1Output->currentIndex() != 0) {
|
||||||
field->setValue(field->getOptions().at(3)); // -> This way we don't depend on channel naming convention
|
field = obj->getField(m_config->ch1Output->currentText());
|
||||||
}
|
field->setValue(field->getOptions().at(1)); // -> This way we don't depend on channel naming convention
|
||||||
if (m_config->ch4Output->currentIndex() != 0) {
|
}
|
||||||
field = obj->getField(m_config->ch4Output->currentText());
|
if (m_config->ch2Output->currentIndex() != 0) {
|
||||||
field->setValue(field->getOptions().at(4)); // -> This way we don't depend on channel naming convention
|
field = obj->getField(m_config->ch2Output->currentText());
|
||||||
}
|
field->setValue(field->getOptions().at(2)); // -> This way we don't depend on channel naming convention
|
||||||
if (m_config->ch5Output->currentIndex() != 0) {
|
}
|
||||||
field = obj->getField(m_config->ch5Output->currentText());
|
if (m_config->ch3Output->currentIndex() != 0) {
|
||||||
field->setValue(field->getOptions().at(5)); // -> This way we don't depend on channel naming convention
|
field = obj->getField(m_config->ch3Output->currentText());
|
||||||
}
|
field->setValue(field->getOptions().at(3)); // -> This way we don't depend on channel naming convention
|
||||||
if (m_config->ch6Output->currentIndex() != 0) {
|
}
|
||||||
field = obj->getField(m_config->ch6Output->currentText());
|
if (m_config->ch4Output->currentIndex() != 0) {
|
||||||
field->setValue(field->getOptions().at(6)); // -> This way we don't depend on channel naming convention
|
field = obj->getField(m_config->ch4Output->currentText());
|
||||||
}
|
field->setValue(field->getOptions().at(4)); // -> This way we don't depend on channel naming convention
|
||||||
if (m_config->ch7Output->currentIndex() != 0) {
|
}
|
||||||
field = obj->getField(m_config->ch7Output->currentText());
|
if (m_config->ch5Output->currentIndex() != 0) {
|
||||||
field->setValue(field->getOptions().at(7)); // -> This way we don't depend on channel naming convention
|
field = obj->getField(m_config->ch5Output->currentText());
|
||||||
}
|
field->setValue(field->getOptions().at(5)); // -> This way we don't depend on channel naming convention
|
||||||
|
}
|
||||||
// ... and send to the OP Board
|
if (m_config->ch6Output->currentIndex() != 0) {
|
||||||
obj->updated();
|
field = obj->getField(m_config->ch6Output->currentText());
|
||||||
|
field->setValue(field->getOptions().at(6)); // -> This way we don't depend on channel naming convention
|
||||||
|
}
|
||||||
}
|
if (m_config->ch7Output->currentIndex() != 0) {
|
||||||
|
field = obj->getField(m_config->ch7Output->currentText());
|
||||||
|
field->setValue(field->getOptions().at(7)); // -> This way we don't depend on channel naming convention
|
||||||
/**
|
}
|
||||||
Sends the config to the board and request saving into the SD card (RC Output)
|
|
||||||
*/
|
// ... and send to the OP Board
|
||||||
void ConfigServoWidget::saveRCOutputObject()
|
obj->updated();
|
||||||
{
|
|
||||||
// Send update so that the latest value is saved
|
|
||||||
sendRCOutputUpdate();
|
}
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
/**
|
||||||
Q_ASSERT(obj);
|
Sends the config to the board and request saving into the SD card (RC Output)
|
||||||
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
*/
|
||||||
|
void ConfigServoWidget::saveRCOutputObject()
|
||||||
}
|
{
|
||||||
|
// Send update so that the latest value is saved
|
||||||
|
sendRCOutputUpdate();
|
||||||
/**
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
Sets the minimum/maximum value of the channel 0 to seven output sliders.
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
Have to do it here because setMinimum is not a slot.
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
||||||
|
Q_ASSERT(obj);
|
||||||
One added trick: if the slider is at either its max or its min when the value
|
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
||||||
is changed, then keep it on the max/min.
|
|
||||||
*/
|
}
|
||||||
void ConfigServoWidget::setChOutRange()
|
|
||||||
{
|
|
||||||
QSpinBox *spinbox = (QSpinBox*)QObject::sender();
|
/**
|
||||||
|
Sets the minimum/maximum value of the channel 0 to seven output sliders.
|
||||||
int index = outMin.indexOf(spinbox); // This is the channel number
|
Have to do it here because setMinimum is not a slot.
|
||||||
if (index < 0)
|
|
||||||
index = outMax.indexOf(spinbox); // We can't know if the signal came from min or max
|
One added trick: if the slider is at either its max or its min when the value
|
||||||
|
is changed, then keep it on the max/min.
|
||||||
QSlider *slider = outSliders[index];
|
*/
|
||||||
|
void ConfigServoWidget::setChOutRange()
|
||||||
int oldMini = slider->minimum();
|
{
|
||||||
int oldMaxi = slider->maximum();
|
QSpinBox *spinbox = (QSpinBox*)QObject::sender();
|
||||||
|
|
||||||
if (outMin[index]->value()<outMax[index]->value())
|
int index = outMin.indexOf(spinbox); // This is the channel number
|
||||||
{
|
if (index < 0)
|
||||||
slider->setRange(outMin[index]->value(), outMax[index]->value());
|
index = outMax.indexOf(spinbox); // We can't know if the signal came from min or max
|
||||||
reversals[index]->setChecked(false);
|
|
||||||
}
|
QSlider *slider = outSliders[index];
|
||||||
else
|
|
||||||
{
|
int oldMini = slider->minimum();
|
||||||
slider->setRange(outMax[index]->value(), outMin[index]->value());
|
int oldMaxi = slider->maximum();
|
||||||
reversals[index]->setChecked(true);
|
|
||||||
}
|
if (outMin[index]->value()<outMax[index]->value())
|
||||||
|
{
|
||||||
if (slider->value() == oldMini)
|
slider->setRange(outMin[index]->value(), outMax[index]->value());
|
||||||
slider->setValue(slider->minimum());
|
reversals[index]->setChecked(false);
|
||||||
|
}
|
||||||
// if (slider->value() == oldMaxi)
|
else
|
||||||
// slider->setValue(slider->maximum()); // this can be dangerous if it happens to be controlling a motor at the time!
|
{
|
||||||
}
|
slider->setRange(outMax[index]->value(), outMin[index]->value());
|
||||||
|
reversals[index]->setChecked(true);
|
||||||
/**
|
}
|
||||||
Reverses the channel when the checkbox is clicked
|
|
||||||
*/
|
if (slider->value() == oldMini)
|
||||||
void ConfigServoWidget::reverseChannel(bool state)
|
slider->setValue(slider->minimum());
|
||||||
{
|
|
||||||
QCheckBox *checkbox = (QCheckBox*)QObject::sender();
|
// if (slider->value() == oldMaxi)
|
||||||
int index = reversals.indexOf(checkbox); // This is the channel number
|
// slider->setValue(slider->maximum()); // this can be dangerous if it happens to be controlling a motor at the time!
|
||||||
|
}
|
||||||
// Sanity check: if state became true, make sure the Maxvalue was higher than Minvalue
|
|
||||||
// the situations below can happen!
|
/**
|
||||||
if (state && (outMax[index]->value()<outMin[index]->value()))
|
Reverses the channel when the checkbox is clicked
|
||||||
return;
|
*/
|
||||||
if (!state && (outMax[index]->value()>outMin[index]->value()))
|
void ConfigServoWidget::reverseChannel(bool state)
|
||||||
return;
|
{
|
||||||
|
QCheckBox *checkbox = (QCheckBox*)QObject::sender();
|
||||||
// Now, swap the min & max values (only on the spinboxes, the slider
|
int index = reversals.indexOf(checkbox); // This is the channel number
|
||||||
// does not change!
|
|
||||||
int temp = outMax[index]->value();
|
// Sanity check: if state became true, make sure the Maxvalue was higher than Minvalue
|
||||||
outMax[index]->setValue(outMin[index]->value());
|
// the situations below can happen!
|
||||||
outMin[index]->setValue(temp);
|
if (state && (outMax[index]->value()<outMin[index]->value()))
|
||||||
|
return;
|
||||||
// Also update the channel value
|
if (!state && (outMax[index]->value()>outMin[index]->value()))
|
||||||
// This is a trick to force the slider to update its value and
|
return;
|
||||||
// emit the right signal itself, because our sendChannelTest(int) method
|
|
||||||
// relies on the object sender's identity.
|
// Now, swap the min & max values (only on the spinboxes, the slider
|
||||||
if (outSliders[index]->value()<outSliders[index]->maximum()) {
|
// does not change!
|
||||||
outSliders[index]->setValue(outSliders[index]->value()+1);
|
int temp = outMax[index]->value();
|
||||||
outSliders[index]->setValue(outSliders[index]->value()-1);
|
outMax[index]->setValue(outMin[index]->value());
|
||||||
} else {
|
outMin[index]->setValue(temp);
|
||||||
outSliders[index]->setValue(outSliders[index]->value()-1);
|
|
||||||
outSliders[index]->setValue(outSliders[index]->value()+1);
|
// Also update the channel value
|
||||||
}
|
// This is a trick to force the slider to update its value and
|
||||||
|
// emit the right signal itself, because our sendChannelTest(int) method
|
||||||
}
|
// relies on the object sender's identity.
|
||||||
|
if (outSliders[index]->value()<outSliders[index]->maximum()) {
|
||||||
|
outSliders[index]->setValue(outSliders[index]->value()+1);
|
||||||
/********************************
|
outSliders[index]->setValue(outSliders[index]->value()-1);
|
||||||
* Input settings
|
} else {
|
||||||
*******************************/
|
outSliders[index]->setValue(outSliders[index]->value()-1);
|
||||||
|
outSliders[index]->setValue(outSliders[index]->value()+1);
|
||||||
/**
|
}
|
||||||
Request the current config from the board
|
|
||||||
*/
|
}
|
||||||
void ConfigServoWidget::requestRCInputUpdate()
|
|
||||||
{
|
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ManualControlSettings")));
|
/********************************
|
||||||
Q_ASSERT(obj);
|
* Input settings
|
||||||
obj->requestUpdate();
|
*******************************/
|
||||||
|
|
||||||
// Now update all the slider values:
|
/**
|
||||||
QString fieldName = QString("ChannelMax");
|
Request the current config from the board
|
||||||
UAVObjectField *field = obj->getField(fieldName);
|
*/
|
||||||
m_config->ch0Max->setText(field->getValue(0).toString());
|
void ConfigServoWidget::requestRCInputUpdate()
|
||||||
m_config->ch0Slider->setMaximum(field->getValue(0).toInt());
|
{
|
||||||
m_config->ch1Max->setText(field->getValue(1).toString());
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ManualControlSettings")));
|
||||||
m_config->ch1Slider->setMaximum(field->getValue(1).toInt());
|
Q_ASSERT(obj);
|
||||||
m_config->ch2Max->setText(field->getValue(2).toString());
|
obj->requestUpdate();
|
||||||
m_config->ch2Slider->setMaximum(field->getValue(2).toInt());
|
|
||||||
m_config->ch3Max->setText(field->getValue(3).toString());
|
// Now update all the slider values:
|
||||||
m_config->ch3Slider->setMaximum(field->getValue(3).toInt());
|
QString fieldName = QString("ChannelMax");
|
||||||
m_config->ch4Max->setText(field->getValue(4).toString());
|
UAVObjectField *field = obj->getField(fieldName);
|
||||||
m_config->ch4Slider->setMaximum(field->getValue(4).toInt());
|
m_config->ch0Max->setText(field->getValue(0).toString());
|
||||||
m_config->ch5Max->setText(field->getValue(5).toString());
|
m_config->ch0Slider->setMaximum(field->getValue(0).toInt());
|
||||||
m_config->ch5Slider->setMaximum(field->getValue(5).toInt());
|
m_config->ch1Max->setText(field->getValue(1).toString());
|
||||||
m_config->ch6Max->setText(field->getValue(6).toString());
|
m_config->ch1Slider->setMaximum(field->getValue(1).toInt());
|
||||||
m_config->ch6Slider->setMaximum(field->getValue(6).toInt());
|
m_config->ch2Max->setText(field->getValue(2).toString());
|
||||||
m_config->ch7Max->setText(field->getValue(7).toString());
|
m_config->ch2Slider->setMaximum(field->getValue(2).toInt());
|
||||||
m_config->ch7Slider->setMaximum(field->getValue(7).toInt());
|
m_config->ch3Max->setText(field->getValue(3).toString());
|
||||||
|
m_config->ch3Slider->setMaximum(field->getValue(3).toInt());
|
||||||
fieldName = QString("ChannelMin");
|
m_config->ch4Max->setText(field->getValue(4).toString());
|
||||||
field = obj->getField(fieldName);
|
m_config->ch4Slider->setMaximum(field->getValue(4).toInt());
|
||||||
m_config->ch0Min->setText(field->getValue(0).toString());
|
m_config->ch5Max->setText(field->getValue(5).toString());
|
||||||
m_config->ch0Slider->setMinimum(field->getValue(0).toInt());
|
m_config->ch5Slider->setMaximum(field->getValue(5).toInt());
|
||||||
m_config->ch1Min->setText(field->getValue(1).toString());
|
m_config->ch6Max->setText(field->getValue(6).toString());
|
||||||
m_config->ch1Slider->setMinimum(field->getValue(1).toInt());
|
m_config->ch6Slider->setMaximum(field->getValue(6).toInt());
|
||||||
m_config->ch2Min->setText(field->getValue(2).toString());
|
m_config->ch7Max->setText(field->getValue(7).toString());
|
||||||
m_config->ch2Slider->setMinimum(field->getValue(2).toInt());
|
m_config->ch7Slider->setMaximum(field->getValue(7).toInt());
|
||||||
m_config->ch3Min->setText(field->getValue(3).toString());
|
|
||||||
m_config->ch3Slider->setMinimum(field->getValue(3).toInt());
|
fieldName = QString("ChannelMin");
|
||||||
m_config->ch4Min->setText(field->getValue(4).toString());
|
field = obj->getField(fieldName);
|
||||||
m_config->ch4Slider->setMinimum(field->getValue(4).toInt());
|
m_config->ch0Min->setText(field->getValue(0).toString());
|
||||||
m_config->ch5Min->setText(field->getValue(5).toString());
|
m_config->ch0Slider->setMinimum(field->getValue(0).toInt());
|
||||||
m_config->ch5Slider->setMinimum(field->getValue(5).toInt());
|
m_config->ch1Min->setText(field->getValue(1).toString());
|
||||||
m_config->ch6Min->setText(field->getValue(6).toString());
|
m_config->ch1Slider->setMinimum(field->getValue(1).toInt());
|
||||||
m_config->ch6Slider->setMinimum(field->getValue(6).toInt());
|
m_config->ch2Min->setText(field->getValue(2).toString());
|
||||||
m_config->ch7Min->setText(field->getValue(7).toString());
|
m_config->ch2Slider->setMinimum(field->getValue(2).toInt());
|
||||||
m_config->ch7Slider->setMinimum(field->getValue(7).toInt());
|
m_config->ch3Min->setText(field->getValue(3).toString());
|
||||||
|
m_config->ch3Slider->setMinimum(field->getValue(3).toInt());
|
||||||
fieldName = QString("ChannelNeutral");
|
m_config->ch4Min->setText(field->getValue(4).toString());
|
||||||
field = obj->getField(fieldName);
|
m_config->ch4Slider->setMinimum(field->getValue(4).toInt());
|
||||||
m_config->ch0Slider->setValue(field->getValue(0).toInt());
|
m_config->ch5Min->setText(field->getValue(5).toString());
|
||||||
m_config->ch1Slider->setValue(field->getValue(1).toInt());
|
m_config->ch5Slider->setMinimum(field->getValue(5).toInt());
|
||||||
m_config->ch2Slider->setValue(field->getValue(2).toInt());
|
m_config->ch6Min->setText(field->getValue(6).toString());
|
||||||
m_config->ch3Slider->setValue(field->getValue(3).toInt());
|
m_config->ch6Slider->setMinimum(field->getValue(6).toInt());
|
||||||
m_config->ch4Slider->setValue(field->getValue(4).toInt());
|
m_config->ch7Min->setText(field->getValue(7).toString());
|
||||||
m_config->ch5Slider->setValue(field->getValue(5).toInt());
|
m_config->ch7Slider->setMinimum(field->getValue(7).toInt());
|
||||||
m_config->ch6Slider->setValue(field->getValue(6).toInt());
|
|
||||||
m_config->ch7Slider->setValue(field->getValue(7).toInt());
|
fieldName = QString("ChannelNeutral");
|
||||||
|
field = obj->getField(fieldName);
|
||||||
// Update receiver type
|
m_config->ch0Slider->setValue(field->getValue(0).toInt());
|
||||||
fieldName = QString("InputMode");
|
m_config->ch1Slider->setValue(field->getValue(1).toInt());
|
||||||
field = obj->getField(fieldName);
|
m_config->ch2Slider->setValue(field->getValue(2).toInt());
|
||||||
m_config->receiverType->setCurrentIndex(m_config->receiverType->findText(field->getValue().toString()));
|
m_config->ch3Slider->setValue(field->getValue(3).toInt());
|
||||||
|
m_config->ch4Slider->setValue(field->getValue(4).toInt());
|
||||||
// Reset all channel assignement dropdowns:
|
m_config->ch5Slider->setValue(field->getValue(5).toInt());
|
||||||
m_config->ch0Assign->setCurrentIndex(0);
|
m_config->ch6Slider->setValue(field->getValue(6).toInt());
|
||||||
m_config->ch1Assign->setCurrentIndex(0);
|
m_config->ch7Slider->setValue(field->getValue(7).toInt());
|
||||||
m_config->ch2Assign->setCurrentIndex(0);
|
|
||||||
m_config->ch3Assign->setCurrentIndex(0);
|
// Update receiver type
|
||||||
m_config->ch4Assign->setCurrentIndex(0);
|
fieldName = QString("InputMode");
|
||||||
m_config->ch5Assign->setCurrentIndex(0);
|
field = obj->getField(fieldName);
|
||||||
m_config->ch6Assign->setCurrentIndex(0);
|
m_config->receiverType->setCurrentIndex(m_config->receiverType->findText(field->getValue().toString()));
|
||||||
m_config->ch7Assign->setCurrentIndex(0);
|
|
||||||
|
// Reset all channel assignement dropdowns:
|
||||||
// Update all channels assignements
|
m_config->ch0Assign->setCurrentIndex(0);
|
||||||
QList<UAVObjectField*> fieldList = obj->getFields();
|
m_config->ch1Assign->setCurrentIndex(0);
|
||||||
foreach (UAVObjectField* field, fieldList) {
|
m_config->ch2Assign->setCurrentIndex(0);
|
||||||
if (field->getUnits().contains("channel")) {
|
m_config->ch3Assign->setCurrentIndex(0);
|
||||||
assignChannel(obj, field->getName());
|
m_config->ch4Assign->setCurrentIndex(0);
|
||||||
}
|
m_config->ch5Assign->setCurrentIndex(0);
|
||||||
}
|
m_config->ch6Assign->setCurrentIndex(0);
|
||||||
|
m_config->ch7Assign->setCurrentIndex(0);
|
||||||
// Update all the flight mode settingsin the relevant tab
|
|
||||||
field = obj->getField(QString("Pos1FlightMode"));
|
// Update all channels assignements
|
||||||
m_config->fmsModePos1->setCurrentIndex((m_config->fmsModePos1->findText(field->getValue().toString())));
|
QList<UAVObjectField*> fieldList = obj->getFields();
|
||||||
field = obj->getField(QString("Pos2FlightMode"));
|
foreach (UAVObjectField* field, fieldList) {
|
||||||
m_config->fmsModePos2->setCurrentIndex((m_config->fmsModePos2->findText(field->getValue().toString())));
|
if (field->getUnits().contains("channel")) {
|
||||||
field = obj->getField(QString("Pos3FlightMode"));
|
assignChannel(obj, field->getName());
|
||||||
m_config->fmsModePos3->setCurrentIndex((m_config->fmsModePos3->findText(field->getValue().toString())));
|
}
|
||||||
field = obj->getField(QString("Pos1StabilizationSettings"));
|
}
|
||||||
m_config->fmsSsPos1Roll->setCurrentIndex(m_config->fmsSsPos1Roll->findText(
|
|
||||||
field->getValue(field->getElementNames().indexOf("Roll")).toString()));
|
// Update all the flight mode settingsin the relevant tab
|
||||||
m_config->fmsSsPos1Pitch->setCurrentIndex(m_config->fmsSsPos1Pitch->findText(
|
field = obj->getField(QString("Pos1FlightMode"));
|
||||||
field->getValue(field->getElementNames().indexOf("Pitch")).toString()));
|
m_config->fmsModePos1->setCurrentIndex((m_config->fmsModePos1->findText(field->getValue().toString())));
|
||||||
m_config->fmsSsPos1Yaw->setCurrentIndex(m_config->fmsSsPos1Yaw->findText(
|
field = obj->getField(QString("Pos2FlightMode"));
|
||||||
field->getValue(field->getElementNames().indexOf("Yaw")).toString()));
|
m_config->fmsModePos2->setCurrentIndex((m_config->fmsModePos2->findText(field->getValue().toString())));
|
||||||
field = obj->getField(QString("Pos2StabilizationSettings"));
|
field = obj->getField(QString("Pos3FlightMode"));
|
||||||
m_config->fmsSsPos2Roll->setCurrentIndex(m_config->fmsSsPos2Roll->findText(
|
m_config->fmsModePos3->setCurrentIndex((m_config->fmsModePos3->findText(field->getValue().toString())));
|
||||||
field->getValue(field->getElementNames().indexOf("Roll")).toString()));
|
field = obj->getField(QString("Pos1StabilizationSettings"));
|
||||||
m_config->fmsSsPos2Pitch->setCurrentIndex(m_config->fmsSsPos2Pitch->findText(
|
m_config->fmsSsPos1Roll->setCurrentIndex(m_config->fmsSsPos1Roll->findText(
|
||||||
field->getValue(field->getElementNames().indexOf("Pitch")).toString()));
|
field->getValue(field->getElementNames().indexOf("Roll")).toString()));
|
||||||
m_config->fmsSsPos2Yaw->setCurrentIndex(m_config->fmsSsPos2Yaw->findText(
|
m_config->fmsSsPos1Pitch->setCurrentIndex(m_config->fmsSsPos1Pitch->findText(
|
||||||
field->getValue(field->getElementNames().indexOf("Yaw")).toString()));
|
field->getValue(field->getElementNames().indexOf("Pitch")).toString()));
|
||||||
field = obj->getField(QString("Pos3StabilizationSettings"));
|
m_config->fmsSsPos1Yaw->setCurrentIndex(m_config->fmsSsPos1Yaw->findText(
|
||||||
m_config->fmsSsPos3Roll->setCurrentIndex(m_config->fmsSsPos3Roll->findText(
|
field->getValue(field->getElementNames().indexOf("Yaw")).toString()));
|
||||||
field->getValue(field->getElementNames().indexOf("Roll")).toString()));
|
field = obj->getField(QString("Pos2StabilizationSettings"));
|
||||||
m_config->fmsSsPos3Pitch->setCurrentIndex(m_config->fmsSsPos3Pitch->findText(
|
m_config->fmsSsPos2Roll->setCurrentIndex(m_config->fmsSsPos2Roll->findText(
|
||||||
field->getValue(field->getElementNames().indexOf("Pitch")).toString()));
|
field->getValue(field->getElementNames().indexOf("Roll")).toString()));
|
||||||
m_config->fmsSsPos3Yaw->setCurrentIndex(m_config->fmsSsPos3Yaw->findText(
|
m_config->fmsSsPos2Pitch->setCurrentIndex(m_config->fmsSsPos2Pitch->findText(
|
||||||
field->getValue(field->getElementNames().indexOf("Yaw")).toString()));
|
field->getValue(field->getElementNames().indexOf("Pitch")).toString()));
|
||||||
|
m_config->fmsSsPos2Yaw->setCurrentIndex(m_config->fmsSsPos2Yaw->findText(
|
||||||
}
|
field->getValue(field->getElementNames().indexOf("Yaw")).toString()));
|
||||||
|
field = obj->getField(QString("Pos3StabilizationSettings"));
|
||||||
|
m_config->fmsSsPos3Roll->setCurrentIndex(m_config->fmsSsPos3Roll->findText(
|
||||||
/**
|
field->getValue(field->getElementNames().indexOf("Roll")).toString()));
|
||||||
* Sends the config to the board, without saving to the SD card
|
m_config->fmsSsPos3Pitch->setCurrentIndex(m_config->fmsSsPos3Pitch->findText(
|
||||||
*/
|
field->getValue(field->getElementNames().indexOf("Pitch")).toString()));
|
||||||
void ConfigServoWidget::sendRCInputUpdate()
|
m_config->fmsSsPos3Yaw->setCurrentIndex(m_config->fmsSsPos3Yaw->findText(
|
||||||
{
|
field->getValue(field->getElementNames().indexOf("Yaw")).toString()));
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
// Load the arming settings
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
|
field = obj->getField(QString("Arming"));
|
||||||
Q_ASSERT(obj);
|
m_config->armControl->setCurrentIndex(m_config->armControl->findText(field->getValue().toString()));
|
||||||
// Now update all fields from the sliders:
|
field = obj->getField(QString("ArmedTimeout"));
|
||||||
QString fieldName = QString("ChannelMax");
|
m_config->armTimeout->setValue(field->getValue().toInt()/1000);
|
||||||
UAVObjectField * field = obj->getField(fieldName);
|
|
||||||
field->setValue(m_config->ch0Max->text().toInt(),0);
|
}
|
||||||
field->setValue(m_config->ch1Max->text().toInt(),1);
|
|
||||||
field->setValue(m_config->ch2Max->text().toInt(),2);
|
|
||||||
field->setValue(m_config->ch3Max->text().toInt(),3);
|
/**
|
||||||
field->setValue(m_config->ch4Max->text().toInt(),4);
|
* Sends the config to the board, without saving to the SD card
|
||||||
field->setValue(m_config->ch5Max->text().toInt(),5);
|
*/
|
||||||
field->setValue(m_config->ch6Max->text().toInt(),6);
|
void ConfigServoWidget::sendRCInputUpdate()
|
||||||
field->setValue(m_config->ch7Max->text().toInt(),7);
|
{
|
||||||
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
fieldName = QString("ChannelMin");
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
field = obj->getField(fieldName);
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
|
||||||
field->setValue(m_config->ch0Min->text().toInt(),0);
|
Q_ASSERT(obj);
|
||||||
field->setValue(m_config->ch1Min->text().toInt(),1);
|
// Now update all fields from the sliders:
|
||||||
field->setValue(m_config->ch2Min->text().toInt(),2);
|
QString fieldName = QString("ChannelMax");
|
||||||
field->setValue(m_config->ch3Min->text().toInt(),3);
|
UAVObjectField * field = obj->getField(fieldName);
|
||||||
field->setValue(m_config->ch4Min->text().toInt(),4);
|
field->setValue(m_config->ch0Max->text().toInt(),0);
|
||||||
field->setValue(m_config->ch5Min->text().toInt(),5);
|
field->setValue(m_config->ch1Max->text().toInt(),1);
|
||||||
field->setValue(m_config->ch6Min->text().toInt(),6);
|
field->setValue(m_config->ch2Max->text().toInt(),2);
|
||||||
field->setValue(m_config->ch7Min->text().toInt(),7);
|
field->setValue(m_config->ch3Max->text().toInt(),3);
|
||||||
|
field->setValue(m_config->ch4Max->text().toInt(),4);
|
||||||
fieldName = QString("ChannelNeutral");
|
field->setValue(m_config->ch5Max->text().toInt(),5);
|
||||||
field = obj->getField(fieldName);
|
field->setValue(m_config->ch6Max->text().toInt(),6);
|
||||||
field->setValue(m_config->ch0Slider->value(),0);
|
field->setValue(m_config->ch7Max->text().toInt(),7);
|
||||||
field->setValue(m_config->ch1Slider->value(),1);
|
|
||||||
field->setValue(m_config->ch2Slider->value(),2);
|
fieldName = QString("ChannelMin");
|
||||||
field->setValue(m_config->ch3Slider->value(),3);
|
field = obj->getField(fieldName);
|
||||||
field->setValue(m_config->ch4Slider->value(),4);
|
field->setValue(m_config->ch0Min->text().toInt(),0);
|
||||||
field->setValue(m_config->ch5Slider->value(),5);
|
field->setValue(m_config->ch1Min->text().toInt(),1);
|
||||||
field->setValue(m_config->ch6Slider->value(),6);
|
field->setValue(m_config->ch2Min->text().toInt(),2);
|
||||||
field->setValue(m_config->ch7Slider->value(),7);
|
field->setValue(m_config->ch3Min->text().toInt(),3);
|
||||||
|
field->setValue(m_config->ch4Min->text().toInt(),4);
|
||||||
// Set RC Receiver type:
|
field->setValue(m_config->ch5Min->text().toInt(),5);
|
||||||
fieldName = QString("InputMode");
|
field->setValue(m_config->ch6Min->text().toInt(),6);
|
||||||
field = obj->getField(fieldName);
|
field->setValue(m_config->ch7Min->text().toInt(),7);
|
||||||
field->setValue(m_config->receiverType->currentText());
|
|
||||||
|
fieldName = QString("ChannelNeutral");
|
||||||
// Set Roll/Pitch/Yaw/Etc assignement:
|
field = obj->getField(fieldName);
|
||||||
// Rule: if two channels have the same setting (which is wrong!) the higher channel
|
field->setValue(m_config->ch0Slider->value(),0);
|
||||||
// will get the setting.
|
field->setValue(m_config->ch1Slider->value(),1);
|
||||||
|
field->setValue(m_config->ch2Slider->value(),2);
|
||||||
// First, reset all channel assignements:
|
field->setValue(m_config->ch3Slider->value(),3);
|
||||||
QList<UAVObjectField*> fieldList = obj->getFields();
|
field->setValue(m_config->ch4Slider->value(),4);
|
||||||
foreach (UAVObjectField* field, fieldList) {
|
field->setValue(m_config->ch5Slider->value(),5);
|
||||||
if (field->getUnits().contains("channel")) {
|
field->setValue(m_config->ch6Slider->value(),6);
|
||||||
field->setValue(field->getOptions().last());
|
field->setValue(m_config->ch7Slider->value(),7);
|
||||||
}
|
|
||||||
}
|
// Set RC Receiver type:
|
||||||
|
fieldName = QString("InputMode");
|
||||||
// Then assign according to current GUI state:
|
field = obj->getField(fieldName);
|
||||||
if (m_config->ch0Assign->currentIndex() != 0) {
|
field->setValue(m_config->receiverType->currentText());
|
||||||
field = obj->getField(m_config->ch0Assign->currentText());
|
|
||||||
field->setValue(field->getOptions().at(0)); // -> This way we don't depend on channel naming convention
|
// Set Roll/Pitch/Yaw/Etc assignement:
|
||||||
}
|
// Rule: if two channels have the same setting (which is wrong!) the higher channel
|
||||||
if (m_config->ch1Assign->currentIndex() != 0) {
|
// will get the setting.
|
||||||
field = obj->getField(m_config->ch1Assign->currentText());
|
|
||||||
field->setValue(field->getOptions().at(1));
|
// First, reset all channel assignements:
|
||||||
}
|
QList<UAVObjectField*> fieldList = obj->getFields();
|
||||||
if (m_config->ch2Assign->currentIndex() != 0) {
|
foreach (UAVObjectField* field, fieldList) {
|
||||||
field = obj->getField(m_config->ch2Assign->currentText());
|
if (field->getUnits().contains("channel")) {
|
||||||
field->setValue(field->getOptions().at(2));
|
field->setValue(field->getOptions().last());
|
||||||
}
|
}
|
||||||
if (m_config->ch3Assign->currentIndex() != 0) {
|
}
|
||||||
field = obj->getField(m_config->ch3Assign->currentText());
|
|
||||||
field->setValue(field->getOptions().at(3));
|
// Then assign according to current GUI state:
|
||||||
}
|
if (m_config->ch0Assign->currentIndex() != 0) {
|
||||||
if (m_config->ch4Assign->currentIndex() != 0) {
|
field = obj->getField(m_config->ch0Assign->currentText());
|
||||||
field = obj->getField(m_config->ch4Assign->currentText());
|
field->setValue(field->getOptions().at(0)); // -> This way we don't depend on channel naming convention
|
||||||
field->setValue(field->getOptions().at(4));
|
}
|
||||||
}
|
if (m_config->ch1Assign->currentIndex() != 0) {
|
||||||
if (m_config->ch5Assign->currentIndex() != 0) {
|
field = obj->getField(m_config->ch1Assign->currentText());
|
||||||
field = obj->getField(m_config->ch5Assign->currentText());
|
field->setValue(field->getOptions().at(1));
|
||||||
field->setValue(field->getOptions().at(5));
|
}
|
||||||
}
|
if (m_config->ch2Assign->currentIndex() != 0) {
|
||||||
if (m_config->ch6Assign->currentIndex() != 0) {
|
field = obj->getField(m_config->ch2Assign->currentText());
|
||||||
field = obj->getField(m_config->ch6Assign->currentText());
|
field->setValue(field->getOptions().at(2));
|
||||||
field->setValue(field->getOptions().at(6));
|
}
|
||||||
}
|
if (m_config->ch3Assign->currentIndex() != 0) {
|
||||||
if (m_config->ch7Assign->currentIndex() != 0) {
|
field = obj->getField(m_config->ch3Assign->currentText());
|
||||||
field = obj->getField(m_config->ch7Assign->currentText());
|
field->setValue(field->getOptions().at(3));
|
||||||
field->setValue(field->getOptions().at(7));
|
}
|
||||||
}
|
if (m_config->ch4Assign->currentIndex() != 0) {
|
||||||
|
field = obj->getField(m_config->ch4Assign->currentText());
|
||||||
// Send all the flight mode settings
|
field->setValue(field->getOptions().at(4));
|
||||||
field = obj->getField(QString("Pos1FlightMode"));
|
}
|
||||||
field->setValue(m_config->fmsModePos1->currentText());
|
if (m_config->ch5Assign->currentIndex() != 0) {
|
||||||
field = obj->getField(QString("Pos2FlightMode"));
|
field = obj->getField(m_config->ch5Assign->currentText());
|
||||||
field->setValue(m_config->fmsModePos2->currentText());
|
field->setValue(field->getOptions().at(5));
|
||||||
field = obj->getField(QString("Pos3FlightMode"));
|
}
|
||||||
field->setValue(m_config->fmsModePos3->currentText());
|
if (m_config->ch6Assign->currentIndex() != 0) {
|
||||||
|
field = obj->getField(m_config->ch6Assign->currentText());
|
||||||
field = obj->getField(QString("Pos1StabilizationSettings"));
|
field->setValue(field->getOptions().at(6));
|
||||||
field->setValue(m_config->fmsSsPos1Roll->currentText(), field->getElementNames().indexOf("Roll"));
|
}
|
||||||
field->setValue(m_config->fmsSsPos1Pitch->currentText(), field->getElementNames().indexOf("Pitch"));
|
if (m_config->ch7Assign->currentIndex() != 0) {
|
||||||
field->setValue(m_config->fmsSsPos1Yaw->currentText(), field->getElementNames().indexOf("Yaw"));
|
field = obj->getField(m_config->ch7Assign->currentText());
|
||||||
field = obj->getField(QString("Pos2StabilizationSettings"));
|
field->setValue(field->getOptions().at(7));
|
||||||
field->setValue(m_config->fmsSsPos2Roll->currentText(), field->getElementNames().indexOf("Roll"));
|
}
|
||||||
field->setValue(m_config->fmsSsPos2Pitch->currentText(), field->getElementNames().indexOf("Pitch"));
|
|
||||||
field->setValue(m_config->fmsSsPos2Yaw->currentText(), field->getElementNames().indexOf("Yaw"));
|
// Send all the flight mode settings
|
||||||
field = obj->getField(QString("Pos3StabilizationSettings"));
|
field = obj->getField(QString("Pos1FlightMode"));
|
||||||
field->setValue(m_config->fmsSsPos3Roll->currentText(), field->getElementNames().indexOf("Roll"));
|
field->setValue(m_config->fmsModePos1->currentText());
|
||||||
field->setValue(m_config->fmsSsPos3Pitch->currentText(), field->getElementNames().indexOf("Pitch"));
|
field = obj->getField(QString("Pos2FlightMode"));
|
||||||
field->setValue(m_config->fmsSsPos3Yaw->currentText(), field->getElementNames().indexOf("Yaw"));
|
field->setValue(m_config->fmsModePos2->currentText());
|
||||||
|
field = obj->getField(QString("Pos3FlightMode"));
|
||||||
// ... and send to the OP Board
|
field->setValue(m_config->fmsModePos3->currentText());
|
||||||
obj->updated();
|
|
||||||
|
field = obj->getField(QString("Pos1StabilizationSettings"));
|
||||||
}
|
field->setValue(m_config->fmsSsPos1Roll->currentText(), field->getElementNames().indexOf("Roll"));
|
||||||
|
field->setValue(m_config->fmsSsPos1Pitch->currentText(), field->getElementNames().indexOf("Pitch"));
|
||||||
|
field->setValue(m_config->fmsSsPos1Yaw->currentText(), field->getElementNames().indexOf("Yaw"));
|
||||||
/**
|
field = obj->getField(QString("Pos2StabilizationSettings"));
|
||||||
Sends the config to the board and request saving into the SD card
|
field->setValue(m_config->fmsSsPos2Roll->currentText(), field->getElementNames().indexOf("Roll"));
|
||||||
*/
|
field->setValue(m_config->fmsSsPos2Pitch->currentText(), field->getElementNames().indexOf("Pitch"));
|
||||||
void ConfigServoWidget::saveRCInputObject()
|
field->setValue(m_config->fmsSsPos2Yaw->currentText(), field->getElementNames().indexOf("Yaw"));
|
||||||
{
|
field = obj->getField(QString("Pos3StabilizationSettings"));
|
||||||
// Send update so that the latest value is saved
|
field->setValue(m_config->fmsSsPos3Roll->currentText(), field->getElementNames().indexOf("Roll"));
|
||||||
sendRCInputUpdate();
|
field->setValue(m_config->fmsSsPos3Pitch->currentText(), field->getElementNames().indexOf("Pitch"));
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
field->setValue(m_config->fmsSsPos3Yaw->currentText(), field->getElementNames().indexOf("Yaw"));
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
|
// Save the arming settings
|
||||||
Q_ASSERT(obj);
|
field = obj->getField(QString("Arming"));
|
||||||
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
field->setValue(m_config->armControl->currentText());
|
||||||
}
|
field = obj->getField(QString("ArmedTimeout"));
|
||||||
|
field->setValue(m_config->armTimeout->value()*1000);
|
||||||
|
|
||||||
/**
|
// ... and send to the OP Board
|
||||||
* Set the dropdown option for a channel Input assignement
|
obj->updated();
|
||||||
*/
|
|
||||||
void ConfigServoWidget::assignChannel(UAVDataObject *obj, QString str)
|
}
|
||||||
{
|
|
||||||
UAVObjectField* field = obj->getField(str);
|
|
||||||
QStringList options = field->getOptions();
|
/**
|
||||||
switch (options.indexOf(field->getValue().toString())) {
|
Sends the config to the board and request saving into the SD card
|
||||||
case 0:
|
*/
|
||||||
m_config->ch0Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
void ConfigServoWidget::saveRCInputObject()
|
||||||
break;
|
{
|
||||||
case 1:
|
// Send update so that the latest value is saved
|
||||||
m_config->ch1Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
sendRCInputUpdate();
|
||||||
break;
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
case 2:
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
m_config->ch2Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
|
||||||
break;
|
Q_ASSERT(obj);
|
||||||
case 3:
|
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
|
||||||
m_config->ch3Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
}
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
m_config->ch4Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
/**
|
||||||
break;
|
* Set the dropdown option for a channel Input assignement
|
||||||
case 5:
|
*/
|
||||||
m_config->ch5Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
void ConfigServoWidget::assignChannel(UAVDataObject *obj, QString str)
|
||||||
break;
|
{
|
||||||
case 6:
|
UAVObjectField* field = obj->getField(str);
|
||||||
m_config->ch6Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
QStringList options = field->getOptions();
|
||||||
break;
|
switch (options.indexOf(field->getValue().toString())) {
|
||||||
case 7:
|
case 0:
|
||||||
m_config->ch7Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
m_config->ch0Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
||||||
break;
|
break;
|
||||||
}
|
case 1:
|
||||||
}
|
m_config->ch1Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
||||||
|
break;
|
||||||
/**
|
case 2:
|
||||||
* Set the dropdown option for a channel output assignement
|
m_config->ch2Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
||||||
*/
|
break;
|
||||||
void ConfigServoWidget::assignOutputChannel(UAVDataObject *obj, QString str)
|
case 3:
|
||||||
{
|
m_config->ch3Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
||||||
UAVObjectField* field = obj->getField(str);
|
break;
|
||||||
QStringList options = field->getOptions();
|
case 4:
|
||||||
switch (options.indexOf(field->getValue().toString())) {
|
m_config->ch4Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
||||||
case 0:
|
break;
|
||||||
m_config->ch0Output->setCurrentIndex(m_config->ch0Output->findText(str));
|
case 5:
|
||||||
break;
|
m_config->ch5Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
||||||
case 1:
|
break;
|
||||||
m_config->ch1Output->setCurrentIndex(m_config->ch1Output->findText(str));
|
case 6:
|
||||||
break;
|
m_config->ch6Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
||||||
case 2:
|
break;
|
||||||
m_config->ch2Output->setCurrentIndex(m_config->ch2Output->findText(str));
|
case 7:
|
||||||
break;
|
m_config->ch7Assign->setCurrentIndex(m_config->ch0Assign->findText(str));
|
||||||
case 3:
|
break;
|
||||||
m_config->ch3Output->setCurrentIndex(m_config->ch3Output->findText(str));
|
}
|
||||||
break;
|
}
|
||||||
case 4:
|
|
||||||
m_config->ch4Output->setCurrentIndex(m_config->ch4Output->findText(str));
|
/**
|
||||||
break;
|
* Set the dropdown option for a channel output assignement
|
||||||
case 5:
|
*/
|
||||||
m_config->ch5Output->setCurrentIndex(m_config->ch5Output->findText(str));
|
void ConfigServoWidget::assignOutputChannel(UAVDataObject *obj, QString str)
|
||||||
break;
|
{
|
||||||
case 6:
|
UAVObjectField* field = obj->getField(str);
|
||||||
m_config->ch6Output->setCurrentIndex(m_config->ch6Output->findText(str));
|
QStringList options = field->getOptions();
|
||||||
break;
|
switch (options.indexOf(field->getValue().toString())) {
|
||||||
case 7:
|
case 0:
|
||||||
m_config->ch7Output->setCurrentIndex(m_config->ch7Output->findText(str));
|
m_config->ch0Output->setCurrentIndex(m_config->ch0Output->findText(str));
|
||||||
break;
|
break;
|
||||||
}
|
case 1:
|
||||||
}
|
m_config->ch1Output->setCurrentIndex(m_config->ch1Output->findText(str));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
m_config->ch2Output->setCurrentIndex(m_config->ch2Output->findText(str));
|
||||||
/**
|
break;
|
||||||
* Updates the slider positions and min/max values
|
case 3:
|
||||||
*
|
m_config->ch3Output->setCurrentIndex(m_config->ch3Output->findText(str));
|
||||||
*/
|
break;
|
||||||
void ConfigServoWidget::updateChannels(UAVObject* controlCommand)
|
case 4:
|
||||||
{
|
m_config->ch4Output->setCurrentIndex(m_config->ch4Output->findText(str));
|
||||||
|
break;
|
||||||
QString fieldName = QString("Connected");
|
case 5:
|
||||||
UAVObjectField *field = controlCommand->getField(fieldName);
|
m_config->ch5Output->setCurrentIndex(m_config->ch5Output->findText(str));
|
||||||
if (field->getValue().toBool()) {
|
break;
|
||||||
m_config->RCInputConnected->setText("RC Receiver Connected");
|
case 6:
|
||||||
} else {
|
m_config->ch6Output->setCurrentIndex(m_config->ch6Output->findText(str));
|
||||||
m_config->RCInputConnected->setText("RC Receiver Not Connected");
|
break;
|
||||||
}
|
case 7:
|
||||||
if (m_config->doRCInputCalibration->isChecked()) {
|
m_config->ch7Output->setCurrentIndex(m_config->ch7Output->findText(str));
|
||||||
if (firstUpdate) {
|
break;
|
||||||
// Increase the data rate from the board so that the sliders
|
}
|
||||||
// move faster
|
}
|
||||||
UAVObject::Metadata mdata = controlCommand->getMetadata();
|
|
||||||
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
|
||||||
mccDataRate = mdata.flightTelemetryUpdatePeriod;
|
|
||||||
mdata.flightTelemetryUpdatePeriod = 150;
|
/**
|
||||||
controlCommand->setMetadata(mdata);
|
* Updates the slider positions and min/max values
|
||||||
}
|
*
|
||||||
fieldName = QString("Channel");
|
*/
|
||||||
field = controlCommand->getField(fieldName);
|
void ConfigServoWidget::updateChannels(UAVObject* controlCommand)
|
||||||
// Hey: if you find a nicer way of doing this, be my guest!
|
{
|
||||||
this->updateChannelSlider(&*m_config->ch0Slider,
|
|
||||||
&*m_config->ch0Min,
|
QString fieldName = QString("Connected");
|
||||||
&*m_config->ch0Max,
|
UAVObjectField *field = controlCommand->getField(fieldName);
|
||||||
&*m_config->ch0Rev,field->getValue(0).toInt());
|
if (field->getValue().toBool()) {
|
||||||
this->updateChannelSlider(&*m_config->ch1Slider,
|
m_config->RCInputConnected->setText("RC Receiver Connected");
|
||||||
&*m_config->ch1Min,
|
} else {
|
||||||
&*m_config->ch1Max,
|
m_config->RCInputConnected->setText("RC Receiver Not Connected");
|
||||||
&*m_config->ch1Rev,field->getValue(1).toInt());
|
}
|
||||||
this->updateChannelSlider(&*m_config->ch2Slider,
|
if (m_config->doRCInputCalibration->isChecked()) {
|
||||||
&*m_config->ch2Min,
|
if (firstUpdate) {
|
||||||
&*m_config->ch2Max,
|
// Increase the data rate from the board so that the sliders
|
||||||
&*m_config->ch2Rev,field->getValue(2).toInt());
|
// move faster
|
||||||
this->updateChannelSlider(&*m_config->ch3Slider,
|
UAVObject::Metadata mdata = controlCommand->getMetadata();
|
||||||
&*m_config->ch3Min,
|
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
||||||
&*m_config->ch3Max,
|
mccDataRate = mdata.flightTelemetryUpdatePeriod;
|
||||||
&*m_config->ch3Rev,field->getValue(3).toInt());
|
mdata.flightTelemetryUpdatePeriod = 150;
|
||||||
this->updateChannelSlider(&*m_config->ch4Slider,
|
controlCommand->setMetadata(mdata);
|
||||||
&*m_config->ch4Min,
|
}
|
||||||
&*m_config->ch4Max,
|
fieldName = QString("Channel");
|
||||||
&*m_config->ch4Rev,field->getValue(4).toInt());
|
field = controlCommand->getField(fieldName);
|
||||||
this->updateChannelSlider(&*m_config->ch5Slider,
|
// Hey: if you find a nicer way of doing this, be my guest!
|
||||||
&*m_config->ch5Min,
|
this->updateChannelSlider(&*m_config->ch0Slider,
|
||||||
&*m_config->ch5Max,
|
&*m_config->ch0Min,
|
||||||
&*m_config->ch5Rev,field->getValue(5).toInt());
|
&*m_config->ch0Max,
|
||||||
this->updateChannelSlider(&*m_config->ch6Slider,
|
&*m_config->ch0Rev,field->getValue(0).toInt());
|
||||||
&*m_config->ch6Min,
|
this->updateChannelSlider(&*m_config->ch1Slider,
|
||||||
&*m_config->ch6Max,
|
&*m_config->ch1Min,
|
||||||
&*m_config->ch6Rev,field->getValue(6).toInt());
|
&*m_config->ch1Max,
|
||||||
this->updateChannelSlider(&*m_config->ch7Slider,
|
&*m_config->ch1Rev,field->getValue(1).toInt());
|
||||||
&*m_config->ch7Min,
|
this->updateChannelSlider(&*m_config->ch2Slider,
|
||||||
&*m_config->ch7Max,
|
&*m_config->ch2Min,
|
||||||
&*m_config->ch7Rev,field->getValue(7).toInt());
|
&*m_config->ch2Max,
|
||||||
firstUpdate = false;
|
&*m_config->ch2Rev,field->getValue(2).toInt());
|
||||||
} else {
|
this->updateChannelSlider(&*m_config->ch3Slider,
|
||||||
if (!firstUpdate) {
|
&*m_config->ch3Min,
|
||||||
// Restore original data rate from the board:
|
&*m_config->ch3Max,
|
||||||
UAVObject::Metadata mdata = controlCommand->getMetadata();
|
&*m_config->ch3Rev,field->getValue(3).toInt());
|
||||||
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
this->updateChannelSlider(&*m_config->ch4Slider,
|
||||||
mdata.flightTelemetryUpdatePeriod = mccDataRate;
|
&*m_config->ch4Min,
|
||||||
controlCommand->setMetadata(mdata);
|
&*m_config->ch4Max,
|
||||||
}
|
&*m_config->ch4Rev,field->getValue(4).toInt());
|
||||||
firstUpdate = true;
|
this->updateChannelSlider(&*m_config->ch5Slider,
|
||||||
}
|
&*m_config->ch5Min,
|
||||||
//Update the Flight mode channel slider
|
&*m_config->ch5Max,
|
||||||
UAVObject* obj = getObjectManager()->getObject("ManualControlSettings");
|
&*m_config->ch5Rev,field->getValue(5).toInt());
|
||||||
// Find the channel currently assigned to flightmode
|
this->updateChannelSlider(&*m_config->ch6Slider,
|
||||||
field = obj->getField("FlightMode");
|
&*m_config->ch6Min,
|
||||||
int chIndex = field->getOptions().indexOf(field->getValue().toString());
|
&*m_config->ch6Max,
|
||||||
if ( chIndex < field->getOptions().length()-1) {
|
&*m_config->ch6Rev,field->getValue(6).toInt());
|
||||||
float valueScaled;
|
this->updateChannelSlider(&*m_config->ch7Slider,
|
||||||
int chMin = inSliders.at(chIndex)->minimum();
|
&*m_config->ch7Min,
|
||||||
int chMax = inSliders.at(chIndex)->maximum();
|
&*m_config->ch7Max,
|
||||||
int chNeutral = inSliders.at(chIndex)->value();
|
&*m_config->ch7Rev,field->getValue(7).toInt());
|
||||||
int value = controlCommand->getField("Channel")->getValue(chIndex).toInt();
|
firstUpdate = false;
|
||||||
if ((chMax > chMin && value >= chNeutral) || (chMin > chMax && value <= chNeutral)) {
|
} else {
|
||||||
if (chMax != chNeutral) {
|
if (!firstUpdate) {
|
||||||
valueScaled = (float)(value - chNeutral) / (float)(chMax - chNeutral);
|
// Restore original data rate from the board:
|
||||||
} else {
|
UAVObject::Metadata mdata = controlCommand->getMetadata();
|
||||||
valueScaled = 0;
|
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
||||||
}
|
mdata.flightTelemetryUpdatePeriod = mccDataRate;
|
||||||
} else {
|
controlCommand->setMetadata(mdata);
|
||||||
if (chMin != chNeutral) {
|
}
|
||||||
valueScaled = (float)(value - chNeutral) / (float)(chNeutral - chMin);
|
firstUpdate = true;
|
||||||
} else {
|
}
|
||||||
valueScaled = 0;
|
//Update the Flight mode channel slider
|
||||||
}
|
UAVObject* obj = getObjectManager()->getObject("ManualControlSettings");
|
||||||
}
|
// Find the channel currently assigned to flightmode
|
||||||
// Bound
|
field = obj->getField("FlightMode");
|
||||||
if (valueScaled > 1.0) {
|
int chIndex = field->getOptions().indexOf(field->getValue().toString());
|
||||||
valueScaled = 1.0;
|
if ( chIndex < field->getOptions().length()-1) {
|
||||||
} else if (valueScaled < -1.0) {
|
float valueScaled;
|
||||||
valueScaled = -1.0;
|
int chMin = inSliders.at(chIndex)->minimum();
|
||||||
}
|
int chMax = inSliders.at(chIndex)->maximum();
|
||||||
m_config->fmsSlider->setValue(valueScaled*100);
|
int chNeutral = inSliders.at(chIndex)->value();
|
||||||
}
|
int value = controlCommand->getField("Channel")->getValue(chIndex).toInt();
|
||||||
}
|
if ((chMax > chMin && value >= chNeutral) || (chMin > chMax && value <= chNeutral)) {
|
||||||
|
if (chMax != chNeutral) {
|
||||||
|
valueScaled = (float)(value - chNeutral) / (float)(chMax - chNeutral);
|
||||||
void ConfigServoWidget::updateChannelSlider(QSlider* slider, QLabel* min, QLabel* max, QCheckBox* rev, int value)
|
} else {
|
||||||
{
|
valueScaled = 0;
|
||||||
|
}
|
||||||
Q_UNUSED(rev);
|
} else {
|
||||||
if (firstUpdate) {
|
if (chMin != chNeutral) {
|
||||||
// Reset all the min/max values of the sliders since we are
|
valueScaled = (float)(value - chNeutral) / (float)(chNeutral - chMin);
|
||||||
// starting the calibration.
|
} else {
|
||||||
slider->setMaximum(value);
|
valueScaled = 0;
|
||||||
slider->setMinimum(value);
|
}
|
||||||
slider->setValue(value);
|
}
|
||||||
max->setText(QString::number(value));
|
// Bound
|
||||||
min->setText(QString::number(value));
|
if (valueScaled > 1.0) {
|
||||||
return;
|
valueScaled = 1.0;
|
||||||
}
|
} else if (valueScaled < -1.0) {
|
||||||
|
valueScaled = -1.0;
|
||||||
if (value != 0) { // Avoids glitches...
|
}
|
||||||
if (value > slider->maximum()) {
|
m_config->fmsSlider->setValue(valueScaled*100);
|
||||||
slider->setMaximum(value);
|
}
|
||||||
max->setText(QString::number(value));
|
}
|
||||||
}
|
|
||||||
if (value < slider->minimum()) {
|
|
||||||
slider->setMinimum(value);
|
void ConfigServoWidget::updateChannelSlider(QSlider* slider, QLabel* min, QLabel* max, QCheckBox* rev, int value)
|
||||||
min->setText(QString::number(value));
|
{
|
||||||
}
|
|
||||||
slider->setValue(value);
|
Q_UNUSED(rev);
|
||||||
}
|
if (firstUpdate) {
|
||||||
}
|
// Reset all the min/max values of the sliders since we are
|
||||||
|
// starting the calibration.
|
||||||
|
slider->setMaximum(value);
|
||||||
|
slider->setMinimum(value);
|
||||||
|
slider->setValue(value);
|
||||||
|
max->setText(QString::number(value));
|
||||||
|
min->setText(QString::number(value));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value != 0) { // Avoids glitches...
|
||||||
|
if (value > slider->maximum()) {
|
||||||
|
slider->setMaximum(value);
|
||||||
|
max->setText(QString::number(value));
|
||||||
|
}
|
||||||
|
if (value < slider->minimum()) {
|
||||||
|
slider->setMinimum(value);
|
||||||
|
min->setText(QString::number(value));
|
||||||
|
}
|
||||||
|
slider->setValue(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -2776,12 +2776,141 @@ Applies and Saves all settings to SD</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_4">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Arming Settings</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_17">
|
||||||
|
<property name="text">
|
||||||
|
<string>Arm airframe using:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="armControl">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Indicate the control used for arming the airframe.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<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>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_18">
|
||||||
|
<property name="text">
|
||||||
|
<string>Arming timeout:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="armTimeout">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>After the time indicated here, the frame will be disarmed.</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>64</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_19">
|
||||||
|
<property name="text">
|
||||||
|
<string>seconds.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<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>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="getArmCurrent">
|
||||||
|
<property name="text">
|
||||||
|
<string>Get Current</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="saveArmToRAM">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save to RAM</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="saveArmToSD">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save to SD</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>tabWidget</tabstop>
|
|
||||||
<tabstop>ch0Slider</tabstop>
|
<tabstop>ch0Slider</tabstop>
|
||||||
<tabstop>ch1Slider</tabstop>
|
<tabstop>ch1Slider</tabstop>
|
||||||
<tabstop>ch2Slider</tabstop>
|
<tabstop>ch2Slider</tabstop>
|
||||||
|
Loading…
Reference in New Issue
Block a user