mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
OP-1422_Tricopter_mixers_settings Ternary operator and include qmath.h in cpp
This commit is contained in:
parent
aea2adf2df
commit
94809de9c4
@ -970,23 +970,9 @@ void ConfigMultiRotorWidget::setupQuadMotor(int channel, double pitch, double ro
|
|||||||
Q_ASSERT(mixer);
|
Q_ASSERT(mixer);
|
||||||
|
|
||||||
//Normalize mixer values, allow a well balanced mixer saved
|
//Normalize mixer values, allow a well balanced mixer saved
|
||||||
if(pitch < 0) {
|
pitch = (pitch < 0) ? qFloor(pitch * 127) : qCeil(pitch * 127);
|
||||||
pitch = qFloor(pitch * 127);
|
roll = (roll < 0) ? qFloor(roll * 127) : qCeil(roll * 127);
|
||||||
} else {
|
yaw = (yaw < 0) ? qFloor(yaw * 127) : qCeil(yaw * 127);
|
||||||
pitch = qCeil(pitch * 127);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(roll < 0) {
|
|
||||||
roll = qFloor(roll * 127);
|
|
||||||
} else {
|
|
||||||
roll = qCeil(roll * 127);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(yaw < 0) {
|
|
||||||
yaw = qFloor(yaw * 127);
|
|
||||||
} else {
|
|
||||||
yaw = qCeil(yaw * 127);
|
|
||||||
}
|
|
||||||
|
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR);
|
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "stabilizationsettings.h"
|
#include "stabilizationsettings.h"
|
||||||
#include "revocalibration.h"
|
#include "revocalibration.h"
|
||||||
#include "accelgyrosettings.h"
|
#include "accelgyrosettings.h"
|
||||||
|
#include <QtCore/qmath.h>
|
||||||
|
|
||||||
const qint16 VehicleConfigurationHelper::LEGACY_ESC_FREQUENCE = 50;
|
const qint16 VehicleConfigurationHelper::LEGACY_ESC_FREQUENCE = 50;
|
||||||
const qint16 VehicleConfigurationHelper::RAPID_ESC_FREQUENCE = 400;
|
const qint16 VehicleConfigurationHelper::RAPID_ESC_FREQUENCE = 400;
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QtCore/qmath.h>
|
|
||||||
#include "vehicleconfigurationsource.h"
|
#include "vehicleconfigurationsource.h"
|
||||||
#include "uavobjectmanager.h"
|
#include "uavobjectmanager.h"
|
||||||
#include "systemsettings.h"
|
#include "systemsettings.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user