mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
OP-39 Implemented functionality for reliable writing of UAVOs to controller board.
Removed the option to configure the board without having it connected. Added Tri, QuadX and QuadP configuration code. Updated some of the texts.
This commit is contained in:
parent
98b5bc305b
commit
9205400cf0
@ -45,7 +45,6 @@ ControllerPage::ControllerPage(SetupWizard *wizard, QWidget *parent) :
|
||||
connect(m_connectionManager, SIGNAL(deviceConnected(QIODevice*)), this, SLOT(connectionStatusChanged()));
|
||||
connect(m_connectionManager, SIGNAL(deviceDisconnected()), this, SLOT(connectionStatusChanged()));
|
||||
|
||||
connect(ui->manualCB, SIGNAL(toggled(bool)), this, SLOT(identificationModeChanged()));
|
||||
connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectDisconnect()));
|
||||
|
||||
setupBoardTypes();
|
||||
@ -71,14 +70,12 @@ void ControllerPage::initializePage()
|
||||
|
||||
bool ControllerPage::isComplete() const
|
||||
{
|
||||
return (ui->manualCB->isChecked() && ui->boardTypeCombo->currentIndex() > 0) ||
|
||||
(!ui->manualCB->isChecked() && m_connectionManager->isConnected() && ui->boardTypeCombo->currentIndex() > 0);
|
||||
return m_connectionManager->isConnected() && ui->boardTypeCombo->currentIndex() > 0;
|
||||
}
|
||||
|
||||
bool ControllerPage::validatePage()
|
||||
{
|
||||
getWizard()->setControllerType((SetupWizard::CONTROLLER_TYPE)ui->boardTypeCombo->itemData(ui->boardTypeCombo->currentIndex()).toInt());
|
||||
getWizard()->setControllerSelectionMode(ui->manualCB->isChecked() ? SetupWizard::CONTROLLER_SELECTION_MANUAL : SetupWizard::CONTROLLER_SELECTION_AUTOMATIC);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -172,7 +169,6 @@ void ControllerPage::connectionStatusChanged()
|
||||
ui->deviceCombo->setEnabled(false);
|
||||
ui->connectButton->setText(tr("Disconnect"));
|
||||
ui->boardTypeCombo->setEnabled(false);
|
||||
ui->manualCB->setEnabled(false);
|
||||
QString connectedDeviceName = m_connectionManager->getCurrentDevice().devName;
|
||||
for(int i = 0; i < ui->deviceCombo->count(); ++i) {
|
||||
if(connectedDeviceName == ui->deviceCombo->itemData(i, Qt::ToolTipRole).toString()) {
|
||||
@ -188,32 +184,12 @@ void ControllerPage::connectionStatusChanged()
|
||||
ui->deviceCombo->setEnabled(true);
|
||||
ui->connectButton->setText(tr("Connect"));
|
||||
ui->boardTypeCombo->setEnabled(false);
|
||||
ui->manualCB->setEnabled(true);
|
||||
ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(0, 0), QVariant(0), Qt::UserRole - 1);
|
||||
setControllerType(SetupWizard::CONTROLLER_UNKNOWN);
|
||||
}
|
||||
emit completeChanged();
|
||||
}
|
||||
|
||||
void ControllerPage::identificationModeChanged()
|
||||
{
|
||||
if(ui->manualCB->isChecked()) {
|
||||
ui->deviceCombo->setEnabled(false);
|
||||
ui->boardTypeCombo->setEnabled(true);
|
||||
ui->connectButton->setEnabled(false);
|
||||
ui->boardTypeCombo->setCurrentIndex(1);
|
||||
//ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(0, 0), QVariant(0), Qt::UserRole - 1);
|
||||
}
|
||||
else {
|
||||
ui->connectButton->setEnabled(ui->deviceCombo->count() > 0);
|
||||
ui->deviceCombo->setEnabled(!m_connectionManager->isConnected());
|
||||
//ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(0, 0), QVariant(1), Qt::UserRole - 1);
|
||||
ui->boardTypeCombo->setCurrentIndex(0);
|
||||
ui->boardTypeCombo->setEnabled(false);
|
||||
}
|
||||
emit completeChanged();
|
||||
}
|
||||
|
||||
void ControllerPage::connectDisconnect()
|
||||
{
|
||||
if(m_connectionManager->isConnected()) {
|
||||
|
@ -60,7 +60,6 @@ private:
|
||||
private slots:
|
||||
void devicesChanged(QLinkedList<Core::devListItem> devices);
|
||||
void connectionStatusChanged();
|
||||
void identificationModeChanged();
|
||||
void connectDisconnect();
|
||||
};
|
||||
|
||||
|
@ -32,9 +32,7 @@ p, li { white-space: pre-wrap; }
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">To continue we need to know what kind of OpenPilot board you want the wizard to create a configuration for. The wizard will try to automatically detect what type of board you have connected.</span></p>
|
||||
<p style="-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;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Please connect the board to a free usb port on your computer, or if a serial modem like BlueTooth, PipX or other is used, then power up the board and select the device to connect with from the list below. Then press Connect.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">If the board already is connected and succesfully detected the board type will allready be displayed. You can disconnect and select another device if you need to detect another board.</span></p>
|
||||
<p style="-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;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">If your board isnt detected or if you want to create a configuration for a board that is not connected. Then select the Manual selection option below and select the board type from the drop down menu.</span></p></body></html></string>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">If the board already is connected and succesfully detected the board type will allready be displayed. You can disconnect and select another device if you need to detect another board.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
@ -99,19 +97,6 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="manualCB">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>441</x>
|
||||
<y>33</y>
|
||||
<width>101</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manual selection</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -153,7 +138,6 @@ p, li { white-space: pre-wrap; }
|
||||
<zorder>deviceCombo</zorder>
|
||||
<zorder>connectButton</zorder>
|
||||
<zorder>boardTypeCombo</zorder>
|
||||
<zorder>manualCB</zorder>
|
||||
<zorder>label_2</zorder>
|
||||
<zorder>label_3</zorder>
|
||||
</widget>
|
||||
|
@ -28,14 +28,14 @@
|
||||
#include "flashpage.h"
|
||||
#include "ui_flashpage.h"
|
||||
#include "setupwizard.h"
|
||||
#include "vehicleconfigurationhelper.h"
|
||||
|
||||
FlashPage::FlashPage(SetupWizard *wizard, QWidget *parent) :
|
||||
AbstractWizardPage(wizard, parent),
|
||||
|
||||
ui(new Ui::FlashPage)
|
||||
ui(new Ui::FlashPage), m_successfulWrite(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->applyButton, SIGNAL(clicked()), wizard, SLOT(writeConfiguration()));
|
||||
connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(writeToController()));
|
||||
}
|
||||
|
||||
FlashPage::~FlashPage()
|
||||
@ -47,3 +47,33 @@ bool FlashPage::validatePage()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FlashPage::isComplete() const
|
||||
{
|
||||
return m_successfulWrite;
|
||||
}
|
||||
|
||||
void FlashPage::writeToController()
|
||||
{
|
||||
ui->saveButton->setEnabled(false);
|
||||
VehicleConfigurationHelper helper(getWizard());
|
||||
connect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString)));
|
||||
m_successfulWrite = helper.setupVehicle();
|
||||
disconnect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString)));
|
||||
emit completeChanged();
|
||||
ui->saveProgressLabel->setText(QString("<font color='%1'>%2</font>").arg(m_successfulWrite ? "green" : "red", ui->saveProgressLabel->text()));
|
||||
ui->saveButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void FlashPage::saveProgress(int total, int current, QString description)
|
||||
{
|
||||
if(ui->saveProgressBar->maximum() != total) {
|
||||
ui->saveProgressBar->setMaximum(total);
|
||||
}
|
||||
if(ui->saveProgressBar->value() != current) {
|
||||
ui->saveProgressBar->setValue(current);
|
||||
}
|
||||
if(ui->saveProgressLabel->text() != description) {
|
||||
ui->saveProgressLabel->setText(description);
|
||||
}
|
||||
}
|
||||
|
@ -42,9 +42,15 @@ public:
|
||||
explicit FlashPage(SetupWizard *wizard, QWidget *parent = 0);
|
||||
~FlashPage();
|
||||
bool validatePage();
|
||||
bool isComplete() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
Ui::FlashPage *ui;
|
||||
bool m_successfulWrite;
|
||||
|
||||
private slots:
|
||||
void writeToController();
|
||||
void saveProgress(int total, int current, QString description);
|
||||
};
|
||||
|
||||
#endif // FLASHPAGE_H
|
||||
|
@ -29,9 +29,11 @@ p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">OpenPilot configuration ready to save</span></p>
|
||||
<p style="-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;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">The wizard is now ready to write the configuration directly to your OpenPilot controller. This is only possible if the controller is connected and identified in the first step of this wizard. If the controller is not connected, or if the controller type was selected manually you can instead of writing the configuration to the controller save it to disk for later use.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">The wizard is now ready to write the configuration directly to your OpenPilot controller. </span></p>
|
||||
<p style="-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;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">If any of the selections made in this wizard requires a reboot of the controller then that will have to be performed after this step by power cycling the OpenPilot controller board.</span></p>
|
||||
<p style="-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;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Press next to write the configuration.</span></p>
|
||||
<p style="-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;"></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -45,9 +47,9 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>230</y>
|
||||
<width>561</width>
|
||||
<height>151</height>
|
||||
<y>250</y>
|
||||
<width>560</width>
|
||||
<height>130</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -57,22 +59,48 @@ p, li { white-space: pre-wrap; }
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Write configuration to controller or save</string>
|
||||
<string>Write configuration to controller</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<widget class="QPushButton" name="applyButton">
|
||||
<widget class="QProgressBar" name="saveProgressBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>30</y>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
<x>20</x>
|
||||
<y>90</y>
|
||||
<width>530</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="saveProgressLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>22</x>
|
||||
<y>65</y>
|
||||
<width>491</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
<string>Ready...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="saveButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>415</x>
|
||||
<y>40</y>
|
||||
<width>100</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Write...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -84,7 +84,7 @@ void LevellingPage::performLevelling()
|
||||
|
||||
void LevellingPage::levellingProgress(long current, long total)
|
||||
{
|
||||
if(!ui->levellinProgressBar->maximum() != (int)total) {
|
||||
if(ui->levellinProgressBar->maximum() != (int)total) {
|
||||
ui->levellinProgressBar->setMaximum((int)total);
|
||||
}
|
||||
if(ui->levellinProgressBar->value() != (int)current) {
|
||||
|
@ -47,8 +47,8 @@ p, li { white-space: pre-wrap; }
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>250</y>
|
||||
<width>561</width>
|
||||
<height>131</height>
|
||||
<width>560</width>
|
||||
<height>130</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -68,7 +68,7 @@ p, li { white-space: pre-wrap; }
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>90</y>
|
||||
<width>531</width>
|
||||
<width>530</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -79,9 +79,9 @@ p, li { white-space: pre-wrap; }
|
||||
<widget class="QPushButton" name="levelButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>414</x>
|
||||
<x>415</x>
|
||||
<y>40</y>
|
||||
<width>101</width>
|
||||
<width>100</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "vehicleconfigurationhelper.h"
|
||||
|
||||
SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent), VehicleConfigurationSource(),
|
||||
m_controllerSelectionMode(CONTROLLER_SELECTION_UNKNOWN), m_controllerType(CONTROLLER_UNKNOWN),
|
||||
m_controllerType(CONTROLLER_UNKNOWN),
|
||||
m_vehicleType(VEHICLE_UNKNOWN), m_inputType(INPUT_UNKNOWN), m_escType(ESC_UNKNOWN),
|
||||
m_levellingPerformed(false), m_connectionManager(0)
|
||||
{
|
||||
@ -90,13 +90,7 @@ int SetupWizard::nextId() const
|
||||
case PAGE_INPUT:
|
||||
return PAGE_VEHICLES;
|
||||
case PAGE_OUTPUT:
|
||||
{
|
||||
if(getControllerSelectionMode() == CONTROLLER_SELECTION_AUTOMATIC) {
|
||||
return PAGE_LEVELLING;
|
||||
} else {
|
||||
return PAGE_SUMMARY;
|
||||
}
|
||||
}
|
||||
return PAGE_LEVELLING;
|
||||
case PAGE_LEVELLING:
|
||||
return PAGE_SUMMARY;
|
||||
case PAGE_SUMMARY:
|
||||
@ -139,6 +133,46 @@ QString SetupWizard::getSummaryText()
|
||||
{
|
||||
case VEHICLE_MULTI:
|
||||
summary.append(tr("Multirotor"));
|
||||
|
||||
summary.append('\n');
|
||||
summary.append(tr("Vehicle sub type: "));
|
||||
switch (getVehicleSubType())
|
||||
{
|
||||
case SetupWizard::MULTI_ROTOR_TRI_Y:
|
||||
summary.append(tr("Tricopter"));
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_QUAD_X:
|
||||
summary.append(tr("Quadcopter X"));
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
|
||||
summary.append(tr("Quadcopter +"));
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_HEXA:
|
||||
summary.append(tr("Hexacopter"));
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_HEXA_COAX_Y:
|
||||
summary.append(tr("Hexacopter Coax (Y6)"));
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_HEXA_H:
|
||||
summary.append(tr("Hexacopter H"));
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_OCTO:
|
||||
summary.append(tr("Octocopter"));
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_OCTO_COAX_X:
|
||||
summary.append(tr("Octocopter Coax X"));
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_OCTO_COAX_PLUS:
|
||||
summary.append(tr("Octocopter Coax +"));
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_OCTO_V:
|
||||
summary.append(tr("Octocopter V"));
|
||||
break;
|
||||
default:
|
||||
summary.append(tr("Unknown"));
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case VEHICLE_FIXEDWING:
|
||||
summary.append(tr("Fixed wing"));
|
||||
@ -199,13 +233,6 @@ QString SetupWizard::getSummaryText()
|
||||
return summary;
|
||||
}
|
||||
|
||||
void SetupWizard::writeConfiguration()
|
||||
{
|
||||
VehicleConfigurationHelper *helper = new VehicleConfigurationHelper(this);
|
||||
Q_ASSERT(helper);
|
||||
helper->setupVehicle();
|
||||
}
|
||||
|
||||
void SetupWizard::createPages()
|
||||
{
|
||||
setPage(PAGE_START, new StartPage(this));
|
||||
|
@ -43,9 +43,6 @@ public:
|
||||
SetupWizard(QWidget *parent = 0);
|
||||
int nextId() const;
|
||||
|
||||
void setControllerSelectionMode(SetupWizard::CONTROLLER_SELECTION_MODE mode) { m_controllerSelectionMode = mode; }
|
||||
SetupWizard::CONTROLLER_SELECTION_MODE getControllerSelectionMode() const { return m_controllerSelectionMode; }
|
||||
|
||||
void setControllerType(SetupWizard::CONTROLLER_TYPE type) { m_controllerType = type; }
|
||||
SetupWizard::CONTROLLER_TYPE getControllerType() const { return m_controllerType; }
|
||||
|
||||
@ -75,8 +72,6 @@ public:
|
||||
}
|
||||
return m_connectionManager;
|
||||
}
|
||||
public slots:
|
||||
void writeConfiguration();
|
||||
|
||||
private:
|
||||
enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
|
||||
@ -84,7 +79,6 @@ private:
|
||||
PAGE_FLASH, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_END};
|
||||
void createPages();
|
||||
|
||||
CONTROLLER_SELECTION_MODE m_controllerSelectionMode;
|
||||
CONTROLLER_TYPE m_controllerType;
|
||||
VEHICLE_TYPE m_vehicleType;
|
||||
VEHICLE_SUB_TYPE m_vehicleSubType;
|
||||
|
@ -34,7 +34,9 @@
|
||||
#include "systemsettings.h"
|
||||
|
||||
VehicleConfigurationHelper::VehicleConfigurationHelper(VehicleConfigurationSource *configSource)
|
||||
: m_configSource(configSource), m_uavoManager(0)
|
||||
: m_configSource(configSource), m_uavoManager(0),
|
||||
m_transactionOK(false), m_transactionTimeout(false), m_currentTransactionObjectID(-1),
|
||||
m_progress(0)
|
||||
{
|
||||
Q_ASSERT(m_configSource);
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
@ -42,13 +44,45 @@ VehicleConfigurationHelper::VehicleConfigurationHelper(VehicleConfigurationSourc
|
||||
Q_ASSERT(m_uavoManager);
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::setupVehicle()
|
||||
bool VehicleConfigurationHelper::setupVehicle()
|
||||
{
|
||||
m_progress = 0;
|
||||
clearModifiedObjects();
|
||||
resetVehicleConfig();
|
||||
resetGUIData();
|
||||
if(!saveChangesToController())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
applyHardwareConfiguration();
|
||||
applyVehicleConfiguration();
|
||||
applyOutputConfiguration();
|
||||
applyFlighModeConfiguration();
|
||||
applyLevellingConfiguration();
|
||||
|
||||
bool result = saveChangesToController();
|
||||
if(result) {
|
||||
emit saveProgress(PROGRESS_STEPS, ++m_progress, tr("Done!"));
|
||||
}
|
||||
else {
|
||||
emit saveProgress(PROGRESS_STEPS, ++m_progress, tr("Failed!"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::addModifiedObject(UAVDataObject *object, QString description)
|
||||
{
|
||||
m_modifiedObjects << new QPair<UAVDataObject*, QString>(object, description);
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::clearModifiedObjects()
|
||||
{
|
||||
for(int i = 0; i < m_modifiedObjects.count(); i++) {
|
||||
QPair<UAVDataObject*, QString> *pair = m_modifiedObjects.at(i);
|
||||
delete pair;
|
||||
}
|
||||
m_modifiedObjects.clear();
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::applyHardwareConfiguration()
|
||||
@ -88,7 +122,8 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
hwSettings->setData(data);
|
||||
//hwSettings->setData(data);
|
||||
addModifiedObject(hwSettings, tr("Writing hardware settings"));
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::applyVehicleConfiguration()
|
||||
@ -98,9 +133,6 @@ void VehicleConfigurationHelper::applyVehicleConfiguration()
|
||||
{
|
||||
case VehicleConfigurationSource::VEHICLE_MULTI:
|
||||
{
|
||||
resetGUIData();
|
||||
resetVehicleConfig();
|
||||
|
||||
switch(m_configSource->getVehicleSubType())
|
||||
{
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_TRI_Y:
|
||||
@ -188,7 +220,8 @@ void VehicleConfigurationHelper::applyOutputConfiguration()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
actSettings->setData(data);
|
||||
//actSettings->setData(data);
|
||||
addModifiedObject(actSettings, tr("Writing output rate settings"));
|
||||
break;
|
||||
}
|
||||
case VehicleConfigurationSource::VEHICLE_FIXEDWING:
|
||||
@ -210,17 +243,179 @@ void VehicleConfigurationHelper::applyLevellingConfiguration()
|
||||
if(m_configSource->isLevellingPerformed())
|
||||
{
|
||||
accelGyroBias bias = m_configSource->getLevellingBias();
|
||||
AttitudeSettings::DataFields attitudeSettingsData = AttitudeSettings::GetInstance(m_uavoManager)->getData();
|
||||
attitudeSettingsData.AccelBias[0] += bias.m_accelerometerXBias;
|
||||
attitudeSettingsData.AccelBias[1] += bias.m_accelerometerYBias;
|
||||
attitudeSettingsData.AccelBias[2] += bias.m_accelerometerZBias;
|
||||
attitudeSettingsData.GyroBias[0] = -bias.m_gyroXBias;
|
||||
attitudeSettingsData.GyroBias[1] = -bias.m_gyroYBias;
|
||||
attitudeSettingsData.GyroBias[2] = -bias.m_gyroZBias;
|
||||
AttitudeSettings::GetInstance(m_uavoManager)->setData(attitudeSettingsData);
|
||||
AttitudeSettings* attitudeSettings = AttitudeSettings::GetInstance(m_uavoManager);
|
||||
Q_ASSERT(attitudeSettings);
|
||||
AttitudeSettings::DataFields data = attitudeSettings->getData();
|
||||
|
||||
data.AccelBias[0] += bias.m_accelerometerXBias;
|
||||
data.AccelBias[1] += bias.m_accelerometerYBias;
|
||||
data.AccelBias[2] += bias.m_accelerometerZBias;
|
||||
data.GyroBias[0] = -bias.m_gyroXBias;
|
||||
data.GyroBias[1] = -bias.m_gyroYBias;
|
||||
data.GyroBias[2] = -bias.m_gyroZBias;
|
||||
|
||||
//AttitudeSettings::GetInstance(m_uavoManager)->setData(data);
|
||||
addModifiedObject(attitudeSettings, tr("Writing levelling bias settings"));
|
||||
}
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::applyMixerConfiguration(mixerSettings mixer)
|
||||
{
|
||||
// Set all mixer data
|
||||
MixerSettings* mSettings = MixerSettings::GetInstance(m_uavoManager);
|
||||
|
||||
// Set Mixer types and values
|
||||
QString mixerTypePattern = "Mixer%1Type";
|
||||
QString mixerVectorPattern = "Mixer%1Vector";
|
||||
for(int i = 0; i < 10; i++) {
|
||||
UAVObjectField *field = mSettings->getField(mixerTypePattern.arg(i + 1));
|
||||
Q_ASSERT(field);
|
||||
field->setValue(field->getOptions().at(mixer.channels[i].type));
|
||||
|
||||
field = mSettings->getField(mixerVectorPattern.arg(i + 1));
|
||||
Q_ASSERT(field);
|
||||
field->setValue((mixer.channels[i].throttle1 * 127) / 100, 0);
|
||||
field->setValue((mixer.channels[i].throttle2 * 127) / 100, 1);
|
||||
field->setValue((mixer.channels[i].roll * 127) / 100, 2);
|
||||
field->setValue((mixer.channels[i].pitch * 127) / 100, 3);
|
||||
field->setValue((mixer.channels[i].yaw *127) / 100, 4);
|
||||
}
|
||||
|
||||
// Apply updates
|
||||
//mSettings->setData(mSettings->getData());
|
||||
addModifiedObject(mSettings, tr("Writing mixer settings"));
|
||||
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::applyMultiGUISettings(SystemSettings::AirframeTypeOptions airframe, GUIConfigDataUnion guiConfig)
|
||||
{
|
||||
SystemSettings * sSettings = SystemSettings::GetInstance(m_uavoManager);
|
||||
Q_ASSERT(sSettings);
|
||||
SystemSettings::DataFields data = sSettings->getData();
|
||||
data.AirframeType = airframe;
|
||||
|
||||
for (int i = 0; i < (int)(SystemSettings::GUICONFIGDATA_NUMELEM); i++) {
|
||||
data.GUIConfigData[i] = guiConfig.UAVObject[i];
|
||||
}
|
||||
|
||||
sSettings->setData(data);
|
||||
addModifiedObject(sSettings, tr("Writing vehicle settings"));
|
||||
}
|
||||
|
||||
bool VehicleConfigurationHelper::saveChangesToController()
|
||||
{
|
||||
qDebug() << "Saving modified objects to controller. " << m_modifiedObjects.count() << " objects in found.";
|
||||
const int OUTER_TIMEOUT = 3000 * 20; // 10 seconds timeout for saving all objects
|
||||
const int INNER_TIMEOUT = 2000; // 1 second timeout on every save attempt
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
Q_ASSERT(pm);
|
||||
UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>();
|
||||
Q_ASSERT(utilMngr);
|
||||
|
||||
QTimer outerTimeoutTimer;
|
||||
outerTimeoutTimer.setSingleShot(true);
|
||||
|
||||
QTimer innerTimeoutTimer;
|
||||
innerTimeoutTimer.setSingleShot(true);
|
||||
|
||||
connect(utilMngr, SIGNAL(saveCompleted(int ,bool)), this, SLOT(uAVOTransactionCompleted(int, bool)));
|
||||
connect(&innerTimeoutTimer, SIGNAL(timeout()), &m_eventLoop, SLOT(quit()));
|
||||
connect(&outerTimeoutTimer, SIGNAL(timeout()), this, SLOT(saveChangesTimeout()));
|
||||
|
||||
outerTimeoutTimer.start(OUTER_TIMEOUT);
|
||||
for(int i = 0; i < m_modifiedObjects.count(); i++) {
|
||||
QPair<UAVDataObject*, QString> *objPair = m_modifiedObjects.at(i);
|
||||
m_transactionOK = false;
|
||||
UAVDataObject* obj = objPair->first;
|
||||
QString objDescription = objPair->second;
|
||||
if(UAVObject::GetGcsAccess(obj->getMetadata()) != UAVObject::ACCESS_READONLY && obj->isSettings()) {
|
||||
|
||||
emit saveProgress(PROGRESS_STEPS, ++m_progress, objDescription);
|
||||
|
||||
m_currentTransactionObjectID = obj->getObjID();
|
||||
|
||||
connect(obj, SIGNAL(transactionCompleted(UAVObject* ,bool)), this, SLOT(uAVOTransactionCompleted(UAVObject*, bool)));
|
||||
while(!m_transactionOK && !m_transactionTimeout) {
|
||||
// Allow the transaction to take some time
|
||||
innerTimeoutTimer.start(INNER_TIMEOUT);
|
||||
|
||||
// Set object updated
|
||||
obj->updated();
|
||||
if(!m_transactionOK) {
|
||||
m_eventLoop.exec();
|
||||
}
|
||||
innerTimeoutTimer.stop();
|
||||
}
|
||||
disconnect(obj, SIGNAL(transactionCompleted(UAVObject* ,bool)), this, SLOT(uAVOTransactionCompleted(UAVObject*, bool)));
|
||||
if(m_transactionOK) {
|
||||
qDebug() << "Object " << obj->getName() << " was successfully updated.";
|
||||
m_transactionOK = false;
|
||||
m_currentTransactionObjectID = obj->getObjID();
|
||||
// Try to save until success or timeout
|
||||
while(!m_transactionOK && !m_transactionTimeout) {
|
||||
// Allow the transaction to take some time
|
||||
innerTimeoutTimer.start(INNER_TIMEOUT);
|
||||
|
||||
// Persist object in controller
|
||||
utilMngr->saveObjectToSD(obj);
|
||||
if(!m_transactionOK) {
|
||||
m_eventLoop.exec();
|
||||
}
|
||||
innerTimeoutTimer.stop();
|
||||
}
|
||||
m_currentTransactionObjectID = -1;
|
||||
}
|
||||
|
||||
if(!m_transactionOK) {
|
||||
qDebug() << "Transaction timed out when trying to save: " << obj->getName();
|
||||
}
|
||||
else {
|
||||
qDebug() << "Object " << obj->getName() << " was successfully saved.";
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Trying to save a UAVDataObject that is read only or is not a settings object.";
|
||||
}
|
||||
if(m_transactionTimeout) {
|
||||
qDebug() << "Transaction timed out when trying to save " << m_modifiedObjects.count() << " objects.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
outerTimeoutTimer.stop();
|
||||
disconnect(&outerTimeoutTimer, SIGNAL(timeout()), this, SLOT(saveChangesTimeout()));
|
||||
disconnect(&innerTimeoutTimer, SIGNAL(timeout()), &m_eventLoop, SLOT(quit()));
|
||||
disconnect(utilMngr, SIGNAL(saveCompleted(int, bool)), this, SLOT(uAVOTransactionCompleted(int, bool)));
|
||||
|
||||
qDebug() << "Finished saving modified objects to controller. Success = " << m_transactionOK;
|
||||
|
||||
clearModifiedObjects();
|
||||
return m_transactionOK;
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::uAVOTransactionCompleted(int oid, bool success)
|
||||
{
|
||||
if(oid == m_currentTransactionObjectID)
|
||||
{
|
||||
m_transactionOK = success;
|
||||
m_eventLoop.quit();
|
||||
}
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::uAVOTransactionCompleted(UAVObject *object, bool success)
|
||||
{
|
||||
if(object) {
|
||||
uAVOTransactionCompleted(object->getObjID(), success);
|
||||
}
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::saveChangesTimeout()
|
||||
{
|
||||
m_transactionOK = false;
|
||||
m_transactionTimeout = true;
|
||||
m_eventLoop.quit();
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::resetVehicleConfig()
|
||||
{
|
||||
@ -238,8 +433,8 @@ void VehicleConfigurationHelper::resetVehicleConfig()
|
||||
for(int i = 1; i <= 2; i++) {
|
||||
UAVObjectField *field = mSettings->getField(throttlePattern.arg(i));
|
||||
Q_ASSERT(field);
|
||||
for(int i = 0; i < field->getNumElements(); i++){
|
||||
field->setValue(i * ( 1.0f / field->getNumElements()), i);
|
||||
for(quint32 i = 0; i < field->getNumElements(); i++){
|
||||
field->setValue(i * ( 1.0f / (field->getNumElements() - 1)), i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,13 +448,14 @@ void VehicleConfigurationHelper::resetVehicleConfig()
|
||||
|
||||
field = mSettings->getField(mixerVectorPattern.arg(i));
|
||||
Q_ASSERT(field);
|
||||
for(int i = 0; i < field->getNumElements(); i++){
|
||||
for(quint32 i = 0; i < field->getNumElements(); i++){
|
||||
field->setValue(0, i);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply updates
|
||||
mSettings->setData(mSettings->getData());
|
||||
//mSettings->setData(mSettings->getData());
|
||||
addModifiedObject(mSettings, tr("Preparing mixer settings"));
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::resetGUIData()
|
||||
@ -268,11 +464,11 @@ void VehicleConfigurationHelper::resetGUIData()
|
||||
Q_ASSERT(sSettings);
|
||||
SystemSettings::DataFields data = sSettings->getData();
|
||||
data.AirframeType = SystemSettings::AIRFRAMETYPE_CUSTOM;
|
||||
for(int i = 0; i < SystemSettings::GUICONFIGDATA_NUMELEM; i++)
|
||||
{
|
||||
for(quint32 i = 0; i < SystemSettings::GUICONFIGDATA_NUMELEM; i++) {
|
||||
data.GUIConfigData[i] = 0;
|
||||
}
|
||||
sSettings->setData(data);
|
||||
//sSettings->setData(data);
|
||||
addModifiedObject(sSettings, tr("Preparing vehicle settings"));
|
||||
}
|
||||
|
||||
|
||||
@ -281,12 +477,151 @@ void VehicleConfigurationHelper::setupTriCopter()
|
||||
// Typical vehicle setup
|
||||
// 1. Setup and apply mixer
|
||||
// 2. Setup GUI data
|
||||
|
||||
mixerSettings mixer;
|
||||
mixer.channels[0].type = 0;
|
||||
mixer.channels[0].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[0].throttle1 = 100;
|
||||
mixer.channels[0].throttle2 = 0;
|
||||
mixer.channels[0].roll = 100;
|
||||
mixer.channels[0].pitch = 50;
|
||||
mixer.channels[0].yaw = 0;
|
||||
|
||||
mixer.channels[1].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[1].throttle1 = 100;
|
||||
mixer.channels[1].throttle2 = 0;
|
||||
mixer.channels[1].roll = -100;
|
||||
mixer.channels[1].pitch = 50;
|
||||
mixer.channels[1].yaw = 0;
|
||||
|
||||
mixer.channels[2].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[2].throttle1 = 100;
|
||||
mixer.channels[2].throttle2 = 0;
|
||||
mixer.channels[2].roll = 0;
|
||||
mixer.channels[2].pitch = -100;
|
||||
mixer.channels[2].yaw = 0;
|
||||
|
||||
mixer.channels[3].type = MIXER_TYPE_SERVO;
|
||||
mixer.channels[3].throttle1 = 0;
|
||||
mixer.channels[3].throttle2 = 0;
|
||||
mixer.channels[3].roll = 0;
|
||||
mixer.channels[3].pitch = 0;
|
||||
mixer.channels[3].yaw = 100;
|
||||
|
||||
applyMixerConfiguration(mixer);
|
||||
|
||||
GUIConfigDataUnion guiSettings = getGUIConfigData();
|
||||
|
||||
guiSettings.multi.VTOLMotorNW = 1;
|
||||
guiSettings.multi.VTOLMotorNE = 2;
|
||||
guiSettings.multi.VTOLMotorS = 3;
|
||||
guiSettings.multi.TRIYaw = 4;
|
||||
|
||||
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_TRI, guiSettings);
|
||||
}
|
||||
|
||||
GUIConfigDataUnion VehicleConfigurationHelper::getGUIConfigData()
|
||||
{
|
||||
GUIConfigDataUnion configData;
|
||||
|
||||
SystemSettings * systemSettings = SystemSettings::GetInstance(m_uavoManager);
|
||||
Q_ASSERT(systemSettings);
|
||||
SystemSettings::DataFields systemSettingsData = systemSettings->getData();
|
||||
|
||||
for(int i = 0; i < (int)(SystemSettings::GUICONFIGDATA_NUMELEM); i++) {
|
||||
configData.UAVObject[i] = 0; //systemSettingsData.GUIConfigData[i];
|
||||
}
|
||||
|
||||
return configData;
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::setupQuadCopter()
|
||||
{
|
||||
mixerSettings mixer;
|
||||
GUIConfigDataUnion guiSettings = getGUIConfigData();
|
||||
SystemSettings::AirframeTypeOptions frame;
|
||||
|
||||
switch(m_configSource->getVehicleSubType())
|
||||
{
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS: {
|
||||
frame = SystemSettings::AIRFRAMETYPE_QUADP;
|
||||
mixer.channels[0].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[0].throttle1 = 100;
|
||||
mixer.channels[0].throttle2 = 0;
|
||||
mixer.channels[0].roll = 0;
|
||||
mixer.channels[0].pitch = 100;
|
||||
mixer.channels[0].yaw = -50;
|
||||
|
||||
mixer.channels[1].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[1].throttle1 = 100;
|
||||
mixer.channels[1].throttle2 = 0;
|
||||
mixer.channels[1].roll = -100;
|
||||
mixer.channels[1].pitch = 0;
|
||||
mixer.channels[1].yaw = 50;
|
||||
|
||||
mixer.channels[2].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[2].throttle1 = 100;
|
||||
mixer.channels[2].throttle2 = 0;
|
||||
mixer.channels[2].roll = 0;
|
||||
mixer.channels[2].pitch = -100;
|
||||
mixer.channels[2].yaw = -50;
|
||||
|
||||
mixer.channels[3].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[3].throttle1 = 100;
|
||||
mixer.channels[3].throttle2 = 0;
|
||||
mixer.channels[3].roll = 100;
|
||||
mixer.channels[3].pitch = 0;
|
||||
mixer.channels[3].yaw = 50;
|
||||
|
||||
guiSettings.multi.VTOLMotorN = 1;
|
||||
guiSettings.multi.VTOLMotorE = 2;
|
||||
guiSettings.multi.VTOLMotorS = 3;
|
||||
guiSettings.multi.VTOLMotorW = 4;
|
||||
|
||||
break;
|
||||
}
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_X: {
|
||||
frame = SystemSettings::AIRFRAMETYPE_QUADX;
|
||||
mixer.channels[0].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[0].throttle1 = 100;
|
||||
mixer.channels[0].throttle2 = 0;
|
||||
mixer.channels[0].roll = 50;
|
||||
mixer.channels[0].pitch = 50;
|
||||
mixer.channels[0].yaw = -50;
|
||||
|
||||
mixer.channels[1].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[1].throttle1 = 100;
|
||||
mixer.channels[1].throttle2 = 0;
|
||||
mixer.channels[1].roll = -50;
|
||||
mixer.channels[1].pitch = 50;
|
||||
mixer.channels[1].yaw = 50;
|
||||
|
||||
mixer.channels[2].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[2].throttle1 = 100;
|
||||
mixer.channels[2].throttle2 = 0;
|
||||
mixer.channels[2].roll = -50;
|
||||
mixer.channels[2].pitch = -50;
|
||||
mixer.channels[2].yaw = -50;
|
||||
|
||||
mixer.channels[3].type = MIXER_TYPE_MOTOR;
|
||||
mixer.channels[3].throttle1 = 100;
|
||||
mixer.channels[3].throttle2 = 0;
|
||||
mixer.channels[3].roll = 50;
|
||||
mixer.channels[3].pitch = -50;
|
||||
mixer.channels[3].yaw = 50;
|
||||
|
||||
guiSettings.multi.VTOLMotorNW = 1;
|
||||
guiSettings.multi.VTOLMotorNE = 2;
|
||||
guiSettings.multi.VTOLMotorSW = 3;
|
||||
guiSettings.multi.VTOLMotorSE = 4;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
applyMixerConfiguration(mixer);
|
||||
applyMultiGUISettings(frame, guiSettings);
|
||||
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::setupHexaCopter()
|
||||
|
@ -28,8 +28,12 @@
|
||||
#ifndef VEHICLECONFIGURATIONHELPER_H
|
||||
#define VEHICLECONFIGURATIONHELPER_H
|
||||
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
#include "vehicleconfigurationsource.h"
|
||||
#include "uavobjectmanager.h"
|
||||
#include "systemsettings.h"
|
||||
#include "cfg_vehicletypes/vehicleconfig.h"
|
||||
|
||||
struct channelSettings {
|
||||
int type;
|
||||
@ -49,24 +53,52 @@ struct mixerSettings {
|
||||
channelSettings channels[10];
|
||||
};
|
||||
|
||||
class VehicleConfigurationHelper
|
||||
class VehicleConfigurationHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VehicleConfigurationHelper(VehicleConfigurationSource* configSource);
|
||||
void setupVehicle();
|
||||
bool setupVehicle();
|
||||
|
||||
signals:
|
||||
void saveProgress(int total, int current, QString description);
|
||||
|
||||
private:
|
||||
static const qint16 LEGACY_ESC_FREQUENCE = 50;
|
||||
static const qint16 RAPID_ESC_FREQUENCE = 400;
|
||||
|
||||
static const int MIXER_TYPE_DISABLED = 0;
|
||||
static const int MIXER_TYPE_MOTOR = 1;
|
||||
static const int MIXER_TYPE_SERVO = 2;
|
||||
|
||||
static const int PROGRESS_STEPS = 8;
|
||||
|
||||
VehicleConfigurationSource *m_configSource;
|
||||
UAVObjectManager *m_uavoManager;
|
||||
|
||||
QList<QPair<UAVDataObject*, QString>* > m_modifiedObjects;
|
||||
void addModifiedObject(UAVDataObject* object, QString description);
|
||||
void clearModifiedObjects();
|
||||
|
||||
void applyHardwareConfiguration();
|
||||
void applyVehicleConfiguration();
|
||||
void applyOutputConfiguration();
|
||||
void applyFlighModeConfiguration();
|
||||
void applyLevellingConfiguration();
|
||||
|
||||
void applyMixerConfiguration(mixerSettings mixer);
|
||||
|
||||
GUIConfigDataUnion getGUIConfigData();
|
||||
void applyMultiGUISettings(SystemSettings::AirframeTypeOptions airframe, GUIConfigDataUnion guiConfig);
|
||||
|
||||
bool saveChangesToController();
|
||||
QEventLoop m_eventLoop;
|
||||
bool m_transactionOK;
|
||||
bool m_transactionTimeout;
|
||||
int m_currentTransactionObjectID;
|
||||
int m_progress;
|
||||
|
||||
void resetVehicleConfig();
|
||||
void resetGUIData();
|
||||
|
||||
@ -75,6 +107,12 @@ private:
|
||||
void setupHexaCopter();
|
||||
void setupOctoCopter();
|
||||
|
||||
private slots:
|
||||
void uAVOTransactionCompleted(UAVObject* object, bool success);
|
||||
void uAVOTransactionCompleted(int oid, bool success);
|
||||
void saveChangesTimeout();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // VEHICLECONFIGURATIONHELPER_H
|
||||
|
@ -45,7 +45,6 @@ class VehicleConfigurationSource
|
||||
public:
|
||||
VehicleConfigurationSource();
|
||||
|
||||
enum CONTROLLER_SELECTION_MODE {CONTROLLER_SELECTION_AUTOMATIC, CONTROLLER_SELECTION_MANUAL, CONTROLLER_SELECTION_UNKNOWN};
|
||||
enum CONTROLLER_TYPE {CONTROLLER_UNKNOWN, CONTROLLER_CC, CONTROLLER_CC3D, CONTROLLER_REVO, CONTROLLER_PIPX};
|
||||
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,
|
||||
@ -55,7 +54,6 @@ public:
|
||||
enum ESC_TYPE {ESC_RAPID, ESC_LEGACY, ESC_UNKNOWN};
|
||||
enum INPUT_TYPE {INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSM, INPUT_UNKNOWN};
|
||||
|
||||
virtual VehicleConfigurationSource::CONTROLLER_SELECTION_MODE getControllerSelectionMode() const = 0;
|
||||
virtual VehicleConfigurationSource::CONTROLLER_TYPE getControllerType() const = 0;
|
||||
virtual VehicleConfigurationSource::VEHICLE_TYPE getVehicleType() const = 0;
|
||||
virtual VehicleConfigurationSource::VEHICLE_SUB_TYPE getVehicleSubType() const = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user