diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 6b44b3d6003b033884f4cfda69c48822c7668734..d6bdb29b866bca719a20fd27ab2e6ea1bc86debe 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -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_DELAY_MS 20 ///< minimum delay between sent messages #define PROTOCOL_MAX_RETRIES 5 ///< maximum number of send retries (after timeout) - +const float UASWaypointManager::defaultAltitudeHomeOffset = 30.0f; UASWaypointManager::UASWaypointManager(UAS* _uas) : uas(_uas), current_retries(0), diff --git a/src/uas/UASWaypointManager.h b/src/uas/UASWaypointManager.h index f0a5566d470fdea33f42b6c8e3b8db794c6a77aa..296f477ce0dfbb057bf480770483cce63ad77b6f 100644 --- a/src/uas/UASWaypointManager.h +++ b/src/uas/UASWaypointManager.h @@ -180,7 +180,7 @@ private: quint16 uasid; // 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 diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index 5ebe1a7582e6c9d04113fb2988f2041403b405d2..a5d266ca7c3ac45b93205983030d769b46ef8f47 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -168,6 +168,7 @@ void QGCToolBar::createUI() addLink(LinkManager::instance()->getLinks().last()); // 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(linkRemoved(LinkInterface*)), this, SLOT(removeLink(LinkInterface*))); // Update label if required if (LinkManager::instance()->getLinks().count() < 3) { diff --git a/src/ui/QGCVehicleConfig.cc b/src/ui/QGCVehicleConfig.cc index 348dab33fdc5ec2a7e7ba8c1f3ba728819f559d1..181daba3eaf0341cc327a48555867624dedd183c 100644 --- a/src/ui/QGCVehicleConfig.cc +++ b/src/ui/QGCVehicleConfig.cc @@ -52,7 +52,7 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : ui->rcCalibrationButton->setCheckable(true); 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->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions())); @@ -174,6 +174,7 @@ void QGCVehicleConfig::stopCalibrationRC() void QGCVehicleConfig::loadQgcConfig(bool primary) { + Q_UNUSED(primary); QDir autopilotdir(qApp->applicationDirPath() + "/files/" + mav->getAutopilotTypeName().toLower()); QDir generaldir = QDir(autopilotdir.absolutePath() + "/general/widgets"); QDir vehicledir = QDir(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/widgets"); @@ -321,7 +322,6 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) } } - // Load calibration //TODO: Handle this more gracefully, maybe have it scan the directory for multiple calibration entries? tool = new QGCToolWidget("", this); @@ -338,7 +338,6 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) delete tool; } - tool = new QGCToolWidget("", this); tool->addUAS(mav); if (tool->loadSettings(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/calibration/calibration.qgw", false)) @@ -352,16 +351,12 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) } else { delete tool; } + //description.txt QFile sensortipsfile(autopilotdir.absolutePath() + "/general/calibration/description.txt"); sensortipsfile.open(QIODevice::ReadOnly); ui->sensorTips->setHtml(sensortipsfile.readAll()); sensortipsfile.close(); - - - - - } void QGCVehicleConfig::loadConfig() @@ -679,10 +674,8 @@ void QGCVehicleConfig::loadConfig() } xml.readNext(); } - if (mav) - { - mav->getParamManager()->setParamInfo(paramTooltips); - } + + mav->getParamManager()->setParamInfo(paramTooltips); 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. } @@ -736,18 +729,24 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active) mav->getParamManager()->setParamInfo(paramTooltips); } - // mav->requestParameters(); - - QString defaultsDir = qApp->applicationDirPath() + "/files/" + mav->getAutopilotTypeName().toLower() + "/widgets/"; 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 //amount of time it actually takes to load the configuration windows. QTimer::singleShot(1,this,SLOT(loadConfig())); 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() { for (unsigned int i = 0; i < chanMax; ++i) @@ -1065,9 +1064,9 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete if (minTpl.exactMatch(parameterName)) { 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; - if (ok && (index >= 0) && (index < chanMax)) + if (ok && index < chanMax) { rcMin[index] = value.toInt(); } @@ -1075,8 +1074,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete if (maxTpl.exactMatch(parameterName)) { bool ok; - int index = parameterName.mid(2, 1).toInt(&ok) - 1; - if (ok && (index >= 0) && (index < chanMax)) + unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1; + if (ok && index < chanMax) { rcMax[index] = value.toInt(); } @@ -1084,8 +1083,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete if (trimTpl.exactMatch(parameterName)) { bool ok; - int index = parameterName.mid(2, 1).toInt(&ok) - 1; - if (ok && (index >= 0) && (index < chanMax)) + unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1; + if (ok && index < chanMax) { rcTrim[index] = value.toInt(); } @@ -1093,8 +1092,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete if (revTpl.exactMatch(parameterName)) { bool ok; - int index = parameterName.mid(2, 1).toInt(&ok) - 1; - if (ok && (index >= 0) && (index < chanMax)) + unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1; + if (ok && index < chanMax) { rcRev[index] = (value.toInt() == -1) ? true : false; updateInvertedCheckboxes(index); diff --git a/src/ui/QGCVehicleConfig.ui b/src/ui/QGCVehicleConfig.ui index 1ed13b206ed519eb80e5d7ad2b7db9a454e36548..9e3fccb66804c109c32a8262e2d7554c668dce25 100644 --- a/src/ui/QGCVehicleConfig.ui +++ b/src/ui/QGCVehicleConfig.ui @@ -6,52 +6,53 @@ 0 0 - 760 - 541 + 774 + 846 + + + 0 + 0 + + Form - - - 6 - - - 8 - + 6 - - - - Store to EEPROM + + + + false - - - - - - No pending changes + + + 0 + 0 + - - - - - 2 + 3 + + + 0 + 0 + + RC Calibration - + 20 - - + + 0 @@ -66,8 +67,21 @@ - - + + + + Qt::Vertical + + + + 598 + 5 + + + + + + 0 @@ -82,6 +96,19 @@ + + + + 0 + + + 100 + + + Qt::Vertical + + + @@ -102,7 +129,7 @@ - true + false @@ -128,15 +155,31 @@ - - + + + + Qt::Horizontal + + + + 22 + 122 + + + + + + Qt::Vertical + + QSizePolicy::MinimumExpanding + - 598 - 5 + 20 + 10 @@ -148,6 +191,187 @@ + + + + Qt::Vertical + + + + 598 + 17 + + + + + + + + Set Trim + + + + + + + + + + :/files/images/rc_stick.svg + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 1 + 1 + + + + + 10 + 10 + + + + + 100 + 100 + + + + + + + :/files/images/rc_stick.svg + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 0 + + + 100 + + + Qt::Vertical + + + + + + + 0 + + + 100 + + + Qt::Vertical + + + + + + + 0 + + + 100 + + + Qt::Vertical + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 0 + + + 100 + + + 0 + + + Qt::Horizontal + + + + + + + 0 + + + 100 + + + 0 + + + Qt::Horizontal + + + + + + + Start Calibration + + + @@ -246,6 +470,9 @@ + + false + Invert @@ -401,6 +628,9 @@ + + false + Invert @@ -408,6 +638,9 @@ + + false + Invert @@ -489,6 +722,9 @@ + + false + Invert @@ -496,232 +732,15 @@ - - - - Qt::Horizontal - - - - 22 - 122 - - - - - - - - Qt::Vertical - - - - 598 - 17 - - - - - - - - - - - :/files/images/rc_stick.svg - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 1 - 1 - - - - - 10 - 10 - - - - - 100 - 100 - - - - - - - :/files/images/rc_stick.svg - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 0 - - - 100 - - - 0 - - - Qt::Horizontal - - - - - - - 0 - - - 100 - - - 0 - - - Qt::Horizontal - - - - - - - Start Calibration - - - - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 20 - 10 - - - - - - - - 0 - - - 100 - - - Qt::Vertical - - - - - - - 0 - - - 100 - - - Qt::Vertical - - - - - - - 0 - - - 100 - - - Qt::Vertical - - - - - - - 0 - - - 100 - - - Qt::Vertical - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Set Trim - - - + + + 0 + 0 + + Sensor Calibration @@ -734,8 +753,8 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 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="-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:8pt;"><br /></p></body></html> +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<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-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p></body></html> @@ -751,8 +770,8 @@ p, li { white-space: pre-wrap; } 0 0 - 354 - 448 + 362 + 489 @@ -769,7 +788,13 @@ p, li { white-space: pre-wrap; } - + + + + 0 + 0 + + General Config @@ -790,10 +815,17 @@ p, li { white-space: pre-wrap; } - + + + false + + - + + + false + Load Platform Defaults @@ -804,7 +836,7 @@ p, li { white-space: pre-wrap; } - + Configuration @@ -822,8 +854,8 @@ p, li { white-space: pre-wrap; } 0 0 - 354 - 404 + 356 + 438 @@ -841,7 +873,7 @@ p, li { white-space: pre-wrap; } - + Configuration @@ -859,8 +891,8 @@ p, li { white-space: pre-wrap; } 0 0 - 354 - 404 + 356 + 438 @@ -881,7 +913,13 @@ p, li { white-space: pre-wrap; } - + + + + 0 + 0 + + Advanced Config @@ -902,10 +940,17 @@ p, li { white-space: pre-wrap; } - + + + false + + - + + + false + Load Platform Defaults @@ -916,11 +961,20 @@ p, li { white-space: pre-wrap; } - + + + + 0 + 0 + + Configuration + + QLayout::SetNoConstraint + 0 @@ -934,16 +988,26 @@ p, li { white-space: pre-wrap; } 0 0 - 354 - 404 + 356 + 438 + + + 0 + 0 + + 0 - + + + 0 + + @@ -953,7 +1017,13 @@ p, li { white-space: pre-wrap; } - + + + + 0 + 0 + + Configuration @@ -971,10 +1041,16 @@ p, li { white-space: pre-wrap; } 0 0 - 354 - 404 + 356 + 438 + + + 0 + 0 + + 0 @@ -995,6 +1071,218 @@ p, li { white-space: pre-wrap; } + + + + 0 + + + QLayout::SetDefaultConstraint + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + 0 + 0 + + + + No pending changes + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 6 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + false + + + Load parameters currently in non-permanent memory of aircraft. + + + + + + Get (UAS) + + + + + + + false + + + Set current parameters in non-permanent onboard memory. + + + + + + Set (UAS) + + + + + + + + + 6 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + false + + + Load parameters from a file on this computer in the view. To write them to the aircraft, use transmit after loading them. + + + + + + Load (File) + + + + + + + false + + + Save parameters in this view to a file on this computer. + + + + + + Save (File) + + + + + + + + + 6 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + false + + + Copy parameters from permanent memory to non-permanent current memory of aircraft. DOES NOT update the parameters in this view, click refresh after copying them to get them. + + + + + + + + + Read (ROM) + + + + + + + false + + + Copy current parameters in non-permanent memory of the aircraft to permanent memory. Transmit your parameters first to write these. + + + + + + Write (ROM) + + + + + + + diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 2286104c109062e9026de5aa045fefab91c1ffea..54416fc794bea948fe6d7e0393a88fb9791e76a8 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -130,6 +130,11 @@ WaypointList::WaypointList(QWidget *parent, UASWaypointManager* wpm) : connect(WPM, SIGNAL(waypointViewOnlyListChanged(void)), this, SLOT(waypointViewOnlyListChanged(void))); connect(WPM, SIGNAL(waypointViewOnlyChanged(int,Waypoint*)), this, SLOT(updateWaypointViewOnly(int,Waypoint*))); 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 diff --git a/src/ui/dockwidgettitlebareventfilter.cpp b/src/ui/dockwidgettitlebareventfilter.cpp index ca5951d7d6a0661a360eff4766e352cd7204207a..52519215ade4e5fb6d1fcb8927a4366fdf6f7da5 100644 --- a/src/ui/dockwidgettitlebareventfilter.cpp +++ b/src/ui/dockwidgettitlebareventfilter.cpp @@ -6,7 +6,6 @@ DockWidgetTitleBarEventFilter::DockWidgetTitleBarEventFilter(QObject *parent) : } bool DockWidgetTitleBarEventFilter::eventFilter(QObject *object,QEvent *event) { - qDebug() << event->type(); if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease) { return true; diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index e9df9cc358b46dcde0f9661e9abe5e0155f29311..d52994aae944f9219e4b70701e5ff9efa0dbc17c 100644 --- a/src/ui/map/QGCMapWidget.cc +++ b/src/ui/map/QGCMapWidget.cc @@ -212,7 +212,11 @@ void QGCMapWidget::loadSettings(bool changePosition) if (trailType == mapcontrol::UAVTrailType::ByDistance) { // XXX +#ifdef Q_OS_WIN +#pragma message ("WARNING: Settings loading for trail type not implemented") +#else #warning Settings loading for trail type not implemented +#endif } else if (trailType == mapcontrol::UAVTrailType::ByTimeElapsed) {