Commit 7b9f9806 authored by tstellanova's avatar tstellanova

fix setting of current mav in QGCConfigView

parent 73ce117b
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
QGCConfigView::QGCConfigView(QWidget *parent) : QGCConfigView::QGCConfigView(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::QGCConfigView), ui(new Ui::QGCConfigView),
currUAS(NULL) mav(NULL)
{ {
ui->setupUi(this); ui->setupUi(this);
...@@ -26,7 +26,7 @@ QGCConfigView::~QGCConfigView() ...@@ -26,7 +26,7 @@ QGCConfigView::~QGCConfigView()
void QGCConfigView::activeUASChanged(UASInterface* uas) void QGCConfigView::activeUASChanged(UASInterface* uas)
{ {
if (currUAS == uas) if (mav == uas)
return; return;
//remove all child widgets since they could contain stale data //remove all child widgets since they could contain stale data
...@@ -41,11 +41,13 @@ void QGCConfigView::activeUASChanged(UASInterface* uas) ...@@ -41,11 +41,13 @@ void QGCConfigView::activeUASChanged(UASInterface* uas)
} }
} }
if (NULL != uas) { mav = uas;
if (NULL != mav) {
ui->gridLayout->removeWidget(ui->waitingLabel); ui->gridLayout->removeWidget(ui->waitingLabel);
ui->waitingLabel->setVisible(false); ui->waitingLabel->setVisible(false);
switch (uas->getAutopilotType()) { int autopilotType = mav->getAutopilotType();
switch (autopilotType) {
case MAV_AUTOPILOT_PX4: case MAV_AUTOPILOT_PX4:
ui->gridLayout->addWidget(new QGCPX4VehicleConfig()); ui->gridLayout->addWidget(new QGCPX4VehicleConfig());
break; break;
......
...@@ -21,7 +21,7 @@ public slots: ...@@ -21,7 +21,7 @@ public slots:
private: private:
Ui::QGCConfigView *ui; Ui::QGCConfigView *ui;
UASInterface* currUAS; UASInterface* mav;
}; };
......
...@@ -941,6 +941,7 @@ void QGCPX4VehicleConfig::writeCalibrationRC() ...@@ -941,6 +941,7 @@ void QGCPX4VehicleConfig::writeCalibrationRC()
// Do not write the RC type, as these values depend on this // Do not write the RC type, as these values depend on this
// active onboard parameter // active onboard parameter
//TODO consolidate RC param sending in the UAS comms mgr
for (unsigned int i = 0; i < chanCount; ++i) for (unsigned int i = 0; i < chanCount; ++i)
{ {
//qDebug() << "SENDING" << minTpl.arg(i+1) << rcMin[i]; //qDebug() << "SENDING" << minTpl.arg(i+1) << rcMin[i];
...@@ -975,7 +976,9 @@ void QGCPX4VehicleConfig::writeCalibrationRC() ...@@ -975,7 +976,9 @@ void QGCPX4VehicleConfig::writeCalibrationRC()
void QGCPX4VehicleConfig::requestCalibrationRC() void QGCPX4VehicleConfig::requestCalibrationRC()
{ {
if (!mav) return; if (!mav ) {
return;
}
QString minTpl("RC%1_MIN"); QString minTpl("RC%1_MIN");
QString maxTpl("RC%1_MAX"); QString maxTpl("RC%1_MAX");
...@@ -985,15 +988,15 @@ void QGCPX4VehicleConfig::requestCalibrationRC() ...@@ -985,15 +988,15 @@ void QGCPX4VehicleConfig::requestCalibrationRC()
// Do not request the RC type, as these values depend on this // Do not request the RC type, as these values depend on this
// active onboard parameter // active onboard parameter
for (unsigned int i = 0; i < chanMax; ++i) for (unsigned int i = 1; i < (chanMax+1); ++i) {
{ qDebug() << "Request RC " << i;
mav->requestParameter(0, minTpl.arg(i+1)); mav->requestParameter(0, minTpl.arg(i));
QGC::SLEEP::usleep(5000); QGC::SLEEP::usleep(5000);
mav->requestParameter(0, trimTpl.arg(i+1)); mav->requestParameter(0, trimTpl.arg(i));
QGC::SLEEP::usleep(5000); QGC::SLEEP::usleep(5000);
mav->requestParameter(0, maxTpl.arg(i+1)); mav->requestParameter(0, maxTpl.arg(i));
QGC::SLEEP::usleep(5000); QGC::SLEEP::usleep(5000);
mav->requestParameter(0, revTpl.arg(i+1)); mav->requestParameter(0, revTpl.arg(i));
QGC::SLEEP::usleep(5000); QGC::SLEEP::usleep(5000);
} }
} }
......
...@@ -937,6 +937,7 @@ void QGCVehicleConfig::writeCalibrationRC() ...@@ -937,6 +937,7 @@ void QGCVehicleConfig::writeCalibrationRC()
// Do not write the RC type, as these values depend on this // Do not write the RC type, as these values depend on this
// active onboard parameter // active onboard parameter
//TODO consolidate RC param sending in the UAS comms mgr
for (unsigned int i = 0; i < chanCount; ++i) for (unsigned int i = 0; i < chanCount; ++i)
{ {
//qDebug() << "SENDING" << minTpl.arg(i+1) << rcMin[i]; //qDebug() << "SENDING" << minTpl.arg(i+1) << rcMin[i];
......
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