Commit 92843a3d authored by tstellanova's avatar tstellanova

ignore duplicate request param list

parent ead568d8
...@@ -1999,7 +1999,7 @@ void UAS::sendMessage(mavlink_message_t message) ...@@ -1999,7 +1999,7 @@ void UAS::sendMessage(mavlink_message_t message)
if (LinkManager::instance()->getLinks().contains(link)) if (LinkManager::instance()->getLinks().contains(link))
{ {
sendMessage(link, message); sendMessage(link, message);
qDebug() << "SENT MESSAGE id" << message.msgid; qDebug() << "SENT MESSAGE id" << message.msgid << "component" << message.compid;
} }
else else
{ {
......
...@@ -70,6 +70,7 @@ void UASParameterCommsMgr::requestParameterList() ...@@ -70,6 +70,7 @@ void UASParameterCommsMgr::requestParameterList()
//TODO check: no need to cause datamodel to forget params here? //TODO check: no need to cause datamodel to forget params here?
// paramDataModel->forgetAllOnboardParameters(); // paramDataModel->forgetAllOnboardParameters();
if (!transmissionListMode) {
// Clear transmission state // Clear transmission state
receivedParamsList.clear(); receivedParamsList.clear();
transmissionListSizeKnown.clear(); transmissionListSizeKnown.clear();
...@@ -82,6 +83,10 @@ void UASParameterCommsMgr::requestParameterList() ...@@ -82,6 +83,10 @@ void UASParameterCommsMgr::requestParameterList()
setParameterStatusMsg(tr("Requested param list.. waiting")); setParameterStatusMsg(tr("Requested param list.. waiting"));
mav->requestParameters(); mav->requestParameters();
}
else {
qDebug() << __FILE__ << __LINE__ << "Ignoring requestParameterList because we're receiving params list";
}
} }
......
...@@ -62,6 +62,7 @@ public slots: ...@@ -62,6 +62,7 @@ public slots:
/** @brief Request list of parameters from MAV */ /** @brief Request list of parameters from MAV */
virtual void requestParameterList(); virtual void requestParameterList();
/** @brief Check for missing parameters */ /** @brief Check for missing parameters */
virtual void retransmissionGuardTick(); virtual void retransmissionGuardTick();
......
...@@ -795,9 +795,12 @@ void QGCPX4VehicleConfig::loadConfig() ...@@ -795,9 +795,12 @@ void QGCPX4VehicleConfig::loadConfig()
xml.readNext(); xml.readNext();
} }
if (!paramTooltips.isEmpty()) {
mav->getParamManager()->setParamDescriptions(paramTooltips); mav->getParamManager()->setParamDescriptions(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. //Config is finished, lets do a parameter request to ensure none are missed if someone else started requesting before we were finished.
mav->getParamCommsMgr()->requestParameterList();
} }
void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
...@@ -826,31 +829,28 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) ...@@ -826,31 +829,28 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
// Disconnect old system // Disconnect old system
disconnect(mav, SIGNAL(remoteControlChannelRawChanged(int,float)), this, disconnect(mav, SIGNAL(remoteControlChannelRawChanged(int,float)), this,
SLOT(remoteControlChannelRawChanged(int,float))); SLOT(remoteControlChannelRawChanged(int,float)));
//TODO use paramCommsMgr instead
disconnect(mav, SIGNAL(parameterChanged(int,int,QString,QVariant)), this, disconnect(mav, SIGNAL(parameterChanged(int,int,QString,QVariant)), this,
SLOT(parameterChanged(int,int,QString,QVariant))); SLOT(parameterChanged(int,int,QString,QVariant)));
disconnect(ui->refreshButton,SIGNAL(clicked()),mav,SLOT(requestParameters())); disconnect(ui->refreshButton,SIGNAL(clicked()),
paramCommsMgr,SLOT(requestParameterList()));
// Delete all children from all fixed tabs. // Delete all children from all fixed tabs.
foreach(QWidget* child, ui->generalLeftContents->findChildren<QWidget*>()) foreach(QWidget* child, ui->generalLeftContents->findChildren<QWidget*>()) {
{
child->deleteLater(); child->deleteLater();
} }
foreach(QWidget* child, ui->generalRightContents->findChildren<QWidget*>()) foreach(QWidget* child, ui->generalRightContents->findChildren<QWidget*>()) {
{
child->deleteLater(); child->deleteLater();
} }
foreach(QWidget* child, ui->advanceColumnContents->findChildren<QWidget*>()) foreach(QWidget* child, ui->advanceColumnContents->findChildren<QWidget*>()) {
{
child->deleteLater(); child->deleteLater();
} }
foreach(QWidget* child, ui->sensorContents->findChildren<QWidget*>()) foreach(QWidget* child, ui->sensorContents->findChildren<QWidget*>()) {
{
child->deleteLater(); child->deleteLater();
} }
// And then delete any custom tabs // And then delete any custom tabs
foreach(QWidget* child, additionalTabs) foreach(QWidget* child, additionalTabs) {
{
child->deleteLater(); child->deleteLater();
} }
additionalTabs.clear(); additionalTabs.clear();
...@@ -866,6 +866,7 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) ...@@ -866,6 +866,7 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
// Connect new system // Connect new system
mav = active; mav = active;
paramCommsMgr = mav->getParamCommsMgr();
// Reset current state // Reset current state
resetCalibrationRC(); resetCalibrationRC();
...@@ -875,25 +876,23 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) ...@@ -875,25 +876,23 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
chanCount = 0; chanCount = 0;
// Connect new system // Connect new system
connect(active, SIGNAL(remoteControlChannelRawChanged(int,float)), this, connect(mav, SIGNAL(remoteControlChannelRawChanged(int,float)), this,
SLOT(remoteControlChannelRawChanged(int,float))); SLOT(remoteControlChannelRawChanged(int,float)));
connect(active, SIGNAL(parameterChanged(int,int,QString,QVariant)), this, connect(mav, SIGNAL(parameterChanged(int,int,QString,QVariant)), this,
SLOT(parameterChanged(int,int,QString,QVariant))); SLOT(parameterChanged(int,int,QString,QVariant)));
connect(ui->refreshButton, SIGNAL(clicked()), active, SLOT(requestParameters())); connect(ui->refreshButton, SIGNAL(clicked()),
paramCommsMgr,SLOT(requestParameterList()));
if (systemTypeToParamMap.contains(mav->getSystemTypeName())) if (systemTypeToParamMap.contains(mav->getSystemTypeName())) {
{
paramToWidgetMap = systemTypeToParamMap[mav->getSystemTypeName()]; paramToWidgetMap = systemTypeToParamMap[mav->getSystemTypeName()];
} }
else else {
{
//Indication that we have no meta data for this system type. //Indication that we have no meta data for this system type.
qDebug() << "No parameters defined for system type:" << mav->getSystemTypeName(); qDebug() << "No parameters defined for system type:" << mav->getSystemTypeName();
paramToWidgetMap = systemTypeToParamMap[mav->getSystemTypeName()]; paramToWidgetMap = systemTypeToParamMap[mav->getSystemTypeName()];
} }
if (!paramTooltips.isEmpty()) if (!paramTooltips.isEmpty()) {
{
mav->getParamManager()->setParamDescriptions(paramTooltips); mav->getParamManager()->setParamDescriptions(paramTooltips);
} }
...@@ -912,8 +911,7 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) ...@@ -912,8 +911,7 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
ui->writeButton->setEnabled(true); ui->writeButton->setEnabled(true);
ui->loadFileButton->setEnabled(true); ui->loadFileButton->setEnabled(true);
ui->saveFileButton->setEnabled(true); ui->saveFileButton->setEnabled(true);
if (mav->getAutopilotTypeName() == "ARDUPILOTMEGA") if (mav->getAutopilotTypeName() == "ARDUPILOTMEGA") {
{
ui->readButton->hide(); ui->readButton->hide();
ui->writeButton->hide(); ui->writeButton->hide();
} }
...@@ -978,8 +976,8 @@ void QGCPX4VehicleConfig::writeCalibrationRC() ...@@ -978,8 +976,8 @@ void QGCPX4VehicleConfig::writeCalibrationRC()
void QGCPX4VehicleConfig::requestCalibrationRC() void QGCPX4VehicleConfig::requestCalibrationRC()
{ {
if (mav) { if (paramCommsMgr) {
mav->getParamCommsMgr()->requestRcCalibrationParamsUpdate(); paramCommsMgr->requestRcCalibrationParamsUpdate();
} }
} }
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include "QGCToolWidget.h" #include "QGCToolWidget.h"
#include "UASInterface.h" #include "UASInterface.h"
class UASParameterCommsMgr;
namespace Ui { namespace Ui {
class QGCPX4VehicleConfig; class QGCPX4VehicleConfig;
} }
...@@ -159,6 +161,7 @@ protected slots: ...@@ -159,6 +161,7 @@ protected slots:
protected: protected:
bool doneLoadingConfig; bool doneLoadingConfig;
UASInterface* mav; ///< The current MAV UASInterface* mav; ///< The current MAV
UASParameterCommsMgr* paramCommsMgr; ///< param comms mgr for the mav
static const unsigned int chanMax = 8; ///< Maximum number of channels static const unsigned int chanMax = 8; ///< Maximum number of channels
unsigned int chanCount; ///< Actual channels unsigned int chanCount; ///< Actual channels
int rcType; ///< Type of the remote control int rcType; ///< Type of the remote control
......
...@@ -790,7 +790,8 @@ void QGCVehicleConfig::loadConfig() ...@@ -790,7 +790,8 @@ void QGCVehicleConfig::loadConfig()
mav->getParamManager()->setParamDescriptions(paramTooltips); mav->getParamManager()->setParamDescriptions(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. //Config is finished, lets do a parameter request to ensure none are missed if someone else started requesting before we were finished.
mav->getParamCommsMgr()->requestParameterList();
} }
void QGCVehicleConfig::setActiveUAS(UASInterface* active) void QGCVehicleConfig::setActiveUAS(UASInterface* active)
......
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