mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-19 04:52:12 +01:00
Merged in f5soh/librepilot/LP-388_AuxMag_calibration_wrong_initial_settings (pull request #306)
LP-388 Workaround for 2 telemetry errors while calibrating AuxMag
This commit is contained in:
commit
279eaf42ca
@ -2,7 +2,8 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file sixpointcalibrationmodel.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
*
|
||||
* @brief Six point calibration for Magnetometer and Accelerometer
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -29,6 +30,7 @@
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "calibration/calibrationuiutils.h"
|
||||
#include "uavobjectmanager.h"
|
||||
#include <uavobjecthelper.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <QThread>
|
||||
@ -156,6 +158,8 @@ void SixPointCalibrationModel::start(bool calibrateAccel, bool calibrateMag)
|
||||
// Store and reset board rotation before calibration starts
|
||||
storeAndClearBoardRotation();
|
||||
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
|
||||
// Calibration accel
|
||||
AccelGyroSettings::DataFields accelGyroSettingsData = accelGyroSettings->getData();
|
||||
memento.accelGyroSettingsData = accelGyroSettingsData;
|
||||
@ -167,7 +171,8 @@ void SixPointCalibrationModel::start(bool calibrateAccel, bool calibrateMag)
|
||||
accelGyroSettingsData.accel_bias[AccelGyroSettings::ACCEL_BIAS_Y] = 0;
|
||||
accelGyroSettingsData.accel_bias[AccelGyroSettings::ACCEL_BIAS_Z] = 0;
|
||||
|
||||
accelGyroSettings->setData(accelGyroSettingsData);
|
||||
accelGyroSettings->setData(accelGyroSettingsData, false);
|
||||
updateHelper.doObjectAndWait(accelGyroSettings);
|
||||
|
||||
// Calibration mag
|
||||
RevoCalibration::DataFields revoCalibrationData = revoCalibration->getData();
|
||||
@ -187,7 +192,8 @@ void SixPointCalibrationModel::start(bool calibrateAccel, bool calibrateMag)
|
||||
// Disable adaptive mag nulling
|
||||
revoCalibrationData.MagBiasNullingRate = 0;
|
||||
|
||||
revoCalibration->setData(revoCalibrationData);
|
||||
revoCalibration->setData(revoCalibrationData, false);
|
||||
updateHelper.doObjectAndWait(revoCalibration);
|
||||
|
||||
// Calibration AuxMag
|
||||
AuxMagSettings::DataFields auxMagSettingsData = auxMagSettings->getData();
|
||||
@ -207,9 +213,8 @@ void SixPointCalibrationModel::start(bool calibrateAccel, bool calibrateMag)
|
||||
// Disable adaptive mag nulling
|
||||
auxMagSettingsData.MagBiasNullingRate = 0;
|
||||
|
||||
auxMagSettings->setData(auxMagSettingsData);
|
||||
|
||||
QThread::usleep(100000);
|
||||
auxMagSettings->setData(auxMagSettingsData, false);
|
||||
updateHelper.doObjectAndWait(auxMagSettings);
|
||||
|
||||
mag_accum_x.clear();
|
||||
mag_accum_y.clear();
|
||||
|
@ -2,7 +2,7 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configinputwidget.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
@ -31,6 +31,7 @@
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/generalsettings.h>
|
||||
#include <utils/stylehelper.h>
|
||||
#include <uavobjecthelper.h>
|
||||
|
||||
#include "ui_input.h"
|
||||
#include "ui_input_wizard.h"
|
||||
@ -61,6 +62,9 @@
|
||||
#define STICK_MIN_MOVE -8
|
||||
#define STICK_MAX_MOVE 8
|
||||
|
||||
#define MIN_INPUT_US 100
|
||||
#define MAX_INPUT_US 2500
|
||||
|
||||
#define CHANNEL_NUMBER_NONE 0
|
||||
#define DEFAULT_FLIGHT_MODE_NUMBER 0
|
||||
|
||||
@ -839,6 +843,10 @@ void ConfigInputWidget::wizardSetUpStep(enum wizardSteps step)
|
||||
manualSettingsData.ChannelMax[i] = manualSettingsData.ChannelNeutral[i];
|
||||
}
|
||||
}
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
manualSettingsObj->setData(manualSettingsData, false);
|
||||
updateHelper.doObjectAndWait(manualSettingsObj);
|
||||
|
||||
connect(manualCommandObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(identifyLimits()));
|
||||
connect(manualCommandObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(moveSticks()));
|
||||
connect(flightStatusObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(moveSticks()));
|
||||
@ -881,6 +889,8 @@ void ConfigInputWidget::wizardSetUpStep(enum wizardSteps step)
|
||||
|
||||
void ConfigInputWidget::wizardTearDownStep(enum wizardSteps step)
|
||||
{
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
|
||||
Q_ASSERT(step == wizardStep);
|
||||
switch (step) {
|
||||
case wizardWelcome:
|
||||
@ -935,7 +945,8 @@ void ConfigInputWidget::wizardTearDownStep(enum wizardSteps step)
|
||||
manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i];
|
||||
}
|
||||
}
|
||||
manualSettingsObj->setData(manualSettingsData);
|
||||
manualSettingsObj->setData(manualSettingsData, false);
|
||||
updateHelper.doObjectAndWait(manualSettingsObj);
|
||||
setTxMovement(nothing);
|
||||
break;
|
||||
case wizardIdentifyLimits:
|
||||
@ -943,7 +954,8 @@ void ConfigInputWidget::wizardTearDownStep(enum wizardSteps step)
|
||||
disconnect(manualCommandObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(moveSticks()));
|
||||
disconnect(flightStatusObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(moveSticks()));
|
||||
disconnect(accessoryDesiredObj0, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(moveSticks()));
|
||||
manualSettingsObj->setData(manualSettingsData);
|
||||
manualSettingsObj->setData(manualSettingsData, false);
|
||||
updateHelper.doObjectAndWait(manualSettingsObj);
|
||||
setTxMovement(nothing);
|
||||
break;
|
||||
case wizardIdentifyInverted:
|
||||
@ -1178,37 +1190,49 @@ void ConfigInputWidget::identifyControls()
|
||||
|
||||
void ConfigInputWidget::identifyLimits()
|
||||
{
|
||||
uint16_t inputValue;
|
||||
bool newLimitValue = false;
|
||||
bool newFlightModeValue = false;
|
||||
|
||||
manualCommandData = manualCommandObj->getData();
|
||||
for (uint i = 0; i < ManualControlSettings::CHANNELMAX_NUMELEM; ++i) {
|
||||
inputValue = manualCommandData.Channel[i];
|
||||
// Check if channel is already detected and prevent glitches
|
||||
if ((manualSettingsData.ChannelNumber[i] != CHANNEL_NUMBER_NONE) &&
|
||||
(inputValue > MIN_INPUT_US) && (inputValue < MAX_INPUT_US)) {
|
||||
if (manualSettingsData.ChannelMin[i] <= manualSettingsData.ChannelMax[i]) {
|
||||
// Non inverted channel
|
||||
if (manualSettingsData.ChannelMin[i] > manualCommandData.Channel[i]) {
|
||||
manualSettingsData.ChannelMin[i] = manualCommandData.Channel[i];
|
||||
if (manualSettingsData.ChannelMin[i] > inputValue) {
|
||||
manualSettingsData.ChannelMin[i] = inputValue;
|
||||
newLimitValue = true;
|
||||
}
|
||||
if (manualSettingsData.ChannelMax[i] < manualCommandData.Channel[i]) {
|
||||
manualSettingsData.ChannelMax[i] = manualCommandData.Channel[i];
|
||||
if (manualSettingsData.ChannelMax[i] < inputValue) {
|
||||
manualSettingsData.ChannelMax[i] = inputValue;
|
||||
newLimitValue = true;
|
||||
}
|
||||
} else {
|
||||
// Inverted channel
|
||||
if (manualSettingsData.ChannelMax[i] > manualCommandData.Channel[i]) {
|
||||
manualSettingsData.ChannelMax[i] = manualCommandData.Channel[i];
|
||||
if (manualSettingsData.ChannelMax[i] > inputValue) {
|
||||
manualSettingsData.ChannelMax[i] = inputValue;
|
||||
newLimitValue = true;
|
||||
}
|
||||
if (manualSettingsData.ChannelMin[i] < manualCommandData.Channel[i]) {
|
||||
manualSettingsData.ChannelMin[i] = manualCommandData.Channel[i];
|
||||
if (manualSettingsData.ChannelMin[i] < inputValue) {
|
||||
manualSettingsData.ChannelMin[i] = inputValue;
|
||||
newLimitValue = true;
|
||||
}
|
||||
}
|
||||
// Flightmode channel
|
||||
if (i == ManualControlSettings::CHANNELGROUPS_FLIGHTMODE) {
|
||||
bool newFlightModeValue = true;
|
||||
// Avoid duplicate values too close and error due to RcTx drift
|
||||
int minSpacing = 100; // 100µs
|
||||
for (int pos = 0; pos < manualSettingsData.FlightModeNumber + 1; ++pos) {
|
||||
if (flightModeSignalValue[pos] == 0) {
|
||||
newFlightModeValue = true;
|
||||
// A new flightmode value can be set now
|
||||
for (int checkpos = 0; checkpos < manualSettingsData.FlightModeNumber + 1; ++checkpos) {
|
||||
// Check if value is already used, MinSpacing needed between values.
|
||||
if ((flightModeSignalValue[checkpos] < manualCommandData.Channel[i] + minSpacing) &&
|
||||
(flightModeSignalValue[checkpos] > manualCommandData.Channel[i] - minSpacing)) {
|
||||
if ((flightModeSignalValue[checkpos] < inputValue + minSpacing) &&
|
||||
(flightModeSignalValue[checkpos] > inputValue - minSpacing)) {
|
||||
newFlightModeValue = false;
|
||||
}
|
||||
}
|
||||
@ -1219,7 +1243,7 @@ void ConfigInputWidget::identifyLimits()
|
||||
manualSettingsData.FlightModeNumber = 0;
|
||||
}
|
||||
// Store new value and increase FlightModeNumber
|
||||
flightModeSignalValue[pos] = manualCommandData.Channel[i];
|
||||
flightModeSignalValue[pos] = inputValue;
|
||||
manualSettingsData.FlightModeNumber++;
|
||||
// Show flight mode number
|
||||
m_txFlightModeCountText->setText(QString().number(manualSettingsData.FlightModeNumber));
|
||||
@ -1230,7 +1254,13 @@ void ConfigInputWidget::identifyLimits()
|
||||
}
|
||||
}
|
||||
}
|
||||
manualSettingsObj->setData(manualSettingsData);
|
||||
}
|
||||
// Save only if something changed
|
||||
if (newLimitValue || newFlightModeValue) {
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
manualSettingsObj->setData(manualSettingsData, false);
|
||||
updateHelper.doObjectAndWait(manualSettingsObj);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigInputWidget::setMoveFromCommand(int command)
|
||||
@ -1671,7 +1701,9 @@ void ConfigInputWidget::invertControls()
|
||||
}
|
||||
}
|
||||
}
|
||||
manualSettingsObj->setData(manualSettingsData);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
manualSettingsObj->setData(manualSettingsData, false);
|
||||
updateHelper.doObjectAndWait(manualSettingsObj);
|
||||
}
|
||||
|
||||
void ConfigInputWidget::moveFMSlider()
|
||||
@ -1922,8 +1954,9 @@ void ConfigInputWidget::updateCalibration()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
manualSettingsObj->setData(manualSettingsData);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
manualSettingsObj->setData(manualSettingsData, false);
|
||||
updateHelper.doObjectAndWait(manualSettingsObj);
|
||||
manualSettingsObj->updated();
|
||||
}
|
||||
|
||||
@ -2067,7 +2100,9 @@ void ConfigInputWidget::resetChannelSettings()
|
||||
for (unsigned int channel = 0; channel < ManualControlSettings::CHANNELNUMBER_NUMELEM; channel++) {
|
||||
manualSettingsData.ChannelGroups[channel] = ManualControlSettings::CHANNELGROUPS_NONE;
|
||||
manualSettingsData.ChannelNumber[channel] = CHANNEL_NUMBER_NONE;
|
||||
manualSettingsObj->setData(manualSettingsData);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
manualSettingsObj->setData(manualSettingsData, false);
|
||||
updateHelper.doObjectAndWait(manualSettingsObj);
|
||||
}
|
||||
resetFlightModeSettings();
|
||||
}
|
||||
@ -2076,7 +2111,9 @@ void ConfigInputWidget::resetFlightModeSettings()
|
||||
{
|
||||
// Reset FlightMode settings
|
||||
manualSettingsData.FlightModeNumber = DEFAULT_FLIGHT_MODE_NUMBER;
|
||||
manualSettingsObj->setData(manualSettingsData);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
manualSettingsObj->setData(manualSettingsData, false);
|
||||
updateHelper.doObjectAndWait(manualSettingsObj);
|
||||
for (uint8_t pos = 0; pos < FlightModeSettings::FLIGHTMODEPOSITION_NUMELEM; pos++) {
|
||||
flightModeSignalValue[pos] = 0;
|
||||
}
|
||||
@ -2110,7 +2147,9 @@ void ConfigInputWidget::resetActuatorSettings()
|
||||
actuatorSettingsData.ChannelMin[output] = 1500;
|
||||
actuatorSettingsData.ChannelNeutral[output] = 1500;
|
||||
}
|
||||
actuatorSettingsObj->setData(actuatorSettingsData);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
actuatorSettingsObj->setData(actuatorSettingsData, false);
|
||||
updateHelper.doObjectAndWait(actuatorSettingsObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "uavsettingsimportexport/uavsettingsimportexportfactory.h"
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/generalsettings.h>
|
||||
#include <uavobjecthelper.h>
|
||||
|
||||
#include "mixersettings.h"
|
||||
#include "actuatorcommand.h"
|
||||
@ -459,7 +460,9 @@ void ConfigOutputWidget::updateObjectsFromWidgets()
|
||||
ActuatorSettings::MOTORSSPINWHILEARMED_FALSE;
|
||||
|
||||
// Apply settings
|
||||
actuatorSettings->setData(actuatorSettingsData);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
actuatorSettings->setData(actuatorSettingsData, false);
|
||||
updateHelper.doObjectAndWait(actuatorSettings);
|
||||
}
|
||||
|
||||
FlightModeSettings *flightModeSettings = FlightModeSettings::GetInstance(getObjectManager());
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/generalsettings.h>
|
||||
#include <uavobjecthelper.h>
|
||||
|
||||
#include "hwsettings.h"
|
||||
|
||||
@ -131,7 +132,9 @@ void ConfigRevoHWWidget::updateObjectsFromWidgets()
|
||||
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED;
|
||||
}
|
||||
|
||||
hwSettings->setData(data);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
hwSettings->setData(data, false);
|
||||
updateHelper.doObjectAndWait(hwSettings);
|
||||
}
|
||||
|
||||
void ConfigRevoHWWidget::usbVCPPortChanged(int index)
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/generalsettings.h>
|
||||
#include <uavobjecthelper.h>
|
||||
|
||||
#include "hwsettings.h"
|
||||
|
||||
@ -124,7 +125,9 @@ void ConfigRevoNanoHWWidget::updateObjectsFromWidgets()
|
||||
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED;
|
||||
}
|
||||
|
||||
hwSettings->setData(data);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
hwSettings->setData(data, false);
|
||||
updateHelper.doObjectAndWait(hwSettings);
|
||||
}
|
||||
|
||||
void ConfigRevoNanoHWWidget::usbVCPPortChanged(int index)
|
||||
|
@ -2,7 +2,8 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file ConfigRevoWidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
@ -28,6 +29,7 @@
|
||||
|
||||
#include "ui_revosensors.h"
|
||||
|
||||
#include <uavobjecthelper.h>
|
||||
#include <attitudestate.h>
|
||||
#include <attitudesettings.h>
|
||||
#include <revocalibration.h>
|
||||
@ -258,6 +260,8 @@ void ConfigRevoWidget::updateVisualHelp()
|
||||
void ConfigRevoWidget::storeAndClearBoardRotation()
|
||||
{
|
||||
if (!isBoardRotationStored) {
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
|
||||
// Store current board rotation
|
||||
isBoardRotationStored = true;
|
||||
AttitudeSettings *attitudeSettings = AttitudeSettings::GetInstance(getObjectManager());
|
||||
@ -271,7 +275,9 @@ void ConfigRevoWidget::storeAndClearBoardRotation()
|
||||
data.BoardRotation[AttitudeSettings::BOARDROTATION_YAW] = 0;
|
||||
data.BoardRotation[AttitudeSettings::BOARDROTATION_ROLL] = 0;
|
||||
data.BoardRotation[AttitudeSettings::BOARDROTATION_PITCH] = 0;
|
||||
attitudeSettings->setData(data);
|
||||
|
||||
attitudeSettings->setData(data, false);
|
||||
updateHelper.doObjectAndWait(attitudeSettings);
|
||||
|
||||
// Store current aux mag board rotation
|
||||
AuxMagSettings *auxMagSettings = AuxMagSettings::GetInstance(getObjectManager());
|
||||
@ -285,13 +291,17 @@ void ConfigRevoWidget::storeAndClearBoardRotation()
|
||||
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_YAW] = 0;
|
||||
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_ROLL] = 0;
|
||||
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_PITCH] = 0;
|
||||
auxMagSettings->setData(auxMagData);
|
||||
|
||||
auxMagSettings->setData(auxMagData, false);
|
||||
updateHelper.doObjectAndWait(auxMagSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigRevoWidget::recallBoardRotation()
|
||||
{
|
||||
if (isBoardRotationStored) {
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
|
||||
// Recall current board rotation
|
||||
isBoardRotationStored = false;
|
||||
|
||||
@ -302,7 +312,9 @@ void ConfigRevoWidget::recallBoardRotation()
|
||||
data.BoardRotation[AttitudeSettings::BOARDROTATION_YAW] = storedBoardRotation[AttitudeSettings::BOARDROTATION_YAW];
|
||||
data.BoardRotation[AttitudeSettings::BOARDROTATION_ROLL] = storedBoardRotation[AttitudeSettings::BOARDROTATION_ROLL];
|
||||
data.BoardRotation[AttitudeSettings::BOARDROTATION_PITCH] = storedBoardRotation[AttitudeSettings::BOARDROTATION_PITCH];
|
||||
attitudeSettings->setData(data);
|
||||
|
||||
attitudeSettings->setData(data, false);
|
||||
updateHelper.doObjectAndWait(attitudeSettings);
|
||||
|
||||
// Restore the aux mag board rotation
|
||||
AuxMagSettings *auxMagSettings = AuxMagSettings::GetInstance(getObjectManager());
|
||||
@ -311,7 +323,9 @@ void ConfigRevoWidget::recallBoardRotation()
|
||||
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_YAW] = auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_YAW];
|
||||
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_ROLL] = auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_ROLL];
|
||||
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_PITCH] = auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_PITCH];
|
||||
auxMagSettings->setData(auxMagData);
|
||||
|
||||
auxMagSettings->setData(auxMagData, false);
|
||||
updateHelper.doObjectAndWait(auxMagSettings);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/generalsettings.h>
|
||||
#include <uavobjecthelper.h>
|
||||
|
||||
#include "hwsettings.h"
|
||||
|
||||
@ -126,7 +127,9 @@ void ConfigSparky2HWWidget::updateObjectsFromWidgets()
|
||||
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED;
|
||||
}
|
||||
|
||||
hwSettings->setData(data);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
hwSettings->setData(data, false);
|
||||
updateHelper.doObjectAndWait(hwSettings);
|
||||
}
|
||||
|
||||
void ConfigSparky2HWWidget::usbVCPPortChanged(int index)
|
||||
|
@ -91,8 +91,8 @@ void InputChannelForm::updateNeutralMark()
|
||||
|
||||
ui->channelNeutral->setStyleSheet(
|
||||
"QSlider::groove:horizontal { border: 1px solid rgb(196, 196, 196); margin: 0px 23px 0px 23px; height: 6px; border-radius: 2px; "
|
||||
"background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:" + QString::number(neutralPosition - 0.01) + " transparent, stop:"
|
||||
+ QString::number(neutralPosition) + " red, stop:" + QString::number(neutralPosition + 0.01) + " transparent); }"
|
||||
"background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:" + QString::number(qBound(0., neutralPosition - 0.01, 1.)) + " transparent, stop:"
|
||||
+ QString::number(qBound<double>(0., neutralPosition, 1.)) + " red, stop:" + QString::number(qBound(0., neutralPosition + 0.01, 1.)) + " transparent); }"
|
||||
"QSlider::add-page:horizontal { background: rgba(255,255,255,120); border: 1px solid #777; margin: 0px 23px 0px 2px; border-radius: 4px; }"
|
||||
"QSlider::sub-page:horizontal { background: rgba(78,147,246,120); border: 1px solid #777; margin: 0px 2px 0px 23px; border-radius: 4px; }"
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "vehicleconfigurationhelper.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "uavobjectutilmanager.h"
|
||||
#include <uavobjecthelper.h>
|
||||
|
||||
#include "hwsettings.h"
|
||||
#include "actuatorsettings.h"
|
||||
@ -403,7 +404,10 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
hwSettings->setData(data);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
hwSettings->setData(data, false);
|
||||
updateHelper.doObjectAndWait(hwSettings);
|
||||
|
||||
addModifiedObject(hwSettings, tr("Writing hardware settings"));
|
||||
}
|
||||
|
||||
@ -747,9 +751,15 @@ void VehicleConfigurationHelper::applyFlightModeConfiguration()
|
||||
data.FlightModePosition[3] = FlightModeSettings::FLIGHTMODEPOSITION_STABILIZED4;
|
||||
data.FlightModePosition[4] = FlightModeSettings::FLIGHTMODEPOSITION_STABILIZED5;
|
||||
data.FlightModePosition[5] = FlightModeSettings::FLIGHTMODEPOSITION_STABILIZED6;
|
||||
modeSettings->setData(data);
|
||||
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
|
||||
modeSettings->setData(data, false);
|
||||
updateHelper.doObjectAndWait(modeSettings);
|
||||
addModifiedObject(modeSettings, tr("Writing flight mode settings 1/2"));
|
||||
controlSettings->setData(data2);
|
||||
|
||||
controlSettings->setData(data2, false);
|
||||
updateHelper.doObjectAndWait(controlSettings);
|
||||
addModifiedObject(controlSettings, tr("Writing flight mode settings 2/2"));
|
||||
}
|
||||
|
||||
@ -814,8 +824,10 @@ void VehicleConfigurationHelper::applyStabilizationConfiguration()
|
||||
|
||||
Q_ASSERT(stabSettings);
|
||||
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
StabilizationSettings defaultSettings;
|
||||
stabSettings->setData(defaultSettings.getData());
|
||||
stabSettings->setData(defaultSettings.getData(), false);
|
||||
updateHelper.doObjectAndWait(stabSettings);
|
||||
addModifiedObject(stabSettings, tr("Writing stabilization settings"));
|
||||
}
|
||||
|
||||
@ -959,7 +971,9 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch
|
||||
}
|
||||
|
||||
// Apply updates
|
||||
mSettings->setData(mSettings->getData());
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
mSettings->setData(mSettings->getData(), false);
|
||||
updateHelper.doObjectAndWait(mSettings);
|
||||
addModifiedObject(mSettings, tr("Writing mixer settings"));
|
||||
}
|
||||
|
||||
@ -975,7 +989,9 @@ void VehicleConfigurationHelper::applyMultiGUISettings(SystemSettings::AirframeT
|
||||
data.GUIConfigData[i] = guiConfig.UAVObject[i];
|
||||
}
|
||||
|
||||
sSettings->setData(data);
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
sSettings->setData(data, false);
|
||||
updateHelper.doObjectAndWait(sSettings);
|
||||
addModifiedObject(sSettings, tr("Writing vehicle settings"));
|
||||
}
|
||||
|
||||
|
@ -102,9 +102,9 @@ $(NAME)::DataFields $(NAME)::getData()
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object data fields
|
||||
* Set the object data fields and (optionaly) emit object update events
|
||||
*/
|
||||
void $(NAME)::setData(const DataFields& data)
|
||||
void $(NAME)::setData(const DataFields& data, bool emitUpdateEvents)
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
// Get metadata
|
||||
@ -112,10 +112,12 @@ void $(NAME)::setData(const DataFields& data)
|
||||
// Update object if the access mode permits
|
||||
if (UAVObject::GetGcsAccess(mdata) == ACCESS_READWRITE) {
|
||||
this->data_ = data;
|
||||
if (emitUpdateEvents) {
|
||||
emit objectUpdatedAuto(this); // trigger object updated event
|
||||
emit objectUpdated(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void $(NAME)::emitNotifications()
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ $(DATAFIELDINFO)
|
||||
$(NAME)();
|
||||
|
||||
DataFields getData();
|
||||
void setData(const DataFields& data);
|
||||
void setData(const DataFields& data, bool emitUpdateEvents = true);
|
||||
Metadata getDefaultMetadata();
|
||||
UAVDataObject* clone(quint32 instID);
|
||||
UAVDataObject* dirtyClone();
|
||||
|
Loading…
x
Reference in New Issue
Block a user