mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
OP-1611 Addressed some review comments and changed logic around plots wanting initial data.
This commit is contained in:
parent
6c476d2a58
commit
8a11c588a6
@ -201,6 +201,10 @@ QwtPlotMarker *PlotData::createMarker(QString value)
|
||||
|
||||
bool SequentialPlotData::append(UAVObject *obj)
|
||||
{
|
||||
if (obj == NULL) {
|
||||
obj = m_object;
|
||||
}
|
||||
|
||||
if (m_object == obj && m_field) {
|
||||
if (!m_isEnumPlot) {
|
||||
double currentValue = m_field->getValue(m_element).toDouble() * pow(10, m_scalePower);
|
||||
@ -241,6 +245,10 @@ bool SequentialPlotData::append(UAVObject *obj)
|
||||
|
||||
bool ChronoPlotData::append(UAVObject *obj)
|
||||
{
|
||||
if (obj == NULL) {
|
||||
obj = m_object;
|
||||
}
|
||||
|
||||
if (m_object == obj && m_field) {
|
||||
// Get the field of interest
|
||||
// THINK ABOUT REIMPLEMENTING THIS TO SHOW UAVO TIME, NOT SYSTEM TIME
|
||||
|
@ -47,7 +47,7 @@ void ScopeGadget::loadConfiguration(IUAVGadgetConfiguration *config)
|
||||
ScopeGadgetConfiguration *sgConfig = qobject_cast<ScopeGadgetConfiguration *>(config);
|
||||
ScopeGadgetWidget *widget = qobject_cast<ScopeGadgetWidget *>(m_widget);
|
||||
|
||||
widget->setName(config->name());
|
||||
widget->setObjectName(config->name());
|
||||
widget->setPlotDataSize(sgConfig->dataSize());
|
||||
widget->setRefreshInterval(sgConfig->refreshInterval());
|
||||
|
||||
|
@ -195,6 +195,11 @@ void ScopeGadgetWidget::showEvent(QShowEvent *e)
|
||||
void ScopeGadgetWidget::startPlotting()
|
||||
{
|
||||
if (replotTimer && !replotTimer->isActive()) {
|
||||
foreach (PlotData *plot, m_curvesData.values()) {
|
||||
if (plot->wantsInitialData()) {
|
||||
plot->append(NULL);
|
||||
}
|
||||
}
|
||||
replotTimer->start(m_refreshInterval);
|
||||
}
|
||||
}
|
||||
@ -378,10 +383,6 @@ void ScopeGadgetWidget::addCurvePlot(QString objectName, QString fieldPlusSubFie
|
||||
connect(this, SIGNAL(visibilityChanged(QwtPlotItem *)), plotData, SLOT(visibilityChanged(QwtPlotItem *)));
|
||||
plotData->attach(this);
|
||||
|
||||
if (plotData->wantsInitialData()) {
|
||||
plotData->append(object);
|
||||
}
|
||||
|
||||
// Keep the curve details for later
|
||||
m_curvesData.insert(plotData->plotName(), plotData);
|
||||
|
||||
@ -671,5 +672,5 @@ void ScopeGadgetWidget::copyToClipboardAsImage()
|
||||
|
||||
void ScopeGadgetWidget::showOptionDialog()
|
||||
{
|
||||
Core::ICore::instance()->showOptionsDialog("ScopeGadget", m_name);
|
||||
Core::ICore::instance()->showOptionsDialog("ScopeGadget", objectName());
|
||||
}
|
||||
|
@ -69,7 +69,6 @@ public:
|
||||
ScopeGadgetWidget(QWidget *parent = 0);
|
||||
~ScopeGadgetWidget();
|
||||
|
||||
void setName (QString name) { m_name = name; }
|
||||
void setupSequentialPlot();
|
||||
void setupChronoPlot();
|
||||
void setupUAVObjectPlot();
|
||||
@ -148,7 +147,6 @@ private:
|
||||
void preparePlot(PlotType plotType);
|
||||
void setupExamplePlot();
|
||||
|
||||
QString m_name;
|
||||
PlotType m_plotType;
|
||||
|
||||
double m_plotDataSize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user