mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-28 17:54:15 +01:00
LP-245 config: don't save HWSettings twice
This commit is contained in:
parent
f930e85175
commit
b32ec8b9e9
@ -29,8 +29,6 @@
|
|||||||
|
|
||||||
#include "ui_configrevohwwidget.h"
|
#include "ui_configrevohwwidget.h"
|
||||||
|
|
||||||
#include <uavobjecthelper.h>
|
|
||||||
|
|
||||||
#include "hwsettings.h"
|
#include "hwsettings.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -102,21 +100,17 @@ void ConfigRevoHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
|
|||||||
|
|
||||||
void ConfigRevoHWWidget::updateObjectsFromWidgetsImpl()
|
void ConfigRevoHWWidget::updateObjectsFromWidgetsImpl()
|
||||||
{
|
{
|
||||||
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
|
||||||
HwSettings::DataFields data = hwSettings->getData();
|
|
||||||
|
|
||||||
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
|
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
|
||||||
// Otherwise disable GPS module.
|
// Otherwise disable GPS module.
|
||||||
|
quint8 enableModule = HwSettings::OPTIONALMODULES_DISABLED;
|
||||||
|
|
||||||
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
|
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
|
||||||
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
|
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
|
||||||
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_ENABLED;
|
enableModule = HwSettings::OPTIONALMODULES_ENABLED;
|
||||||
} else {
|
|
||||||
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UAVObjectUpdaterHelper updateHelper;
|
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
||||||
hwSettings->setData(data, false);
|
hwSettings->setOptionalModules(HwSettings::OPTIONALMODULES_GPS, enableModule);
|
||||||
updateHelper.doObjectAndWait(hwSettings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigRevoHWWidget::usbVCPPortChanged(int index)
|
void ConfigRevoHWWidget::usbVCPPortChanged(int index)
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
|
|
||||||
#include "ui_configrevonanohwwidget.h"
|
#include "ui_configrevonanohwwidget.h"
|
||||||
|
|
||||||
#include <uavobjecthelper.h>
|
|
||||||
|
|
||||||
#include "hwsettings.h"
|
#include "hwsettings.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -94,21 +92,17 @@ void ConfigRevoNanoHWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
|
|||||||
|
|
||||||
void ConfigRevoNanoHWWidget::updateObjectsFromWidgetsImpl()
|
void ConfigRevoNanoHWWidget::updateObjectsFromWidgetsImpl()
|
||||||
{
|
{
|
||||||
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
|
||||||
HwSettings::DataFields data = hwSettings->getData();
|
|
||||||
|
|
||||||
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
|
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
|
||||||
// Otherwise disable GPS module.
|
// Otherwise disable GPS module.
|
||||||
|
quint8 enableModule = HwSettings::OPTIONALMODULES_DISABLED;
|
||||||
|
|
||||||
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
|
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
|
||||||
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
|
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
|
||||||
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_ENABLED;
|
enableModule = HwSettings::OPTIONALMODULES_ENABLED;
|
||||||
} else {
|
|
||||||
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UAVObjectUpdaterHelper updateHelper;
|
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
||||||
hwSettings->setData(data, false);
|
hwSettings->setOptionalModules(HwSettings::OPTIONALMODULES_GPS, enableModule);
|
||||||
updateHelper.doObjectAndWait(hwSettings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigRevoNanoHWWidget::usbVCPPortChanged(int index)
|
void ConfigRevoNanoHWWidget::usbVCPPortChanged(int index)
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
|
|
||||||
#include "ui_configsparky2hwwidget.h"
|
#include "ui_configsparky2hwwidget.h"
|
||||||
|
|
||||||
#include <uavobjecthelper.h>
|
|
||||||
|
|
||||||
#include "hwsettings.h"
|
#include "hwsettings.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -97,21 +95,17 @@ void ConfigSparky2HWWidget::refreshWidgetsValuesImpl(UAVObject *obj)
|
|||||||
|
|
||||||
void ConfigSparky2HWWidget::updateObjectsFromWidgetsImpl()
|
void ConfigSparky2HWWidget::updateObjectsFromWidgetsImpl()
|
||||||
{
|
{
|
||||||
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
|
||||||
HwSettings::DataFields data = hwSettings->getData();
|
|
||||||
|
|
||||||
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
|
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
|
||||||
// Otherwise disable GPS module.
|
// Otherwise disable GPS module.
|
||||||
|
quint8 enableModule = HwSettings::OPTIONALMODULES_DISABLED;
|
||||||
|
|
||||||
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_GPS)
|
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_GPS)
|
||||||
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::SPK2_MAINPORT_GPS)) {
|
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::SPK2_MAINPORT_GPS)) {
|
||||||
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_ENABLED;
|
enableModule = HwSettings::OPTIONALMODULES_ENABLED;
|
||||||
} else {
|
|
||||||
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UAVObjectUpdaterHelper updateHelper;
|
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
||||||
hwSettings->setData(data, false);
|
hwSettings->setOptionalModules(HwSettings::OPTIONALMODULES_GPS, enableModule);
|
||||||
updateHelper.doObjectAndWait(hwSettings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigSparky2HWWidget::usbVCPPortChanged(int index)
|
void ConfigSparky2HWWidget::usbVCPPortChanged(int index)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user