Commit 0757b49e authored by tstellanova's avatar tstellanova

debug multiple parameter widgets creation

parent b09e81f7
...@@ -16,22 +16,13 @@ QGCUASParamManager::QGCUASParamManager(UASInterface* uas, QWidget *parent) : ...@@ -16,22 +16,13 @@ QGCUASParamManager::QGCUASParamManager(UASInterface* uas, QWidget *parent) :
} }
/**
* The .. signal is emitted
*/
void QGCUASParamManager::requestParameterListUpdate(int component)
{
Q_UNUSED(component);
}
bool QGCUASParamManager::getParameterValue(int component, const QString& parameter, QVariant& value) const { bool QGCUASParamManager::getParameterValue(int component, const QString& parameter, QVariant& value) const {
return paramDataModel->getOnboardParameterValue(component,parameter,value); return paramDataModel->getOnboardParameterValue(component,parameter,value);
} }
/** /**
* Send a request to deliver the list of onboard parameters * Send a request to deliver the list of onboard parameters
* to the MAV. * to the MAV.
...@@ -69,7 +60,7 @@ void QGCUASParamManager::requestParameterList() ...@@ -69,7 +60,7 @@ void QGCUASParamManager::requestParameterList()
*/ */
void QGCUASParamManager::setRetransmissionGuardEnabled(bool enabled) void QGCUASParamManager::setRetransmissionGuardEnabled(bool enabled)
{ {
qDebug() << "setRetransmissionGuardEnabled: " << enabled; // qDebug() << "setRetransmissionGuardEnabled: " << enabled;
if (enabled) { if (enabled) {
retransmissionTimer.start(retransmissionTimeout); retransmissionTimer.start(retransmissionTimeout);
......
...@@ -17,8 +17,6 @@ public: ...@@ -17,8 +17,6 @@ public:
virtual bool getParameterValue(int component, const QString& parameter, QVariant& value) const; virtual bool getParameterValue(int component, const QString& parameter, QVariant& value) const;
/** @brief Request an update for the parameter list */
void requestParameterListUpdate(int component = 0);
/** @brief Request an update for this specific parameter */ /** @brief Request an update for this specific parameter */
virtual void requestParameterUpdate(int component, const QString& parameter) = 0; virtual void requestParameterUpdate(int component, const QString& parameter) = 0;
......
...@@ -1995,7 +1995,7 @@ void UAS::sendMessage(mavlink_message_t message) ...@@ -1995,7 +1995,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!"; qDebug() << "SENT MESSAGE id" << message.msgid;
} }
else else
{ {
......
...@@ -89,8 +89,18 @@ void ParameterInterface::selectUAS(int index) ...@@ -89,8 +89,18 @@ void ParameterInterface::selectUAS(int index)
*/ */
void ParameterInterface::addUAS(UASInterface* uas) void ParameterInterface::addUAS(UASInterface* uas)
{ {
int uasId = uas->getUASID();
if (paramWidgets->contains(uasId) ) {
qDebug() << "Already have QGCParamWidget for: " << uasId ;
return;
}
QGCParamWidget* param = new QGCParamWidget(uas, this); QGCParamWidget* param = new QGCParamWidget(uas, this);
paramWidgets->insert(uas->getUASID(), param); QString ptrStr;
ptrStr.sprintf("%8p", param);
qDebug() << "Created QGCParamWidget " << ptrStr << "for UAS id: " << uasId << " count: " << paramWidgets->count();
paramWidgets->insert(uasId, param);
m_ui->stackedWidget->addWidget(param); m_ui->stackedWidget->addWidget(param);
QGCSensorSettingsWidget* sensor = NULL; QGCSensorSettingsWidget* sensor = NULL;
......
...@@ -87,7 +87,7 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) : ...@@ -87,7 +87,7 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) :
QPushButton* refreshButton = new QPushButton(tr("Get")); QPushButton* refreshButton = new QPushButton(tr("Get"));
refreshButton->setToolTip(tr("Load parameters currently in non-permanent memory of aircraft.")); refreshButton->setToolTip(tr("Load parameters currently in non-permanent memory of aircraft."));
refreshButton->setWhatsThis(tr("Load parameters currently in non-permanent memory of aircraft.")); refreshButton->setWhatsThis(tr("Load parameters currently in non-permanent memory of aircraft."));
connect(refreshButton, SIGNAL(clicked()), this, SLOT(requestParameterListUpdate())); connect(refreshButton, SIGNAL(clicked()), this, SLOT(requestAllParamsUpdate()));
horizontalLayout->addWidget(refreshButton, 2, 0); horizontalLayout->addWidget(refreshButton, 2, 0);
QPushButton* setButton = new QPushButton(tr("Set")); QPushButton* setButton = new QPushButton(tr("Set"));
...@@ -151,7 +151,7 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) : ...@@ -151,7 +151,7 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) :
// Get parameters // Get parameters
if (uas) { if (uas) {
requestParameterListUpdate(); requestAllParamsUpdate();
} }
} }
...@@ -245,7 +245,8 @@ void QGCParamWidget::addComponent(int uas, int component, QString componentName) ...@@ -245,7 +245,8 @@ void QGCParamWidget::addComponent(int uas, int component, QString componentName)
*/ */
void QGCParamWidget::receivedParameterUpdate(int uas, int component, int paramCount, int paramId, QString parameterName, QVariant value) void QGCParamWidget::receivedParameterUpdate(int uas, int component, int paramCount, int paramId, QString parameterName, QVariant value)
{ {
receivedParameterUpdate(uas, component, parameterName, value);
updateParameterDisplay(uas, component, parameterName, value);
// Missing packets list has to be instantiated for all components // Missing packets list has to be instantiated for all components
if (!transmissionMissingPackets.contains(component)) { if (!transmissionMissingPackets.contains(component)) {
...@@ -390,10 +391,15 @@ void QGCParamWidget::receivedParameterUpdate(int uas, int component, int paramCo ...@@ -390,10 +391,15 @@ void QGCParamWidget::receivedParameterUpdate(int uas, int component, int paramCo
* @param component id of the component * @param component id of the component
* @param parameterName human friendly name of the parameter * @param parameterName human friendly name of the parameter
*/ */
void QGCParamWidget::receivedParameterUpdate(int uas, int component, QString parameterName, QVariant value) void QGCParamWidget::updateParameterDisplay(int uas, int component, QString parameterName, QVariant value)
{ {
qDebug() << "PARAM WIDGET GOT PARAM:" << parameterName;
Q_UNUSED(uas); Q_UNUSED(uas);
QString ptrStr;
ptrStr.sprintf("%8p", this);
qDebug() << "QGCParamWidget " << ptrStr << " got param" << parameterName;
// Reference to item in tree // Reference to item in tree
QTreeWidgetItem* parameterItem = NULL; QTreeWidgetItem* parameterItem = NULL;
...@@ -417,9 +423,8 @@ void QGCParamWidget::receivedParameterUpdate(int uas, int component, QString par ...@@ -417,9 +423,8 @@ void QGCParamWidget::receivedParameterUpdate(int uas, int component, QString par
addComponent(uas, component, componentName); addComponent(uas, component, componentName);
} }
// Replace value in map // Replace value in data model
paramDataModel->handleParameterUpdate(component,parameterName,value);
paramDataModel->setOnboardParameter(component,parameterName,value);
QString splitToken = "_"; QString splitToken = "_";
...@@ -564,7 +569,7 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column) ...@@ -564,7 +569,7 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column)
current->setBackground(1, QBrush(QColor(QGC::colorOrange))); current->setBackground(1, QBrush(QColor(QGC::colorOrange)));
//TODO this seems incorrect-- we're pre-updating the onboard value before we've received confirmation //TODO this seems incorrect-- we're pre-updating the onboard value before we've received confirmation
paramDataModel->setOnboardParameterWithType(componentId,key,value); //paramDataModel->setOnboardParameterWithType(componentId,key,value);
} }
} }
...@@ -608,7 +613,7 @@ void QGCParamWidget::setParameterStatusMsg(const QString& msg) ...@@ -608,7 +613,7 @@ void QGCParamWidget::setParameterStatusMsg(const QString& msg)
void QGCParamWidget::requestParameterListUpdate() void QGCParamWidget::requestAllParamsUpdate()
{ {
if (!mav) { if (!mav) {
return; return;
......
...@@ -65,9 +65,9 @@ public slots: ...@@ -65,9 +65,9 @@ public slots:
/** @brief Add a parameter to the list with retransmission / safety checks */ /** @brief Add a parameter to the list with retransmission / safety checks */
void receivedParameterUpdate(int uas, int component, int paramCount, int paramId, QString parameterName, QVariant value); void receivedParameterUpdate(int uas, int component, int paramCount, int paramId, QString parameterName, QVariant value);
/** @brief Add a parameter to the list */ /** @brief Add a parameter to the list */
void receivedParameterUpdate(int uas, int component, QString parameterName, QVariant value); void updateParameterDisplay(int uas, int component, QString parameterName, QVariant value);
/** @brief Request list of parameters from MAV */ /** @brief Request list of parameters from MAV */
void requestParameterListUpdate(); void requestAllParamsUpdate();
/** @brief Request one single parameter */ /** @brief Request one single parameter */
void requestParameterUpdate(int component, const QString& parameter); void requestParameterUpdate(int component, const QString& parameter);
/** @brief Set one parameter, changes value in RAM of MAV */ /** @brief Set one parameter, changes value in RAM of MAV */
......
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