dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
configoutputwidget.h
Go to the documentation of this file.
1 
12 /*
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.
17  *
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
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 #ifndef CONFIGOUTPUTWIDGET_H
27 #define CONFIGOUTPUTWIDGET_H
28 
29 #include "ui_output.h"
30 #include "../uavobjectwidgetutils/configtaskwidget.h"
33 #include "uavobjects/uavobject.h"
36 #include <QWidget>
37 #include <QList>
38 
39 class Ui_OutputWidget;
40 class OutputChannelForm;
41 
43 {
44  Q_OBJECT
45 
46 public:
47  ConfigOutputWidget(QWidget *parent = nullptr);
49 
50 private:
51  enum SpecialOutputRates {
52  RATE_SYNCPWM = 0,
53  RATE_DSHOT300 = 65532,
54  RATE_DSHOT600 = 65533,
55  RATE_DSHOT1200 = 65534,
56  };
57 
58  Ui_OutputWidget *m_config;
59 
60  QList<QSlider> sliders;
61 
62  void updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, QCheckBox *rev,
63  int value);
64 
65  void assignChannel(UAVDataObject *obj, QString str);
66  OutputChannelForm *getOutputChannelForm(const int index) const;
67  int mccDataRate;
68 
70  QList<QComboBox *> rateList;
72  QList<QComboBox *> resList;
74  QList<QLabel *> lblList;
75 
76  // For naming custom rates and OneShot
77  QString timerFreqToString(quint32) const;
78  quint32 timerStringToFreq(QString) const;
79 
80  UAVObject::Metadata accInitialData;
81 
82  virtual void tabSwitchingAway();
83 
84 private slots:
85  void stopTests();
86  virtual void refreshWidgetsValues(UAVObject *obj = NULL);
87  void updateObjectsFromWidgets();
88  void runChannelTests(bool state);
89  void sendChannelTest(int index, int value);
90  void startESCCalibration();
91  void do_SetDirty();
92  void assignOutputChannels(UAVObject *obj);
93  void refreshWidgetRanges();
94 
95 protected:
96  void enableControls(bool enable);
97 };
98 
99 #endif
void enableControls(bool enable)
ConfigOutputWidget(QWidget *parent=nullptr)