2 ******************************************************************************
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
6 * @addtogroup GCSPlugins GCS Plugins
8 * @addtogroup Setup Wizard Plugin
10 * @brief A Wizards to make the initial setup easy for everyone.
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
32 #include "biascalibrationutil.h"
33 #include <coreplugin/icore.h>
34 #include <coreplugin/connectionmanager.h>
35 #include "vehicleconfigurationsource.h"
36 #include "vehicleconfigurationhelper.h"
38 class SetupWizard
: public QWizard
, public VehicleConfigurationSource
{
42 SetupWizard(QWidget
*parent
= 0);
46 void setControllerType(SetupWizard::CONTROLLER_TYPE type
)
48 m_controllerType
= type
;
50 SetupWizard::CONTROLLER_TYPE
getControllerType() const
52 return m_controllerType
;
55 void setVehicleType(SetupWizard::VEHICLE_TYPE type
)
59 SetupWizard::VEHICLE_TYPE
getVehicleType() const
64 void setVehicleSubType(SetupWizard::VEHICLE_SUB_TYPE type
)
66 m_vehicleSubType
= type
;
68 SetupWizard::VEHICLE_SUB_TYPE
getVehicleSubType() const
70 return m_vehicleSubType
;
73 void setInputType(SetupWizard::INPUT_TYPE type
)
77 SetupWizard::INPUT_TYPE
getInputType() const
82 void setEscType(SetupWizard::ESC_TYPE type
)
86 SetupWizard::ESC_TYPE
getEscType() const
91 void setServoType(SetupWizard::SERVO_TYPE type
)
95 SetupWizard::SERVO_TYPE
getServoType() const
100 void setAirspeedType(SetupWizard::AIRSPEED_TYPE setting
)
102 m_airspeedType
= setting
;
104 SetupWizard::AIRSPEED_TYPE
getAirspeedType() const
106 return m_airspeedType
;
110 void setGpsType(SetupWizard::GPS_TYPE setting
)
114 SetupWizard::GPS_TYPE
getGpsType() const
119 void setRadioSetting(SetupWizard::RADIO_SETTING setting
)
121 m_radioSetting
= setting
;
123 SetupWizard::RADIO_SETTING
getRadioSetting() const
125 return m_radioSetting
;
128 void setVehicleTemplate(QJsonObject
*templ
)
130 m_vehicleTemplate
= templ
;
132 QJsonObject
*getVehicleTemplate() const
134 return m_vehicleTemplate
;
137 void setLevellingBias(accelGyroBias bias
)
139 m_calibrationBias
= bias
; m_calibrationPerformed
= true;
141 bool isCalibrationPerformed() const
143 return m_calibrationPerformed
;
145 accelGyroBias
getCalibrationBias() const
147 return m_calibrationBias
;
150 void setActuatorSettings(QList
<actuatorChannelSettings
> actuatorSettings
)
152 m_actuatorSettings
= actuatorSettings
;
154 bool isMotorCalibrationPerformed() const
156 return m_motorCalibrationPerformed
;
158 QList
<actuatorChannelSettings
> getActuatorSettings() const
160 return m_actuatorSettings
;
163 void setRestartNeeded(bool needed
)
165 m_restartNeeded
= needed
;
167 bool isRestartNeeded() const
169 return m_restartNeeded
;
172 QString
getSummaryText();
174 Core::ConnectionManager
*getConnectionManager()
176 if (!m_connectionManager
) {
177 m_connectionManager
= Core::ICore::instance()->connectionManager();
178 Q_ASSERT(m_connectionManager
);
180 return m_connectionManager
;
185 void customBackClicked();
186 void pageChanged(int currId
);
188 enum { PAGE_START
, PAGE_CONTROLLER
, PAGE_VEHICLES
, PAGE_MULTI
, PAGE_FIXEDWING
,
189 PAGE_AIRSPEED
, PAGE_GPS
, PAGE_HELI
, PAGE_SURFACE
, PAGE_INPUT
, PAGE_ESC
, PAGE_SERVO
,
190 PAGE_BIAS_CALIBRATION
, PAGE_ESC_CALIBRATION
, PAGE_REVO_CALIBRATION
, PAGE_OUTPUT_CALIBRATION
,
191 PAGE_SAVE
, PAGE_SUMMARY
, PAGE_NOTYETIMPLEMENTED
, PAGE_AIRFRAME_INITIAL_TUNING
,
192 PAGE_REBOOT
, PAGE_END
, PAGE_UPDATE
};
194 bool saveHardwareSettings() const;
195 bool canAutoUpdate() const;
197 CONTROLLER_TYPE m_controllerType
;
198 VEHICLE_TYPE m_vehicleType
;
199 VEHICLE_SUB_TYPE m_vehicleSubType
;
200 INPUT_TYPE m_inputType
;
202 SERVO_TYPE m_servoType
;
203 AIRSPEED_TYPE m_airspeedType
;
205 RADIO_SETTING m_radioSetting
;
207 QJsonObject
*m_vehicleTemplate
;
209 bool m_calibrationPerformed
;
210 accelGyroBias m_calibrationBias
;
212 bool m_motorCalibrationPerformed
;
213 QList
<actuatorChannelSettings
> m_actuatorSettings
;
215 bool m_restartNeeded
;
219 Core::ConnectionManager
*m_connectionManager
;
222 #endif // SETUPWIZARD_H