mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +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);
|
||||
|
||||
//Compute boxcar average
|
||||
if (meanSamples > 1){
|
||||
if (mathFunction == "Boxcar average" || mathFunction == "Standard deviation"){
|
||||
//Put the new value at the front
|
||||
yDataHistory->append( currentValue );
|
||||
|
||||
|
@ -144,45 +144,44 @@ IUAVGadgetConfiguration *ScopeGadgetConfiguration::clone()
|
||||
}
|
||||
|
||||
|
||||
////THIS SEEMS TO BE UNUSED
|
||||
///**
|
||||
// * Saves a configuration.
|
||||
// *
|
||||
// */
|
||||
//void ScopeGadgetConfiguration::saveConfig(QSettings* qSettings) const {
|
||||
/**
|
||||
* Saves a configuration. //REDEFINES saveConfig CHILD BEHAVIOR?
|
||||
*
|
||||
*/
|
||||
void ScopeGadgetConfiguration::saveConfig(QSettings* qSettings) const {
|
||||
|
||||
// int plotCurveCount = m_PlotCurveConfigs.size();
|
||||
// int plotDatasLoadIndex = 0;
|
||||
int plotCurveCount = m_PlotCurveConfigs.size();
|
||||
int plotDatasLoadIndex = 0;
|
||||
|
||||
// qSettings->setValue("configurationStreamVersion", m_configurationStreamVersion);
|
||||
// qSettings->setValue("plotType", m_plotType);
|
||||
// qSettings->setValue("dataSize", m_dataSize);
|
||||
// qSettings->setValue("refreshInterval", m_refreshInterval);
|
||||
// qSettings->setValue("plotCurveCount", plotCurveCount);
|
||||
qSettings->setValue("configurationStreamVersion", m_configurationStreamVersion);
|
||||
qSettings->setValue("plotType", m_plotType);
|
||||
qSettings->setValue("dataSize", m_dataSize);
|
||||
qSettings->setValue("refreshInterval", m_refreshInterval);
|
||||
qSettings->setValue("plotCurveCount", plotCurveCount);
|
||||
|
||||
// for(plotDatasLoadIndex = 0; plotDatasLoadIndex < plotCurveCount; plotDatasLoadIndex++)
|
||||
// {
|
||||
// qSettings->beginGroup(QString("plotCurve") + QString().number(plotDatasLoadIndex));
|
||||
for(plotDatasLoadIndex = 0; plotDatasLoadIndex < plotCurveCount; plotDatasLoadIndex++)
|
||||
{
|
||||
qSettings->beginGroup(QString("plotCurve") + QString().number(plotDatasLoadIndex));
|
||||
|
||||
// PlotCurveConfiguration* plotCurveConf = m_PlotCurveConfigs.at(plotDatasLoadIndex);
|
||||
// qSettings->setValue("uavObject", plotCurveConf->uavObject);
|
||||
// qSettings->setValue("uavField", plotCurveConf->uavField);
|
||||
// qSettings->setValue("color", plotCurveConf->color);
|
||||
// qSettings->setValue("mathFunction", plotCurveConf->mathFunction);
|
||||
// qSettings->setValue("yScalePower", plotCurveConf->yScalePower);
|
||||
// qSettings->setValue("yMeanSamples", plotCurveConf->yMeanSamples);
|
||||
// qSettings->setValue("yMinimum", plotCurveConf->yMinimum);
|
||||
// qSettings->setValue("yMaximum", plotCurveConf->yMaximum);
|
||||
PlotCurveConfiguration* plotCurveConf = m_PlotCurveConfigs.at(plotDatasLoadIndex);
|
||||
qSettings->setValue("uavObject", plotCurveConf->uavObject);
|
||||
qSettings->setValue("uavField", plotCurveConf->uavField);
|
||||
qSettings->setValue("color", plotCurveConf->color);
|
||||
qSettings->setValue("mathFunction", plotCurveConf->mathFunction);
|
||||
qSettings->setValue("yScalePower", plotCurveConf->yScalePower);
|
||||
qSettings->setValue("yMeanSamples", plotCurveConf->yMeanSamples);
|
||||
qSettings->setValue("yMinimum", plotCurveConf->yMinimum);
|
||||
qSettings->setValue("yMaximum", plotCurveConf->yMaximum);
|
||||
|
||||
// qSettings->endGroup();
|
||||
// }
|
||||
qSettings->endGroup();
|
||||
}
|
||||
|
||||
// qSettings->setValue("LoggingEnabled", m_LoggingEnabled);
|
||||
// qSettings->setValue("LoggingNewFileOnConnect", m_LoggingNewFileOnConnect);
|
||||
// qSettings->setValue("LoggingPath", m_LoggingPath);
|
||||
qSettings->setValue("LoggingEnabled", m_LoggingEnabled);
|
||||
qSettings->setValue("LoggingNewFileOnConnect", m_LoggingNewFileOnConnect);
|
||||
qSettings->setValue("LoggingPath", m_LoggingPath);
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
void ScopeGadgetConfiguration::replacePlotCurveConfig(QList<PlotCurveConfiguration*> newPlotCurveConfigs)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
int refreshInterval(){return m_refreshInterval;}
|
||||
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();
|
||||
|
||||
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)));
|
||||
|
||||
options_page->mathFunctionComboBox->addItem("None");
|
||||
options_page->mathFunctionComboBox->addItem("Boxcar average");
|
||||
options_page->mathFunctionComboBox->addItem("Standard deviation");
|
||||
|
||||
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->lstCurves, SIGNAL(currentRowChanged(int)), this, SLOT(on_lstCurves_currentRowChanged(int)));
|
||||
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)));
|
||||
|
||||
setYAxisWidgetFromPlotCurve();
|
||||
@ -132,11 +134,47 @@ QWidget* ScopeGadgetOptionsPage::createPage(QWidget *parent)
|
||||
connect(options_page->LoggingEnable, SIGNAL(clicked()), this, SLOT(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;
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
QColor color = QColorDialog::getColor( QColor(options_page->btnColor->text()));
|
||||
|
@ -71,6 +71,7 @@ private:
|
||||
void setYAxisWidgetFromPlotCurve();
|
||||
void setButtonColor(const QColor &color);
|
||||
void validateRefreshInterval();
|
||||
bool eventFilter( QObject * obj, QEvent * evt );
|
||||
|
||||
private slots:
|
||||
void on_spnRefreshInterval_valueChanged(int );
|
||||
@ -79,6 +80,7 @@ private slots:
|
||||
void on_btnAddCurve_clicked();
|
||||
void on_cmbUAVObjects_currentIndexChanged(QString val);
|
||||
void on_btnColor_clicked();
|
||||
void on_mathFunctionComboBox_currentIndexChanged(int currentIndex);
|
||||
void on_loggingEnable_clicked();
|
||||
|
||||
};
|
||||
|
@ -100,7 +100,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<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 row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
@ -111,6 +115,9 @@
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="spnDataSize">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> seconds</string>
|
||||
</property>
|
||||
@ -134,6 +141,9 @@
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="spnRefreshInterval">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
@ -161,7 +171,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Plot curves</string>
|
||||
<string>Y-axis</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -173,7 +183,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<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 row="6" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
@ -183,45 +197,67 @@
|
||||
</widget>
|
||||
</item>
|
||||
<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 row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QPushButton" name="btnColor">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Choose</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Y-axis scale factor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QComboBox" name="cmbScale">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Display moving average:</string>
|
||||
<string>Math window size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="8" column="1">
|
||||
<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">
|
||||
<string> samples</string>
|
||||
</property>
|
||||
@ -247,7 +283,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
@ -400,6 +440,22 @@ Update</string>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</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/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -142,7 +142,7 @@ void ScopeGadgetWidget::mouseMoveEvent(QMouseEvent *e)
|
||||
|
||||
void ScopeGadgetWidget::wheelEvent(QWheelEvent *e)
|
||||
{
|
||||
QwtPlot::wheelEvent(e);
|
||||
QwtPlot::wheelEvent(e);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user