mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Fixed some little race conditions that messed with the configuration UI. Added
message to indicate power cycle is required after enabling this module.
This commit is contained in:
parent
44cc9245e4
commit
a387532a94
@ -21,6 +21,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>After enabling the module, you must power cycle before using and configuring.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -424,7 +438,4 @@ specific calibration button on top of the screen.</string>
|
|||||||
<include location="../coreplugin/core.qrc"/>
|
<include location="../coreplugin/core.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
<buttongroups>
|
|
||||||
<buttongroup name="buttonGroup"/>
|
|
||||||
</buttongroups>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -47,11 +47,7 @@ ConfigCameraStabilizationWidget::ConfigCameraStabilizationWidget(QWidget *parent
|
|||||||
m_camerastabilization = new Ui_CameraStabilizationWidget();
|
m_camerastabilization = new Ui_CameraStabilizationWidget();
|
||||||
m_camerastabilization->setupUi(this);
|
m_camerastabilization->setupUi(this);
|
||||||
|
|
||||||
// Now connect the widget to the StabilizationSettings object
|
connectUpdates();
|
||||||
connect(MixerSettings::GetInstance(getObjectManager()),SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
|
||||||
connect(CameraStabSettings::GetInstance(getObjectManager()),SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
|
||||||
// TODO: This will need to support both CC and OP later
|
|
||||||
connect(HwSettings::GetInstance(getObjectManager()),SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
|
||||||
|
|
||||||
// Connect buttons
|
// Connect buttons
|
||||||
connect(m_camerastabilization->camerastabilizationSaveRAM,SIGNAL(clicked()),this,SLOT(applySettings()));
|
connect(m_camerastabilization->camerastabilizationSaveRAM,SIGNAL(clicked()),this,SLOT(applySettings()));
|
||||||
@ -64,6 +60,24 @@ ConfigCameraStabilizationWidget::~ConfigCameraStabilizationWidget()
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigCameraStabilizationWidget::connectUpdates()
|
||||||
|
{
|
||||||
|
// Now connect the widget to the StabilizationSettings object
|
||||||
|
connect(MixerSettings::GetInstance(getObjectManager()),SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||||
|
connect(CameraStabSettings::GetInstance(getObjectManager()),SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||||
|
// TODO: This will need to support both CC and OP later
|
||||||
|
connect(HwSettings::GetInstance(getObjectManager()),SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigCameraStabilizationWidget::disconnectUpdates()
|
||||||
|
{
|
||||||
|
// Now connect the widget to the StabilizationSettings object
|
||||||
|
disconnect(MixerSettings::GetInstance(getObjectManager()),SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||||
|
disconnect(CameraStabSettings::GetInstance(getObjectManager()),SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||||
|
// TODO: This will need to support both CC and OP later
|
||||||
|
disconnect(HwSettings::GetInstance(getObjectManager()),SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Populate the gui settings into the appropriate
|
* @brief Populate the gui settings into the appropriate
|
||||||
* UAV structures
|
* UAV structures
|
||||||
@ -126,11 +140,21 @@ void ConfigCameraStabilizationWidget::applySettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the ranges
|
// Update the ranges
|
||||||
CameraStabSettings * cameraStabSettings = CameraStabSettings::GetInstance(getObjectManager());
|
CameraStabSettings * cameraStab = CameraStabSettings::GetInstance(getObjectManager());
|
||||||
CameraStabSettings::DataFields cameraStab = cameraStabSettings->getData();
|
CameraStabSettings::DataFields cameraStabData = cameraStab->getData();
|
||||||
cameraStab.OutputRange[CameraStabSettings::OUTPUTRANGE_ROLL] = m_camerastabilization->rollOutputRange->value();
|
cameraStabData.OutputRange[CameraStabSettings::OUTPUTRANGE_ROLL] = m_camerastabilization->rollOutputRange->value();
|
||||||
cameraStab.OutputRange[CameraStabSettings::OUTPUTRANGE_PITCH] = m_camerastabilization->pitchOutputRange->value();
|
cameraStabData.OutputRange[CameraStabSettings::OUTPUTRANGE_PITCH] = m_camerastabilization->pitchOutputRange->value();
|
||||||
cameraStab.OutputRange[CameraStabSettings::OUTPUTRANGE_YAW] = m_camerastabilization->yawOutputRange->value();
|
cameraStabData.OutputRange[CameraStabSettings::OUTPUTRANGE_YAW] = m_camerastabilization->yawOutputRange->value();
|
||||||
|
|
||||||
|
// Because multiple objects are updated, and all of them trigger the callback
|
||||||
|
// they must be done together (if update one then load settings from second
|
||||||
|
// the first update would wipe the UI controls). However to be extra cautious
|
||||||
|
// I'm also disabling updates during the setting to the UAVObjects
|
||||||
|
disconnectUpdates();
|
||||||
|
hwSettings->setData(hwSettingsData);
|
||||||
|
mixerSettings->setData(mixerSettingsData);
|
||||||
|
cameraStab->setData(cameraStabData);
|
||||||
|
connectUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,6 +224,12 @@ void ConfigCameraStabilizationWidget::openHelp()
|
|||||||
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Camera+Configuration", QUrl::StrictMode) );
|
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Camera+Configuration", QUrl::StrictMode) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigCameraStabilizationWidget::enableControls(bool enable)
|
||||||
|
{
|
||||||
|
m_camerastabilization->camerastabilizationSaveSD->setEnabled(enable);
|
||||||
|
m_camerastabilization->camerastabilizationSaveRAM->setEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@}
|
@}
|
||||||
@}
|
@}
|
||||||
|
@ -61,7 +61,8 @@ private slots:
|
|||||||
void refreshValues();
|
void refreshValues();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void connectUpdates();
|
||||||
|
void disconnectUpdates();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ConfigCameraStabilization_H
|
#endif // ConfigCameraStabilization_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user