26 #ifndef CONFIGINPUTWIDGET_H
27 #define CONFIGINPUTWIDGET_H
29 #include <QGraphicsView>
32 #include <QRadioButton>
34 #include <QSvgRenderer>
35 #include <QGraphicsSvgItem>
38 #include "ui_inputchannelform.h"
48 #include "flightstatus.h"
49 #include "manualcontrolcommand.h"
50 #include "manualcontrolsettings.h"
51 #include "receiveractivity.h"
126 static const int DEBOUNCE_THRESHOLD_COUNT = 1;
131 static const int CHANNEL_IDENTIFICATION_WAIT_TIME_MS = 2500;
134 bool reverse[ManualControlSettings::CHANNELNEUTRAL_NUMELEM];
136 int minSeen[ManualControlSettings::CHANNELNEUTRAL_NUMELEM];
137 int maxSeen[ManualControlSettings::CHANNELNEUTRAL_NUMELEM];
142 Ui_InputWidget *m_config;
149 struct channelsStruct
153 return ((group == rhs.group) && (number == rhs.number));
158 channelsStruct currentChannel;
160 bool channelDetected;
164 int currentChannelNum;
168 ManualControlCommand *manualCommandObj;
169 ManualControlCommand::DataFields manualCommandData;
170 FlightStatus *flightStatusObj;
171 UAVObject::Metadata manualControlMdata;
172 ManualControlSettings *manualSettingsObj;
173 ManualControlSettings::DataFields manualSettingsData;
174 ManualControlSettings::DataFields previousManualSettingsData;
175 ReceiverActivity *receiverActivityObj;
176 ReceiverActivity::DataFields receiverActivityData;
177 QMap<QString, UAVObject::Metadata> originalMetaData;
179 QSvgRenderer *m_renderer;
182 QGraphicsSvgItem *m_txMainBody;
183 QGraphicsSvgItem *m_txLeftStick;
184 QGraphicsSvgItem *m_txRightStick;
185 QGraphicsSvgItem *m_txAccess0;
186 QGraphicsSvgItem *m_txAccess1;
187 QGraphicsSvgItem *m_txAccess2;
188 QGraphicsSvgItem *m_txFlightMode;
189 QGraphicsSvgItem *m_txArming;
190 QGraphicsSvgItem *m_txBackground;
191 QGraphicsSvgItem *m_txArrows;
192 QTransform m_txLeftStickOrig;
193 QTransform m_txRightStickOrig;
194 QTransform m_txAccess0Orig;
195 QTransform m_txAccess1Orig;
196 QTransform m_txAccess2Orig;
197 QTransform m_txFlightModeCOrig;
198 QTransform m_txFlightModeLOrig;
199 QTransform m_txFlightModeROrig;
200 QTransform m_txArmingSwitchOrigL;
201 QTransform m_txArmingSwitchOrigR;
202 QTransform m_txMainBodyOrig;
203 QTransform m_txArrowsOrig;
206 QComboBox *cbArmingOption;
208 bool armingConfigUpdating;
210 void resetTxControls();
211 void setMoveFromCommand(
int command);
216 void setChannel(
int);
225 quint8 scaleSwitchChannel(quint8 channelNumber, quint8 switchPositions);
227 const ArmingMethod armingMethodFromArmName(
const QString &name);
228 const ArmingMethod armingMethodFromUavoOption(
const QString &option);
229 void fillArmingComboBox();
236 void identifyControls();
237 void identifyLimits();
238 void moveTxControls();
240 void detectFailsafe();
241 void dimOtherControls(
bool value);
243 void updatePositionSlider();
244 void invertControls();
245 void simpleCalibration(
bool state);
246 void updateCalibration();
247 void checkArmingConfig();
248 void checkReprojection();
249 void updateArmingConfig(
UAVObject *manualControlSettings);
250 void timeoutCheckboxChanged();
251 void checkCollective();
256 void addMessage(QWidget *target,
const QString type,
const QString msg);
257 void addWarning(QWidget *target, QWidget *cause,
const QString msg);
void clearMessages(QWidget *widget, const QString type)
void resizeEvent(QResizeEvent *event)
bool operator==(const channelsStruct &rhs) const
void clearWarnings(QWidget *target, QWidget *causesParent)
void addMessage(QWidget *target, const QString type, const QString msg)
void addWarning(QWidget *target, QWidget *cause, const QString msg)
virtual void enableControls(bool enable)
static const QVector< ArmingMethod > armingMethods
enum ArmingMethodType method
ConfigInputWidget(QWidget *parent=nullptr)