mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP-138 Modify Mixer curve to use values from 0 to 1 instead of -1 to +1, since the actuator module in OP works in the 0-1 range. Comments welcome on this.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1815 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
b32da232cb
commit
b385ce961e
@ -197,7 +197,7 @@ void ConfigAirframeWidget::requestAircraftUpdate()
|
||||
// is a straight line (that's how the mixer works on the mainboard):
|
||||
if (field->getValue(0).toInt() <= -10) {
|
||||
for (double i=0; i<field->getNumElements(); i++) {
|
||||
curveValues.append(-1.0 + 2*i/(field->getNumElements()-1));
|
||||
curveValues.append(i/(field->getNumElements()-1));
|
||||
}
|
||||
} else {
|
||||
for (unsigned int i=0; i < field->getNumElements(); i++) {
|
||||
|
@ -78,7 +78,7 @@ MixerCurveWidget::~MixerCurveWidget()
|
||||
Init curve: create a (flat) curve with a specified number of points.
|
||||
|
||||
If a curve exists already, resets it.
|
||||
Points should be between -1 and 1.
|
||||
Points should be between 0 and 1.
|
||||
*/
|
||||
void MixerCurveWidget::initCurve(QList<double> points)
|
||||
{
|
||||
@ -98,7 +98,7 @@ void MixerCurveWidget::initCurve(QList<double> points)
|
||||
|
||||
// Create the nodes
|
||||
qreal w = plot->boundingRect().width()/(points.length()-1);
|
||||
qreal h = plot->boundingRect().height()/2;
|
||||
qreal h = plot->boundingRect().height();
|
||||
for (int i=0; i<points.length(); i++) {
|
||||
Node *node = new Node(this);
|
||||
scene()->addItem(node);
|
||||
@ -106,8 +106,8 @@ void MixerCurveWidget::initCurve(QList<double> points)
|
||||
double val = points.at(i);
|
||||
if (val>1)
|
||||
val=1;
|
||||
if (val<-1)
|
||||
val=-1;
|
||||
if (val<0)
|
||||
val=0;
|
||||
node->setPos(w*i,h-val*h);
|
||||
node->verticalMove(true);
|
||||
}
|
||||
@ -126,7 +126,7 @@ void MixerCurveWidget::initCurve(QList<double> points)
|
||||
QList<double> MixerCurveWidget::getCurve() {
|
||||
QList<double> list;
|
||||
|
||||
qreal h = plot->boundingRect().height()/2;
|
||||
qreal h = plot->boundingRect().height();
|
||||
foreach(Node *node, nodeList) {
|
||||
list.append((h-node->pos().y())/h);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user