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>
|
2012-08-02 13:44:14 +02:00
|
|
|
#include "levellingutil.h"
|
|
|
|
#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
|
|
|
|
2012-08-17 00:47:31 +02:00
|
|
|
class SetupWizard : public QWizard, public VehicleConfigurationSource
|
2012-07-10 00:26:59 +02:00
|
|
|
{
|
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
|
|
|
|
2012-07-17 01:24:22 +02:00
|
|
|
void setControllerType(SetupWizard::CONTROLLER_TYPE type) { m_controllerType = type; }
|
|
|
|
SetupWizard::CONTROLLER_TYPE getControllerType() const { return m_controllerType; }
|
|
|
|
|
|
|
|
void setVehicleType(SetupWizard::VEHICLE_TYPE type) { m_vehicleType = type; }
|
|
|
|
SetupWizard::VEHICLE_TYPE getVehicleType() const { return m_vehicleType; }
|
|
|
|
|
2012-08-15 01:04:54 +02:00
|
|
|
void setVehicleSubType(SetupWizard::VEHICLE_SUB_TYPE type) { m_vehicleSubType = type; }
|
|
|
|
SetupWizard::VEHICLE_SUB_TYPE getVehicleSubType() const { return m_vehicleSubType; }
|
|
|
|
|
2012-08-01 00:21:15 +02:00
|
|
|
void setInputType(SetupWizard::INPUT_TYPE type) { m_inputType = type; }
|
|
|
|
SetupWizard::INPUT_TYPE getInputType() const { return m_inputType; }
|
|
|
|
|
|
|
|
void setESCType(SetupWizard::ESC_TYPE type) { m_escType = type; }
|
|
|
|
SetupWizard::ESC_TYPE getESCType() const { return m_escType; }
|
|
|
|
|
2012-08-02 13:44:14 +02:00
|
|
|
void setLevellingBias(accelGyroBias bias) { m_levellingBias = bias; m_levellingPerformed = true; }
|
2012-08-27 07:19:46 +02:00
|
|
|
bool isLevellingPerformed() const { return m_levellingPerformed; }
|
2012-08-02 13:44:14 +02:00
|
|
|
accelGyroBias getLevellingBias() const { return m_levellingBias; }
|
|
|
|
|
2012-09-09 23:44:42 +02:00
|
|
|
void setActuatorSettings(QList<actuatorChannelSettings> actuatorSettings) { m_actuatorSettings = actuatorSettings; }
|
2012-08-27 07:19:46 +02:00
|
|
|
bool isMotorCalibrationPerformed() const { return m_motorCalibrationPerformed; }
|
2012-09-09 23:44:42 +02:00
|
|
|
QList<actuatorChannelSettings> getActuatorSettings() const { return m_actuatorSettings; }
|
2012-08-02 13:44:14 +02:00
|
|
|
|
2012-09-16 15:14:47 +02:00
|
|
|
void setRestartNeeded(bool needed) { m_restartNeeded = needed; }
|
|
|
|
bool isRestartNeeded() const {return m_restartNeeded; }
|
|
|
|
|
2012-08-01 00:21:15 +02:00
|
|
|
QString getSummaryText();
|
|
|
|
|
2012-08-02 13:44:14 +02:00
|
|
|
Core::ConnectionManager* getConnectionManager() {
|
|
|
|
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:
|
2012-07-17 01:24:22 +02:00
|
|
|
enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
|
2012-09-03 01:01:57 +02:00
|
|
|
PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_LEVELLING, PAGE_CALIBRATION,
|
2012-10-06 02:41:50 +02:00
|
|
|
PAGE_SAVE, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, 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;
|
|
|
|
ESC_TYPE m_escType;
|
2012-09-04 01:28:28 +02:00
|
|
|
|
2012-08-02 13:44:14 +02:00
|
|
|
bool m_levellingPerformed;
|
|
|
|
accelGyroBias m_levellingBias;
|
|
|
|
|
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
|