diff --git a/src/uas/QGCUASParamManager.cc b/src/uas/QGCUASParamManager.cc index 1a967e79d3ba239c8fa8cbbbe9521b377043e19a..38450eb81a027c11247e9485067bb49eedc5d7e7 100644 --- a/src/uas/QGCUASParamManager.cc +++ b/src/uas/QGCUASParamManager.cc @@ -56,6 +56,8 @@ void QGCUASParamManager::connectToModelAndComms() void QGCUASParamManager::clearAllPendingParams() { paramDataModel.clearAllPendingParams(); + emit parameterStatusMsgUpdated(tr("Cleared all pending params"), UASParameterCommsMgr::ParamCommsStatusLevel_OK); + } diff --git a/src/ui/QGCPX4VehicleConfig.cc b/src/ui/QGCPX4VehicleConfig.cc index 2e458ea7afefbb9de8a97a4de927a8a1a4b1c6f0..a494b1ab0c86f1d26e2909b1dfc16824a2c90486 100644 --- a/src/ui/QGCPX4VehicleConfig.cc +++ b/src/ui/QGCPX4VehicleConfig.cc @@ -16,7 +16,6 @@ #include "QGCPX4VehicleConfig.h" #include "QGC.h" -//#include "QGCPendingParamWidget.h" #include "QGCToolWidget.h" #include "UASManager.h" #include "UASParameterCommsMgr.h" @@ -130,8 +129,6 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : ui->rcCalibrationButton->setCheckable(true); connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool))); - connect(ui->writeButton, SIGNAL(clicked()), - this, SLOT(writeParameters())); //TODO connect buttons here to save/clear actions? UASInterface* tmpMav = UASManager::instance()->getActiveUAS(); @@ -516,26 +513,29 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary) } } - // Generate widgets for the Advanced tab. - foreach (QString file,vehicledir.entryList(QDir::Files | QDir::NoDotAndDotDot)) - { - if (file.toLower().endsWith(".qgw")) { - QWidget* parent = ui->advanceColumnContents; - tool = new QGCToolWidget("", parent); - if (tool->loadSettings(vehicledir.absoluteFilePath(file), false)) - { - toolWidgets.append(tool); - QGroupBox *box = new QGroupBox(parent); - box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout(box)); - box->layout()->addWidget(tool); - ui->advancedColumnLayout->addWidget(box); - } else { - delete tool; - } - } - } + //TODO fix and reintegrate the Advanced parameter editor +// // Generate widgets for the Advanced tab. +// foreach (QString file,vehicledir.entryList(QDir::Files | QDir::NoDotAndDotDot)) +// { +// if (file.toLower().endsWith(".qgw")) { +// QWidget* parent = ui->advanceColumnContents; +// tool = new QGCToolWidget("", parent); +// if (tool->loadSettings(vehicledir.absoluteFilePath(file), false)) +// { +// toolWidgets.append(tool); +// QGroupBox *box = new QGroupBox(parent); +// box->setTitle(tool->objectName()); +// box->setLayout(new QVBoxLayout(box)); +// box->layout()->addWidget(tool); +// ui->advancedColumnLayout->addWidget(box); + +// } else { +// delete tool; +// } +// } +// } + // Load tabs for general configuration foreach (QString dir,generaldir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) @@ -1023,17 +1023,6 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) { // Hide items if NULL and abort if (!active) { - ui->refreshButton->setEnabled(false); - ui->refreshButton->show(); - ui->readButton->setEnabled(false); - ui->readButton->show(); - ui->writeButton->setEnabled(false); - ui->writeButton->show(); - ui->loadFileButton->setEnabled(false); - ui->loadFileButton->show(); - ui->saveFileButton->setEnabled(false); - ui->saveFileButton->show(); - return; } @@ -1051,8 +1040,6 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) //TODO use paramCommsMgr instead disconnect(mav, SIGNAL(parameterChanged(int,int,QString,QVariant)), this, SLOT(parameterChanged(int,int,QString,QVariant))); - disconnect(ui->refreshButton,SIGNAL(clicked()), - paramMgr,SLOT(requestParameterList())); // Delete all children from all fixed tabs. foreach(QWidget* child, ui->generalLeftContents->findChildren()) { @@ -1093,6 +1080,7 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) paramMgr = mav->getParamManager(); ui->pendingCommitsWidget->setUAS(mav); + ui->paramTreeWidget->setUAS(mav); // Reset current state resetCalibrationRC(); @@ -1106,8 +1094,7 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) SLOT(remoteControlChannelRawChanged(int,float))); connect(mav, SIGNAL(parameterChanged(int,int,QString,QVariant)), this, SLOT(parameterChanged(int,int,QString,QVariant))); - connect(ui->refreshButton, SIGNAL(clicked()), - paramMgr,SLOT(requestParameterList())); + if (systemTypeToParamMap.contains(mav->getSystemTypeName())) { paramToWidgetMap = systemTypeToParamMap[mav->getSystemTypeName()]; @@ -1131,22 +1118,7 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) updateStatus(QString("Reading from system %1").arg(mav->getUASName())); // Since a system is now connected, enable the VehicleConfig UI. - ui->refreshButton->setEnabled(true); - ui->refreshButton->show(); - ui->readButton->setEnabled(true); - ui->readButton->show(); - ui->writeButton->setEnabled(true); - ui->writeButton->show(); - ui->loadFileButton->setEnabled(true); - ui->loadFileButton->show(); - ui->saveFileButton->setEnabled(true); - ui->saveFileButton->show(); - - //TODO never true? - if (mav->getAutopilotTypeName() == "ARDUPILOTMEGA") { - ui->readButton->hide(); - ui->writeButton->hide(); - } + //TODO anything? } void QGCPX4VehicleConfig::resetCalibrationRC() @@ -1222,8 +1194,13 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval) } // Raw value - int delta = abs(fval - rcMappedValue[rcToFunctionMapping[chan]]); - if (!configEnabled && !calibrationEnabled && delta < 12 && delta >= 0 && rcValue[chan] > 800 && rcValue[chan] < 2200) { + float mappedVal = rcMappedValue[rcToFunctionMapping[chan]]; + bool isMapped = (((float)UINT16_MAX) != mappedVal); + float delta = fabsf(fval - mappedVal); + if (!configEnabled && !calibrationEnabled && + (!isMapped || + (delta < 12.0f && rcValue[chan] > 800 && rcValue[chan] < 2200) ) + ) { //ignore tiny jitter values return; } @@ -1690,33 +1667,33 @@ void QGCPX4VehicleConfig::parameterChanged(int uas, int component, QString param break; } } - if (!found) { - //New param type, create a QGroupBox for it. - QWidget* parent = ui->advanceColumnContents; - - // Create the tool, attaching it to the QGroupBox - QGCToolWidget *tool = new QGCToolWidget("", parent); - QString tooltitle = parameterName; - if (parameterName.split("_").size() > 1) { - tooltitle = parameterName.split("_")[0] + "_"; - } - tool->setTitle(tooltitle); - tool->setObjectName(tooltitle); - //tool->setSettings(set); - libParamToWidgetMap.insert(parameterName,tool); - toolWidgets.append(tool); - tool->addParam(uas, component, parameterName, value); - QGroupBox *box = new QGroupBox(parent); - box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout(box)); - box->layout()->addWidget(tool); - - libParamToWidgetMap.insert(parameterName,tool); - toolWidgets.append(tool); - ui->advancedColumnLayout->addWidget(box); - - toolToBoxMap[tool] = box; - } +// if (!found) { +// //New param type, create a QGroupBox for it. +// QWidget* parent = ui->advanceColumnContents; + +// // Create the tool, attaching it to the QGroupBox +// QGCToolWidget *tool = new QGCToolWidget("", parent); +// QString tooltitle = parameterName; +// if (parameterName.split("_").size() > 1) { +// tooltitle = parameterName.split("_")[0] + "_"; +// } +// tool->setTitle(tooltitle); +// tool->setObjectName(tooltitle); +// //tool->setSettings(set); +// libParamToWidgetMap.insert(parameterName,tool); +// toolWidgets.append(tool); +// tool->addParam(uas, component, parameterName, value); +// QGroupBox *box = new QGroupBox(parent); +// box->setTitle(tool->objectName()); +// box->setLayout(new QVBoxLayout(box)); +// box->layout()->addWidget(tool); + +// libParamToWidgetMap.insert(parameterName,tool); +// toolWidgets.append(tool); +// ui->advancedColumnLayout->addWidget(box); + +// toolToBoxMap[tool] = box; +// } } } diff --git a/src/ui/QGCPX4VehicleConfig.ui b/src/ui/QGCPX4VehicleConfig.ui index ba2407e0ba0f046199187924145e8de91ac6c976..608402afc3d1e497aa9be19e3103dc89ed25047b 100644 --- a/src/ui/QGCPX4VehicleConfig.ui +++ b/src/ui/QGCPX4VehicleConfig.ui @@ -7,7 +7,7 @@ 0 0 1256 - 889 + 912 @@ -43,7 +43,7 @@ 0 0 133 - 863 + 886 @@ -154,7 +154,7 @@ Config - 1 + 5 @@ -932,8 +932,8 @@ Config 0 0 - 98 - 28 + 39 + 26 @@ -1020,8 +1020,8 @@ Config 0 0 - 98 - 28 + 16 + 16 @@ -1057,8 +1057,8 @@ Config 0 0 - 98 - 28 + 16 + 16 @@ -1149,8 +1149,8 @@ Config 0 0 - 98 - 28 + 597 + 740 @@ -1158,90 +1158,20 @@ Config 0 - + + + + + true + + + + - - - - - - false - - - Load parameters currently in non-permanent memory of aircraft. - - - - - - Refresh - - - - - - - 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 - - - - - - - Load File - - - - - - - false - - - Save parameters in this view to a file on this computer. - - - - - - Save to File - - - - - @@ -1275,34 +1205,28 @@ Config Changes Pending - - - - 10 - 30 - 381 - 601 - - - - - 0 - - - - - - 0 - 30 - - - - true - - - - - + + + + + -1 + + + + + + 0 + 0 + + + + true + + + + + + @@ -1354,6 +1278,12 @@ Config
QGCMessageView.h
1 + + QGCParamWidget + QWidget +
ui/QGCParamWidget.h
+ 1 +
diff --git a/src/ui/QGCPendingParamWidget.cc b/src/ui/QGCPendingParamWidget.cc index 35402d995e3220617509004ce7f46466bee2866c..aaafc42192cc32157000a9a12b6112a711c14eaa 100644 --- a/src/ui/QGCPendingParamWidget.cc +++ b/src/ui/QGCPendingParamWidget.cc @@ -10,6 +10,8 @@ QGCPendingParamWidget::QGCPendingParamWidget(QObject *parent) : QGCParamWidget((QWidget*)parent) { + //this subclass doesn't display status updates + statusLabel->hide(); } @@ -20,10 +22,6 @@ void QGCPendingParamWidget::connectToParamManager() // Listen to updated param signals from the data model connect(paramMgr, SIGNAL(pendingParamUpdate(int , const QString&, QVariant , bool )), this, SLOT(handlePendingParamUpdate(int , const QString& , QVariant, bool ))); - - // Listen to communications status messages so we can display them - connect(paramMgr, SIGNAL(parameterStatusMsgUpdated(QString,int)), - this, SLOT(handleParamStatusMsgUpdate(QString , int ))); } @@ -33,10 +31,6 @@ void QGCPendingParamWidget::disconnectFromParamManager() disconnect(paramMgr, SIGNAL(pendingParamUpdate(int , const QString&, QVariant , bool )), this, SLOT(handlePendingParamUpdate(int , const QString& , QVariant, bool ))); - // Listen to communications status messages so we can display them - disconnect(paramMgr, SIGNAL(parameterStatusMsgUpdated(QString,int)), - this, SLOT(handleParamStatusMsgUpdate(QString , int ))); - paramMgr = NULL; }