mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
Changed order of scope math functions to be more logical.
Added "Average" as scope math function. Changed averaging window size text edit box to be active only when math functions are selected. Fixed bug introduced immediately prior by removing child redefinition of saveConfig. Tried installing scroll wheel event filter for scope config plugin, but is not currently working.
This commit is contained in:
parent
a210b790b4
commit
6003d2d574
@ -100,7 +100,7 @@ bool SequentialPlotData::append(UAVObject* obj)
|
|||||||
double currentValue = valueAsDouble(obj, field) * pow(10, scalePower);
|
double currentValue = valueAsDouble(obj, field) * pow(10, scalePower);
|
||||||
|
|
||||||
//Compute boxcar average
|
//Compute boxcar average
|
||||||
if (meanSamples > 1){
|
if (mathFunction == "Boxcar average" || mathFunction == "Standard deviation"){
|
||||||
//Put the new value at the front
|
//Put the new value at the front
|
||||||
yDataHistory->append( currentValue );
|
yDataHistory->append( currentValue );
|
||||||
|
|
||||||
|
@ -144,45 +144,44 @@ IUAVGadgetConfiguration *ScopeGadgetConfiguration::clone()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////THIS SEEMS TO BE UNUSED
|
/**
|
||||||
///**
|
* Saves a configuration. //REDEFINES saveConfig CHILD BEHAVIOR?
|
||||||
// * Saves a configuration.
|
*
|
||||||
// *
|
*/
|
||||||
// */
|
void ScopeGadgetConfiguration::saveConfig(QSettings* qSettings) const {
|
||||||
//void ScopeGadgetConfiguration::saveConfig(QSettings* qSettings) const {
|
|
||||||
|
|
||||||
// int plotCurveCount = m_PlotCurveConfigs.size();
|
int plotCurveCount = m_PlotCurveConfigs.size();
|
||||||
// int plotDatasLoadIndex = 0;
|
int plotDatasLoadIndex = 0;
|
||||||
|
|
||||||
// qSettings->setValue("configurationStreamVersion", m_configurationStreamVersion);
|
qSettings->setValue("configurationStreamVersion", m_configurationStreamVersion);
|
||||||
// qSettings->setValue("plotType", m_plotType);
|
qSettings->setValue("plotType", m_plotType);
|
||||||
// qSettings->setValue("dataSize", m_dataSize);
|
qSettings->setValue("dataSize", m_dataSize);
|
||||||
// qSettings->setValue("refreshInterval", m_refreshInterval);
|
qSettings->setValue("refreshInterval", m_refreshInterval);
|
||||||
// qSettings->setValue("plotCurveCount", plotCurveCount);
|
qSettings->setValue("plotCurveCount", plotCurveCount);
|
||||||
|
|
||||||
// for(plotDatasLoadIndex = 0; plotDatasLoadIndex < plotCurveCount; plotDatasLoadIndex++)
|
for(plotDatasLoadIndex = 0; plotDatasLoadIndex < plotCurveCount; plotDatasLoadIndex++)
|
||||||
// {
|
{
|
||||||
// qSettings->beginGroup(QString("plotCurve") + QString().number(plotDatasLoadIndex));
|
qSettings->beginGroup(QString("plotCurve") + QString().number(plotDatasLoadIndex));
|
||||||
|
|
||||||
// PlotCurveConfiguration* plotCurveConf = m_PlotCurveConfigs.at(plotDatasLoadIndex);
|
PlotCurveConfiguration* plotCurveConf = m_PlotCurveConfigs.at(plotDatasLoadIndex);
|
||||||
// qSettings->setValue("uavObject", plotCurveConf->uavObject);
|
qSettings->setValue("uavObject", plotCurveConf->uavObject);
|
||||||
// qSettings->setValue("uavField", plotCurveConf->uavField);
|
qSettings->setValue("uavField", plotCurveConf->uavField);
|
||||||
// qSettings->setValue("color", plotCurveConf->color);
|
qSettings->setValue("color", plotCurveConf->color);
|
||||||
// qSettings->setValue("mathFunction", plotCurveConf->mathFunction);
|
qSettings->setValue("mathFunction", plotCurveConf->mathFunction);
|
||||||
// qSettings->setValue("yScalePower", plotCurveConf->yScalePower);
|
qSettings->setValue("yScalePower", plotCurveConf->yScalePower);
|
||||||
// qSettings->setValue("yMeanSamples", plotCurveConf->yMeanSamples);
|
qSettings->setValue("yMeanSamples", plotCurveConf->yMeanSamples);
|
||||||
// qSettings->setValue("yMinimum", plotCurveConf->yMinimum);
|
qSettings->setValue("yMinimum", plotCurveConf->yMinimum);
|
||||||
// qSettings->setValue("yMaximum", plotCurveConf->yMaximum);
|
qSettings->setValue("yMaximum", plotCurveConf->yMaximum);
|
||||||
|
|
||||||
// qSettings->endGroup();
|
qSettings->endGroup();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// qSettings->setValue("LoggingEnabled", m_LoggingEnabled);
|
qSettings->setValue("LoggingEnabled", m_LoggingEnabled);
|
||||||
// qSettings->setValue("LoggingNewFileOnConnect", m_LoggingNewFileOnConnect);
|
qSettings->setValue("LoggingNewFileOnConnect", m_LoggingNewFileOnConnect);
|
||||||
// qSettings->setValue("LoggingPath", m_LoggingPath);
|
qSettings->setValue("LoggingPath", m_LoggingPath);
|
||||||
|
|
||||||
|
|
||||||
//}
|
}
|
||||||
|
|
||||||
void ScopeGadgetConfiguration::replacePlotCurveConfig(QList<PlotCurveConfiguration*> newPlotCurveConfigs)
|
void ScopeGadgetConfiguration::replacePlotCurveConfig(QList<PlotCurveConfiguration*> newPlotCurveConfigs)
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
int refreshInterval(){return m_refreshInterval;}
|
int refreshInterval(){return m_refreshInterval;}
|
||||||
QList<PlotCurveConfiguration*> plotCurveConfigs(){return m_PlotCurveConfigs;}
|
QList<PlotCurveConfiguration*> plotCurveConfigs(){return m_PlotCurveConfigs;}
|
||||||
|
|
||||||
// void saveConfig(QSettings* settings) const; //THIS SEEMS TO BE UNUSED
|
void saveConfig(QSettings* settings) const; //THIS SEEMS TO BE UNUSED
|
||||||
IUAVGadgetConfiguration *clone();
|
IUAVGadgetConfiguration *clone();
|
||||||
|
|
||||||
bool getLoggingEnabled(){return m_LoggingEnabled;};
|
bool getLoggingEnabled(){return m_LoggingEnabled;};
|
||||||
|
@ -70,6 +70,7 @@ QWidget* ScopeGadgetOptionsPage::createPage(QWidget *parent)
|
|||||||
connect(options_page->cmbUAVObjects, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_cmbUAVObjects_currentIndexChanged(QString)));
|
connect(options_page->cmbUAVObjects, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_cmbUAVObjects_currentIndexChanged(QString)));
|
||||||
|
|
||||||
options_page->mathFunctionComboBox->addItem("None");
|
options_page->mathFunctionComboBox->addItem("None");
|
||||||
|
options_page->mathFunctionComboBox->addItem("Boxcar average");
|
||||||
options_page->mathFunctionComboBox->addItem("Standard deviation");
|
options_page->mathFunctionComboBox->addItem("Standard deviation");
|
||||||
|
|
||||||
if(options_page->cmbUAVObjects->currentIndex() >= 0)
|
if(options_page->cmbUAVObjects->currentIndex() >= 0)
|
||||||
@ -119,6 +120,7 @@ QWidget* ScopeGadgetOptionsPage::createPage(QWidget *parent)
|
|||||||
connect(options_page->btnRemoveCurve, SIGNAL(clicked()), this, SLOT(on_btnRemoveCurve_clicked()));
|
connect(options_page->btnRemoveCurve, SIGNAL(clicked()), this, SLOT(on_btnRemoveCurve_clicked()));
|
||||||
connect(options_page->lstCurves, SIGNAL(currentRowChanged(int)), this, SLOT(on_lstCurves_currentRowChanged(int)));
|
connect(options_page->lstCurves, SIGNAL(currentRowChanged(int)), this, SLOT(on_lstCurves_currentRowChanged(int)));
|
||||||
connect(options_page->btnColor, SIGNAL(clicked()), this, SLOT(on_btnColor_clicked()));
|
connect(options_page->btnColor, SIGNAL(clicked()), this, SLOT(on_btnColor_clicked()));
|
||||||
|
connect(options_page->mathFunctionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_mathFunctionComboBox_currentIndexChanged(int)));
|
||||||
connect(options_page->spnRefreshInterval, SIGNAL(valueChanged(int )), this, SLOT(on_spnRefreshInterval_valueChanged(int)));
|
connect(options_page->spnRefreshInterval, SIGNAL(valueChanged(int )), this, SLOT(on_spnRefreshInterval_valueChanged(int)));
|
||||||
|
|
||||||
setYAxisWidgetFromPlotCurve();
|
setYAxisWidgetFromPlotCurve();
|
||||||
@ -132,11 +134,47 @@ QWidget* ScopeGadgetOptionsPage::createPage(QWidget *parent)
|
|||||||
connect(options_page->LoggingEnable, SIGNAL(clicked()), this, SLOT(on_loggingEnable_clicked()));
|
connect(options_page->LoggingEnable, SIGNAL(clicked()), this, SLOT(on_loggingEnable_clicked()));
|
||||||
on_loggingEnable_clicked();
|
on_loggingEnable_clicked();
|
||||||
|
|
||||||
|
//Disable mouse wheel events
|
||||||
|
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
||||||
|
sp->installEventFilter( this );
|
||||||
|
}
|
||||||
|
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
||||||
|
sp->installEventFilter( this );
|
||||||
|
}
|
||||||
|
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
||||||
|
sp->installEventFilter( this );
|
||||||
|
}
|
||||||
|
foreach( QComboBox * sp, findChildren<QComboBox*>() ) {
|
||||||
|
sp->installEventFilter( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return optionsPageWidget;
|
return optionsPageWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScopeGadgetOptionsPage::eventFilter( QObject * obj, QEvent * evt ) {
|
||||||
|
//Filter all wheel events, and ignore them
|
||||||
|
if ( evt->type() == QEvent::Wheel &&
|
||||||
|
(qobject_cast<QAbstractSpinBox*>( obj ) ||
|
||||||
|
qobject_cast<QComboBox*>( obj ) ||
|
||||||
|
qobject_cast<QAbstractSlider*>( obj ) ))
|
||||||
|
{
|
||||||
|
evt->ignore();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return ScopeGadgetOptionsPage::eventFilter( obj, evt );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScopeGadgetOptionsPage::on_mathFunctionComboBox_currentIndexChanged(int currentIndex){
|
||||||
|
if (currentIndex > 0){
|
||||||
|
options_page->spnMeanSamples->setEnabled(true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
options_page->spnMeanSamples->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ScopeGadgetOptionsPage::on_btnColor_clicked()
|
void ScopeGadgetOptionsPage::on_btnColor_clicked()
|
||||||
{
|
{
|
||||||
QColor color = QColorDialog::getColor( QColor(options_page->btnColor->text()));
|
QColor color = QColorDialog::getColor( QColor(options_page->btnColor->text()));
|
||||||
|
@ -71,6 +71,7 @@ private:
|
|||||||
void setYAxisWidgetFromPlotCurve();
|
void setYAxisWidgetFromPlotCurve();
|
||||||
void setButtonColor(const QColor &color);
|
void setButtonColor(const QColor &color);
|
||||||
void validateRefreshInterval();
|
void validateRefreshInterval();
|
||||||
|
bool eventFilter( QObject * obj, QEvent * evt );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_spnRefreshInterval_valueChanged(int );
|
void on_spnRefreshInterval_valueChanged(int );
|
||||||
@ -79,6 +80,7 @@ private slots:
|
|||||||
void on_btnAddCurve_clicked();
|
void on_btnAddCurve_clicked();
|
||||||
void on_cmbUAVObjects_currentIndexChanged(QString val);
|
void on_cmbUAVObjects_currentIndexChanged(QString val);
|
||||||
void on_btnColor_clicked();
|
void on_btnColor_clicked();
|
||||||
|
void on_mathFunctionComboBox_currentIndexChanged(int currentIndex);
|
||||||
void on_loggingEnable_clicked();
|
void on_loggingEnable_clicked();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -100,7 +100,11 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="cmbPlotType"/>
|
<widget class="QComboBox" name="cmbPlotType">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
@ -111,6 +115,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSpinBox" name="spnDataSize">
|
<widget class="QSpinBox" name="spnDataSize">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> seconds</string>
|
<string> seconds</string>
|
||||||
</property>
|
</property>
|
||||||
@ -134,6 +141,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QSpinBox" name="spnRefreshInterval">
|
<widget class="QSpinBox" name="spnRefreshInterval">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string>ms</string>
|
<string>ms</string>
|
||||||
</property>
|
</property>
|
||||||
@ -161,7 +171,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Plot curves</string>
|
<string>Y-axis</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -173,7 +183,11 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QComboBox" name="cmbUAVObjects"/>
|
<widget class="QComboBox" name="cmbUAVObjects">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
@ -183,45 +197,67 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QComboBox" name="cmbUAVField"/>
|
<widget class="QComboBox" name="cmbUAVField">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="9" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Color:</string>
|
<string>Color:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="9" column="1">
|
||||||
<widget class="QPushButton" name="btnColor">
|
<widget class="QPushButton" name="btnColor">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Choose</string>
|
<string>Choose</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="10" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Y-axis scale factor:</string>
|
<string>Y-axis scale factor:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1">
|
<item row="10" column="1">
|
||||||
<widget class="QComboBox" name="cmbScale">
|
<widget class="QComboBox" name="cmbScale">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QLabel" name="label_10">
|
<widget class="QLabel" name="label_10">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Display moving average:</string>
|
<string>Math window size</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="QSpinBox" name="spnMeanSamples">
|
<widget class="QSpinBox" name="spnMeanSamples">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> samples</string>
|
<string> samples</string>
|
||||||
</property>
|
</property>
|
||||||
@ -247,7 +283,11 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QComboBox" name="mathFunctionComboBox"/>
|
<widget class="QComboBox" name="mathFunctionComboBox">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@ -400,6 +440,22 @@ Update</string>
|
|||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>cmbPlotType</tabstop>
|
||||||
|
<tabstop>spnDataSize</tabstop>
|
||||||
|
<tabstop>spnRefreshInterval</tabstop>
|
||||||
|
<tabstop>cmbUAVObjects</tabstop>
|
||||||
|
<tabstop>cmbUAVField</tabstop>
|
||||||
|
<tabstop>mathFunctionComboBox</tabstop>
|
||||||
|
<tabstop>spnMeanSamples</tabstop>
|
||||||
|
<tabstop>btnColor</tabstop>
|
||||||
|
<tabstop>cmbScale</tabstop>
|
||||||
|
<tabstop>btnAddCurve</tabstop>
|
||||||
|
<tabstop>btnRemoveCurve</tabstop>
|
||||||
|
<tabstop>lstCurves</tabstop>
|
||||||
|
<tabstop>LoggingEnable</tabstop>
|
||||||
|
<tabstop>LoggingConnect</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -142,7 +142,7 @@ void ScopeGadgetWidget::mouseMoveEvent(QMouseEvent *e)
|
|||||||
|
|
||||||
void ScopeGadgetWidget::wheelEvent(QWheelEvent *e)
|
void ScopeGadgetWidget::wheelEvent(QWheelEvent *e)
|
||||||
{
|
{
|
||||||
QwtPlot::wheelEvent(e);
|
QwtPlot::wheelEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user