1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

OP-532 Created union of struct to assist in type casting of GUI settings

to UAVObject
This commit is contained in:
Andrew Thoms 2011-06-13 21:40:39 -04:00
parent 31339e0414
commit 23f9dc42cc
2 changed files with 20 additions and 16 deletions

View File

@ -851,13 +851,13 @@ void ConfigccpmWidget::UpdatCCPMUIOptions()
if (updatingFromHardware) return;
//get the user options
//swashplate config
ccpmGUISettings.SwasplateType = m_ccpm->ccpmType->count() - m_ccpm->ccpmType->currentIndex()-1;
ccpmGUISettings.FirstServoIndex = m_ccpm->ccpmSingleServo->currentIndex();
GUIConfigData.heli.SwasplateType = m_ccpm->ccpmType->count() - m_ccpm->ccpmType->currentIndex()-1;
GUIConfigData.heli.FirstServoIndex = m_ccpm->ccpmSingleServo->currentIndex();
//ccpm mixing options
ccpmGUISettings.ccpmCollectivePassthroughState = m_ccpm->ccpmCollectivePassthrough->isChecked();
ccpmGUISettings.ccpmLinkCyclicState = m_ccpm->ccpmLinkCyclic->isChecked();
ccpmGUISettings.ccpmLinkRollState = m_ccpm->ccpmLinkRoll->isChecked();
GUIConfigData.heli.ccpmCollectivePassthroughState = m_ccpm->ccpmCollectivePassthrough->isChecked();
GUIConfigData.heli.ccpmLinkCyclicState = m_ccpm->ccpmLinkCyclic->isChecked();
GUIConfigData.heli.ccpmLinkRollState = m_ccpm->ccpmLinkRoll->isChecked();
}
@ -868,16 +868,16 @@ void ConfigccpmWidget::SetUIComponentVisibilities()
//set which sliders are user...
m_ccpm->ccpmRevoMixingBox->setVisible(0);
m_ccpm->ccpmPitchMixingBox->setVisible(!ccpmGUISettings.ccpmCollectivePassthroughState && ccpmGUISettings.ccpmLinkCyclicState);
m_ccpm->ccpmCollectiveScalingBox->setVisible(ccpmGUISettings.ccpmCollectivePassthroughState || !ccpmGUISettings.ccpmLinkCyclicState);
m_ccpm->ccpmPitchMixingBox->setVisible(!GUIConfigData.heli.ccpmCollectivePassthroughState && GUIConfigData.heli.ccpmLinkCyclicState);
m_ccpm->ccpmCollectiveScalingBox->setVisible(GUIConfigData.heli.ccpmCollectivePassthroughState || !GUIConfigData.heli.ccpmLinkCyclicState);
m_ccpm->ccpmCollectiveChLabel->setVisible(ccpmGUISettings.ccpmCollectivePassthroughState);
m_ccpm->ccpmCollectiveChannel->setVisible(ccpmGUISettings.ccpmCollectivePassthroughState);
m_ccpm->ccpmCollectiveChLabel->setVisible(GUIConfigData.heli.ccpmCollectivePassthroughState);
m_ccpm->ccpmCollectiveChannel->setVisible(GUIConfigData.heli.ccpmCollectivePassthroughState);
m_ccpm->ccpmLinkCyclic->setVisible(!ccpmGUISettings.ccpmCollectivePassthroughState);
m_ccpm->ccpmLinkCyclic->setVisible(!GUIConfigData.heli.ccpmCollectivePassthroughState);
m_ccpm->ccpmCyclicScalingBox->setVisible((ccpmGUISettings.ccpmCollectivePassthroughState || !ccpmGUISettings.ccpmLinkCyclicState) && ccpmGUISettings.ccpmLinkRollState);
if (!ccpmGUISettings.ccpmCollectivePassthroughState && ccpmGUISettings.ccpmLinkCyclicState)
m_ccpm->ccpmCyclicScalingBox->setVisible((GUIConfigData.heli.ccpmCollectivePassthroughState || !GUIConfigData.heli.ccpmLinkCyclicState) && GUIConfigData.heli.ccpmLinkRollState);
if (!GUIConfigData.heli.ccpmCollectivePassthroughState && GUIConfigData.heli.ccpmLinkCyclicState)
{
m_ccpm->ccpmPitchScalingBox->setVisible(0);
m_ccpm->ccpmRollScalingBox->setVisible(0);
@ -886,8 +886,8 @@ void ConfigccpmWidget::SetUIComponentVisibilities()
}
else
{
m_ccpm->ccpmPitchScalingBox->setVisible(!ccpmGUISettings.ccpmLinkRollState);
m_ccpm->ccpmRollScalingBox->setVisible(!ccpmGUISettings.ccpmLinkRollState);
m_ccpm->ccpmPitchScalingBox->setVisible(!GUIConfigData.heli.ccpmLinkRollState);
m_ccpm->ccpmRollScalingBox->setVisible(!GUIConfigData.heli.ccpmLinkRollState);
m_ccpm->ccpmLinkRoll->setVisible(1);
}

View File

@ -61,7 +61,11 @@ typedef struct {
uint padding2:32;
} __attribute__((packed)) ccpmGUISettingsStruct;
typedef union
{
uint UAVObject;
ccpmGUISettingsStruct heli;
} GUIConfigDataUnion;
class ConfigccpmWidget: public ConfigTaskWidget
{
@ -96,7 +100,7 @@ private:
SwashplateServoSettingsStruct oldSwashLvlConfiguration;
SwashplateServoSettingsStruct newSwashLvlConfiguration;
ccpmGUISettingsStruct ccpmGUISettings;
GUIConfigDataUnion GUIConfigData;
int MixerChannelData[6];
int ShowDisclaimer(int messageID);