From 33d963d24e42964e83a93a651f291869296c1bc5 Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Wed, 18 Dec 2013 16:41:38 -0500 Subject: [PATCH] prepping to fix refreshWidgetsValues() so that Output & Vehicle screens populate properly after wizard is run. --- .../configfixedwingwidget.cpp | 29 ++++++++++--------- .../pages/outputcalibrationpage.cpp | 4 +-- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp index 71861c2c4..72eaf436c 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp @@ -53,27 +53,28 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions() // get the gui config data GUIConfigDataUnion configData = getConfigData(); + fixedGUISettingsStruct fixed = configData.fixedwing; - if (configData.fixedwing.FixedWingPitch1 > 0) { - channelDesc[configData.fixedwing.FixedWingPitch1 - 1] = QString("FixedWingPitch1"); + if (fixed.FixedWingThrottle > 0 && fixed.FixedWingThrottle <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixed.FixedWingThrottle - 1] = QString("fixed.WingThrottle"); } - if (configData.fixedwing.FixedWingPitch2 > 0) { - channelDesc[configData.fixedwing.FixedWingPitch2 - 1] = QString("FixedWingPitch2"); + if (fixed.FixedWingPitch1 > 0 && fixed.FixedWingPitch1 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixed.FixedWingPitch1 - 1] = QString("FixedWingPitch1"); } - if (configData.fixedwing.FixedWingRoll1 > 0) { - channelDesc[configData.fixedwing.FixedWingRoll1 - 1] = QString("FixedWingRoll1"); + if (fixed.FixedWingPitch2 > 0 && fixed.FixedWingPitch2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixed.FixedWingPitch2 - 1] = QString("FixedWingPitch2"); } - if (configData.fixedwing.FixedWingRoll2 > 0) { - channelDesc[configData.fixedwing.FixedWingRoll2 - 1] = QString("FixedWingRoll2"); + if (fixed.FixedWingRoll1 > 0 && fixed.FixedWingRoll1 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixed.FixedWingRoll1 - 1] = QString("FixedWingRoll1"); } - if (configData.fixedwing.FixedWingYaw1 > 0) { - channelDesc[configData.fixedwing.FixedWingYaw1 - 1] = QString("FixedWingYaw1"); + if (fixed.FixedWingRoll2 > 0 && fixed.FixedWingRoll2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixed.FixedWingRoll2 - 1] = QString("FixedWingRoll2"); } - if (configData.fixedwing.FixedWingYaw2 > 0) { - channelDesc[configData.fixedwing.FixedWingYaw2 - 1] = QString("FixedWingYaw2"); + if (fixed.FixedWingYaw1 > 0 && fixed.FixedWingYaw1 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixed.FixedWingYaw1 - 1] = QString("FixedWingYaw1"); } - if (configData.fixedwing.FixedWingThrottle > 0) { - channelDesc[configData.fixedwing.FixedWingThrottle - 1] = QString("FixedWingThrottle"); + if (fixed.FixedWingYaw2 > 0 && fixed.FixedWingYaw2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixed.FixedWingYaw2 - 1] = QString("FixedWingYaw2"); } return channelDesc; } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index d720f6118..edb4419c9 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -147,7 +147,7 @@ void OutputCalibrationPage::setupVehicle() ui->vehicleView->setScene(m_vehicleScene); } qDebug() << "no clue what a wizard index is!"; - m_wizardIndexes << 0 << 1 << 2 << 2 << 2 << 2; // These come from OutputCalibrationPage::setWizardPage() + m_wizardIndexes << 0 << 1 << 3 << 3 << 3 << 3; // These come from OutputCalibrationPage::setWizardPage() m_vehicleElementIds << "fixed-aileron" << "aileron"; m_vehicleHighlightElementIndexes << 0 << 1; m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4; @@ -179,7 +179,7 @@ void OutputCalibrationPage::setupVehicle() ui->vehicleView->setScene(m_vehicleScene); } qDebug() << "no clue what a wizard index is!"; - m_wizardIndexes << 0 << 2 << 2 << 2; // These come from OutputCalibrationPage::setWizardPage() + m_wizardIndexes << 0 << 0 << 3 << 3; // These come from OutputCalibrationPage::setWizardPage() m_vehicleElementIds << "fixed-vtail" << "vtail"; m_vehicleHighlightElementIndexes << 0 << 1; m_channelIndex << 0 << 0 << 1 << 2;