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

OP-180 Implementd a setting to disable PFD smooth updates.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2010 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2010-10-26 20:19:43 +00:00 committed by edouard
parent fc4238b369
commit a568e27703
7 changed files with 34 additions and 7 deletions

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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

View File

@ -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());
}

View File

@ -28,7 +28,7 @@
<height>331</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,1,0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,1,0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
@ -105,6 +105,20 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="smoothUpdates">
<property name="text">
<string>Smooth updates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -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;

View File

@ -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_ */