mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
LP-461 Remove save warning and UpdateMixer() lock
This commit is contained in:
parent
c2cf44f8d8
commit
1b2c20defb
@ -2,7 +2,7 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configccpmwidget.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
|
||||
* E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
@ -31,6 +31,7 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <uavobjectutilmanager.h>
|
||||
#include <uavobjecthelper.h>
|
||||
|
||||
#include "mixersettings.h"
|
||||
#include "systemsettings.h"
|
||||
@ -246,8 +247,6 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) :
|
||||
|
||||
// refreshWidgetsValues(QString("HeliCP"));
|
||||
|
||||
UpdateType();
|
||||
|
||||
connect(m_aircraft->ccpmAngleW, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
|
||||
connect(m_aircraft->ccpmAngleX, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
|
||||
connect(m_aircraft->ccpmAngleY, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
|
||||
@ -277,7 +276,7 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) :
|
||||
connect(m_aircraft->ccpmLinkCyclic, SIGNAL(clicked()), this, SLOT(SetUIComponentVisibilities()));
|
||||
connect(m_aircraft->ccpmLinkRoll, SIGNAL(clicked()), this, SLOT(SetUIComponentVisibilities()));
|
||||
|
||||
ccpmSwashplateRedraw();
|
||||
UpdateType();
|
||||
}
|
||||
|
||||
ConfigCcpmWidget::~ConfigCcpmWidget()
|
||||
@ -398,8 +397,6 @@ void ConfigCcpmWidget::UpdateType()
|
||||
int SingleServoIndex, NumServosDefined;
|
||||
double AdjustmentAngle = 0;
|
||||
|
||||
SetUIComponentVisibilities();
|
||||
|
||||
typeText = m_aircraft->ccpmType->currentText();
|
||||
SingleServoIndex = m_aircraft->ccpmSingleServo->currentIndex();
|
||||
|
||||
@ -977,27 +974,19 @@ void ConfigCcpmWidget::setMixer()
|
||||
|
||||
int typeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
|
||||
|
||||
// Exit if currently updatingToHardware or ConfigError
|
||||
// Exit if currently updatingToHardware, ConfigError or LevelConfigInProgress
|
||||
// Avoid mixer changes if something wrong in config
|
||||
if (throwConfigError(typeInt) || updatingToHardware) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SwashLvlConfigurationInProgress) {
|
||||
return;
|
||||
}
|
||||
if (updatingToHardware == true) {
|
||||
if (throwConfigError(typeInt) || updatingToHardware || SwashLvlConfigurationInProgress) {
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateMixer();
|
||||
updatingToHardware = true;
|
||||
|
||||
MixerSettings *mixerSettings = MixerSettings::GetInstance(getObjectManager());
|
||||
Q_ASSERT(mixerSettings);
|
||||
MixerSettings::DataFields mixerSettingsData = mixerSettings->getData();
|
||||
|
||||
UpdateMixer();
|
||||
|
||||
// Set up some helper pointers
|
||||
qint8 *mixers[12] = { mixerSettingsData.Mixer1Vector,
|
||||
mixerSettingsData.Mixer2Vector,
|
||||
@ -1069,8 +1058,11 @@ void ConfigCcpmWidget::setMixer()
|
||||
mixerSettingsData.Curve2Source = MixerSettings::CURVE2SOURCE_THROTTLE;
|
||||
}
|
||||
|
||||
mixerSettings->setData(mixerSettingsData);
|
||||
mixerSettings->updated();
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
|
||||
mixerSettings->setData(mixerSettingsData, false);
|
||||
updateHelper.doObjectAndWait(mixerSettings);
|
||||
|
||||
updatingToHardware = false;
|
||||
}
|
||||
|
||||
@ -1541,8 +1533,10 @@ void ConfigCcpmWidget::setSwashplateLevel(int percent)
|
||||
SwashLvlSpinBoxes[i]->setValue(value);
|
||||
}
|
||||
|
||||
actuatorCommand->setData(actuatorCommandData);
|
||||
actuatorCommand->updated();
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
|
||||
actuatorCommand->setData(actuatorCommandData, false);
|
||||
updateHelper.doObjectAndWait(actuatorCommand);
|
||||
|
||||
SwashLvlServoInterlock = 0;
|
||||
}
|
||||
@ -1588,8 +1582,10 @@ void ConfigCcpmWidget::SwashLvlSpinBoxChanged(int value)
|
||||
actuatorCommandData.Channel[newSwashLvlConfiguration.ServoChannels[i]] = value;
|
||||
}
|
||||
|
||||
actuatorCommand->setData(actuatorCommandData);
|
||||
actuatorCommand->updated();
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
|
||||
actuatorCommand->setData(actuatorCommandData, false);
|
||||
updateHelper.doObjectAndWait(actuatorCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user