1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Merge remote-tracking branch 'origin/rel-12.10.2' into next

This commit is contained in:
Oleg Semyonov 2012-11-19 01:52:15 +02:00
commit a2a12cd34c
14 changed files with 86 additions and 67 deletions

View File

@ -8,3 +8,4 @@
+ XAircraft ESCs uses non-standard PPM range which may cause issues with Vehicle Wizard.
+ Spectrum Satellite Receivers setup in Radio Wizard may have wrong protocol set.
+ Old Intel 965 have an OpenGL bug that turns the QML PFD black and while.
+ [OP-691] Helicopter configuration change still resets camera/accessory mixers (some code refactoring is desired).

26
OPLicenseTemplate.txt Normal file
View File

@ -0,0 +1,26 @@
/**
******************************************************************************
*
* @file %FILENAME%
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup [Group]
* @{
* @addtogroup %CLASS%
* @{
* @brief [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
*/

View File

@ -281,6 +281,7 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType)
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);
// ... and compute the matrix:
// In order to make code a bit nicer, we assume:
@ -288,16 +289,8 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType)
// 1. Assign the servo/motor/none for each channel
int channel;
//disable all
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
//motor
channel = m_aircraft->fwEngineChannelBox->currentIndex()-1;
int channel = m_aircraft->fwEngineChannelBox->currentIndex()-1;
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_MOTOR);
setMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
@ -359,6 +352,7 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);
// Save the curve:
// ... and compute the matrix:
@ -367,17 +361,10 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
// 1. Assign the servo/motor/none for each channel
int channel;
double value;
//disable all
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
//motor
channel = m_aircraft->fwEngineChannelBox->currentIndex()-1;
int channel = m_aircraft->fwEngineChannelBox->currentIndex()-1;
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_MOTOR);
setMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
@ -437,6 +424,7 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);
// Save the curve:
// ... and compute the matrix:
@ -445,17 +433,10 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
// 1. Assign the servo/motor/none for each channel
int channel;
double value;
//disable all
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
//motor
channel = m_aircraft->fwEngineChannelBox->currentIndex()-1;
int channel = m_aircraft->fwEngineChannelBox->currentIndex()-1;
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_MOTOR);
setMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);

View File

@ -295,16 +295,10 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleMotorcycle(QString airframeTyp
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
int channel;
//disable all
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++) {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
resetMotorAndServoMixers(mixer);
//motor
channel = m_aircraft->gvMotor2ChannelBox->currentIndex()-1;
int channel = m_aircraft->gvMotor2ChannelBox->currentIndex()-1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, 127);
@ -352,16 +346,10 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleDifferential(QString airframeT
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
int channel;
//disable all
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++) {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
resetMotorAndServoMixers(mixer);
//left motor
channel = m_aircraft->gvMotor1ChannelBox->currentIndex()-1;
int channel = m_aircraft->gvMotor1ChannelBox->currentIndex()-1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, 127);
@ -407,15 +395,9 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleCar(QString airframeType)
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer);
int channel;
//disable all
for (channel=0; (unsigned int) channel < VehicleConfig::CHANNEL_NUMELEM; channel++) {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
channel = m_aircraft->gvSteering1ChannelBox->currentIndex()-1;
int channel = m_aircraft->gvSteering1ChannelBox->currentIndex()-1;
setMixerType(mixer,channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, 127);

View File

@ -1032,13 +1032,7 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
//disable all
for (int channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
resetMotorAndServoMixers(mixer);
// and enable only the relevant channels:
double pFactor = (double)m_aircraft->mrPitchMixLevel->value()/100;

View File

@ -181,6 +181,18 @@ void VehicleConfig::resetMixerVector(UAVDataObject* mixer, int channel)
}
}
// Disable all servo/motor mixers (but keep camera and accessory ones)
void VehicleConfig::resetMotorAndServoMixers(UAVDataObject *mixer)
{
for (int channel = 0; channel < (int)VehicleConfig::CHANNEL_NUMELEM; channel++) {
QString type = getMixerType(mixer, channel);
if ((type == "Disabled") || (type == "Motor") || (type == "Servo")) {
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
}
}
double VehicleConfig::getMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName)
{
Q_ASSERT(mixer);

View File

@ -127,6 +127,7 @@ class VehicleConfig: public ConfigTaskWidget
double getMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName);
void setMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName, double value);
void resetMixerVector(UAVDataObject* mixer, int channel);
void resetMotorAndServoMixers(UAVDataObject* mixer);
QString getMixerType(UAVDataObject* mixer, int channel);
void setMixerType(UAVDataObject* mixer, int channel, MixerTypeElem mixerType);
double getMixerValue(UAVDataObject* mixer, QString elementName);

View File

@ -1368,7 +1368,8 @@ channel value for each flight mode.</string>
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>After the time indicated here, the frame go back to disarmed state.</string>
<string>After the time indicated here, the frame go back to disarmed state.
Set to 0 to disable (recommended for soaring fixed wings).</string>
</property>
<property name="maximum">
<number>64</number>
@ -1378,7 +1379,7 @@ channel value for each flight mode.</string>
<item>
<widget class="QLabel" name="label_19">
<property name="text">
<string>seconds.</string>
<string>seconds (0 to disable).</string>
</property>
</widget>
</item>

View File

@ -8,13 +8,14 @@
AutoUpdatePage::AutoUpdatePage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::AutoUpdatePage),m_wiz(wizard)
ui(new Ui::AutoUpdatePage)
{
ui->setupUi(this);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Q_ASSERT(pm);
UploaderGadgetFactory *uploader = pm->getObject<UploaderGadgetFactory>();
Q_ASSERT(uploader);
connect(ui->startUpdate,SIGNAL(clicked()), this, SLOT(disableButtons()));
connect(ui->startUpdate,SIGNAL(clicked()),uploader,SIGNAL(autoUpdate()));
connect(uploader,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant)),this,SLOT(updateStatus(uploader::AutoUpdateStep,QVariant)));
}
@ -24,18 +25,30 @@ AutoUpdatePage::~AutoUpdatePage()
delete ui;
}
void AutoUpdatePage::enableButtons(bool enable = false)
{
ui->startUpdate->setEnabled(enable);
getWizard()->button(QWizard::NextButton)->setEnabled(enable);
getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
getWizard()->button(QWizard::BackButton)->setEnabled(enable);
getWizard()->button(QWizard::CustomButton1)->setEnabled(enable);
QApplication::processEvents();
}
void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant value)
{
switch(status)
{
case uploader::WAITING_DISCONNECT:
m_wiz->setWindowFlags(m_wiz->windowFlags() & ~Qt::WindowStaysOnTopHint);
getWizard()->setWindowFlags(getWizard()->windowFlags() & ~Qt::WindowStaysOnTopHint);
disableButtons();
ui->statusLabel->setText("Waiting for all OP boards to be disconnected");
break;
case uploader::WAITING_CONNECT:
m_wiz->setWindowFlags(m_wiz->windowFlags() | Qt::WindowStaysOnTopHint);
m_wiz->setWindowIcon(qApp->windowIcon());
m_wiz->show();
getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
getWizard()->setWindowIcon(qApp->windowIcon());
disableButtons();
getWizard()->show();
ui->statusLabel->setText("Please connect the board to the USB port (don't use external supply)");
ui->levellinProgressBar->setValue(value.toInt());
break;
@ -57,12 +70,14 @@ void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant valu
ui->statusLabel->setText("Booting the board");
break;
case uploader::SUCCESS:
enableButtons(true);
ui->statusLabel->setText("Board Updated, please press the 'next' button below");
break;
case uploader::FAILURE:
m_wiz->setWindowFlags(m_wiz->windowFlags() | Qt::WindowStaysOnTopHint);
m_wiz->setWindowIcon(qApp->windowIcon());
m_wiz->show();
getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
getWizard()->setWindowIcon(qApp->windowIcon());
enableButtons(true);
getWizard()->show();
ui->statusLabel->setText("Something went wrong, you will have to manualy upgrade the board using the uploader plugin");
break;
}

View File

@ -49,10 +49,12 @@ public:
private slots:
void updateStatus(uploader::AutoUpdateStep ,QVariant);
void disableButtons(){ enableButtons(false); }
void enableButtons(bool enable);
private:
Ui::AutoUpdatePage *ui;
SetupWizard * m_wiz;
};
#endif // AUTOUPDATEPAGE_H

View File

@ -64,6 +64,7 @@ void LevellingPage::enableButtons(bool enable)
getWizard()->button(QWizard::NextButton)->setEnabled(enable);
getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
getWizard()->button(QWizard::BackButton)->setEnabled(enable);
getWizard()->button(QWizard::CustomButton1)->setEnabled(enable);
QApplication::processEvents();
}

View File

@ -85,6 +85,7 @@ void SavePage::enableButtons(bool enable)
getWizard()->button(QWizard::NextButton)->setEnabled(enable);
getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
getWizard()->button(QWizard::BackButton)->setEnabled(enable);
getWizard()->button(QWizard::CustomButton1)->setEnabled(enable);
QApplication::processEvents();
}

View File

@ -132,6 +132,7 @@ void UAVObjectBrowserWidget::useScientificNotation(bool scientific)
void UAVObjectBrowserWidget::sendUpdate()
{
this->setFocus();
ObjectTreeItem *objItem = findCurrentObjectTreeItem();
Q_ASSERT(objItem);
objItem->apply();
@ -165,6 +166,7 @@ ObjectTreeItem *UAVObjectBrowserWidget::findCurrentObjectTreeItem()
void UAVObjectBrowserWidget::saveObject()
{
this->setFocus();
// Send update so that the latest value is saved
sendUpdate();
// Save object

Binary file not shown.