1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

OP-39 Added reset of stabilization data to default values when wizard writes its configuration.

This commit is contained in:
Fredrik Arvidsson 2012-08-21 23:10:38 +02:00
parent 5199d9e738
commit 8e66133b2d
2 changed files with 16 additions and 2 deletions

View File

@ -33,6 +33,7 @@
#include "mixersettings.h"
#include "systemsettings.h"
#import "manualcontrolsettings.h"
#import "stabilizationsettings.h"
VehicleConfigurationHelper::VehicleConfigurationHelper(VehicleConfigurationSource *configSource)
: m_configSource(configSource), m_uavoManager(0),
@ -61,6 +62,7 @@ bool VehicleConfigurationHelper::setupVehicle()
applyOutputConfiguration();
applyFlighModeConfiguration();
applyLevellingConfiguration();
applyStabilizationConfiguration();
bool result = saveChangesToController();
if(result) {
@ -282,10 +284,21 @@ void VehicleConfigurationHelper::applyLevellingConfiguration()
data.GyroBias[2] = -bias.m_gyroZBias;
attitudeSettings->setData(data);
addModifiedObject(attitudeSettings, tr("Writing levelling bias settings"));
addModifiedObject(attitudeSettings, tr("Writing gyro and accelerometer bias settings"));
}
}
void VehicleConfigurationHelper::applyStabilizationConfiguration()
{
StabilizationSettings *stabSettings = StabilizationSettings::GetInstance(m_uavoManager);
Q_ASSERT(stabSettings);
StabilizationSettings::DataFields data = stabSettings->getData();
StabilizationSettings defaultSettings;
stabSettings->setData(defaultSettings.getData());
addModifiedObject(stabSettings, tr("Writing stabilization settings"));
}
void VehicleConfigurationHelper::applyMixerConfiguration(mixerSettings mixer)
{
// Set all mixer data

View File

@ -72,7 +72,7 @@ private:
static const int MIXER_TYPE_MOTOR = 1;
static const int MIXER_TYPE_SERVO = 2;
static const int PROGRESS_STEPS = 9;
static const int PROGRESS_STEPS = 10;
VehicleConfigurationSource *m_configSource;
UAVObjectManager *m_uavoManager;
@ -86,6 +86,7 @@ private:
void applyOutputConfiguration();
void applyFlighModeConfiguration();
void applyLevellingConfiguration();
void applyStabilizationConfiguration();
void applyMixerConfiguration(mixerSettings mixer);