diff --git a/ground/src/plugins/pfd/pfdgadget.cpp b/ground/src/plugins/pfd/pfdgadget.cpp
index a7d86d7f3..80befeac0 100644
--- a/ground/src/plugins/pfd/pfdgadget.cpp
+++ b/ground/src/plugins/pfd/pfdgadget.cpp
@@ -51,5 +51,6 @@ void PFDGadget::loadConfiguration(IUAVGadgetConfiguration* config)
m_widget->setHqFonts(m->getHqFonts());
m_widget->setDialFile(m->dialFile());
m_widget->enableOpenGL(m->useOpenGL());
+ m_widget->enableSmoothUpdates(m->getBeSmooth());
m_widget->connectNeedles();
}
diff --git a/ground/src/plugins/pfd/pfdgadgetconfiguration.cpp b/ground/src/plugins/pfd/pfdgadgetconfiguration.cpp
index d742f25ce..3312d8687 100644
--- a/ground/src/plugins/pfd/pfdgadgetconfiguration.cpp
+++ b/ground/src/plugins/pfd/pfdgadgetconfiguration.cpp
@@ -34,13 +34,15 @@
*/
PFDGadgetConfiguration::PFDGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
- m_defaultDial("Unknown")
+ m_defaultDial("Unknown"),
+ beSmooth(true)
{
//if a saved configuration exists load it
if(qSettings != 0) {
QString dialFile = qSettings->value("dialFile").toString();
useOpenGLFlag = qSettings->value("useOpenGLFlag").toBool();
hqFonts = qSettings->value("hqFonts").toBool();
+ beSmooth = qSettings->value("beSmooth").toBool();
m_defaultDial=Utils::PathUtils().InsertDataPath(dialFile);
}
}
@@ -55,6 +57,7 @@ IUAVGadgetConfiguration *PFDGadgetConfiguration::clone()
m->m_defaultDial=m_defaultDial;
m->useOpenGLFlag = useOpenGLFlag;
m->hqFonts = hqFonts;
+ m->beSmooth = beSmooth;
return m;
}
@@ -67,4 +70,5 @@ void PFDGadgetConfiguration::saveConfig(QSettings* qSettings) const {
qSettings->setValue("dialFile", dialFile);
qSettings->setValue("useOpenGLFlag", useOpenGLFlag);
qSettings->setValue("hqFonts", hqFonts);
+ qSettings->setValue("beSmooth", beSmooth);
}
diff --git a/ground/src/plugins/pfd/pfdgadgetconfiguration.h b/ground/src/plugins/pfd/pfdgadgetconfiguration.h
index 25fe773cc..f267d5847 100644
--- a/ground/src/plugins/pfd/pfdgadgetconfiguration.h
+++ b/ground/src/plugins/pfd/pfdgadgetconfiguration.h
@@ -42,10 +42,13 @@ public:
void setDialFile(QString dialFile){m_defaultDial=dialFile;}
void setUseOpenGL(bool flag) { useOpenGLFlag = flag; }
void setHqFonts(bool flag) { hqFonts = flag; }
+ void setBeSmooth(bool flag) { beSmooth = flag;}
+
//get dial configuration functions
QString dialFile() {return m_defaultDial;}
bool useOpenGL() { return useOpenGLFlag; }
bool getHqFonts() { return hqFonts; }
+ bool getBeSmooth() { return beSmooth; }
void saveConfig(QSettings* settings) const;
IUAVGadgetConfiguration *clone();
@@ -54,6 +57,7 @@ private:
QString m_defaultDial; // The name of the dial's SVG source file
bool useOpenGLFlag;
bool hqFonts;
+ bool beSmooth;
};
#endif // PFDGADGETCONFIGURATION_H
diff --git a/ground/src/plugins/pfd/pfdgadgetoptionspage.cpp b/ground/src/plugins/pfd/pfdgadgetoptionspage.cpp
index 0f0584b21..57de1588d 100644
--- a/ground/src/plugins/pfd/pfdgadgetoptionspage.cpp
+++ b/ground/src/plugins/pfd/pfdgadgetoptionspage.cpp
@@ -62,6 +62,7 @@ QWidget *PFDGadgetOptionsPage::createPage(QWidget *parent)
options_page->svgSourceFile->setPath(m_config->dialFile());
options_page->useOpenGL->setChecked(m_config->useOpenGL());
options_page->hqText->setChecked(m_config->getHqFonts());
+ options_page->smoothUpdates->setChecked(m_config->getBeSmooth());
return optionsPageWidget;
}
@@ -77,6 +78,7 @@ void PFDGadgetOptionsPage::apply()
m_config->setDialFile(options_page->svgSourceFile->path());
m_config->setUseOpenGL(options_page->useOpenGL->checkState());
m_config->setHqFonts(options_page->hqText->checkState());
+ m_config->setBeSmooth(options_page->smoothUpdates->checkState());
}
diff --git a/ground/src/plugins/pfd/pfdgadgetoptionspage.ui b/ground/src/plugins/pfd/pfdgadgetoptionspage.ui
index 44ef78ff5..4086d1a5a 100644
--- a/ground/src/plugins/pfd/pfdgadgetoptionspage.ui
+++ b/ground/src/plugins/pfd/pfdgadgetoptionspage.ui
@@ -28,7 +28,7 @@
331
-
+
QLayout::SetMinimumSize
@@ -105,6 +105,20 @@
+ -
+
+
-
+
+
+ Smooth updates
+
+
+ true
+
+
+
+
+
-
diff --git a/ground/src/plugins/pfd/pfdgadgetwidget.cpp b/ground/src/plugins/pfd/pfdgadgetwidget.cpp
index 22a7f8f56..499273d0d 100644
--- a/ground/src/plugins/pfd/pfdgadgetwidget.cpp
+++ b/ground/src/plugins/pfd/pfdgadgetwidget.cpp
@@ -824,7 +824,7 @@ void PFDGadgetWidget::moveSky() {
//////
if (rollValue != rollTarget) {
double rollDiff;
- if ((abs((rollValue-rollTarget)*10) > 5)) {
+ if ((abs((rollValue-rollTarget)*10) > 5) && beSmooth ) {
rollDiff =(rollTarget - rollValue)/2;
} else {
rollDiff = rollTarget - rollValue;
@@ -842,7 +842,7 @@ void PFDGadgetWidget::moveSky() {
//////
if (pitchValue != pitchTarget) {
double pitchDiff;
- if ((abs((pitchValue-pitchTarget)*10) > 5)) {
+ if ((abs((pitchValue-pitchTarget)*10) > 5) && beSmooth ) {
// if (0) {
pitchDiff = (pitchTarget - pitchValue)/2;
} else {
@@ -892,7 +892,7 @@ void PFDGadgetWidget::moveNeedles()
//////
if (headingValue != headingTarget) {
double headingDiff;
- if ((abs((headingValue-headingTarget)*10) > 5)) {
+ if ((abs((headingValue-headingTarget)*10) > 5) && beSmooth ) {
headingDiff = (headingTarget - headingValue)/5;
} else {
headingDiff = headingTarget-headingValue;
@@ -921,7 +921,7 @@ void PFDGadgetWidget::moveNeedles()
// Speed
//////
if (groundspeedValue != groundspeedTarget) {
- if (abs(groundspeedValue-groundspeedTarget) > speedScaleHeight/100) {
+ if ((abs(groundspeedValue-groundspeedTarget) > speedScaleHeight/100) && beSmooth ) {
groundspeedValue += (groundspeedTarget-groundspeedValue)/2;
} else {
groundspeedValue = groundspeedTarget;
@@ -960,7 +960,7 @@ void PFDGadgetWidget::moveNeedles()
// Altitude
//////
if (altitudeValue != altitudeTarget) {
- if (abs(altitudeValue-altitudeTarget) > altitudeScaleHeight/100) {
+ if ((abs(altitudeValue-altitudeTarget) > altitudeScaleHeight/100) && beSmooth ) {
altitudeValue += (altitudeTarget-altitudeValue)/2;
} else {
altitudeValue = altitudeTarget;
diff --git a/ground/src/plugins/pfd/pfdgadgetwidget.h b/ground/src/plugins/pfd/pfdgadgetwidget.h
index be1b24485..fcad7ac25 100644
--- a/ground/src/plugins/pfd/pfdgadgetwidget.h
+++ b/ground/src/plugins/pfd/pfdgadgetwidget.h
@@ -52,6 +52,7 @@ public:
void connectNeedles();
void enableOpenGL(bool flag);
void setHqFonts(bool flag) { hqFonts = flag; }
+ void enableSmoothUpdates(bool flag) { beSmooth = flag; }
public slots:
void updateAttitude(UAVObject *object1);
@@ -144,6 +145,7 @@ private:
bool pfdError;
// Flag to enable better rendering of fonts in OpenGL
bool hqFonts;
+ bool beSmooth;
};
#endif /* PFDGADGETWIDGET_H_ */