1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Merge remote-tracking branch 'origin/thread/OP-816_Setup_Wizard_Revo_Support' into next

This commit is contained in:
Oleg Semyonov 2013-04-26 15:18:01 +03:00
commit 4718e666ee
19 changed files with 369 additions and 134 deletions

View File

@ -1,11 +1,11 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file levellingutil.cpp * @file cccalibrationutil.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup * @addtogroup
* @{ * @{
* @addtogroup LevellingUtil * @addtogroup CCCalibrationUtil
* @{ * @{
* @brief * @brief
*****************************************************************************/ *****************************************************************************/
@ -25,7 +25,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "levellingutil.h" #include "cccalibrationutil.h"
#include "extensionsystem/pluginmanager.h" #include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h" #include "uavobjectmanager.h"
#include "attitudesettings.h" #include "attitudesettings.h"
@ -33,20 +33,20 @@
#include "gyros.h" #include "gyros.h"
LevellingUtil::LevellingUtil(long measurementCount, long measurementRate) : QObject(), CCCalibrationUtil::CCCalibrationUtil(long measurementCount, long measurementRate) : QObject(),
m_isMeasuring(false), m_accelMeasurementCount(measurementCount), m_gyroMeasurementCount(measurementCount), m_isMeasuring(false), m_accelMeasurementCount(measurementCount), m_gyroMeasurementCount(measurementCount),
m_accelMeasurementRate(measurementRate), m_gyroMeasurementRate(measurementRate) m_accelMeasurementRate(measurementRate), m_gyroMeasurementRate(measurementRate)
{ {
} }
LevellingUtil::LevellingUtil(long accelMeasurementCount, long accelMeasurementRate, CCCalibrationUtil::CCCalibrationUtil(long accelMeasurementCount, long accelMeasurementRate,
long gyroMeasurementCount, long gyroMeasurementRate) : QObject(), long gyroMeasurementCount, long gyroMeasurementRate) : QObject(),
m_isMeasuring(false), m_accelMeasurementCount(accelMeasurementCount), m_gyroMeasurementCount(gyroMeasurementCount), m_isMeasuring(false), m_accelMeasurementCount(accelMeasurementCount), m_gyroMeasurementCount(gyroMeasurementCount),
m_accelMeasurementRate(accelMeasurementRate), m_gyroMeasurementRate(gyroMeasurementRate) m_accelMeasurementRate(accelMeasurementRate), m_gyroMeasurementRate(gyroMeasurementRate)
{ {
} }
void LevellingUtil::start() void CCCalibrationUtil::start()
{ {
if(!m_isMeasuring) { if(!m_isMeasuring) {
startMeasurement(); startMeasurement();
@ -58,15 +58,16 @@ void LevellingUtil::start()
} }
} }
void LevellingUtil::abort() void CCCalibrationUtil::abort()
{ {
if(m_isMeasuring) { if(m_isMeasuring) {
stopMeasurement(); stopMeasurement();
} }
} }
void LevellingUtil::gyroMeasurementsUpdated(UAVObject *obj) void CCCalibrationUtil::gyroMeasurementsUpdated(UAVObject *obj)
{ {
Q_UNUSED(obj);
QMutexLocker locker(&m_measurementMutex); QMutexLocker locker(&m_measurementMutex);
if(m_receivedGyroUpdates < m_gyroMeasurementCount) { if(m_receivedGyroUpdates < m_gyroMeasurementCount) {
@ -91,8 +92,9 @@ void LevellingUtil::gyroMeasurementsUpdated(UAVObject *obj)
} }
} }
void LevellingUtil::accelMeasurementsUpdated(UAVObject *obj) void CCCalibrationUtil::accelMeasurementsUpdated(UAVObject *obj)
{ {
Q_UNUSED(obj);
QMutexLocker locker(&m_measurementMutex); QMutexLocker locker(&m_measurementMutex);
if(m_receivedAccelUpdates < m_accelMeasurementCount) { if(m_receivedAccelUpdates < m_accelMeasurementCount) {
@ -117,7 +119,7 @@ void LevellingUtil::accelMeasurementsUpdated(UAVObject *obj)
} }
} }
void LevellingUtil::timeout() void CCCalibrationUtil::timeout()
{ {
QMutexLocker locker(&m_measurementMutex); QMutexLocker locker(&m_measurementMutex);
@ -125,7 +127,7 @@ void LevellingUtil::timeout()
emit timeout(tr("Calibration timed out before receiving required updates.")); emit timeout(tr("Calibration timed out before receiving required updates."));
} }
void LevellingUtil::startMeasurement() void CCCalibrationUtil::startMeasurement()
{ {
QMutexLocker locker(&m_measurementMutex); QMutexLocker locker(&m_measurementMutex);
@ -174,7 +176,7 @@ void LevellingUtil::startMeasurement()
uavObject->setMetadata(newMetaData); uavObject->setMetadata(newMetaData);
} }
void LevellingUtil::stopMeasurement() void CCCalibrationUtil::stopMeasurement()
{ {
m_isMeasuring = false; m_isMeasuring = false;
@ -202,7 +204,7 @@ void LevellingUtil::stopMeasurement()
AttitudeSettings::GetInstance(uavObjectManager)->setData(attitudeSettingsData); AttitudeSettings::GetInstance(uavObjectManager)->setData(attitudeSettingsData);
} }
accelGyroBias LevellingUtil::calculateLevellingData() accelGyroBias CCCalibrationUtil::calculateLevellingData()
{ {
accelGyroBias bias; accelGyroBias bias;
bias.m_accelerometerXBias = m_accelerometerX / (double)m_receivedAccelUpdates / ACCELERATION_SCALE; bias.m_accelerometerXBias = m_accelerometerX / (double)m_receivedAccelUpdates / ACCELERATION_SCALE;

View File

@ -1,11 +1,11 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file levellingutil.h * @file cccalibrationutil.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup * @addtogroup
* @{ * @{
* @addtogroup LevellingUtil * @addtogroup CCCalibrationUtil
* @{ * @{
* @brief * @brief
*****************************************************************************/ *****************************************************************************/
@ -25,8 +25,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef LEVELLINGUTIL_H #ifndef CCCALIBRATIONUTIL_H
#define LEVELLINGUTIL_H #define CCCALIBRATIONUTIL_H
#include <QObject> #include <QObject>
#include <QTimer> #include <QTimer>
@ -35,12 +35,12 @@
#include "uavobject.h" #include "uavobject.h"
#include "vehicleconfigurationsource.h" #include "vehicleconfigurationsource.h"
class LevellingUtil : public QObject class CCCalibrationUtil : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit LevellingUtil(long measurementCount, long measurementRate); explicit CCCalibrationUtil(long measurementCount, long measurementRate);
explicit LevellingUtil(long accelMeasurementCount, long accelMeasurementRate, explicit CCCalibrationUtil(long accelMeasurementCount, long accelMeasurementRate,
long gyroMeasurementCount, long gyroMeasurementRate); long gyroMeasurementCount, long gyroMeasurementRate);
signals: signals:
@ -89,4 +89,4 @@ private:
accelGyroBias calculateLevellingData(); accelGyroBias calculateLevellingData();
}; };
#endif // LEVELLINGUTIL_H #endif // CCCALIBRATIONUTIL_H

View File

@ -82,7 +82,7 @@ void ConnectionDiagram::setupGraphicsScene()
case VehicleConfigurationSource::CONTROLLER_CC: case VehicleConfigurationSource::CONTROLLER_CC:
case VehicleConfigurationSource::CONTROLLER_CC3D: case VehicleConfigurationSource::CONTROLLER_CC3D:
case VehicleConfigurationSource::CONTROLLER_REVO: case VehicleConfigurationSource::CONTROLLER_REVO:
case VehicleConfigurationSource::CONTROLLER_PIPX: case VehicleConfigurationSource::CONTROLLER_OPLINK:
default: default:
elementsToShow << "controller"; elementsToShow << "controller";
break; break;

View File

@ -46,7 +46,7 @@ OutputCalibrationUtil::~OutputCalibrationUtil()
void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValue) void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValue)
{ {
if(m_outputChannel < 0 && channel >= 0 && channel < ActuatorCommand::CHANNEL_NUMELEM) if(m_outputChannel < 0 && channel < ActuatorCommand::CHANNEL_NUMELEM)
{ {
//Start output... //Start output...
m_outputChannel = channel; m_outputChannel = channel;

View File

@ -1,11 +1,11 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file levellingpage.cpp * @file cccalibrationpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup * @addtogroup
* @{ * @{
* @addtogroup LevellingPage * @addtogroup CCCalibrationPage
* @{ * @{
* @brief * @brief
*****************************************************************************/ *****************************************************************************/
@ -27,38 +27,37 @@
#include <QMessageBox> #include <QMessageBox>
#include <QDebug> #include <QDebug>
#include "levellingpage.h" #include "cccalibrationpage.h"
#include "ui_levellingpage.h" #include "ui_cccalibrationpage.h"
#include "setupwizard.h" #include "setupwizard.h"
LevellingPage::LevellingPage(SetupWizard *wizard, QWidget *parent) : CCCalibrationPage::CCCalibrationPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent), AbstractWizardPage(wizard, parent),
ui(new Ui::LevellingPage), m_levellingUtil(0) ui(new Ui::CCCalibrationPage), m_calibrationUtil(0)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->levelButton, SIGNAL(clicked()), this, SLOT(performLevelling())); connect(ui->levelButton, SIGNAL(clicked()), this, SLOT(performCalibration()));
} }
LevellingPage::~LevellingPage() CCCalibrationPage::~CCCalibrationPage()
{ {
if(m_levellingUtil) { if(m_calibrationUtil) {
delete m_levellingUtil; delete m_calibrationUtil;
} }
delete ui; delete ui;
} }
bool LevellingPage::validatePage() bool CCCalibrationPage::validatePage()
{ {
return true; return true;
} }
bool LevellingPage::isComplete() const bool CCCalibrationPage::isComplete() const
{ {
//const_cast<LevellingPage *>(this)->getWizard()->isLevellingPerformed() &&
return ui->levelButton->isEnabled(); return ui->levelButton->isEnabled();
} }
void LevellingPage::enableButtons(bool enable) void CCCalibrationPage::enableButtons(bool enable)
{ {
ui->levelButton->setEnabled(enable); ui->levelButton->setEnabled(enable);
getWizard()->button(QWizard::NextButton)->setEnabled(enable); getWizard()->button(QWizard::NextButton)->setEnabled(enable);
@ -68,7 +67,7 @@ void LevellingPage::enableButtons(bool enable)
QApplication::processEvents(); QApplication::processEvents();
} }
void LevellingPage::performLevelling() void CCCalibrationPage::performCalibration()
{ {
if(!getWizard()->getConnectionManager()->isConnected()) { if(!getWizard()->getConnectionManager()->isConnected()) {
QMessageBox msgBox; QMessageBox msgBox;
@ -84,19 +83,19 @@ void LevellingPage::performLevelling()
ui->progressLabel->setText(QString(tr("Retrieving data..."))); ui->progressLabel->setText(QString(tr("Retrieving data...")));
if(!m_levellingUtil) if(!m_calibrationUtil)
{ {
m_levellingUtil = new LevellingUtil(BIAS_CYCLES, BIAS_RATE); m_calibrationUtil = new CCCalibrationUtil(BIAS_CYCLES, BIAS_RATE);
} }
connect(m_levellingUtil, SIGNAL(progress(long,long)), this, SLOT(levellingProgress(long,long))); connect(m_calibrationUtil, SIGNAL(progress(long,long)), this, SLOT(calibrationProgress(long,long)));
connect(m_levellingUtil, SIGNAL(done(accelGyroBias)), this, SLOT(levellingDone(accelGyroBias))); connect(m_calibrationUtil, SIGNAL(done(accelGyroBias)), this, SLOT(calibrationDone(accelGyroBias)));
connect(m_levellingUtil, SIGNAL(timeout(QString)), this, SLOT(levellingTimeout(QString))); connect(m_calibrationUtil, SIGNAL(timeout(QString)), this, SLOT(calibrationTimeout(QString)));
m_levellingUtil->start(); m_calibrationUtil->start();
} }
void LevellingPage::levellingProgress(long current, long total) void CCCalibrationPage::calibrationProgress(long current, long total)
{ {
if(ui->levellinProgressBar->maximum() != (int)total) { if(ui->levellinProgressBar->maximum() != (int)total) {
ui->levellinProgressBar->setMaximum((int)total); ui->levellinProgressBar->setMaximum((int)total);
@ -106,16 +105,16 @@ void LevellingPage::levellingProgress(long current, long total)
} }
} }
void LevellingPage::levellingDone(accelGyroBias bias) void CCCalibrationPage::calibrationDone(accelGyroBias bias)
{ {
stopLevelling(); stopCalibration();
getWizard()->setLevellingBias(bias); getWizard()->setLevellingBias(bias);
emit completeChanged(); emit completeChanged();
} }
void LevellingPage::levellingTimeout(QString message) void CCCalibrationPage::calibrationTimeout(QString message)
{ {
stopLevelling(); stopCalibration();
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(message); msgBox.setText(message);
@ -124,13 +123,13 @@ void LevellingPage::levellingTimeout(QString message)
msgBox.exec(); msgBox.exec();
} }
void LevellingPage::stopLevelling() void CCCalibrationPage::stopCalibration()
{ {
if(m_levellingUtil) if(m_calibrationUtil)
{ {
disconnect(m_levellingUtil, SIGNAL(progress(long,long)), this, SLOT(levellingProgress(long,long))); disconnect(m_calibrationUtil, SIGNAL(progress(long,long)), this, SLOT(calibrationProgress(long,long)));
disconnect(m_levellingUtil, SIGNAL(done(accelGyroBias)), this, SLOT(levellingDone(accelGyroBias))); disconnect(m_calibrationUtil, SIGNAL(done(accelGyroBias)), this, SLOT(calibrationDone(accelGyroBias)));
disconnect(m_levellingUtil, SIGNAL(timeout(QString)), this, SLOT(levellingTimeout(QString))); disconnect(m_calibrationUtil, SIGNAL(timeout(QString)), this, SLOT(calibrationTimeout(QString)));
ui->progressLabel->setText(QString(tr("<font color='green'>Done!</font>"))); ui->progressLabel->setText(QString(tr("<font color='green'>Done!</font>")));
enableButtons(true); enableButtons(true);
} }

View File

@ -1,11 +1,11 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file levellingpage.h * @file cccalibrationpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup * @addtogroup
* @{ * @{
* @addtogroup LevellingPage * @addtogroup CCCalibrationPage
* @{ * @{
* @brief * @brief
*****************************************************************************/ *****************************************************************************/
@ -25,41 +25,41 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef LEVELLINGPAGE_H #ifndef CCCALIBRATIONPAGE_H
#define LEVELLINGPAGE_H #define CCCALIBRATIONPAGE_H
#include "abstractwizardpage.h" #include "abstractwizardpage.h"
#include "levellingutil.h" #include "cccalibrationutil.h"
namespace Ui { namespace Ui {
class LevellingPage; class CCCalibrationPage;
} }
class LevellingPage : public AbstractWizardPage class CCCalibrationPage : public AbstractWizardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit LevellingPage(SetupWizard *wizard, QWidget *parent = 0); explicit CCCalibrationPage(SetupWizard *wizard, QWidget *parent = 0);
~LevellingPage(); ~CCCalibrationPage();
bool validatePage(); bool validatePage();
bool isComplete() const; bool isComplete() const;
private slots: private slots:
void performLevelling(); void performCalibration();
void levellingProgress(long current, long total); void calibrationProgress(long current, long total);
void levellingDone(accelGyroBias bias); void calibrationDone(accelGyroBias bias);
void levellingTimeout(QString message); void calibrationTimeout(QString message);
private: private:
static const int BIAS_CYCLES = 200; static const int BIAS_CYCLES = 200;
static const int BIAS_RATE = 30; static const int BIAS_RATE = 30;
Ui::LevellingPage *ui; Ui::CCCalibrationPage *ui;
LevellingUtil *m_levellingUtil; CCCalibrationUtil *m_calibrationUtil;
void stopLevelling(); void stopCalibration();
void enableButtons(bool enable); void enableButtons(bool enable);
}; };
#endif // LEVELLINGPAGE_H #endif // CCCALIBRATIONPAGE_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>LevellingPage</class> <class>CCCalibrationPage</class>
<widget class="QWizardPage" name="LevellingPage"> <widget class="QWizardPage" name="CCCalibrationPage">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -20,12 +20,12 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;&quot;&gt;OpenPilot controller leveling calibration procedure&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;OpenPilot CopterControl sensor calibration procedure&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;&quot;&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt;&quot;&gt;The wizard needs to get information from the controller to determine in which position the vehicle is normally considered to be level. To be able to successfully perform these measurements, you need to place the vehicle on a surface that is as flat and level as possible. Examples of such surfaces could be a table top or the floor. Be careful to ensure that the vehicle really is level, since this step will affect the accelerometer and gyro bias in the controller software.&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;The wizard needs to get information from the controller to determine in which position the vehicle is normally considered to be level. To be able to successfully perform these measurements, you need to place the vehicle on a surface that is as flat and level as possible. Examples of such surfaces could be a table top or the floor. Be careful to ensure that the vehicle really is level, since this step will affect the accelerometer and gyro bias in the controller software.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;&quot;&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt;&quot;&gt;To perform the leveling, please push the Calculate button and wait for the process to finish. &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;To perform the calibration, please push the Calculate button and wait for the process to finish. &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>

View File

@ -97,12 +97,12 @@ SetupWizard::CONTROLLER_TYPE ControllerPage::getControllerType()
switch (id) { switch (id) {
case 0x0301: case 0x0301:
return SetupWizard::CONTROLLER_PIPX; return SetupWizard::CONTROLLER_OPLINK;
case 0x0401: case 0x0401:
return SetupWizard::CONTROLLER_CC; return SetupWizard::CONTROLLER_CC;
case 0x0402: case 0x0402:
return SetupWizard::CONTROLLER_CC3D; return SetupWizard::CONTROLLER_CC3D;
case 0x0901: case 0x0903:
return SetupWizard::CONTROLLER_REVO; return SetupWizard::CONTROLLER_REVO;
default: default:
return SetupWizard::CONTROLLER_UNKNOWN; return SetupWizard::CONTROLLER_UNKNOWN;
@ -122,9 +122,7 @@ void ControllerPage::setupBoardTypes()
ui->boardTypeCombo->addItem(tr("OpenPilot CopterControl"), SetupWizard::CONTROLLER_CC); ui->boardTypeCombo->addItem(tr("OpenPilot CopterControl"), SetupWizard::CONTROLLER_CC);
ui->boardTypeCombo->addItem(tr("OpenPilot CopterControl 3D"), SetupWizard::CONTROLLER_CC3D); ui->boardTypeCombo->addItem(tr("OpenPilot CopterControl 3D"), SetupWizard::CONTROLLER_CC3D);
ui->boardTypeCombo->addItem(tr("OpenPilot Revolution"), SetupWizard::CONTROLLER_REVO); ui->boardTypeCombo->addItem(tr("OpenPilot Revolution"), SetupWizard::CONTROLLER_REVO);
//ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(ui->boardTypeCombo->count() - 1, 0), v, Qt::UserRole - 1); ui->boardTypeCombo->addItem(tr("OpenPilot OPLink Radio Modem"), SetupWizard::CONTROLLER_OPLINK);
ui->boardTypeCombo->addItem(tr("OpenPilot OPLink Radio Modem"), SetupWizard::CONTROLLER_PIPX);
//ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(ui->boardTypeCombo->count() - 1, 0), v, Qt::UserRole - 1);
} }
void ControllerPage::setControllerType(SetupWizard::CONTROLLER_TYPE type) void ControllerPage::setControllerType(SetupWizard::CONTROLLER_TYPE type)

View File

@ -74,6 +74,10 @@ bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedTyp
Q_ASSERT(uavoManager); Q_ASSERT(uavoManager);
HwSettings* hwSettings = HwSettings::GetInstance(uavoManager); HwSettings* hwSettings = HwSettings::GetInstance(uavoManager);
HwSettings::DataFields data = hwSettings->getData(); HwSettings::DataFields data = hwSettings->getData();
switch(getWizard()->getControllerType()) {
case SetupWizard::CONTROLLER_CC:
case SetupWizard::CONTROLLER_CC3D:
{
switch(selectedType) switch(selectedType)
{ {
case VehicleConfigurationSource::INPUT_PWM: case VehicleConfigurationSource::INPUT_PWM:
@ -85,7 +89,27 @@ bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedTyp
case VehicleConfigurationSource::INPUT_DSM2: case VehicleConfigurationSource::INPUT_DSM2:
// TODO: Handle all of the DSM types ?? Which is most common? // TODO: Handle all of the DSM types ?? Which is most common?
return data.CC_MainPort != HwSettings::CC_MAINPORT_DSM2; return data.CC_MainPort != HwSettings::CC_MAINPORT_DSM2;
default: default: return true;
return true; }
break;
}
case SetupWizard::CONTROLLER_REVO:
{
switch(selectedType)
{
case VehicleConfigurationSource::INPUT_PWM:
return data.RM_RcvrPort != HwSettings::CC_RCVRPORT_PWM;
case VehicleConfigurationSource::INPUT_PPM:
return data.RM_RcvrPort != HwSettings::CC_RCVRPORT_PPM;
case VehicleConfigurationSource::INPUT_SBUS:
return data.RM_MainPort != HwSettings::CC_MAINPORT_SBUS;
case VehicleConfigurationSource::INPUT_DSM2:
// TODO: Handle all of the DSM types ?? Which is most common?
return data.RM_MainPort != HwSettings::CC_MAINPORT_DSM2;
default: return true;
}
break;
}
default: return true;
} }
} }

View File

@ -330,6 +330,7 @@ void OutputCalibrationPage::debugLogChannelValues()
void OutputCalibrationPage::on_motorNeutralSlider_valueChanged(int value) void OutputCalibrationPage::on_motorNeutralSlider_valueChanged(int value)
{ {
Q_UNUSED(value);
if(ui->motorNeutralButton->isChecked()) { if(ui->motorNeutralButton->isChecked()) {
quint16 value = ui->motorNeutralSlider->value(); quint16 value = ui->motorNeutralSlider->value();
m_calibrationUtil->setChannelOutputValue(value); m_calibrationUtil->setChannelOutputValue(value);
@ -348,6 +349,7 @@ void OutputCalibrationPage::on_servoCenterButton_toggled(bool checked)
void OutputCalibrationPage::on_servoCenterSlider_valueChanged(int position) void OutputCalibrationPage::on_servoCenterSlider_valueChanged(int position)
{ {
Q_UNUSED(position);
if(ui->servoCenterButton->isChecked()) { if(ui->servoCenterButton->isChecked()) {
quint16 value = ui->servoCenterSlider->value(); quint16 value = ui->servoCenterSlider->value();
m_calibrationUtil->setChannelOutputValue(value); m_calibrationUtil->setChannelOutputValue(value);
@ -375,6 +377,7 @@ void OutputCalibrationPage::on_servoMinAngleButton_toggled(bool checked)
void OutputCalibrationPage::on_servoMinAngleSlider_valueChanged(int position) void OutputCalibrationPage::on_servoMinAngleSlider_valueChanged(int position)
{ {
Q_UNUSED(position);
if(ui->servoMinAngleButton->isChecked()) { if(ui->servoMinAngleButton->isChecked()) {
quint16 value = ui->servoMinAngleSlider->value(); quint16 value = ui->servoMinAngleSlider->value();
m_calibrationUtil->setChannelOutputValue(value); m_calibrationUtil->setChannelOutputValue(value);
@ -393,6 +396,7 @@ void OutputCalibrationPage::on_servoMaxAngleButton_toggled(bool checked)
void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position) void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position)
{ {
Q_UNUSED(position);
if(ui->servoMaxAngleButton->isChecked()) { if(ui->servoMaxAngleButton->isChecked()) {
quint16 value = ui->servoMaxAngleSlider->value(); quint16 value = ui->servoMaxAngleSlider->value();
m_calibrationUtil->setChannelOutputValue(value); m_calibrationUtil->setChannelOutputValue(value);

View File

@ -0,0 +1,42 @@
/**
******************************************************************************
*
* @file revocalibrationpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup RevoCalibrationPage
* @{
* @brief
*****************************************************************************/
/*
* 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
*/
#include "revocalibrationpage.h"
#include "ui_revocalibrationpage.h"
RevoCalibrationPage::RevoCalibrationPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::RevoCalibrationPage)
{
ui->setupUi(this);
setFinalPage(true);
}
RevoCalibrationPage::~RevoCalibrationPage()
{
delete ui;
}

View File

@ -0,0 +1,49 @@
/**
******************************************************************************
*
* @file revocalibrationpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup RevoCalibrationPage
* @{
* @brief
*****************************************************************************/
/*
* 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 REVOCALIBRATIONPAGE_H
#define REVOCALIBRATIONPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class RevoCalibrationPage;
}
class RevoCalibrationPage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit RevoCalibrationPage(SetupWizard *wizard, QWidget *parent = 0);
~RevoCalibrationPage();
private:
Ui::RevoCalibrationPage *ui;
};
#endif // REVOCALIBRATIONPAGE_H

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RevoCalibrationPage</class>
<widget class="QWizardPage" name="RevoCalibrationPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>582</width>
<height>150</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;OpenPilot Revolution controller sensor calibration procedure&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;The calibration procedure for the OpenPilot Revolution controller is not yet implemented in this setup wizard. To calibrate your OpenPilot Revolution controller please use the calibration utility found in the configuration plugin after you have finished this wizard.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Future versions of will have an easy to use calibration procedure implemented.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -36,12 +36,13 @@
#include "pages/surfacepage.h" #include "pages/surfacepage.h"
#include "pages/inputpage.h" #include "pages/inputpage.h"
#include "pages/outputpage.h" #include "pages/outputpage.h"
#include "pages/levellingpage.h" #include "pages/cccalibrationpage.h"
#include "pages/summarypage.h" #include "pages/summarypage.h"
#include "pages/savepage.h" #include "pages/savepage.h"
#include "pages/notyetimplementedpage.h" #include "pages/notyetimplementedpage.h"
#include "pages/rebootpage.h" #include "pages/rebootpage.h"
#include "pages/outputcalibrationpage.h" #include "pages/outputcalibrationpage.h"
#include "pages/revocalibrationpage.h"
#include "extensionsystem/pluginmanager.h" #include "extensionsystem/pluginmanager.h"
#include "vehicleconfigurationhelper.h" #include "vehicleconfigurationhelper.h"
#include "actuatorsettings.h" #include "actuatorsettings.h"
@ -51,7 +52,7 @@
SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent), VehicleConfigurationSource(), SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent), VehicleConfigurationSource(),
m_controllerType(CONTROLLER_UNKNOWN), m_controllerType(CONTROLLER_UNKNOWN),
m_vehicleType(VEHICLE_UNKNOWN), m_inputType(INPUT_UNKNOWN), m_escType(ESC_UNKNOWN), m_vehicleType(VEHICLE_UNKNOWN), m_inputType(INPUT_UNKNOWN), m_escType(ESC_UNKNOWN),
m_levellingPerformed(false), m_restartNeeded(false), m_connectionManager(0) m_calibrationPerformed(false), m_restartNeeded(false), m_connectionManager(0)
{ {
setWindowTitle(tr("OpenPilot Setup Wizard")); setWindowTitle(tr("OpenPilot Setup Wizard"));
setOption(QWizard::IndependentPages, false); setOption(QWizard::IndependentPages, false);
@ -81,9 +82,9 @@ int SetupWizard::nextId() const
{ {
case CONTROLLER_CC: case CONTROLLER_CC:
case CONTROLLER_CC3D: case CONTROLLER_CC3D:
return PAGE_INPUT;
case CONTROLLER_REVO: case CONTROLLER_REVO:
case CONTROLLER_PIPX: return PAGE_INPUT;
case CONTROLLER_OPLINK:
default: default:
return PAGE_NOTYETIMPLEMENTED; return PAGE_NOTYETIMPLEMENTED;
} }
@ -117,12 +118,25 @@ int SetupWizard::nextId() const
return PAGE_VEHICLES; return PAGE_VEHICLES;
case PAGE_OUTPUT: case PAGE_OUTPUT:
return PAGE_SUMMARY; return PAGE_SUMMARY;
case PAGE_LEVELLING: case PAGE_CC_CALIBRATION:
return PAGE_CALIBRATION; return PAGE_OUTPUT_CALIBRATION;
case PAGE_CALIBRATION: case PAGE_REVO_CALIBRATION:
return PAGE_OUTPUT_CALIBRATION;
case PAGE_OUTPUT_CALIBRATION:
return PAGE_SAVE; return PAGE_SAVE;
case PAGE_SUMMARY: case PAGE_SUMMARY:
return PAGE_LEVELLING; {
switch(getControllerType())
{
case CONTROLLER_CC:
case CONTROLLER_CC3D:
return PAGE_CC_CALIBRATION;
case CONTROLLER_REVO:
return PAGE_REVO_CALIBRATION;
default:
return PAGE_NOTYETIMPLEMENTED;
}
}
case PAGE_SAVE: case PAGE_SAVE:
return PAGE_END; return PAGE_END;
case PAGE_NOTYETIMPLEMENTED: case PAGE_NOTYETIMPLEMENTED:
@ -147,7 +161,7 @@ QString SetupWizard::getSummaryText()
case CONTROLLER_REVO: case CONTROLLER_REVO:
summary.append(tr("OpenPilot Revolution")); summary.append(tr("OpenPilot Revolution"));
break; break;
case CONTROLLER_PIPX: case CONTROLLER_OPLINK:
summary.append(tr("OpenPilot OPLink Radio Modem")); summary.append(tr("OpenPilot OPLink Radio Modem"));
break; break;
default: default:
@ -275,8 +289,9 @@ void SetupWizard::createPages()
setPage(PAGE_SURFACE, new SurfacePage(this)); setPage(PAGE_SURFACE, new SurfacePage(this));
setPage(PAGE_INPUT, new InputPage(this)); setPage(PAGE_INPUT, new InputPage(this));
setPage(PAGE_OUTPUT, new OutputPage(this)); setPage(PAGE_OUTPUT, new OutputPage(this));
setPage(PAGE_LEVELLING, new LevellingPage(this)); setPage(PAGE_CC_CALIBRATION, new CCCalibrationPage(this));
setPage(PAGE_CALIBRATION, new OutputCalibrationPage(this)); setPage(PAGE_REVO_CALIBRATION, new RevoCalibrationPage(this));
setPage(PAGE_OUTPUT_CALIBRATION, new OutputCalibrationPage(this));
setPage(PAGE_SUMMARY, new SummaryPage(this)); setPage(PAGE_SUMMARY, new SummaryPage(this));
setPage(PAGE_SAVE, new SavePage(this)); setPage(PAGE_SAVE, new SavePage(this));
setPage(PAGE_REBOOT, new RebootPage(this)); setPage(PAGE_REBOOT, new RebootPage(this));
@ -295,7 +310,7 @@ void SetupWizard::createPages()
void SetupWizard::customBackClicked() void SetupWizard::customBackClicked()
{ {
if(currentId() == PAGE_CALIBRATION) { if(currentId() == PAGE_OUTPUT_CALIBRATION) {
static_cast<OutputCalibrationPage*>(currentPage())->customBackClicked(); static_cast<OutputCalibrationPage*>(currentPage())->customBackClicked();
} }
else { else {

View File

@ -29,7 +29,7 @@
#define SETUPWIZARD_H #define SETUPWIZARD_H
#include <QWizard> #include <QWizard>
#include "levellingutil.h" #include "cccalibrationutil.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/connectionmanager.h> #include <coreplugin/connectionmanager.h>
#include "vehicleconfigurationsource.h" #include "vehicleconfigurationsource.h"
@ -58,9 +58,15 @@ public:
void setESCType(SetupWizard::ESC_TYPE type) { m_escType = type; } void setESCType(SetupWizard::ESC_TYPE type) { m_escType = type; }
SetupWizard::ESC_TYPE getESCType() const { return m_escType; } SetupWizard::ESC_TYPE getESCType() const { return m_escType; }
void setLevellingBias(accelGyroBias bias) { m_levellingBias = bias; m_levellingPerformed = true; } void setGPSSetting(SetupWizard::GPS_SETTING setting) { m_gpsSetting = setting; }
bool isLevellingPerformed() const { return m_levellingPerformed; } SetupWizard::GPS_SETTING getGPSSetting() const {return m_gpsSetting;}
accelGyroBias getLevellingBias() const { return m_levellingBias; }
void setRadioSetting(SetupWizard::RADIO_SETTING setting) { m_radioSetting = setting; }
SetupWizard::RADIO_SETTING getRadioSetting() const {return m_radioSetting;}
void setLevellingBias(accelGyroBias bias) { m_calibrationBias = bias; m_calibrationPerformed = true; }
bool isCalibrationPerformed() const { return m_calibrationPerformed; }
accelGyroBias getCalibrationBias() const { return m_calibrationBias; }
void setActuatorSettings(QList<actuatorChannelSettings> actuatorSettings) { m_actuatorSettings = actuatorSettings; } void setActuatorSettings(QList<actuatorChannelSettings> actuatorSettings) { m_actuatorSettings = actuatorSettings; }
bool isMotorCalibrationPerformed() const { return m_motorCalibrationPerformed; } bool isMotorCalibrationPerformed() const { return m_motorCalibrationPerformed; }
@ -84,8 +90,9 @@ private slots:
void pageChanged(int currId); void pageChanged(int currId);
private: private:
enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING, enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_LEVELLING, PAGE_CALIBRATION, PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_CC_CALIBRATION,
PAGE_SAVE, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END, PAGE_UPDATE}; PAGE_REVO_CALIBRATION, PAGE_OUTPUT_CALIBRATION, PAGE_SAVE, PAGE_SUMMARY,
PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END, PAGE_UPDATE};
void createPages(); void createPages();
bool saveHardwareSettings() const; bool saveHardwareSettings() const;
bool canAutoUpdate() const; bool canAutoUpdate() const;
@ -96,8 +103,11 @@ private:
INPUT_TYPE m_inputType; INPUT_TYPE m_inputType;
ESC_TYPE m_escType; ESC_TYPE m_escType;
bool m_levellingPerformed; GPS_SETTING m_gpsSetting;
accelGyroBias m_levellingBias; RADIO_SETTING m_radioSetting;
bool m_calibrationPerformed;
accelGyroBias m_calibrationBias;
bool m_motorCalibrationPerformed; bool m_motorCalibrationPerformed;
QList<actuatorChannelSettings> m_actuatorSettings; QList<actuatorChannelSettings> m_actuatorSettings;

View File

@ -25,8 +25,6 @@ HEADERS += setupwizardplugin.h \
pages/outputpage.h \ pages/outputpage.h \
pages/inputpage.h \ pages/inputpage.h \
pages/summarypage.h \ pages/summarypage.h \
pages/levellingpage.h \
levellingutil.h \
vehicleconfigurationsource.h \ vehicleconfigurationsource.h \
vehicleconfigurationhelper.h \ vehicleconfigurationhelper.h \
connectiondiagram.h \ connectiondiagram.h \
@ -34,7 +32,10 @@ HEADERS += setupwizardplugin.h \
outputcalibrationutil.h \ outputcalibrationutil.h \
pages/rebootpage.h \ pages/rebootpage.h \
pages/savepage.h \ pages/savepage.h \
pages/autoupdatepage.h pages/autoupdatepage.h \
pages/cccalibrationpage.h \
cccalibrationutil.h \
pages/revocalibrationpage.h
SOURCES += setupwizardplugin.cpp \ SOURCES += setupwizardplugin.cpp \
setupwizard.cpp \ setupwizard.cpp \
@ -51,8 +52,6 @@ SOURCES += setupwizardplugin.cpp \
pages/outputpage.cpp \ pages/outputpage.cpp \
pages/inputpage.cpp \ pages/inputpage.cpp \
pages/summarypage.cpp \ pages/summarypage.cpp \
pages/levellingpage.cpp \
levellingutil.cpp \
vehicleconfigurationsource.cpp \ vehicleconfigurationsource.cpp \
vehicleconfigurationhelper.cpp \ vehicleconfigurationhelper.cpp \
connectiondiagram.cpp \ connectiondiagram.cpp \
@ -60,7 +59,10 @@ SOURCES += setupwizardplugin.cpp \
outputcalibrationutil.cpp \ outputcalibrationutil.cpp \
pages/rebootpage.cpp \ pages/rebootpage.cpp \
pages/savepage.cpp \ pages/savepage.cpp \
pages/autoupdatepage.cpp pages/autoupdatepage.cpp \
pages/cccalibrationpage.cpp \
cccalibrationutil.cpp \
pages/revocalibrationpage.cpp
OTHER_FILES += SetupWizard.pluginspec OTHER_FILES += SetupWizard.pluginspec
@ -77,12 +79,13 @@ FORMS += \
pages/outputpage.ui \ pages/outputpage.ui \
pages/inputpage.ui \ pages/inputpage.ui \
pages/summarypage.ui \ pages/summarypage.ui \
pages/levellingpage.ui \
connectiondiagram.ui \ connectiondiagram.ui \
pages/outputcalibrationpage.ui \ pages/outputcalibrationpage.ui \
pages/rebootpage.ui \ pages/rebootpage.ui \
pages/savepage.ui \ pages/savepage.ui \
pages/autoupdatepage.ui pages/autoupdatepage.ui \
pages/cccalibrationpage.ui \
pages/revocalibrationpage.ui
RESOURCES += \ RESOURCES += \
wizardResources.qrc wizardResources.qrc

View File

@ -141,7 +141,38 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
} }
break; break;
case VehicleConfigurationSource::CONTROLLER_REVO: case VehicleConfigurationSource::CONTROLLER_REVO:
// TODO: Implement Revo settings // Reset all ports
data.RM_RcvrPort = HwSettings::RM_RCVRPORT_DISABLED;
//Default mainport to be active telemetry link
data.RM_MainPort = HwSettings::RM_MAINPORT_TELEMETRY;
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DISABLED;
switch(m_configSource->getInputType())
{
case VehicleConfigurationSource::INPUT_PWM:
data.RM_RcvrPort = HwSettings::RM_RCVRPORT_PWM;
break;
case VehicleConfigurationSource::INPUT_PPM:
data.RM_RcvrPort = HwSettings::RM_RCVRPORT_PPM;
break;
case VehicleConfigurationSource::INPUT_SBUS:
// We have to set teletry on flexport since s.bus needs the mainport.
data.RM_MainPort = HwSettings::RM_MAINPORT_SBUS;
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_TELEMETRY;
break;
case VehicleConfigurationSource::INPUT_DSMX10:
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSMX10BIT;
break;
case VehicleConfigurationSource::INPUT_DSMX11:
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSMX11BIT;
break;
case VehicleConfigurationSource::INPUT_DSM2:
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSM2;
break;
default:
break;
}
break; break;
default: default:
break; break;
@ -229,11 +260,17 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
switch(m_configSource->getVehicleSubType()) { switch(m_configSource->getVehicleSubType()) {
case VehicleConfigurationSource::MULTI_ROTOR_TRI_Y: case VehicleConfigurationSource::MULTI_ROTOR_TRI_Y:
data.ChannelUpdateFreq[0] = updateFrequence; data.ChannelUpdateFreq[0] = updateFrequence;
if(m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) {
data.ChannelUpdateFreq[1] = updateFrequence;
}
break; break;
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_X: case VehicleConfigurationSource::MULTI_ROTOR_QUAD_X:
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS: case VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS:
data.ChannelUpdateFreq[0] = updateFrequence; data.ChannelUpdateFreq[0] = updateFrequence;
data.ChannelUpdateFreq[1] = updateFrequence; data.ChannelUpdateFreq[1] = updateFrequence;
if(m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) {
data.ChannelUpdateFreq[2] = updateFrequence;
}
break; break;
case VehicleConfigurationSource::MULTI_ROTOR_HEXA: case VehicleConfigurationSource::MULTI_ROTOR_HEXA:
case VehicleConfigurationSource::MULTI_ROTOR_HEXA_COAX_Y: case VehicleConfigurationSource::MULTI_ROTOR_HEXA_COAX_Y:
@ -295,9 +332,9 @@ void VehicleConfigurationHelper::applyLevellingConfiguration()
AttitudeSettings* attitudeSettings = AttitudeSettings::GetInstance(m_uavoManager); AttitudeSettings* attitudeSettings = AttitudeSettings::GetInstance(m_uavoManager);
Q_ASSERT(attitudeSettings); Q_ASSERT(attitudeSettings);
AttitudeSettings::DataFields data = attitudeSettings->getData(); AttitudeSettings::DataFields data = attitudeSettings->getData();
if(m_configSource->isLevellingPerformed()) if(m_configSource->isCalibrationPerformed())
{ {
accelGyroBias bias = m_configSource->getLevellingBias(); accelGyroBias bias = m_configSource->getCalibrationBias();
data.AccelBias[0] += bias.m_accelerometerXBias; data.AccelBias[0] += bias.m_accelerometerXBias;
data.AccelBias[1] += bias.m_accelerometerYBias; data.AccelBias[1] += bias.m_accelerometerYBias;

View File

@ -56,7 +56,7 @@ class VehicleConfigurationSource
public: public:
VehicleConfigurationSource(); VehicleConfigurationSource();
enum CONTROLLER_TYPE {CONTROLLER_UNKNOWN, CONTROLLER_CC, CONTROLLER_CC3D, CONTROLLER_REVO, CONTROLLER_PIPX}; enum CONTROLLER_TYPE {CONTROLLER_UNKNOWN, CONTROLLER_CC, CONTROLLER_CC3D, CONTROLLER_REVO, CONTROLLER_OPLINK};
enum VEHICLE_TYPE {VEHICLE_UNKNOWN, VEHICLE_MULTI, VEHICLE_FIXEDWING, VEHICLE_HELI, VEHICLE_SURFACE}; enum VEHICLE_TYPE {VEHICLE_UNKNOWN, VEHICLE_MULTI, VEHICLE_FIXEDWING, VEHICLE_HELI, VEHICLE_SURFACE};
enum VEHICLE_SUB_TYPE {MULTI_ROTOR_UNKNOWN, MULTI_ROTOR_TRI_Y, MULTI_ROTOR_QUAD_X, MULTI_ROTOR_QUAD_PLUS, enum VEHICLE_SUB_TYPE {MULTI_ROTOR_UNKNOWN, MULTI_ROTOR_TRI_Y, MULTI_ROTOR_QUAD_X, MULTI_ROTOR_QUAD_PLUS,
MULTI_ROTOR_HEXA, MULTI_ROTOR_HEXA_H, MULTI_ROTOR_HEXA_COAX_Y, MULTI_ROTOR_OCTO, MULTI_ROTOR_HEXA, MULTI_ROTOR_HEXA_H, MULTI_ROTOR_HEXA_COAX_Y, MULTI_ROTOR_OCTO,
@ -65,14 +65,20 @@ public:
enum ESC_TYPE {ESC_RAPID, ESC_LEGACY, ESC_UNKNOWN}; enum ESC_TYPE {ESC_RAPID, ESC_LEGACY, ESC_UNKNOWN};
enum INPUT_TYPE {INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSMX10, INPUT_DSMX11, INPUT_DSM2, INPUT_UNKNOWN}; enum INPUT_TYPE {INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSMX10, INPUT_DSMX11, INPUT_DSM2, INPUT_UNKNOWN};
enum GPS_SETTING {GPS_UBX, GPS_NMEA, GPS_DISABLED};
enum RADIO_SETTING {RADIO_TELEMETRY, RADIO_DISABLED};
virtual VehicleConfigurationSource::CONTROLLER_TYPE getControllerType() const = 0; virtual VehicleConfigurationSource::CONTROLLER_TYPE getControllerType() const = 0;
virtual VehicleConfigurationSource::VEHICLE_TYPE getVehicleType() const = 0; virtual VehicleConfigurationSource::VEHICLE_TYPE getVehicleType() const = 0;
virtual VehicleConfigurationSource::VEHICLE_SUB_TYPE getVehicleSubType() const = 0; virtual VehicleConfigurationSource::VEHICLE_SUB_TYPE getVehicleSubType() const = 0;
virtual VehicleConfigurationSource::INPUT_TYPE getInputType() const = 0; virtual VehicleConfigurationSource::INPUT_TYPE getInputType() const = 0;
virtual VehicleConfigurationSource::ESC_TYPE getESCType() const = 0; virtual VehicleConfigurationSource::ESC_TYPE getESCType() const = 0;
virtual bool isLevellingPerformed() const = 0; virtual VehicleConfigurationSource::GPS_SETTING getGPSSetting() const = 0;
virtual accelGyroBias getLevellingBias() const = 0; virtual VehicleConfigurationSource::RADIO_SETTING getRadioSetting() const = 0;
virtual bool isCalibrationPerformed() const = 0;
virtual accelGyroBias getCalibrationBias() const = 0;
virtual bool isMotorCalibrationPerformed() const = 0; virtual bool isMotorCalibrationPerformed() const = 0;
virtual QList<actuatorChannelSettings> getActuatorSettings() const = 0; virtual QList<actuatorChannelSettings> getActuatorSettings() const = 0;