2 ******************************************************************************
4 * @file configoutputwidget.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
8 * @addtogroup ConfigPlugin Config Plugin
10 * @brief Servo output configuration panel for the config gadget
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #ifndef CONFIGOUTPUTWIDGET_H
28 #define CONFIGOUTPUTWIDGET_H
30 #include "cfg_vehicletypes/vehicleconfig.h"
32 #include "../uavobjectwidgetutils/configtaskwidget.h"
33 #include "extensionsystem/pluginmanager.h"
34 #include "uavobjectmanager.h"
35 #include "uavobject.h"
36 #include "uavobjectutilmanager.h"
38 #include "systemalarms.h"
43 class Ui_OutputWidget
;
44 class OutputChannelForm
;
51 class OutputBankControls
{
53 OutputBankControls(MixerSettings
*mixer
, QLabel
*label
, QColor color
, QComboBox
*rateCombo
, QComboBox
*modeCombo
);
54 virtual ~OutputBankControls();
64 QComboBox
*rateCombo() const
68 QComboBox
*modeCombo() const
74 MixerSettings
*m_mixer
;
77 QComboBox
*m_rateCombo
;
78 QComboBox
*m_modeCombo
;
81 class ConfigOutputWidget
: public ConfigTaskWidget
{
85 ConfigOutputWidget(QWidget
*parent
= 0);
86 ~ConfigOutputWidget();
89 void setInputCalibrationState(bool state
);
92 void outputConfigSafeChanged(bool newStatus
);
95 void enableControls(bool enable
);
96 void setBoardWarning(QString message
);
97 void setConfigWarning(QString message
);
99 virtual void refreshWidgetsValuesImpl(UAVObject
*obj
);
100 virtual void updateObjectsFromWidgetsImpl();
103 Ui_OutputWidget
*m_ui
;
104 QList
<QSlider
> m_sliders
;
106 UAVObject::Metadata m_accInitialData
;
107 QList
<OutputBankControls
> m_banks
;
108 int activeBanksCount
;
109 void setBanksEnabled(bool state
);
111 bool inputCalibrationStarted
;
112 bool channelTestsStarted
;
114 OutputChannelForm
*getOutputChannelForm(const int index
) const;
115 void updateChannelInSlider(QSlider
*slider
, QLabel
*min
, QLabel
*max
, QCheckBox
*rev
, int value
);
116 void assignOutputChannel(UAVDataObject
*obj
, QString
&str
);
117 void setColor(QWidget
*widget
, const QColor color
);
118 void sendAllChannelTests();
119 enum ChannelConfigWarning
{ None
, CannotDriveServo
, IsNormalMotorCheckNeutral
, IsReversibleMotorCheckNeutral
, BiDirectionalDShotNotSupported
};
120 void setChannelLimits(OutputChannelForm
*channelForm
, OutputBankControls
*bankControls
);
121 ChannelConfigWarning
checkChannelConfig(OutputChannelForm
*channelForm
, OutputBankControls
*bankControls
);
122 bool checkOutputConfig();
123 void updateChannelConfigWarning(ChannelConfigWarning warning
);
126 void updateBoardWarnings(UAVObject
*);
127 void updateSpinStabilizeCheckComboBoxes();
128 void updateAlwaysStabilizeStatus();
130 void runChannelTests(bool state
);
131 void sendChannelTest(int index
, int value
);
132 void onBankTypeChange();
135 #endif // CONFIGOUTPUTWIDGET_H