mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +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:
parent
fc4238b369
commit
a568e27703
@ -51,5 +51,6 @@ void PFDGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
|||||||
m_widget->setHqFonts(m->getHqFonts());
|
m_widget->setHqFonts(m->getHqFonts());
|
||||||
m_widget->setDialFile(m->dialFile());
|
m_widget->setDialFile(m->dialFile());
|
||||||
m_widget->enableOpenGL(m->useOpenGL());
|
m_widget->enableOpenGL(m->useOpenGL());
|
||||||
|
m_widget->enableSmoothUpdates(m->getBeSmooth());
|
||||||
m_widget->connectNeedles();
|
m_widget->connectNeedles();
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,15 @@
|
|||||||
*/
|
*/
|
||||||
PFDGadgetConfiguration::PFDGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
|
PFDGadgetConfiguration::PFDGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
|
||||||
IUAVGadgetConfiguration(classId, parent),
|
IUAVGadgetConfiguration(classId, parent),
|
||||||
m_defaultDial("Unknown")
|
m_defaultDial("Unknown"),
|
||||||
|
beSmooth(true)
|
||||||
{
|
{
|
||||||
//if a saved configuration exists load it
|
//if a saved configuration exists load it
|
||||||
if(qSettings != 0) {
|
if(qSettings != 0) {
|
||||||
QString dialFile = qSettings->value("dialFile").toString();
|
QString dialFile = qSettings->value("dialFile").toString();
|
||||||
useOpenGLFlag = qSettings->value("useOpenGLFlag").toBool();
|
useOpenGLFlag = qSettings->value("useOpenGLFlag").toBool();
|
||||||
hqFonts = qSettings->value("hqFonts").toBool();
|
hqFonts = qSettings->value("hqFonts").toBool();
|
||||||
|
beSmooth = qSettings->value("beSmooth").toBool();
|
||||||
m_defaultDial=Utils::PathUtils().InsertDataPath(dialFile);
|
m_defaultDial=Utils::PathUtils().InsertDataPath(dialFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,6 +57,7 @@ IUAVGadgetConfiguration *PFDGadgetConfiguration::clone()
|
|||||||
m->m_defaultDial=m_defaultDial;
|
m->m_defaultDial=m_defaultDial;
|
||||||
m->useOpenGLFlag = useOpenGLFlag;
|
m->useOpenGLFlag = useOpenGLFlag;
|
||||||
m->hqFonts = hqFonts;
|
m->hqFonts = hqFonts;
|
||||||
|
m->beSmooth = beSmooth;
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,4 +70,5 @@ void PFDGadgetConfiguration::saveConfig(QSettings* qSettings) const {
|
|||||||
qSettings->setValue("dialFile", dialFile);
|
qSettings->setValue("dialFile", dialFile);
|
||||||
qSettings->setValue("useOpenGLFlag", useOpenGLFlag);
|
qSettings->setValue("useOpenGLFlag", useOpenGLFlag);
|
||||||
qSettings->setValue("hqFonts", hqFonts);
|
qSettings->setValue("hqFonts", hqFonts);
|
||||||
|
qSettings->setValue("beSmooth", beSmooth);
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,13 @@ public:
|
|||||||
void setDialFile(QString dialFile){m_defaultDial=dialFile;}
|
void setDialFile(QString dialFile){m_defaultDial=dialFile;}
|
||||||
void setUseOpenGL(bool flag) { useOpenGLFlag = flag; }
|
void setUseOpenGL(bool flag) { useOpenGLFlag = flag; }
|
||||||
void setHqFonts(bool flag) { hqFonts = flag; }
|
void setHqFonts(bool flag) { hqFonts = flag; }
|
||||||
|
void setBeSmooth(bool flag) { beSmooth = flag;}
|
||||||
|
|
||||||
//get dial configuration functions
|
//get dial configuration functions
|
||||||
QString dialFile() {return m_defaultDial;}
|
QString dialFile() {return m_defaultDial;}
|
||||||
bool useOpenGL() { return useOpenGLFlag; }
|
bool useOpenGL() { return useOpenGLFlag; }
|
||||||
bool getHqFonts() { return hqFonts; }
|
bool getHqFonts() { return hqFonts; }
|
||||||
|
bool getBeSmooth() { return beSmooth; }
|
||||||
|
|
||||||
void saveConfig(QSettings* settings) const;
|
void saveConfig(QSettings* settings) const;
|
||||||
IUAVGadgetConfiguration *clone();
|
IUAVGadgetConfiguration *clone();
|
||||||
@ -54,6 +57,7 @@ private:
|
|||||||
QString m_defaultDial; // The name of the dial's SVG source file
|
QString m_defaultDial; // The name of the dial's SVG source file
|
||||||
bool useOpenGLFlag;
|
bool useOpenGLFlag;
|
||||||
bool hqFonts;
|
bool hqFonts;
|
||||||
|
bool beSmooth;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PFDGADGETCONFIGURATION_H
|
#endif // PFDGADGETCONFIGURATION_H
|
||||||
|
@ -62,6 +62,7 @@ QWidget *PFDGadgetOptionsPage::createPage(QWidget *parent)
|
|||||||
options_page->svgSourceFile->setPath(m_config->dialFile());
|
options_page->svgSourceFile->setPath(m_config->dialFile());
|
||||||
options_page->useOpenGL->setChecked(m_config->useOpenGL());
|
options_page->useOpenGL->setChecked(m_config->useOpenGL());
|
||||||
options_page->hqText->setChecked(m_config->getHqFonts());
|
options_page->hqText->setChecked(m_config->getHqFonts());
|
||||||
|
options_page->smoothUpdates->setChecked(m_config->getBeSmooth());
|
||||||
|
|
||||||
return optionsPageWidget;
|
return optionsPageWidget;
|
||||||
}
|
}
|
||||||
@ -77,6 +78,7 @@ void PFDGadgetOptionsPage::apply()
|
|||||||
m_config->setDialFile(options_page->svgSourceFile->path());
|
m_config->setDialFile(options_page->svgSourceFile->path());
|
||||||
m_config->setUseOpenGL(options_page->useOpenGL->checkState());
|
m_config->setUseOpenGL(options_page->useOpenGL->checkState());
|
||||||
m_config->setHqFonts(options_page->hqText->checkState());
|
m_config->setHqFonts(options_page->hqText->checkState());
|
||||||
|
m_config->setBeSmooth(options_page->smoothUpdates->checkState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<height>331</height>
|
<height>331</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</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">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetMinimumSize</enum>
|
<enum>QLayout::SetMinimumSize</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -105,6 +105,20 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -824,7 +824,7 @@ void PFDGadgetWidget::moveSky() {
|
|||||||
//////
|
//////
|
||||||
if (rollValue != rollTarget) {
|
if (rollValue != rollTarget) {
|
||||||
double rollDiff;
|
double rollDiff;
|
||||||
if ((abs((rollValue-rollTarget)*10) > 5)) {
|
if ((abs((rollValue-rollTarget)*10) > 5) && beSmooth ) {
|
||||||
rollDiff =(rollTarget - rollValue)/2;
|
rollDiff =(rollTarget - rollValue)/2;
|
||||||
} else {
|
} else {
|
||||||
rollDiff = rollTarget - rollValue;
|
rollDiff = rollTarget - rollValue;
|
||||||
@ -842,7 +842,7 @@ void PFDGadgetWidget::moveSky() {
|
|||||||
//////
|
//////
|
||||||
if (pitchValue != pitchTarget) {
|
if (pitchValue != pitchTarget) {
|
||||||
double pitchDiff;
|
double pitchDiff;
|
||||||
if ((abs((pitchValue-pitchTarget)*10) > 5)) {
|
if ((abs((pitchValue-pitchTarget)*10) > 5) && beSmooth ) {
|
||||||
// if (0) {
|
// if (0) {
|
||||||
pitchDiff = (pitchTarget - pitchValue)/2;
|
pitchDiff = (pitchTarget - pitchValue)/2;
|
||||||
} else {
|
} else {
|
||||||
@ -892,7 +892,7 @@ void PFDGadgetWidget::moveNeedles()
|
|||||||
//////
|
//////
|
||||||
if (headingValue != headingTarget) {
|
if (headingValue != headingTarget) {
|
||||||
double headingDiff;
|
double headingDiff;
|
||||||
if ((abs((headingValue-headingTarget)*10) > 5)) {
|
if ((abs((headingValue-headingTarget)*10) > 5) && beSmooth ) {
|
||||||
headingDiff = (headingTarget - headingValue)/5;
|
headingDiff = (headingTarget - headingValue)/5;
|
||||||
} else {
|
} else {
|
||||||
headingDiff = headingTarget-headingValue;
|
headingDiff = headingTarget-headingValue;
|
||||||
@ -921,7 +921,7 @@ void PFDGadgetWidget::moveNeedles()
|
|||||||
// Speed
|
// Speed
|
||||||
//////
|
//////
|
||||||
if (groundspeedValue != groundspeedTarget) {
|
if (groundspeedValue != groundspeedTarget) {
|
||||||
if (abs(groundspeedValue-groundspeedTarget) > speedScaleHeight/100) {
|
if ((abs(groundspeedValue-groundspeedTarget) > speedScaleHeight/100) && beSmooth ) {
|
||||||
groundspeedValue += (groundspeedTarget-groundspeedValue)/2;
|
groundspeedValue += (groundspeedTarget-groundspeedValue)/2;
|
||||||
} else {
|
} else {
|
||||||
groundspeedValue = groundspeedTarget;
|
groundspeedValue = groundspeedTarget;
|
||||||
@ -960,7 +960,7 @@ void PFDGadgetWidget::moveNeedles()
|
|||||||
// Altitude
|
// Altitude
|
||||||
//////
|
//////
|
||||||
if (altitudeValue != altitudeTarget) {
|
if (altitudeValue != altitudeTarget) {
|
||||||
if (abs(altitudeValue-altitudeTarget) > altitudeScaleHeight/100) {
|
if ((abs(altitudeValue-altitudeTarget) > altitudeScaleHeight/100) && beSmooth ) {
|
||||||
altitudeValue += (altitudeTarget-altitudeValue)/2;
|
altitudeValue += (altitudeTarget-altitudeValue)/2;
|
||||||
} else {
|
} else {
|
||||||
altitudeValue = altitudeTarget;
|
altitudeValue = altitudeTarget;
|
||||||
|
@ -52,6 +52,7 @@ public:
|
|||||||
void connectNeedles();
|
void connectNeedles();
|
||||||
void enableOpenGL(bool flag);
|
void enableOpenGL(bool flag);
|
||||||
void setHqFonts(bool flag) { hqFonts = flag; }
|
void setHqFonts(bool flag) { hqFonts = flag; }
|
||||||
|
void enableSmoothUpdates(bool flag) { beSmooth = flag; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateAttitude(UAVObject *object1);
|
void updateAttitude(UAVObject *object1);
|
||||||
@ -144,6 +145,7 @@ private:
|
|||||||
bool pfdError;
|
bool pfdError;
|
||||||
// Flag to enable better rendering of fonts in OpenGL
|
// Flag to enable better rendering of fonts in OpenGL
|
||||||
bool hqFonts;
|
bool hqFonts;
|
||||||
|
bool beSmooth;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif /* PFDGADGETWIDGET_H_ */
|
#endif /* PFDGADGETWIDGET_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user