Commit 764e22c9 authored by tstellanova's avatar tstellanova

fix setting of current mav in QGCConfigView

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