mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
OP-60 : more performance and precision improvements for the analog dials plugin. Config dialog size corrected as well.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@889 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
9f0d8795c8
commit
06d9919981
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>487</width>
|
<width>513</width>
|
||||||
<height>346</height>
|
<height>341</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -24,7 +24,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>-1</x>
|
<x>-1</x>
|
||||||
<y>-1</y>
|
<y>-1</y>
|
||||||
<width>504</width>
|
<width>481</width>
|
||||||
<height>331</height>
|
<height>331</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -107,20 +107,26 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Indicator 1</string>
|
<string>Indicator 1</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="QWidget" name="">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>10</x>
|
||||||
<y>10</y>
|
<y>10</y>
|
||||||
<width>471</width>
|
<width>441</width>
|
||||||
<height>110</height>
|
<height>121</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
@ -333,13 +339,13 @@
|
|||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Indicator 2</string>
|
<string>Indicator 2</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="QWidget" name="">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>10</x>
|
||||||
<y>10</y>
|
<y>10</y>
|
||||||
<width>471</width>
|
<width>441</width>
|
||||||
<height>116</height>
|
<height>121</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
@ -540,10 +546,10 @@
|
|||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>10</x>
|
||||||
<y>10</y>
|
<y>10</y>
|
||||||
<width>471</width>
|
<width>441</width>
|
||||||
<height>116</height>
|
<height>121</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
@ -45,10 +45,12 @@ AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(pare
|
|||||||
obj2 = NULL;
|
obj2 = NULL;
|
||||||
obj3 = NULL;
|
obj3 = NULL;
|
||||||
|
|
||||||
|
needle1Target = 0;
|
||||||
|
needle2Target = 0;
|
||||||
|
needle3Target = 0;
|
||||||
|
|
||||||
// This timer mechanism makes needles rotate smoothly
|
// This timer mechanism makes needles rotate smoothly
|
||||||
connect(&dialTimer, SIGNAL(timeout()), this, SLOT(rotateNeedles()));
|
connect(&dialTimer, SIGNAL(timeout()), this, SLOT(rotateNeedles()));
|
||||||
dialTimer.start(20);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AirspeedGadgetWidget::~AirspeedGadgetWidget()
|
AirspeedGadgetWidget::~AirspeedGadgetWidget()
|
||||||
@ -367,9 +369,13 @@ void AirspeedGadgetWidget::rotateNeedles()
|
|||||||
{
|
{
|
||||||
int dialRun = 3;
|
int dialRun = 3;
|
||||||
if (n2enabled) {
|
if (n2enabled) {
|
||||||
if (abs((needle2Value-needle2Target)*10) > 5) {
|
|
||||||
double needle2Diff;
|
double needle2Diff;
|
||||||
|
if (abs((needle2Value-needle2Target)*10) > 5) {
|
||||||
needle2Diff =(needle2Target - needle2Value)/5;
|
needle2Diff =(needle2Target - needle2Value)/5;
|
||||||
|
} else {
|
||||||
|
needle2Diff = needle2Target - needle2Value;
|
||||||
|
dialRun--;
|
||||||
|
}
|
||||||
if (rotateN2) {
|
if (rotateN2) {
|
||||||
m_needle2->setRotation(m_needle2->rotation()+needle2Diff);
|
m_needle2->setRotation(m_needle2->rotation()+needle2Diff);
|
||||||
} else {
|
} else {
|
||||||
@ -390,18 +396,18 @@ void AirspeedGadgetWidget::rotateNeedles()
|
|||||||
m_needle2->setTransformOriginPoint(oop.x()-opd.x(),oop.y()-opd.y());
|
m_needle2->setTransformOriginPoint(oop.x()-opd.x(),oop.y()-opd.y());
|
||||||
}
|
}
|
||||||
needle2Value += needle2Diff;
|
needle2Value += needle2Diff;
|
||||||
} else {
|
|
||||||
needle2Value = needle2Target;
|
|
||||||
dialRun--;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
dialRun--;
|
dialRun--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We assume that needle1 always exists!
|
// We assume that needle1 always exists!
|
||||||
if ((abs((needle1Value-needle1Target)*10) > 5)) {
|
|
||||||
double needle1Diff;
|
double needle1Diff;
|
||||||
|
if ((abs((needle1Value-needle1Target)*10) > 5)) {
|
||||||
needle1Diff = (needle1Target - needle1Value)/5;
|
needle1Diff = (needle1Target - needle1Value)/5;
|
||||||
|
} else {
|
||||||
|
needle1Diff = needle1Target - needle1Value;
|
||||||
|
dialRun--;
|
||||||
|
}
|
||||||
if (rotateN1) {
|
if (rotateN1) {
|
||||||
m_needle1->setRotation(m_needle1->rotation()+needle1Diff);
|
m_needle1->setRotation(m_needle1->rotation()+needle1Diff);
|
||||||
} else {
|
} else {
|
||||||
@ -417,16 +423,15 @@ void AirspeedGadgetWidget::rotateNeedles()
|
|||||||
m_needle1->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y()));
|
m_needle1->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y()));
|
||||||
}
|
}
|
||||||
needle1Value += needle1Diff;
|
needle1Value += needle1Diff;
|
||||||
} else { // value is close enough to target, value to exact target
|
|
||||||
// to cancel out any potential drift
|
|
||||||
needle1Value = needle1Target;
|
|
||||||
dialRun--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n3enabled) {
|
if (n3enabled) {
|
||||||
if ((abs((needle3Value-needle3Target)*10) > 5)) {
|
|
||||||
double needle3Diff;
|
double needle3Diff;
|
||||||
|
if ((abs((needle3Value-needle3Target)*10) > 5)) {
|
||||||
needle3Diff = (needle3Target - needle3Value)/5;
|
needle3Diff = (needle3Target - needle3Value)/5;
|
||||||
|
} else {
|
||||||
|
needle3Diff = needle3Target - needle3Value;
|
||||||
|
dialRun--;
|
||||||
|
}
|
||||||
if (rotateN3) {
|
if (rotateN3) {
|
||||||
m_needle3->setRotation(m_needle3->rotation()+needle3Diff);
|
m_needle3->setRotation(m_needle3->rotation()+needle3Diff);
|
||||||
} else {
|
} else {
|
||||||
@ -443,13 +448,9 @@ void AirspeedGadgetWidget::rotateNeedles()
|
|||||||
}
|
}
|
||||||
needle3Value += needle3Diff;
|
needle3Value += needle3Diff;
|
||||||
} else {
|
} else {
|
||||||
needle3Value = needle3Target;
|
|
||||||
dialRun--;
|
dialRun--;
|
||||||
}
|
}
|
||||||
} else {
|
//update();
|
||||||
dialRun--;
|
|
||||||
}
|
|
||||||
update();
|
|
||||||
// Now check: if dialRun is now zero, we should
|
// Now check: if dialRun is now zero, we should
|
||||||
// just stop the timer since all needles have finished moving
|
// just stop the timer since all needles have finished moving
|
||||||
if (!dialRun) dialTimer.stop();
|
if (!dialRun) dialTimer.stop();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user