From 748d49817f541bfbcd50c8508278f71e5dc8c464 Mon Sep 17 00:00:00 2001 From: Andrew Thoms Date: Tue, 14 Jun 2011 00:53:42 -0400 Subject: [PATCH] OP-532 Save and Load UI elements to new GUIConfigData UABObject Field --- .../src/plugins/config/configccpmwidget.cpp | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp b/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp index fd182b031..4a9c7f12c 100644 --- a/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp @@ -845,6 +845,17 @@ void ConfigccpmWidget::UpdateMixer() **************************/ /* Get the state of the UI check boxes and change the visibility of sliders + typedef struct { + uint SwasplateType:3; + uint FirstServoIndex:2; + uint CorrectionAngle:9; + uint ccpmCollectivePassthroughState:1; + uint ccpmLinkCyclicState:1; + uint ccpmLinkRollState:1; + uint CollectiveChannel:3; + uint padding:12; + } __attribute__((packed)) heliGUISettingsStruct; + */ void ConfigccpmWidget::UpdatCCPMOptionsFromUI() { @@ -859,10 +870,29 @@ void ConfigccpmWidget::UpdatCCPMOptionsFromUI() GUIConfigData.heli.ccpmLinkCyclicState = m_ccpm->ccpmLinkCyclic->isChecked(); GUIConfigData.heli.ccpmLinkRollState = m_ccpm->ccpmLinkRoll->isChecked(); + //correction angle + GUIConfigData.heli.CorrectionAngle = m_ccpm->ccpmCorrectionAngle->value(); + //CollectiveChannel + GUIConfigData.heli.CollectiveChannel = m_ccpm->ccpmCollectiveChannel->currentIndex(); } void ConfigccpmWidget::UpdatCCPMUIFromOptions() { + //swashplate config + m_ccpm->ccpmType->setCurrentIndex(m_ccpm->ccpmType->count() - (GUIConfigData.heli.SwasplateType +1)); + m_ccpm->ccpmSingleServo->setCurrentIndex(GUIConfigData.heli.FirstServoIndex); + + //ccpm mixing options + m_ccpm->ccpmCollectivePassthrough->setChecked(GUIConfigData.heli.ccpmCollectivePassthroughState); + m_ccpm->ccpmLinkCyclic->setChecked(GUIConfigData.heli.ccpmLinkCyclicState); + m_ccpm->ccpmLinkRoll->setChecked(GUIConfigData.heli.ccpmLinkRollState); + + //correction angle + m_ccpm->ccpmCorrectionAngle->setValue(GUIConfigData.heli.CorrectionAngle); + + //CollectiveChannel + m_ccpm->ccpmCollectiveChannel->setCurrentIndex(GUIConfigData.heli.CollectiveChannel); + } @@ -923,7 +953,7 @@ void ConfigccpmWidget::requestccpmUpdate() obj = dynamic_cast(getObjectManager()->getObject(QString("SystemSettings"))); field = obj->getField(QString("GUIConfigData")); GUIConfigData.UAVObject=field->getValue().toUInt(); - + UpdatCCPMUIFromOptions(); obj = dynamic_cast(objManager->getObject(QString("MixerSettings")));