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
|
* @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.
|
* E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||||
* @addtogroup GCSPlugins GCS Plugins
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
* @{
|
* @{
|
||||||
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <uavobjectutilmanager.h>
|
#include <uavobjectutilmanager.h>
|
||||||
|
#include <uavobjecthelper.h>
|
||||||
|
|
||||||
#include "mixersettings.h"
|
#include "mixersettings.h"
|
||||||
#include "systemsettings.h"
|
#include "systemsettings.h"
|
||||||
@ -246,8 +247,6 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) :
|
|||||||
|
|
||||||
// refreshWidgetsValues(QString("HeliCP"));
|
// refreshWidgetsValues(QString("HeliCP"));
|
||||||
|
|
||||||
UpdateType();
|
|
||||||
|
|
||||||
connect(m_aircraft->ccpmAngleW, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
|
connect(m_aircraft->ccpmAngleW, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
|
||||||
connect(m_aircraft->ccpmAngleX, 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()));
|
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->ccpmLinkCyclic, SIGNAL(clicked()), this, SLOT(SetUIComponentVisibilities()));
|
||||||
connect(m_aircraft->ccpmLinkRoll, SIGNAL(clicked()), this, SLOT(SetUIComponentVisibilities()));
|
connect(m_aircraft->ccpmLinkRoll, SIGNAL(clicked()), this, SLOT(SetUIComponentVisibilities()));
|
||||||
|
|
||||||
ccpmSwashplateRedraw();
|
UpdateType();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigCcpmWidget::~ConfigCcpmWidget()
|
ConfigCcpmWidget::~ConfigCcpmWidget()
|
||||||
@ -398,8 +397,6 @@ void ConfigCcpmWidget::UpdateType()
|
|||||||
int SingleServoIndex, NumServosDefined;
|
int SingleServoIndex, NumServosDefined;
|
||||||
double AdjustmentAngle = 0;
|
double AdjustmentAngle = 0;
|
||||||
|
|
||||||
SetUIComponentVisibilities();
|
|
||||||
|
|
||||||
typeText = m_aircraft->ccpmType->currentText();
|
typeText = m_aircraft->ccpmType->currentText();
|
||||||
SingleServoIndex = m_aircraft->ccpmSingleServo->currentIndex();
|
SingleServoIndex = m_aircraft->ccpmSingleServo->currentIndex();
|
||||||
|
|
||||||
@ -977,27 +974,19 @@ void ConfigCcpmWidget::setMixer()
|
|||||||
|
|
||||||
int typeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
|
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
|
// Avoid mixer changes if something wrong in config
|
||||||
if (throwConfigError(typeInt) || updatingToHardware) {
|
if (throwConfigError(typeInt) || updatingToHardware || SwashLvlConfigurationInProgress) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SwashLvlConfigurationInProgress) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (updatingToHardware == true) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateMixer();
|
||||||
updatingToHardware = true;
|
updatingToHardware = true;
|
||||||
|
|
||||||
MixerSettings *mixerSettings = MixerSettings::GetInstance(getObjectManager());
|
MixerSettings *mixerSettings = MixerSettings::GetInstance(getObjectManager());
|
||||||
Q_ASSERT(mixerSettings);
|
Q_ASSERT(mixerSettings);
|
||||||
MixerSettings::DataFields mixerSettingsData = mixerSettings->getData();
|
MixerSettings::DataFields mixerSettingsData = mixerSettings->getData();
|
||||||
|
|
||||||
UpdateMixer();
|
|
||||||
|
|
||||||
// Set up some helper pointers
|
// Set up some helper pointers
|
||||||
qint8 *mixers[12] = { mixerSettingsData.Mixer1Vector,
|
qint8 *mixers[12] = { mixerSettingsData.Mixer1Vector,
|
||||||
mixerSettingsData.Mixer2Vector,
|
mixerSettingsData.Mixer2Vector,
|
||||||
@ -1069,8 +1058,11 @@ void ConfigCcpmWidget::setMixer()
|
|||||||
mixerSettingsData.Curve2Source = MixerSettings::CURVE2SOURCE_THROTTLE;
|
mixerSettingsData.Curve2Source = MixerSettings::CURVE2SOURCE_THROTTLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mixerSettings->setData(mixerSettingsData);
|
UAVObjectUpdaterHelper updateHelper;
|
||||||
mixerSettings->updated();
|
|
||||||
|
mixerSettings->setData(mixerSettingsData, false);
|
||||||
|
updateHelper.doObjectAndWait(mixerSettings);
|
||||||
|
|
||||||
updatingToHardware = false;
|
updatingToHardware = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1541,8 +1533,10 @@ void ConfigCcpmWidget::setSwashplateLevel(int percent)
|
|||||||
SwashLvlSpinBoxes[i]->setValue(value);
|
SwashLvlSpinBoxes[i]->setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
actuatorCommand->setData(actuatorCommandData);
|
UAVObjectUpdaterHelper updateHelper;
|
||||||
actuatorCommand->updated();
|
|
||||||
|
actuatorCommand->setData(actuatorCommandData, false);
|
||||||
|
updateHelper.doObjectAndWait(actuatorCommand);
|
||||||
|
|
||||||
SwashLvlServoInterlock = 0;
|
SwashLvlServoInterlock = 0;
|
||||||
}
|
}
|
||||||
@ -1588,8 +1582,10 @@ void ConfigCcpmWidget::SwashLvlSpinBoxChanged(int value)
|
|||||||
actuatorCommandData.Channel[newSwashLvlConfiguration.ServoChannels[i]] = value;
|
actuatorCommandData.Channel[newSwashLvlConfiguration.ServoChannels[i]] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
actuatorCommand->setData(actuatorCommandData);
|
UAVObjectUpdaterHelper updateHelper;
|
||||||
actuatorCommand->updated();
|
|
||||||
|
actuatorCommand->setData(actuatorCommandData, false);
|
||||||
|
updateHelper.doObjectAndWait(actuatorCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user