dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
setupwizard.h
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  */
28 
29 #ifndef SETUPWIZARD_H
30 #define SETUPWIZARD_H
31 
32 #include <QWizard>
33 #include <coreplugin/icore.h>
34 #include <coreplugin/iboardtype.h>
38 
47 class SetupWizard : public QWizard, public VehicleConfigurationSource
48 {
49  Q_OBJECT
50 
51 public:
52  explicit SetupWizard(bool autoLaunched = false, QWidget *parent = nullptr);
53  int nextId() const;
54 
55  void setControllerType(Core::IBoardType *type) { m_controllerType = type; }
56  Core::IBoardType *getControllerType() const { return m_controllerType; }
57 
58  void setVehicleType(SetupWizard::VEHICLE_TYPE type) { m_vehicleType = type; }
59  SetupWizard::VEHICLE_TYPE getVehicleType() const { return m_vehicleType; }
60 
61  void setVehicleSubType(SetupWizard::VEHICLE_SUB_TYPE type) { m_vehicleSubType = type; }
62  SetupWizard::VEHICLE_SUB_TYPE getVehicleSubType() const { return m_vehicleSubType; }
63 
64  void setInputType(Core::IBoardType::InputType type) { m_inputType = type; }
65  Core::IBoardType::InputType getInputType() const { return m_inputType; }
66 
67  void setESCType(SetupWizard::ESC_TYPE type) { m_escType = type; }
68  SetupWizard::ESC_TYPE getESCType() const { return m_escType; }
69 
70  void setGPSSetting(SetupWizard::GPS_SETTING setting) { m_gpsSetting = setting; }
71  SetupWizard::GPS_SETTING getGPSSetting() const { return m_gpsSetting; }
72 
73  void setRadioSetting(SetupWizard::RADIO_SETTING setting) { m_radioSetting = setting; }
74  SetupWizard::RADIO_SETTING getRadioSetting() const { return m_radioSetting; }
75 
77  {
78  m_calibrationBias = bias;
79  m_calibrationPerformed = true;
80  }
81  bool isCalibrationPerformed() const { return m_calibrationPerformed; }
82  accelGyroBias getCalibrationBias() const { return m_calibrationBias; }
83 
85  {
86  m_actuatorSettings = actuatorSettings;
87  }
88  bool isMotorCalibrationPerformed() const { return m_motorCalibrationPerformed; }
89  QList<actuatorChannelSettings> getActuatorSettings() const { return m_actuatorSettings; }
90 
91  void setRestartNeeded(bool needed) { m_restartNeeded = needed; }
92  bool isRestartNeeded() const { return m_restartNeeded; }
93  bool isDshot() const
94  {
95  switch (m_escType) {
96  case ESC_DSHOT300:
97  case ESC_DSHOT600:
98  case ESC_DSHOT1200:
99  return true;
100  default:
101  break;
102  }
103  return false;
104  }
105 
106  QString getSummaryText();
107 
109  {
110  if (!m_connectionManager) {
111  m_connectionManager = Core::ICore::instance()->connectionManager();
112  Q_ASSERT(m_connectionManager);
113  }
114  return m_connectionManager;
115  }
116 
117 signals:
118  void boardIgnored(QByteArray uuid);
119 
120 private slots:
121  void customBackClicked();
122  void pageChanged(int currId);
123  void boardIgnorePrompt();
124 
125 private:
126  enum {
127  PAGE_START,
128  PAGE_CONTROLLER,
129  PAGE_VEHICLES,
130  PAGE_MULTI,
131  PAGE_FIXEDWING,
132  PAGE_HELI,
133  PAGE_SURFACE,
134  PAGE_INPUT,
135  PAGE_INPUT_NOT_SUPPORTED,
136  PAGE_OUTPUT,
137  PAGE_BIAS_CALIBRATION,
138  PAGE_OUTPUT_CALIBRATION,
139  PAGE_SAVE,
140  PAGE_SUMMARY,
141  PAGE_NOTYETIMPLEMENTED,
142  PAGE_BOARDTYPE_UNKNOWN,
143  PAGE_REBOOT,
144  PAGE_END
145  };
146  void createPages();
147  bool saveHardwareSettings() const;
148  bool canAutoUpdate() const;
149 
150  Core::IBoardType *m_controllerType;
151  VEHICLE_TYPE m_vehicleType;
152  VEHICLE_SUB_TYPE m_vehicleSubType;
153  Core::IBoardType::InputType m_inputType;
154  ESC_TYPE m_escType;
155 
156  GPS_SETTING m_gpsSetting;
157  RADIO_SETTING m_radioSetting;
158 
159  bool m_calibrationPerformed;
160  accelGyroBias m_calibrationBias;
161 
162  bool m_motorCalibrationPerformed;
163  QList<actuatorChannelSettings> m_actuatorSettings;
164 
165  bool m_restartNeeded;
166  bool m_autoLaunched;
167  bool m_back;
168 
169  Core::ConnectionManager *m_connectionManager;
170 };
171 
172 #endif // SETUPWIZARD_H
The SetupWizard class is the main interface to the setup wizard. It provides selects the sequence of ...
Definition: setupwizard.h:47
int nextId() const
Definition: setupwizard.cpp:78
InputType
Types of input to configure for the default port.
Definition: iboardtype.h:158
SetupWizard::ESC_TYPE getESCType() const
Definition: setupwizard.h:68
SetupWizard::VEHICLE_TYPE getVehicleType() const
Definition: setupwizard.h:59
SetupWizard::RADIO_SETTING getRadioSetting() const
Definition: setupwizard.h:74
void setInputType(Core::IBoardType::InputType type)
Definition: setupwizard.h:64
void setRestartNeeded(bool needed)
Definition: setupwizard.h:91
void boardIgnored(QByteArray uuid)
virtual ConnectionManager * connectionManager() const =0
void setGPSSetting(SetupWizard::GPS_SETTING setting)
Definition: setupwizard.h:70
SetupWizard(bool autoLaunched=false, QWidget *parent=nullptr)
Definition: setupwizard.cpp:54
bool isDshot() const
Definition: setupwizard.h:93
bool isRestartNeeded() const
Definition: setupwizard.h:92
void setVehicleType(SetupWizard::VEHICLE_TYPE type)
Definition: setupwizard.h:58
void setLevellingBias(accelGyroBias bias)
Definition: setupwizard.h:76
void setVehicleSubType(SetupWizard::VEHICLE_SUB_TYPE type)
Definition: setupwizard.h:61
void setActuatorSettings(QList< actuatorChannelSettings > actuatorSettings)
Definition: setupwizard.h:84
Core::ConnectionManager * getConnectionManager()
Definition: setupwizard.h:108
Core::IBoardType * getControllerType() const
Definition: setupwizard.h:56
bool isMotorCalibrationPerformed() const
Definition: setupwizard.h:88
static ICore * instance()
Definition: coreimpl.cpp:46
SetupWizard::GPS_SETTING getGPSSetting() const
Definition: setupwizard.h:71
QList< actuatorChannelSettings > getActuatorSettings() const
Definition: setupwizard.h:89
QString getSummaryText()
SetupWizard::VEHICLE_SUB_TYPE getVehicleSubType() const
Definition: setupwizard.h:62
void setControllerType(Core::IBoardType *type)
Definition: setupwizard.h:55
void setRadioSetting(SetupWizard::RADIO_SETTING setting)
Definition: setupwizard.h:73
bool isCalibrationPerformed() const
Definition: setupwizard.h:81
Core::IBoardType::InputType getInputType() const
Definition: setupwizard.h:65
void setESCType(SetupWizard::ESC_TYPE type)
Definition: setupwizard.h:67
accelGyroBias getCalibrationBias() const
Definition: setupwizard.h:82