2012-07-10 00:26:59 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file setupwizard.h
|
2012-07-17 01:24:22 +02:00
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
2012-07-10 00:26:59 +02:00
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
|
|
|
* @addtogroup Setup Wizard Plugin
|
|
|
|
* @{
|
|
|
|
* @brief A Wizards to make the initial setup easy for everyone.
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SETUPWIZARD_H
|
|
|
|
#define SETUPWIZARD_H
|
|
|
|
|
|
|
|
#include <QWizard>
|
2013-04-29 15:11:24 +02:00
|
|
|
#include "biascalibrationutil.h"
|
2012-08-02 13:44:14 +02:00
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
#include <coreplugin/connectionmanager.h>
|
2012-08-17 00:47:31 +02:00
|
|
|
#include "vehicleconfigurationsource.h"
|
2012-09-04 01:28:28 +02:00
|
|
|
#include "vehicleconfigurationhelper.h"
|
2012-08-15 01:04:54 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
class SetupWizard : public QWizard, public VehicleConfigurationSource {
|
2012-07-11 01:00:41 +02:00
|
|
|
Q_OBJECT
|
2012-07-10 00:26:59 +02:00
|
|
|
|
|
|
|
public:
|
2012-07-11 01:00:41 +02:00
|
|
|
SetupWizard(QWidget *parent = 0);
|
|
|
|
int nextId() const;
|
2012-08-01 00:21:15 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setControllerType(SetupWizard::CONTROLLER_TYPE type)
|
|
|
|
{
|
|
|
|
m_controllerType = type;
|
|
|
|
}
|
|
|
|
SetupWizard::CONTROLLER_TYPE getControllerType() const
|
|
|
|
{
|
|
|
|
return m_controllerType;
|
|
|
|
}
|
2012-07-17 01:24:22 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setVehicleType(SetupWizard::VEHICLE_TYPE type)
|
|
|
|
{
|
|
|
|
m_vehicleType = type;
|
|
|
|
}
|
|
|
|
SetupWizard::VEHICLE_TYPE getVehicleType() const
|
|
|
|
{
|
|
|
|
return m_vehicleType;
|
|
|
|
}
|
2012-07-17 01:24:22 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setVehicleSubType(SetupWizard::VEHICLE_SUB_TYPE type)
|
|
|
|
{
|
|
|
|
m_vehicleSubType = type;
|
|
|
|
}
|
|
|
|
SetupWizard::VEHICLE_SUB_TYPE getVehicleSubType() const
|
|
|
|
{
|
|
|
|
return m_vehicleSubType;
|
|
|
|
}
|
2012-08-15 01:04:54 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setInputType(SetupWizard::INPUT_TYPE type)
|
|
|
|
{
|
|
|
|
m_inputType = type;
|
|
|
|
}
|
|
|
|
SetupWizard::INPUT_TYPE getInputType() const
|
|
|
|
{
|
|
|
|
return m_inputType;
|
|
|
|
}
|
2012-08-01 00:21:15 +02:00
|
|
|
|
2014-08-22 01:40:05 +02:00
|
|
|
void setEscType(SetupWizard::ESC_TYPE type)
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
m_escType = type;
|
|
|
|
}
|
2014-08-22 01:40:05 +02:00
|
|
|
SetupWizard::ESC_TYPE getEscType() const
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
return m_escType;
|
|
|
|
}
|
2012-08-01 00:21:15 +02:00
|
|
|
|
2014-08-22 01:40:05 +02:00
|
|
|
void setServoType(SetupWizard::SERVO_TYPE type)
|
|
|
|
{
|
|
|
|
m_servoType = type;
|
|
|
|
}
|
|
|
|
SetupWizard::SERVO_TYPE getServoType() const
|
|
|
|
{
|
|
|
|
return m_servoType;
|
|
|
|
}
|
|
|
|
|
2014-09-02 18:19:15 +02:00
|
|
|
void setAirspeedType(SetupWizard::AIRSPEED_TYPE setting)
|
|
|
|
{
|
|
|
|
m_airspeedType = setting;
|
|
|
|
}
|
|
|
|
SetupWizard::AIRSPEED_TYPE getAirspeedType() const
|
|
|
|
{
|
|
|
|
return m_airspeedType;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setGPSSetting(SetupWizard::GPS_SETTING setting)
|
|
|
|
{
|
|
|
|
m_gpsSetting = setting;
|
|
|
|
}
|
|
|
|
SetupWizard::GPS_SETTING getGPSSetting() const
|
|
|
|
{
|
|
|
|
return m_gpsSetting;
|
|
|
|
}
|
2013-04-07 11:52:33 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setRadioSetting(SetupWizard::RADIO_SETTING setting)
|
|
|
|
{
|
|
|
|
m_radioSetting = setting;
|
|
|
|
}
|
|
|
|
SetupWizard::RADIO_SETTING getRadioSetting() const
|
|
|
|
{
|
|
|
|
return m_radioSetting;
|
|
|
|
}
|
2013-04-07 11:52:33 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setLevellingBias(accelGyroBias bias)
|
|
|
|
{
|
|
|
|
m_calibrationBias = bias; m_calibrationPerformed = true;
|
|
|
|
}
|
|
|
|
bool isCalibrationPerformed() const
|
|
|
|
{
|
|
|
|
return m_calibrationPerformed;
|
|
|
|
}
|
|
|
|
accelGyroBias getCalibrationBias() const
|
|
|
|
{
|
|
|
|
return m_calibrationBias;
|
|
|
|
}
|
2012-08-02 13:44:14 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setActuatorSettings(QList<actuatorChannelSettings> actuatorSettings)
|
|
|
|
{
|
|
|
|
m_actuatorSettings = actuatorSettings;
|
|
|
|
}
|
|
|
|
bool isMotorCalibrationPerformed() const
|
|
|
|
{
|
|
|
|
return m_motorCalibrationPerformed;
|
|
|
|
}
|
|
|
|
QList<actuatorChannelSettings> getActuatorSettings() const
|
|
|
|
{
|
|
|
|
return m_actuatorSettings;
|
|
|
|
}
|
2012-08-02 13:44:14 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setRestartNeeded(bool needed)
|
|
|
|
{
|
|
|
|
m_restartNeeded = needed;
|
|
|
|
}
|
|
|
|
bool isRestartNeeded() const
|
|
|
|
{
|
|
|
|
return m_restartNeeded;
|
|
|
|
}
|
2012-09-16 15:14:47 +02:00
|
|
|
|
2012-08-01 00:21:15 +02:00
|
|
|
QString getSummaryText();
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
Core::ConnectionManager *getConnectionManager()
|
|
|
|
{
|
2012-08-02 13:44:14 +02:00
|
|
|
if (!m_connectionManager) {
|
|
|
|
m_connectionManager = Core::ICore::instance()->connectionManager();
|
|
|
|
Q_ASSERT(m_connectionManager);
|
|
|
|
}
|
|
|
|
return m_connectionManager;
|
|
|
|
}
|
2012-10-02 23:17:56 +02:00
|
|
|
|
2012-09-26 00:42:17 +02:00
|
|
|
private slots:
|
|
|
|
void customBackClicked();
|
2012-10-02 23:17:56 +02:00
|
|
|
void pageChanged(int currId);
|
2012-07-11 01:00:41 +02:00
|
|
|
private:
|
2013-05-19 16:37:30 +02:00
|
|
|
enum { PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
|
2014-09-02 18:19:15 +02:00
|
|
|
PAGE_AIRSPEED, PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_ESC, PAGE_SERVO,
|
2014-08-22 01:40:05 +02:00
|
|
|
PAGE_BIAS_CALIBRATION, PAGE_REVO_CALIBRATION, PAGE_OUTPUT_CALIBRATION,
|
2014-08-17 19:43:00 +02:00
|
|
|
PAGE_SAVE, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_AIRFRAMESTAB_FIXEDWING,
|
|
|
|
PAGE_REBOOT, PAGE_END, PAGE_UPDATE };
|
2012-07-11 01:00:41 +02:00
|
|
|
void createPages();
|
2012-09-23 21:58:37 +02:00
|
|
|
bool saveHardwareSettings() const;
|
2012-10-07 21:49:07 +02:00
|
|
|
bool canAutoUpdate() const;
|
2012-07-17 01:24:22 +02:00
|
|
|
|
|
|
|
CONTROLLER_TYPE m_controllerType;
|
|
|
|
VEHICLE_TYPE m_vehicleType;
|
2012-08-15 01:04:54 +02:00
|
|
|
VEHICLE_SUB_TYPE m_vehicleSubType;
|
2012-08-01 00:21:15 +02:00
|
|
|
INPUT_TYPE m_inputType;
|
2014-08-22 01:40:05 +02:00
|
|
|
ESC_TYPE m_escType;
|
|
|
|
SERVO_TYPE m_servoType;
|
2014-09-02 18:19:15 +02:00
|
|
|
AIRSPEED_TYPE m_airspeedType;
|
2013-04-07 11:52:33 +02:00
|
|
|
GPS_SETTING m_gpsSetting;
|
|
|
|
RADIO_SETTING m_radioSetting;
|
|
|
|
|
2013-04-16 20:40:25 +02:00
|
|
|
bool m_calibrationPerformed;
|
|
|
|
accelGyroBias m_calibrationBias;
|
2012-08-02 13:44:14 +02:00
|
|
|
|
2012-08-27 07:19:46 +02:00
|
|
|
bool m_motorCalibrationPerformed;
|
2012-09-09 23:44:42 +02:00
|
|
|
QList<actuatorChannelSettings> m_actuatorSettings;
|
2012-08-27 07:19:46 +02:00
|
|
|
|
2012-09-16 15:14:47 +02:00
|
|
|
bool m_restartNeeded;
|
|
|
|
|
2012-09-26 00:42:17 +02:00
|
|
|
bool m_back;
|
|
|
|
|
2012-08-02 13:44:14 +02:00
|
|
|
Core::ConnectionManager *m_connectionManager;
|
2012-07-10 00:26:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SETUPWIZARD_H
|