Skip to content

Commit cd94147

Browse files
f5sohfilnet
authored andcommitted
Merged in f5soh/librepilot/LP-577_HW_Settings_GPS_reboot (pull request #494)
LP-577 Ignore disabling GPS module for boards where the module is already built in. Approved-by: Philippe Renon <philippe_renon@yahoo.fr>
2 parents 66bbc2b + 15c2e61 commit cd94147

3 files changed

Lines changed: 18 additions & 24 deletions

File tree

ground/gcs/src/plugins/config/configrevohwwidget.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,14 @@ void ConfigRevoHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
108108
void ConfigRevoHWWidget::updateObjectsFromWidgetsImpl()
109109
{
110110
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
111-
// Otherwise disable GPS module.
112-
quint8 enableModule = HwSettings::OPTIONALMODULES_DISABLED;
111+
// GPS module will be already built in for Revo board, keep this check just in case.
112+
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
113113

114-
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
115-
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
116-
enableModule = HwSettings::OPTIONALMODULES_ENABLED;
114+
if ((hwSettings->optionalModulesGPS() == HwSettings_OptionalModules::Disabled) &&
115+
(isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS) ||
116+
isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS))) {
117+
hwSettings->setOptionalModulesGPS(HwSettings_OptionalModules::Enabled);
117118
}
118-
119-
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
120-
hwSettings->setOptionalModules(HwSettings::OPTIONALMODULES_GPS, enableModule);
121119
}
122120

123121
void ConfigRevoHWWidget::usbVCPPortChanged(int index)

ground/gcs/src/plugins/config/configrevonanohwwidget.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,14 @@ void ConfigRevoNanoHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
9898
void ConfigRevoNanoHWWidget::updateObjectsFromWidgetsImpl()
9999
{
100100
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
101-
// Otherwise disable GPS module.
102-
quint8 enableModule = HwSettings::OPTIONALMODULES_DISABLED;
101+
// GPS module will be already built in for RevoNano board, keep this check just in case.
102+
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
103103

104-
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
105-
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
106-
enableModule = HwSettings::OPTIONALMODULES_ENABLED;
104+
if ((hwSettings->optionalModulesGPS() == HwSettings_OptionalModules::Disabled) &&
105+
(isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS) ||
106+
isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS))) {
107+
hwSettings->setOptionalModulesGPS(HwSettings_OptionalModules::Enabled);
107108
}
108-
109-
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
110-
hwSettings->setOptionalModules(HwSettings::OPTIONALMODULES_GPS, enableModule);
111109
}
112110

113111
void ConfigRevoNanoHWWidget::usbVCPPortChanged(int index)

ground/gcs/src/plugins/config/configsparky2hwwidget.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,14 @@ void ConfigSparky2HWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
103103
void ConfigSparky2HWWidget::updateObjectsFromWidgetsImpl()
104104
{
105105
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
106-
// Otherwise disable GPS module.
107-
quint8 enableModule = HwSettings::OPTIONALMODULES_DISABLED;
106+
// GPS will be already built in for Sparky2 board, keep this check just in case.
107+
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
108108

109-
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_GPS)
110-
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::SPK2_MAINPORT_GPS)) {
111-
enableModule = HwSettings::OPTIONALMODULES_ENABLED;
109+
if ((hwSettings->optionalModulesGPS() == HwSettings_OptionalModules::Disabled) &&
110+
(isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS) ||
111+
isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS))) {
112+
hwSettings->setOptionalModulesGPS(HwSettings_OptionalModules::Enabled);
112113
}
113-
114-
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
115-
hwSettings->setOptionalModules(HwSettings::OPTIONALMODULES_GPS, enableModule);
116114
}
117115

118116
void ConfigSparky2HWWidget::usbVCPPortChanged(int index)

0 commit comments

Comments
 (0)