1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

MixerCurve: alpha version of integrated mixer curve;

only in fixedwing config currently.
This commit is contained in:
Mike LaBranche 2012-06-30 14:35:38 -07:00
parent 1e985f3aed
commit 7f3a810fa6
8 changed files with 596 additions and 96 deletions

View File

@ -471,23 +471,7 @@ margin:1px;</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="MixerCurveWidget" name="fixedWingThrottle" native="true">
<widget class="MixerCurve" name="fixedWingThrottle" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
@ -496,14 +480,14 @@ margin:1px;</string>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
<width>350</width>
<height>350</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>200</height>
<width>500</width>
<height>500</height>
</size>
</property>
<property name="sizeIncrement">
@ -514,26 +498,6 @@ margin:1px;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fwThrottleReset">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="fwThrottleCurveItemValue">
<property name="text">
<string>Val: 0.00</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -2784,14 +2748,14 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
&lt;tr&gt;
&lt;td style=&quot;border: none;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:14pt; font-weight:600; color:#ff0000;&quot;&gt;SETTING UP FEED FORWARD IS DANGEROUS&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Beware: Feed Forward Tuning will launch all engines around mid-throttle, you have been warned!&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Remove your props initially, and for fine-tuning, make sure your airframe is safely held in place. Wear glasses and protect your face and body.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;Beware: Feed Forward Tuning will launch all engines around mid-throttle, you have been warned!&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;Remove your props initially, and for fine-tuning, make sure your airframe is safely held in place. Wear glasses and protect your face and body.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -2889,7 +2853,7 @@ p, li { white-space: pre-wrap; }
<customwidget>
<class>MixerCurveWidget</class>
<extends>QWidget</extends>
<header>mixercurvewidget.h</header>
<header location="global">uavobjectwidgetutils/mixercurvewidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
@ -2898,6 +2862,12 @@ p, li { white-space: pre-wrap; }
<header>cfg_vehicletypes/configccpmwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>MixerCurve</class>
<extends>QWidget</extends>
<header location="global">uavobjectwidgetutils/mixercurve.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../coreplugin/core.qrc"/>

View File

@ -207,7 +207,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
//mdl connect(m_heli->m_ccpm->ccpmType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString)));
//Connect throttle curve reset pushbuttons to reset functions
connect(m_aircraft->fwThrottleReset, SIGNAL(clicked()), this, SLOT(resetFwMixer()));
//connect(m_aircraft->fwThrottleReset, SIGNAL(clicked()), this, SLOT(resetFwMixer()));
connect(m_aircraft->mrThrottleCurveReset, SIGNAL(clicked()), this, SLOT(resetMrMixer()));
connect(m_aircraft->gvThrottleCurve1Reset, SIGNAL(clicked()), this, SLOT(resetGvFrontMixer()));
connect(m_aircraft->gvThrottleCurve2Reset, SIGNAL(clicked()), this, SLOT(resetGvRearMixer()));
@ -487,7 +487,7 @@ void ConfigVehicleTypeWidget::resetFwMixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve1"));
resetMixer(m_aircraft->fixedWingThrottle, field->getNumElements(),1);
//resetMixer(m_aircraft->fixedWingThrottle, field->getNumElements(),1);
}
/**
@ -497,7 +497,7 @@ void ConfigVehicleTypeWidget::resetMrMixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve1"));
resetMixer(m_aircraft->multiThrottleCurve, field->getNumElements(),0.9);
//resetMixer(m_aircraft->multiThrottleCurve, field->getNumElements(),0.9);
}
/**
@ -507,7 +507,7 @@ void ConfigVehicleTypeWidget::resetGvFrontMixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve1"));
resetMixer(m_aircraft->groundVehicleThrottle1, field->getNumElements(),1);
//resetMixer(m_aircraft->groundVehicleThrottle1, field->getNumElements(),1);
}
/**
@ -517,7 +517,7 @@ void ConfigVehicleTypeWidget::resetGvRearMixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve2"));
resetMixer(m_aircraft->groundVehicleThrottle2, field->getNumElements(),1);
//resetMixer(m_aircraft->groundVehicleThrottle2, field->getNumElements(),1);
}
/**
@ -537,7 +537,7 @@ void ConfigVehicleTypeWidget::resetCt2Mixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve2"));
resetMixer(m_aircraft->customThrottle2Curve, field->getNumElements(),1);
//resetMixer(m_aircraft->customThrottle2Curve, field->getNumElements(),1);
}
@ -550,15 +550,6 @@ void ConfigVehicleTypeWidget::resetMixer(MixerCurveWidget *mixer, int numElement
mixer->initLinearCurve((quint32)numElements,maxvalue);
}
/**
Updates the currently moved fixed wing throttle curve item value
*/
void ConfigVehicleTypeWidget::updateFwThrottleCurveValue(QList<double> list, double value)
{
Q_UNUSED(list);
m_aircraft->fwThrottleCurveItemValue->setText(QString().sprintf("Val: %.2f",value));
}
/**
Updates the currently moved multi-rotor throttle curve item value
*/

View File

@ -99,7 +99,6 @@ private slots:
void resetGvRearMixer();
void resetCt1Mixer();
void resetCt2Mixer();
void updateFwThrottleCurveValue(QList<double> list, double value);
void updateMrThrottleCurveValue(QList<double> list, double value);
void updateGvThrottle1CurveValue(QList<double> list, double value);
void updateGvThrottle2CurveValue(QList<double> list, double value);

View File

@ -1,14 +1,265 @@
#include <math.h>
#include "mixercurve.h"
#include "ui_mixercurve.h"
MixerCurve::MixerCurve(QWidget *parent) :
QFrame(parent),
ui(new Ui::MixerCurve)
m_mixerUI(new Ui::MixerCurve),
m_curveType(MixerCurve::MIXERCURVE_THROTTLE)
{
ui->setupUi(this);
m_mixerUI->setupUi(this);
m_curve = m_mixerUI->CurveWidget;
m_settings = m_mixerUI->CurveSettings;
UpdateCurveSettings();
connect(m_mixerUI->CurveType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCurveSettings()));
connect(m_mixerUI->ResetCurve, SIGNAL(clicked()), this, SLOT(ResetCurve()));
connect(m_mixerUI->GenerateCurve, SIGNAL(clicked()), this, SLOT(GenerateCurve()));
connect(m_curve, SIGNAL(curveUpdated()), this, SLOT(UpdateSettings()));
connect(m_mixerUI->CurveMin, SIGNAL(valueChanged(double)), this, SLOT(CurveMinChanged(double)));
connect(m_mixerUI->CurveMax, SIGNAL(valueChanged(double)), this, SLOT(CurveMaxChanged(double)));
connect(m_mixerUI->CurveStep, SIGNAL(valueChanged(double)), this, SLOT(GenerateCurve()));
}
MixerCurve::~MixerCurve()
{
delete ui;
delete m_mixerUI;
}
void MixerCurve::ResetCurve()
{
m_curve->setMin((m_curveType == MixerCurve::MIXERCURVE_THROTTLE) ? 0.0 : -1.0);
m_curve->setMax(1.0);
m_mixerUI->CurveMin->setValue(m_curve->getMin());
m_mixerUI->CurveMax->setValue(m_curve->getMax());
initLinearCurve(MixerCurveWidget::NODE_NUMELEM, m_curve->getMax(), m_curve->getMin());
UpdateSettings();
}
void MixerCurve::UpdateCurveSettings()
{
//get the user settings
QString curveType = m_mixerUI->CurveType->currentText();
switch (m_curveType) {
case MixerCurve::MIXERCURVE_THROTTLE:
{
m_mixerUI->CurveMin->setMinimum(0.0);
m_mixerUI->CurveMax->setMinimum(0.0);
m_mixerUI->CurveStep->setMinimum(0.0);
break;
}
case MixerCurve::MIXERCURVEPITCH:
{
m_mixerUI->CurveMin->setMinimum(-1.0);
m_mixerUI->CurveMax->setMinimum(-1.0);
m_mixerUI->CurveStep->setMinimum(0.0);
break;
}
}
m_mixerUI->CurveMin->setMaximum(1.0);
m_mixerUI->CurveMax->setMaximum(1.0);
m_mixerUI->CurveStep->setMaximum(100.0);
//set default visible
m_mixerUI->minLabel->setText("Min");
m_mixerUI->minLabel->setVisible(true);
m_mixerUI->CurveMin->setVisible(true);
m_mixerUI->maxLabel->setVisible(false);
m_mixerUI->CurveMax->setVisible(false);
m_mixerUI->stepLabel->setVisible(false);
m_mixerUI->CurveStep->setVisible(false);
if ( curveType.compare("Flat")==0)
{
m_mixerUI->minLabel->setText("Value");
}
if ( curveType.compare("Linear")==0)
{
m_mixerUI->maxLabel->setVisible(true);
m_mixerUI->CurveMax->setVisible(true);
}
if ( curveType.compare("Step")==0)
{
m_mixerUI->maxLabel->setVisible(true);
m_mixerUI->CurveMax->setVisible(true);
m_mixerUI->stepLabel->setText("Step at");
m_mixerUI->stepLabel->setVisible(true);
m_mixerUI->CurveStep->setVisible(true);
}
if ( curveType.compare("Exp")==0)
{
m_mixerUI->maxLabel->setVisible(true);
m_mixerUI->CurveMax->setVisible(true);
m_mixerUI->stepLabel->setText("Strength");
m_mixerUI->stepLabel->setVisible(true);
m_mixerUI->CurveStep->setVisible(true);
}
if ( curveType.compare("Log")==0)
{
m_mixerUI->maxLabel->setVisible(true);
m_mixerUI->CurveMax->setVisible(true);
m_mixerUI->stepLabel->setText("Strength");
m_mixerUI->stepLabel->setVisible(true);
m_mixerUI->CurveStep->setVisible(true);
}
}
void MixerCurve::GenerateCurve()
{
double scale;
double newValue;
//get the user settings
double value1 = getMin();
double value2 = getMax();
double value3 = getStep();
QString CurveType = m_mixerUI->CurveType->currentText();
QList<double> points;
for (int i=0; i<MixerCurveWidget::NODE_NUMELEM; i++)
{
scale =((double)i/(double)(MixerCurveWidget::NODE_NUMELEM - 1));
if ( CurveType.compare("Flat")==0)
{
points.append(value1);
}
if ( CurveType.compare("Linear")==0)
{
newValue =value1 +(scale*(value2-value1));
points.append(newValue);
}
if ( CurveType.compare("Step")==0)
{
if (scale*100<value3)
{
points.append(value1);
}
else
{
points.append(value2);
}
}
if ( CurveType.compare("Exp")==0)
{
newValue =value1 +(((exp(scale*(value3/10))-1))/(exp((value3/10))-1)*(value2-value1));
points.append(newValue);
}
if ( CurveType.compare("Log")==0)
{
newValue = value1 +(((log(scale*(value3*2)+1))/(log(1+(value3*2))))*(value2-value1));
points.append(newValue);
}
}
initCurve(&points);
}
void MixerCurve::initCurve (const QList<double>* points)
{
m_curve->initCurve(points);
UpdateSettings();
}
QList<double> MixerCurve::getCurve()
{
return m_curve->getCurve();
}
void MixerCurve::initLinearCurve(int numPoints, double maxValue, double minValue)
{
m_curve->initLinearCurve(numPoints, maxValue, minValue);
}
void MixerCurve::setCurve(const QList<double>* points)
{
m_curve->setCurve(points);
UpdateSettings();
}
void MixerCurve::setMin(double value)
{
m_curve->setMin(value);
}
double MixerCurve::getMin()
{
return m_curve->getMin();
}
void MixerCurve::setMax(double value)
{
m_curve->setMax(value);
}
double MixerCurve::getMax()
{
return m_curve->getMax();
}
double MixerCurve::getStep()
{
return m_mixerUI->CurveStep->value();
}
void MixerCurve::UpdateSettings()
{
QList<double> points = m_curve->getCurve();
int ptCnt = points.count();
for (int i=0; i<ptCnt; i++)
{
QTableWidgetItem* item = m_settings->item((ptCnt - 1) - i, 0);
if (item)
item->setText(QString().sprintf("%.2f",points.at(i)));
}
}
void MixerCurve::CurveMinChanged(double value)
{
setMin(value);
// the min changed so redraw the curve
// mixercurvewidget::setCurve will trim any points below min
QList<double> points = getCurve();
setCurve(&points);
}
void MixerCurve::CurveMaxChanged(double value)
{
setMax(value);
// the max changed so redraw the curve
// mixercurvewidget::setCurve will trim any points above max
QList<double> points = getCurve();
setCurve(&points);
}
double MixerCurve::setRange(double min, double max)
{
return m_curve->setRange(min, max);
}
void MixerCurve::showEvent(QShowEvent *event)
{
Q_UNUSED(event)
// Thit fitInView method should only be called now, once the
// widget is shown, otherwise it cannot compute its values and
// the result is usually a ahrsbargraph that is way too small.
//fitInView(this, Qt::KeepAspectRatio);
}
void MixerCurve::resizeEvent(QResizeEvent* event)
{
Q_UNUSED(event);
//fitInView(this, Qt::KeepAspectRatio);
}

View File

@ -2,21 +2,64 @@
#define MIXERCURVE_H
#include <QFrame>
#include <QtGui/QWidget>
#include <QList>
#include <QTableWidget>
#include "ui_mixercurve.h"
#include "mixercurvewidget.h"
#include "uavobjectwidgetutils_global.h"
namespace Ui {
class MixerCurve;
}
class MixerCurve : public QFrame
class UAVOBJECTWIDGETUTILS_EXPORT MixerCurve : public QFrame
{
Q_OBJECT
public:
explicit MixerCurve(QWidget *parent = 0);
~MixerCurve();
/* Enumeration options for ThrottleCurves */
typedef enum { MIXERCURVE_THROTTLE=0, MIXERCURVEPITCH=1 } MixerCurveType;
void initCurve (const QList<double>* points);
QList<double> getCurve();
void initLinearCurve(int numPoints, double maxValue = 1, double minValue = 0);
void setCurve(const QList<double>* points);
void setMin(double value);
double getMin();
void setMax(double value);
double getMax();
double getStep();
double setRange(double min, double max);
signals:
protected:
void showEvent(QShowEvent *event);
void resizeEvent(QResizeEvent *event);
public slots:
void ResetCurve();
void GenerateCurve();
void UpdateSettings();
private slots:
void CurveMinChanged(double value);
void CurveMaxChanged(double value);
void UpdateCurveSettings();
private:
Ui::MixerCurve *ui;
Ui::MixerCurve* m_mixerUI;
MixerCurveWidget* m_curve;
QTableWidget* m_settings;
MixerCurveType m_curveType;
};
#endif // MIXERCURVE_H

View File

@ -6,10 +6,28 @@
<rect>
<x>0</x>
<y>0</y>
<width>322</width>
<height>300</height>
<width>437</width>
<height>317</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>365</width>
<height>306</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>500</height>
</size>
</property>
<property name="baseSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="windowTitle">
<string>MixerCurve</string>
</property>
@ -19,64 +37,282 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="MixerCurveWidget" name="mixerCurveWidget" native="true">
<widget class="MixerCurveWidget" name="CurveWidget" native="true">
<property name="geometry">
<rect>
<x>80</x>
<y>40</y>
<width>221</width>
<x>140</x>
<y>10</y>
<width>291</width>
<height>300</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>261</width>
<height>241</height>
</rect>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinCurveMin">
<widget class="QDoubleSpinBox" name="CurveMin">
<property name="geometry">
<rect>
<x>20</x>
<y>260</y>
<x>70</x>
<y>240</y>
<width>51</width>
<height>22</height>
</rect>
</property>
<property name="correctionMode">
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="spinCurveMax">
<widget class="QDoubleSpinBox" name="CurveMax">
<property name="geometry">
<rect>
<x>20</x>
<x>70</x>
<y>40</y>
<width>51</width>
<height>22</height>
</rect>
</property>
<property name="correctionMode">
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
<widget class="QTableWidget" name="curveSettings">
<widget class="QTableWidget" name="CurveSettings">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>61</width>
<height>181</height>
<x>20</x>
<y>60</y>
<width>101</width>
<height>171</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="rowCount">
<number>5</number>
</property>
<property name="columnCount">
<number>1</number>
</property>
<row/>
<row/>
<row/>
<row/>
<row/>
<column/>
<row>
<property name="text">
<string>5</string>
</property>
</row>
<row>
<property name="text">
<string>4</string>
</property>
</row>
<row>
<property name="text">
<string>3</string>
</property>
</row>
<row>
<property name="text">
<string>2</string>
</property>
</row>
<row>
<property name="text">
<string>1</string>
</property>
</row>
<column>
<property name="text">
<string>Value</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>1.0</string>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>.75</string>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>.50</string>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>.25</string>
</property>
</item>
<item row="4" column="0">
<property name="text">
<string>.00</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="CurveType">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>61</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Log</string>
</property>
</item>
<item>
<property name="text">
<string>Exp</string>
</property>
</item>
<item>
<property name="text">
<string>Flat</string>
</property>
</item>
<item>
<property name="text">
<string>Step</string>
</property>
</item>
</widget>
<widget class="QPushButton" name="GenerateCurve">
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<width>61</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Generate</string>
</property>
</widget>
<widget class="QLabel" name="minLabel">
<property name="geometry">
<rect>
<x>20</x>
<y>240</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Min</string>
</property>
</widget>
<widget class="QLabel" name="maxLabel">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Max</string>
</property>
</widget>
<widget class="QPushButton" name="ResetCurve">
<property name="geometry">
<rect>
<x>20</x>
<y>290</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
<widget class="QLabel" name="stepLabel">
<property name="geometry">
<rect>
<x>20</x>
<y>260</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Step</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="CurveStep">
<property name="geometry">
<rect>
<x>70</x>
<y>260</y>
<width>51</width>
<height>22</height>
</rect>
</property>
<property name="correctionMode">
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
</property>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>MixerCurveWidget</class>
<extends>QWidget</extends>
<header>mixercurvewidget.h</header>
<header location="global">uavobjectwidgetutils/mixercurvewidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>

View File

@ -220,12 +220,13 @@ void MixerCurveWidget::setCurve(const QList<double>* points)
Node* node = nodeList.at(i);
node->setPos(w*i, h - (val*h));
node->verticalMove(true);
node->update();
}
curveUpdating = false;
update();
emit curveUpdated(points, (double)0);
emit curveUpdated();
}
@ -248,19 +249,26 @@ void MixerCurveWidget::resizeEvent(QResizeEvent* event)
void MixerCurveWidget::itemMoved(double itemValue)
{
if (!curveUpdating) {
QList<double> curve = getCurve();
emit curveUpdated(&curve, itemValue);
emit curveUpdated();
}
}
void MixerCurveWidget::setMin(double value)
{
if (curveMin != value)
emit curveMinChanged(value);
curveMin = value;
}
void MixerCurveWidget::setMax(double value)
{
if (curveMax != value)
emit curveMaxChanged(value);
curveMax = value;
}
double MixerCurveWidget::getMin()
{
return curveMin;

View File

@ -57,7 +57,9 @@ public:
static const int NODE_NUMELEM = 5;
signals:
void curveUpdated(const QList<double>* points, const double value);
void curveUpdated();
void curveMinChanged(double value);
void curveMaxChanged(double value);
private slots: