1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

LP-577 Ignore disabling GPS module for boards where the module is already built in.

This commit is contained in:
Laurent Lalanne 2018-02-11 21:29:33 +01:00
parent 4c9c3c202c
commit 15c2e619e5
3 changed files with 21 additions and 27 deletions

View File

@ -108,16 +108,14 @@ void ConfigRevoHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
void ConfigRevoHWWidget::updateObjectsFromWidgetsImpl()
{
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
// Otherwise disable GPS module.
quint8 enableModule = HwSettings::OPTIONALMODULES_DISABLED;
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
enableModule = HwSettings::OPTIONALMODULES_ENABLED;
}
// GPS module will be already built in for Revo board, keep this check just in case.
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
hwSettings->setOptionalModules(HwSettings::OPTIONALMODULES_GPS, enableModule);
if ((hwSettings->optionalModulesGPS() == HwSettings_OptionalModules::Disabled) &&
(isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS) ||
isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS))) {
hwSettings->setOptionalModulesGPS(HwSettings_OptionalModules::Enabled);
}
}
void ConfigRevoHWWidget::usbVCPPortChanged(int index)

View File

@ -98,16 +98,14 @@ void ConfigRevoNanoHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
void ConfigRevoNanoHWWidget::updateObjectsFromWidgetsImpl()
{
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
// Otherwise disable GPS module.
quint8 enableModule = HwSettings::OPTIONALMODULES_DISABLED;
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
enableModule = HwSettings::OPTIONALMODULES_ENABLED;
}
// GPS module will be already built in for RevoNano board, keep this check just in case.
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
hwSettings->setOptionalModules(HwSettings::OPTIONALMODULES_GPS, enableModule);
if ((hwSettings->optionalModulesGPS() == HwSettings_OptionalModules::Disabled) &&
(isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS) ||
isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS))) {
hwSettings->setOptionalModulesGPS(HwSettings_OptionalModules::Enabled);
}
}
void ConfigRevoNanoHWWidget::usbVCPPortChanged(int index)

View File

@ -103,16 +103,14 @@ void ConfigSparky2HWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
void ConfigSparky2HWWidget::updateObjectsFromWidgetsImpl()
{
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
// Otherwise disable GPS module.
quint8 enableModule = HwSettings::OPTIONALMODULES_DISABLED;
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_GPS)
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::SPK2_MAINPORT_GPS)) {
enableModule = HwSettings::OPTIONALMODULES_ENABLED;
}
// GPS will be already built in for Sparky2 board, keep this check just in case.
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
hwSettings->setOptionalModules(HwSettings::OPTIONALMODULES_GPS, enableModule);
if ((hwSettings->optionalModulesGPS() == HwSettings_OptionalModules::Disabled) &&
(isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS) ||
isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS))) {
hwSettings->setOptionalModulesGPS(HwSettings_OptionalModules::Enabled);
}
}
void ConfigSparky2HWWidget::usbVCPPortChanged(int index)