2011-02-25 21:43:58 +01:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file configservowidget.h
|
|
|
|
* @author 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-03-28 17:39:22 +02:00
|
|
|
#ifndef CONFIGINPUTWIDGET_H
|
|
|
|
#define CONFIGINPUTWIDGET_H
|
2011-02-25 21:43:58 +01:00
|
|
|
|
2011-03-28 17:39:22 +02:00
|
|
|
#include "ui_input.h"
|
2012-02-05 19:16:38 +01:00
|
|
|
#include "../uavobjectwidgetutils/configtaskwidget.h"
|
2011-02-25 21:43:58 +01:00
|
|
|
#include "extensionsystem/pluginmanager.h"
|
|
|
|
#include "uavobjectmanager.h"
|
|
|
|
#include "uavobject.h"
|
|
|
|
#include <QtGui/QWidget>
|
|
|
|
#include <QList>
|
2011-08-04 17:58:41 +02:00
|
|
|
#include "inputchannelform.h"
|
|
|
|
#include "ui_inputchannelform.h"
|
2011-08-10 16:24:35 +02:00
|
|
|
#include <QRadioButton>
|
|
|
|
#include "manualcontrolcommand.h"
|
|
|
|
#include "manualcontrolsettings.h"
|
|
|
|
#include "receiveractivity.h"
|
2011-08-16 17:06:18 +02:00
|
|
|
#include <QGraphicsView>
|
|
|
|
#include <QtSvg/QSvgRenderer>
|
|
|
|
#include <QtSvg/QGraphicsSvgItem>
|
|
|
|
|
2011-03-28 17:39:22 +02:00
|
|
|
class Ui_InputWidget;
|
2011-02-25 21:43:58 +01:00
|
|
|
|
2011-03-28 17:39:22 +02:00
|
|
|
class ConfigInputWidget: public ConfigTaskWidget
|
2011-02-25 21:43:58 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2011-03-28 17:39:22 +02:00
|
|
|
ConfigInputWidget(QWidget *parent = 0);
|
|
|
|
~ConfigInputWidget();
|
2011-09-11 18:14:09 +02:00
|
|
|
enum wizardSteps{wizardWelcome,wizardChooseMode,wizardChooseType,wizardIdentifySticks,wizardIdentifyCenter,wizardIdentifyLimits,wizardIdentifyInverted,wizardFinish,wizardNone};
|
2011-08-10 16:24:35 +02:00
|
|
|
enum txMode{mode1,mode2};
|
2011-08-16 17:06:18 +02:00
|
|
|
enum txMovements{moveLeftVerticalStick,moveRightVerticalStick,moveLeftHorizontalStick,moveRightHorizontalStick,moveAccess0,moveAccess1,moveAccess2,moveFlightMode,centerAll,moveAll,nothing};
|
|
|
|
enum txMovementType{vertical,horizontal,jump,mix};
|
2011-09-07 16:09:41 +02:00
|
|
|
enum txType {acro, heli};
|
2011-02-27 20:20:43 +01:00
|
|
|
public slots:
|
|
|
|
|
2011-02-25 21:43:58 +01:00
|
|
|
private:
|
2011-08-16 17:06:18 +02:00
|
|
|
bool growing;
|
2011-09-09 07:54:47 +02:00
|
|
|
bool reverse[ManualControlSettings::CHANNELNEUTRAL_NUMELEM];
|
2011-08-16 17:06:18 +02:00
|
|
|
txMovements currentMovement;
|
|
|
|
int movePos;
|
|
|
|
void setTxMovement(txMovements movement);
|
2011-03-28 17:39:22 +02:00
|
|
|
Ui_InputWidget *m_config;
|
2011-08-10 16:24:35 +02:00
|
|
|
wizardSteps wizardStep;
|
|
|
|
QList<QWidget*> extraWidgets;
|
|
|
|
txMode transmitterMode;
|
2011-09-07 16:09:41 +02:00
|
|
|
txType transmitterType;
|
2011-08-10 16:24:35 +02:00
|
|
|
struct channelsStruct
|
|
|
|
{
|
|
|
|
bool operator ==(const channelsStruct& rhs) const
|
|
|
|
{
|
|
|
|
return((group==rhs.group) &&(number==rhs.number));
|
|
|
|
}
|
|
|
|
int group;
|
|
|
|
int number;
|
|
|
|
}lastChannel;
|
|
|
|
channelsStruct currentChannel;
|
|
|
|
QList<channelsStruct> usedChannels;
|
2011-10-20 15:26:46 +02:00
|
|
|
bool channelDetected;
|
2011-08-10 16:24:35 +02:00
|
|
|
QEventLoop * loop;
|
|
|
|
bool skipflag;
|
2011-02-25 21:43:58 +01:00
|
|
|
|
2011-09-11 18:14:09 +02:00
|
|
|
int currentChannelNum;
|
|
|
|
QList<int> heliChannelOrder;
|
|
|
|
QList<int> acroChannelOrder;
|
2011-08-04 17:58:41 +02:00
|
|
|
|
2011-08-10 16:24:35 +02:00
|
|
|
ManualControlCommand * manualCommandObj;
|
|
|
|
ManualControlCommand::DataFields manualCommandData;
|
2011-09-11 18:14:09 +02:00
|
|
|
UAVObject::Metadata manualControlMdata;
|
2011-08-10 16:24:35 +02:00
|
|
|
ManualControlSettings * manualSettingsObj;
|
|
|
|
ManualControlSettings::DataFields manualSettingsData;
|
2011-09-11 18:14:09 +02:00
|
|
|
ManualControlSettings::DataFields previousManualSettingsData;
|
2011-08-10 16:24:35 +02:00
|
|
|
ReceiverActivity * receiverActivityObj;
|
|
|
|
ReceiverActivity::DataFields receiverActivityData;
|
|
|
|
|
2011-08-16 17:06:18 +02:00
|
|
|
QSvgRenderer *m_renderer;
|
|
|
|
|
|
|
|
// Background: background
|
|
|
|
QGraphicsSvgItem *m_txMainBody;
|
|
|
|
QGraphicsSvgItem *m_txLeftStick;
|
|
|
|
QGraphicsSvgItem *m_txRightStick;
|
|
|
|
QGraphicsSvgItem *m_txAccess0;
|
|
|
|
QGraphicsSvgItem *m_txAccess1;
|
|
|
|
QGraphicsSvgItem *m_txAccess2;
|
|
|
|
QGraphicsSvgItem *m_txFlightMode;
|
|
|
|
QGraphicsSvgItem *m_txBackground;
|
|
|
|
QGraphicsSvgItem *m_txArrows;
|
|
|
|
QTransform m_txLeftStickOrig;
|
|
|
|
QTransform m_txRightStickOrig;
|
|
|
|
QTransform m_txAccess0Orig;
|
|
|
|
QTransform m_txAccess1Orig;
|
|
|
|
QTransform m_txAccess2Orig;
|
|
|
|
QTransform m_txFlightModeCOrig;
|
|
|
|
QTransform m_txFlightModeLOrig;
|
|
|
|
QTransform m_txFlightModeROrig;
|
|
|
|
QTransform m_txMainBodyOrig;
|
|
|
|
QTransform m_txArrowsOrig;
|
|
|
|
QTimer * animate;
|
|
|
|
void resetTxControls();
|
|
|
|
void setMoveFromCommand(int command);
|
2011-09-11 18:14:09 +02:00
|
|
|
|
|
|
|
void fastMdata();
|
|
|
|
void restoreMdata();
|
|
|
|
|
|
|
|
void setChannel(int);
|
|
|
|
void nextChannel();
|
|
|
|
void prevChannel();
|
|
|
|
|
|
|
|
void wizardSetUpStep(enum wizardSteps);
|
|
|
|
void wizardTearDownStep(enum wizardSteps);
|
2011-08-10 16:24:35 +02:00
|
|
|
private slots:
|
|
|
|
void wzNext();
|
|
|
|
void wzBack();
|
|
|
|
void wzCancel();
|
2011-09-11 19:24:48 +02:00
|
|
|
void goToWizard();
|
|
|
|
|
2011-05-31 09:16:01 +02:00
|
|
|
void openHelp();
|
2011-08-10 16:24:35 +02:00
|
|
|
void identifyControls();
|
|
|
|
void identifyLimits();
|
2011-08-16 17:06:18 +02:00
|
|
|
void moveTxControls();
|
2011-08-17 13:43:08 +02:00
|
|
|
void moveSticks();
|
|
|
|
void dimOtherControls(bool value);
|
2011-08-23 12:25:28 +02:00
|
|
|
void moveFMSlider();
|
2012-06-23 16:14:59 +02:00
|
|
|
void updatePositionSlider();
|
2011-08-20 20:10:28 +02:00
|
|
|
void invertControls();
|
2011-09-07 01:26:47 +02:00
|
|
|
void simpleCalibration(bool state);
|
|
|
|
void updateCalibration();
|
2011-08-16 17:06:18 +02:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *event);
|
2011-08-17 13:43:08 +02:00
|
|
|
virtual void enableControls(bool enable);
|
2011-08-23 12:25:28 +02:00
|
|
|
|
2011-08-16 17:06:18 +02:00
|
|
|
|
2011-02-25 21:43:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|