1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

OP-532 Save and recall the new GUI config data to UAVObject

This commit is contained in:
Andrew Thoms 2011-06-14 00:10:28 -04:00
parent 23f9dc42cc
commit 1c1881663f
2 changed files with 26 additions and 6 deletions

View File

@ -264,7 +264,7 @@ void ConfigccpmWidget::UpdateType()
QString TypeText; QString TypeText;
double AdjustmentAngle=0; double AdjustmentAngle=0;
UpdatCCPMUIOptions(); UpdatCCPMOptionsFromUI();
SetUIComponentVisibilities(); SetUIComponentVisibilities();
TypeInt = m_ccpm->ccpmType->count() - m_ccpm->ccpmType->currentIndex()-1; TypeInt = m_ccpm->ccpmType->count() - m_ccpm->ccpmType->currentIndex()-1;
@ -846,7 +846,7 @@ void ConfigccpmWidget::UpdateMixer()
/* /*
Get the state of the UI check boxes and change the visibility of sliders Get the state of the UI check boxes and change the visibility of sliders
*/ */
void ConfigccpmWidget::UpdatCCPMUIOptions() void ConfigccpmWidget::UpdatCCPMOptionsFromUI()
{ {
if (updatingFromHardware) return; if (updatingFromHardware) return;
//get the user options //get the user options
@ -861,10 +861,14 @@ void ConfigccpmWidget::UpdatCCPMUIOptions()
} }
void ConfigccpmWidget::UpdatCCPMUIFromOptions()
{
}
void ConfigccpmWidget::SetUIComponentVisibilities() void ConfigccpmWidget::SetUIComponentVisibilities()
{ {
UpdatCCPMUIOptions(); UpdatCCPMOptionsFromUI();
//set which sliders are user... //set which sliders are user...
m_ccpm->ccpmRevoMixingBox->setVisible(0); m_ccpm->ccpmRevoMixingBox->setVisible(0);
@ -915,6 +919,13 @@ void ConfigccpmWidget::requestccpmUpdate()
int i,j; int i,j;
UAVObjectField *field; UAVObjectField *field;
UAVDataObject* obj; UAVDataObject* obj;
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("SystemSettings")));
field = obj->getField(QString("GUIConfigData"));
GUIConfigData.UAVObject=field->getValue().toUInt();
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("MixerSettings"))); obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("MixerSettings")));
Q_ASSERT(obj); Q_ASSERT(obj);
@ -1180,9 +1191,16 @@ void ConfigccpmWidget::sendccpmUpdate()
if (SwashLvlConfigurationInProgress)return; if (SwashLvlConfigurationInProgress)return;
ShowDisclaimer(1); ShowDisclaimer(1);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>(); UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("SystemSettings")));
field = obj->getField(QString("GUIConfigData"));
field->setValue(GUIConfigData.UAVObject);
obj->updated();
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("MixerSettings"))); obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("MixerSettings")));
Q_ASSERT(obj); Q_ASSERT(obj);

View File

@ -59,12 +59,12 @@ typedef struct {
uint CollectiveChannel:3; uint CollectiveChannel:3;
uint padding:12; uint padding:12;
uint padding2:32; uint padding2:32;
} __attribute__((packed)) ccpmGUISettingsStruct; } __attribute__((packed)) heliGUISettingsStruct;
typedef union typedef union
{ {
uint UAVObject; uint UAVObject;
ccpmGUISettingsStruct heli; heliGUISettingsStruct heli;
} GUIConfigDataUnion; } GUIConfigDataUnion;
class ConfigccpmWidget: public ConfigTaskWidget class ConfigccpmWidget: public ConfigTaskWidget
@ -125,7 +125,9 @@ private:
void SwashLvlCancelButtonPressed(); void SwashLvlCancelButtonPressed();
void SwashLvlFinishButtonPressed(); void SwashLvlFinishButtonPressed();
void UpdatCCPMUIOptions(); void UpdatCCPMOptionsFromUI();
void UpdatCCPMUIFromOptions();
void SetUIComponentVisibilities(); void SetUIComponentVisibilities();
void enableSwashplateLevellingControl(bool state); void enableSwashplateLevellingControl(bool state);