Commit 51c45920 authored by Lorenz Meier's avatar Lorenz Meier

Merge branch 'master' of github.com:mavlink/qgroundcontrol

parents 233a1716 89696feb
...@@ -38,7 +38,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -38,7 +38,7 @@ This file is part of the QGROUNDCONTROL project
#define PROTOCOL_TIMEOUT_MS 2000 ///< maximum time to wait for pending messages until timeout #define PROTOCOL_TIMEOUT_MS 2000 ///< maximum time to wait for pending messages until timeout
#define PROTOCOL_DELAY_MS 20 ///< minimum delay between sent messages #define PROTOCOL_DELAY_MS 20 ///< minimum delay between sent messages
#define PROTOCOL_MAX_RETRIES 5 ///< maximum number of send retries (after timeout) #define PROTOCOL_MAX_RETRIES 5 ///< maximum number of send retries (after timeout)
const float UASWaypointManager::defaultAltitudeHomeOffset = 30.0f;
UASWaypointManager::UASWaypointManager(UAS* _uas) UASWaypointManager::UASWaypointManager(UAS* _uas)
: uas(_uas), : uas(_uas),
current_retries(0), current_retries(0),
......
...@@ -180,7 +180,7 @@ private: ...@@ -180,7 +180,7 @@ private:
quint16 uasid; quint16 uasid;
// XXX export to settings // XXX export to settings
static const float defaultAltitudeHomeOffset = 30.0f; ///< Altitude offset in meters from home for new waypoints static const float defaultAltitudeHomeOffset; ///< Altitude offset in meters from home for new waypoints
}; };
#endif // UASWAYPOINTMANAGER_H #endif // UASWAYPOINTMANAGER_H
...@@ -177,6 +177,7 @@ void QGCToolBar::createUI() ...@@ -177,6 +177,7 @@ void QGCToolBar::createUI()
addLink(LinkManager::instance()->getLinks().last()); addLink(LinkManager::instance()->getLinks().last());
// XXX implies that connect button is always active for the last used link // XXX implies that connect button is always active for the last used link
connect(LinkManager::instance(), SIGNAL(newLink(LinkInterface*)), this, SLOT(addLink(LinkInterface*))); connect(LinkManager::instance(), SIGNAL(newLink(LinkInterface*)), this, SLOT(addLink(LinkInterface*)));
connect(LinkManager::instance(), SIGNAL(linkRemoved(LinkInterface*)), this, SLOT(removeLink(LinkInterface*)));
// Update label if required // Update label if required
if (LinkManager::instance()->getLinks().count() < 3) { if (LinkManager::instance()->getLinks().count() < 3) {
......
...@@ -52,7 +52,7 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : ...@@ -52,7 +52,7 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) :
ui->rcCalibrationButton->setCheckable(true); ui->rcCalibrationButton->setCheckable(true);
connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool))); connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool)));
connect(ui->storeButton, SIGNAL(clicked()), this, SLOT(writeParameters())); connect(ui->setButton, SIGNAL(clicked()), this, SLOT(writeParameters()));
connect(ui->rcModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setRCModeIndex(int))); connect(ui->rcModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setRCModeIndex(int)));
connect(ui->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions())); connect(ui->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions()));
...@@ -174,6 +174,7 @@ void QGCVehicleConfig::stopCalibrationRC() ...@@ -174,6 +174,7 @@ void QGCVehicleConfig::stopCalibrationRC()
void QGCVehicleConfig::loadQgcConfig(bool primary) void QGCVehicleConfig::loadQgcConfig(bool primary)
{ {
Q_UNUSED(primary);
QDir autopilotdir(qApp->applicationDirPath() + "/files/" + mav->getAutopilotTypeName().toLower()); QDir autopilotdir(qApp->applicationDirPath() + "/files/" + mav->getAutopilotTypeName().toLower());
QDir generaldir = QDir(autopilotdir.absolutePath() + "/general/widgets"); QDir generaldir = QDir(autopilotdir.absolutePath() + "/general/widgets");
QDir vehicledir = QDir(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/widgets"); QDir vehicledir = QDir(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/widgets");
...@@ -321,7 +322,6 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) ...@@ -321,7 +322,6 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
} }
} }
// Load calibration // Load calibration
//TODO: Handle this more gracefully, maybe have it scan the directory for multiple calibration entries? //TODO: Handle this more gracefully, maybe have it scan the directory for multiple calibration entries?
tool = new QGCToolWidget("", this); tool = new QGCToolWidget("", this);
...@@ -338,7 +338,6 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) ...@@ -338,7 +338,6 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
delete tool; delete tool;
} }
tool = new QGCToolWidget("", this); tool = new QGCToolWidget("", this);
tool->addUAS(mav); tool->addUAS(mav);
if (tool->loadSettings(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/calibration/calibration.qgw", false)) if (tool->loadSettings(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/calibration/calibration.qgw", false))
...@@ -352,16 +351,12 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) ...@@ -352,16 +351,12 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
} else { } else {
delete tool; delete tool;
} }
//description.txt //description.txt
QFile sensortipsfile(autopilotdir.absolutePath() + "/general/calibration/description.txt"); QFile sensortipsfile(autopilotdir.absolutePath() + "/general/calibration/description.txt");
sensortipsfile.open(QIODevice::ReadOnly); sensortipsfile.open(QIODevice::ReadOnly);
ui->sensorTips->setHtml(sensortipsfile.readAll()); ui->sensorTips->setHtml(sensortipsfile.readAll());
sensortipsfile.close(); sensortipsfile.close();
} }
void QGCVehicleConfig::loadConfig() void QGCVehicleConfig::loadConfig()
...@@ -679,10 +674,8 @@ void QGCVehicleConfig::loadConfig() ...@@ -679,10 +674,8 @@ void QGCVehicleConfig::loadConfig()
} }
xml.readNext(); xml.readNext();
} }
if (mav)
{ mav->getParamManager()->setParamInfo(paramTooltips);
mav->getParamManager()->setParamInfo(paramTooltips);
}
doneLoadingConfig = true; doneLoadingConfig = true;
mav->requestParameters(); //Config is finished, lets do a parameter request to ensure none are missed if someone else started requesting before we were finished. mav->requestParameters(); //Config is finished, lets do a parameter request to ensure none are missed if someone else started requesting before we were finished.
} }
...@@ -736,18 +729,24 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active) ...@@ -736,18 +729,24 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
mav->getParamManager()->setParamInfo(paramTooltips); mav->getParamManager()->setParamInfo(paramTooltips);
} }
// mav->requestParameters();
QString defaultsDir = qApp->applicationDirPath() + "/files/" + mav->getAutopilotTypeName().toLower() + "/widgets/";
qDebug() << "CALIBRATION!! System Type Name:" << mav->getSystemTypeName(); qDebug() << "CALIBRATION!! System Type Name:" << mav->getSystemTypeName();
//Load configuration after 1ms. This allows it to go into the event loop, and prevents application hangups due to the //Load configuration after 1ms. This allows it to go into the event loop, and prevents application hangups due to the
//amount of time it actually takes to load the configuration windows. //amount of time it actually takes to load the configuration windows.
QTimer::singleShot(1,this,SLOT(loadConfig())); QTimer::singleShot(1,this,SLOT(loadConfig()));
updateStatus(QString("Reading from system %1").arg(mav->getUASName())); updateStatus(QString("Reading from system %1").arg(mav->getUASName()));
// Since a system is now connected, enable the VehicleConfig UI.
ui->tabWidget->setEnabled(true);
ui->setButton->setEnabled(true);
ui->refreshButton->setEnabled(true);
ui->readButton->setEnabled(true);
ui->writeButton->setEnabled(true);
ui->loadFileButton->setEnabled(true);
ui->saveFileButton->setEnabled(true);
} }
void QGCVehicleConfig::resetCalibrationRC() void QGCVehicleConfig::resetCalibrationRC()
{ {
for (unsigned int i = 0; i < chanMax; ++i) for (unsigned int i = 0; i < chanMax; ++i)
...@@ -1065,9 +1064,9 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete ...@@ -1065,9 +1064,9 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (minTpl.exactMatch(parameterName)) { if (minTpl.exactMatch(parameterName)) {
bool ok; bool ok;
int index = parameterName.mid(2, 1).toInt(&ok) - 1; unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
//qDebug() << "PARAM:" << parameterName << "index:" << index; //qDebug() << "PARAM:" << parameterName << "index:" << index;
if (ok && (index >= 0) && (index < chanMax)) if (ok && index < chanMax)
{ {
rcMin[index] = value.toInt(); rcMin[index] = value.toInt();
} }
...@@ -1075,8 +1074,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete ...@@ -1075,8 +1074,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (maxTpl.exactMatch(parameterName)) { if (maxTpl.exactMatch(parameterName)) {
bool ok; bool ok;
int index = parameterName.mid(2, 1).toInt(&ok) - 1; unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && (index >= 0) && (index < chanMax)) if (ok && index < chanMax)
{ {
rcMax[index] = value.toInt(); rcMax[index] = value.toInt();
} }
...@@ -1084,8 +1083,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete ...@@ -1084,8 +1083,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (trimTpl.exactMatch(parameterName)) { if (trimTpl.exactMatch(parameterName)) {
bool ok; bool ok;
int index = parameterName.mid(2, 1).toInt(&ok) - 1; unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && (index >= 0) && (index < chanMax)) if (ok && index < chanMax)
{ {
rcTrim[index] = value.toInt(); rcTrim[index] = value.toInt();
} }
...@@ -1093,8 +1092,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete ...@@ -1093,8 +1092,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (revTpl.exactMatch(parameterName)) { if (revTpl.exactMatch(parameterName)) {
bool ok; bool ok;
int index = parameterName.mid(2, 1).toInt(&ok) - 1; unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && (index >= 0) && (index < chanMax)) if (ok && index < chanMax)
{ {
rcRev[index] = (value.toInt() == -1) ? true : false; rcRev[index] = (value.toInt() == -1) ? true : false;
updateInvertedCheckboxes(index); updateInvertedCheckboxes(index);
......
This diff is collapsed.
...@@ -122,6 +122,11 @@ WaypointList::WaypointList(QWidget *parent, UASWaypointManager* wpm) : ...@@ -122,6 +122,11 @@ WaypointList::WaypointList(QWidget *parent, UASWaypointManager* wpm) :
connect(WPM, SIGNAL(waypointViewOnlyListChanged(void)), this, SLOT(waypointViewOnlyListChanged(void))); connect(WPM, SIGNAL(waypointViewOnlyListChanged(void)), this, SLOT(waypointViewOnlyListChanged(void)));
connect(WPM, SIGNAL(waypointViewOnlyChanged(int,Waypoint*)), this, SLOT(updateWaypointViewOnly(int,Waypoint*))); connect(WPM, SIGNAL(waypointViewOnlyChanged(int,Waypoint*)), this, SLOT(updateWaypointViewOnly(int,Waypoint*)));
connect(WPM, SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointViewOnlyChanged(quint16))); connect(WPM, SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointViewOnlyChanged(quint16)));
//Even if there are no waypoints, since this is a new instance and there is an
//existing WPM, then we need to assume things have changed, and act appropriatly.
waypointEditableListChanged();
waypointViewOnlyListChanged();
} }
// STATUS LABEL // STATUS LABEL
......
...@@ -263,11 +263,7 @@ void QGCParamSlider::endEditMode() ...@@ -263,11 +263,7 @@ void QGCParamSlider::endEditMode()
switch (parameterValue.type()) switch (parameterValue.type())
{ {
case QVariant::Char: case QVariant::Char:
ui->intValueSpinBox->show();
break;
case QVariant::Int: case QVariant::Int:
ui->intValueSpinBox->show();
break;
case QVariant::UInt: case QVariant::UInt:
ui->intValueSpinBox->show(); ui->intValueSpinBox->show();
break; break;
...@@ -381,14 +377,6 @@ void QGCParamSlider::setParameterValue(int uas, int component, int paramCount, i ...@@ -381,14 +377,6 @@ void QGCParamSlider::setParameterValue(int uas, int component, int paramCount, i
ui->editSelectParamComboBox->addItem(parameterName, paramIndex); ui->editSelectParamComboBox->addItem(parameterName, paramIndex);
} }
if (this->parameterName == "RC5_MIN")
{
int stopper = 1;
}
if (parameterName == "RC5_MIN")
{
int stpoper = 1;
}
if (visibleParam != "") if (visibleParam != "")
{ {
if (parameterName == visibleParam) if (parameterName == visibleParam)
...@@ -427,51 +415,51 @@ void QGCParamSlider::setParameterValue(int uas, int component, int paramCount, i ...@@ -427,51 +415,51 @@ void QGCParamSlider::setParameterValue(int uas, int component, int paramCount, i
ui->intValueSpinBox->setEnabled(true); ui->intValueSpinBox->setEnabled(true);
ui->doubleValueSpinBox->hide(); ui->doubleValueSpinBox->hide();
ui->intValueSpinBox->setValue(value.toUInt()); ui->intValueSpinBox->setValue(value.toUInt());
ui->intValueSpinBox->setMinimum(-ui->intValueSpinBox->maximum()); ui->intValueSpinBox->setRange(0, UINT8_MAX);
ui->valueSlider->setValue(floatToScaledInt(value.toUInt()));
if (parameterMax == 0 && parameterMin == 0) if (parameterMax == 0 && parameterMin == 0)
{ {
ui->editMaxSpinBox->setValue(255); ui->editMaxSpinBox->setValue(UINT8_MAX);
ui->editMinSpinBox->setValue(0); ui->editMinSpinBox->setValue(0);
} }
ui->valueSlider->setValue(floatToScaledInt(value.toUInt()));
break; break;
case QVariant::Int: case QVariant::Int:
ui->intValueSpinBox->show(); ui->intValueSpinBox->show();
ui->intValueSpinBox->setEnabled(true); ui->intValueSpinBox->setEnabled(true);
ui->doubleValueSpinBox->hide(); ui->doubleValueSpinBox->hide();
ui->intValueSpinBox->setValue(value.toInt()); ui->intValueSpinBox->setValue(value.toInt());
ui->valueSlider->setValue(floatToScaledInt(value.toInt())); ui->intValueSpinBox->setRange(INT32_MIN, INT32_MAX);
ui->intValueSpinBox->setMinimum(-ui->intValueSpinBox->maximum());
if (parameterMax == 0 && parameterMin == 0) if (parameterMax == 0 && parameterMin == 0)
{ {
ui->editMaxSpinBox->setValue(65535); ui->editMaxSpinBox->setValue(INT32_MAX);
ui->editMinSpinBox->setValue(0); ui->editMinSpinBox->setValue(INT32_MIN);
} }
ui->valueSlider->setValue(floatToScaledInt(value.toInt()));
break; break;
case QVariant::UInt: case QVariant::UInt:
ui->intValueSpinBox->show(); ui->intValueSpinBox->show();
ui->intValueSpinBox->setEnabled(true); ui->intValueSpinBox->setEnabled(true);
ui->doubleValueSpinBox->hide(); ui->doubleValueSpinBox->hide();
ui->intValueSpinBox->setValue(value.toUInt()); ui->intValueSpinBox->setValue(value.toUInt());
ui->valueSlider->setValue(floatToScaledInt(value.toUInt())); ui->intValueSpinBox->setRange(0, UINT32_MAX);
ui->intValueSpinBox->setMinimum(0);
if (parameterMax == 0 && parameterMin == 0) if (parameterMax == 0 && parameterMin == 0)
{ {
ui->editMaxSpinBox->setValue(65535); ui->editMaxSpinBox->setValue(UINT32_MAX);
ui->editMinSpinBox->setValue(0); ui->editMinSpinBox->setValue(0);
} }
ui->valueSlider->setValue(floatToScaledInt(value.toUInt()));
break; break;
case QMetaType::Float: case QMetaType::Float:
ui->doubleValueSpinBox->setValue(value.toFloat()); ui->doubleValueSpinBox->setValue(value.toFloat());
ui->doubleValueSpinBox->show(); ui->doubleValueSpinBox->show();
ui->doubleValueSpinBox->setEnabled(true); ui->doubleValueSpinBox->setEnabled(true);
ui->intValueSpinBox->hide(); ui->intValueSpinBox->hide();
ui->valueSlider->setValue(floatToScaledInt(value.toFloat()));
if (parameterMax == 0 && parameterMin == 0) if (parameterMax == 0 && parameterMin == 0)
{ {
ui->editMaxSpinBox->setValue(10000); ui->editMaxSpinBox->setValue(10000);
ui->editMinSpinBox->setValue(0); ui->editMinSpinBox->setValue(0);
} }
ui->valueSlider->setValue(floatToScaledInt(value.toFloat()));
break; break;
default: default:
qCritical() << "ERROR: NO VALID PARAM TYPE"; qCritical() << "ERROR: NO VALID PARAM TYPE";
......
...@@ -6,7 +6,6 @@ DockWidgetTitleBarEventFilter::DockWidgetTitleBarEventFilter(QObject *parent) : ...@@ -6,7 +6,6 @@ DockWidgetTitleBarEventFilter::DockWidgetTitleBarEventFilter(QObject *parent) :
} }
bool DockWidgetTitleBarEventFilter::eventFilter(QObject *object,QEvent *event) bool DockWidgetTitleBarEventFilter::eventFilter(QObject *object,QEvent *event)
{ {
qDebug() << event->type();
if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease) if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
{ {
return true; return true;
......
...@@ -212,7 +212,11 @@ void QGCMapWidget::loadSettings(bool changePosition) ...@@ -212,7 +212,11 @@ void QGCMapWidget::loadSettings(bool changePosition)
if (trailType == mapcontrol::UAVTrailType::ByDistance) if (trailType == mapcontrol::UAVTrailType::ByDistance)
{ {
// XXX // XXX
#ifdef Q_OS_WIN
#pragma message ("WARNING: Settings loading for trail type not implemented")
#else
#warning Settings loading for trail type not implemented #warning Settings loading for trail type not implemented
#endif
} }
else if (trailType == mapcontrol::UAVTrailType::ByTimeElapsed) else if (trailType == mapcontrol::UAVTrailType::ByTimeElapsed)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment