2011-02-08 17:49:33 +01:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file configservowidget.cpp
|
|
|
|
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
|
|
|
* @addtogroup ConfigPlugin Config Plugin
|
|
|
|
* @{
|
|
|
|
* @brief Servo input/output configuration panel for the config gadget
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
2011-02-27 20:20:43 +01:00
|
|
|
|
2011-03-28 17:39:22 +02:00
|
|
|
#include "configinputwidget.h"
|
2011-02-08 17:49:33 +01:00
|
|
|
|
2011-02-27 20:20:43 +01:00
|
|
|
#include "uavtalk/telemetrymanager.h"
|
|
|
|
|
2011-02-08 17:49:33 +01:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QtGui/QWidget>
|
|
|
|
#include <QtGui/QTextEdit>
|
|
|
|
#include <QtGui/QVBoxLayout>
|
|
|
|
#include <QtGui/QPushButton>
|
2011-05-31 09:16:01 +02:00
|
|
|
#include <QDesktopServices>
|
|
|
|
#include <QUrl>
|
2011-06-13 12:14:40 +02:00
|
|
|
#include <QMessageBox>
|
2011-02-08 17:49:33 +01:00
|
|
|
|
2011-06-08 00:35:21 +02:00
|
|
|
#include "manualcontrolsettings.h"
|
|
|
|
|
2011-03-28 17:39:22 +02:00
|
|
|
ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
2011-02-08 17:49:33 +01:00
|
|
|
{
|
2011-03-28 17:39:22 +02:00
|
|
|
m_config = new Ui_InputWidget();
|
2011-02-08 17:49:33 +01:00
|
|
|
m_config->setupUi(this);
|
|
|
|
|
2011-08-04 17:58:41 +02:00
|
|
|
setupButtons(m_config->saveRCInputToRAM,m_config->saveRCInputToSD);
|
|
|
|
|
2011-06-07 16:56:16 +02:00
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
|
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
2011-08-04 17:58:41 +02:00
|
|
|
UAVDataObject * obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
|
|
|
|
UAVObjectField * field = obj->getField(QString("ChannelGroups"));
|
|
|
|
int index=0;
|
|
|
|
foreach(QString name,field->getElementNames())
|
|
|
|
{
|
|
|
|
inputChannelForm * inp=new inputChannelForm(this,index==0);
|
|
|
|
m_config->advancedPage->layout()->addWidget(inp);
|
|
|
|
inp->ui->channelName->setText(name);
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","ChannelGroups",inp->ui->channelGroup,index);
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","ChannelNumber",inp->ui->channelNumber,index);
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","ChannelMin",inp->ui->channelMin,index);
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","ChannelNeutral",inp->ui->channelNeutral,index);
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","ChannelMax",inp->ui->channelMax,index);
|
|
|
|
++index;
|
|
|
|
}
|
|
|
|
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos1,0);
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos2,1);
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos3,2);
|
|
|
|
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Roll,"Roll");
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization2Settings",m_config->fmsSsPos2Roll,"Roll");
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization3Settings",m_config->fmsSsPos3Roll,"Roll");
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Pitch,"Pitch");
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization2Settings",m_config->fmsSsPos2Pitch,"Pitch");
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization3Settings",m_config->fmsSsPos3Pitch,"Pitch");
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Yaw,"Yaw");
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization2Settings",m_config->fmsSsPos2Yaw,"Yaw");
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization3Settings",m_config->fmsSsPos3Yaw,"Yaw");
|
|
|
|
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","Arming",m_config->armControl);
|
|
|
|
addUAVObjectToWidgetRelation("ManualControlSettings","armTimeout",m_config->armTimeout,0,1000);
|
|
|
|
|
|
|
|
populateWidgets();
|
|
|
|
refreshWidgetsValues();
|
2011-05-31 09:16:01 +02:00
|
|
|
// Connect the help button
|
|
|
|
connect(m_config->inputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
2011-06-20 15:28:16 +02:00
|
|
|
|
2011-02-08 17:49:33 +01:00
|
|
|
}
|
|
|
|
|
2011-03-28 17:39:22 +02:00
|
|
|
ConfigInputWidget::~ConfigInputWidget()
|
2011-02-08 17:49:33 +01:00
|
|
|
{
|
2011-08-04 17:58:41 +02:00
|
|
|
// Do nothing
|
2011-02-28 17:44:04 +01:00
|
|
|
}
|
2011-05-31 09:16:01 +02:00
|
|
|
|
|
|
|
void ConfigInputWidget::openHelp()
|
|
|
|
{
|
|
|
|
|
|
|
|
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Input+Configuration", QUrl::StrictMode) );
|
|
|
|
}
|
2011-06-20 15:28:16 +02:00
|
|
|
|
|
|
|
|