Add delay ability to sensor actor
This commit is contained in:
parent
8db0ac7290
commit
8e33897d29
4 changed files with 94 additions and 43 deletions
|
|
@ -108,6 +108,9 @@ QString SensorActor::getName() const
|
||||||
else if (sloap_ == SLOPE_BOTH) string.append(" passes ");
|
else if (sloap_ == SLOPE_BOTH) string.append(" passes ");
|
||||||
|
|
||||||
string.append(QString::number(threshold_) + " ");
|
string.append(QString::number(threshold_) + " ");
|
||||||
|
|
||||||
|
if(delayMs_ > 0) string.append("(+" + QString::number(delayMs_) + "ms) ");
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,12 @@ SensorActorWidget::SensorActorWidget(std::shared_ptr<SensorActor> sensorActor, S
|
||||||
|
|
||||||
ui->doubleSpinBox_threshold->setValue(sensorActor_->getThreshold());
|
ui->doubleSpinBox_threshold->setValue(sensorActor_->getThreshold());
|
||||||
|
|
||||||
|
ui->spinBox_delay->setValue(sensorActor_->getDelayMs());
|
||||||
|
|
||||||
connect(ui->listView, &SensorListWidget::clicked, this, &SensorActorWidget::setSensor);
|
connect(ui->listView, &SensorListWidget::clicked, this, &SensorActorWidget::setSensor);
|
||||||
connect(ui->doubleSpinBox_threshold, SIGNAL(valueChanged(double)), this, SLOT(setThreshold(double)));
|
connect(ui->doubleSpinBox_threshold, SIGNAL(valueChanged(double)), this, SLOT(setThreshold(double)));
|
||||||
connect(ui->comboBox_slope, SIGNAL(currentIndexChanged(int)), this, SLOT(setSlope(int)));
|
connect(ui->comboBox_slope, SIGNAL(currentIndexChanged(int)), this, SLOT(setSlope(int)));
|
||||||
|
connect(ui->spinBox_delay, SIGNAL(valueChanged(int)), this, SLOT(setDelay(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
SensorActorWidget::~SensorActorWidget()
|
SensorActorWidget::~SensorActorWidget()
|
||||||
|
|
@ -52,3 +55,8 @@ void SensorActorWidget::setSensor(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
sensorActor_->setSensor(ui->listView->getSensorForIndex(index));
|
sensorActor_->setSensor(ui->listView->getSensorForIndex(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SensorActorWidget::setDelay(int ms)
|
||||||
|
{
|
||||||
|
sensorActor_->setDelayMs(ms);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ private slots:
|
||||||
void setThreshold(double in);
|
void setThreshold(double in);
|
||||||
void setSlope(int index);
|
void setSlope(int index);
|
||||||
void setSensor(const QModelIndex &index);
|
void setSensor(const QModelIndex &index);
|
||||||
|
void setDelay(int ms);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SensorActorWidget *ui;
|
Ui::SensorActorWidget *ui;
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item>
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0" colspan="4">
|
||||||
<widget class="SensorListWidget" name="listView">
|
<widget class="SensorListWidget" name="listView">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
|
@ -37,16 +37,27 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Threshold</string>
|
<string>Threshold</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="1">
|
||||||
|
<spacer name="horizontalSpacer_threshold">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
<widget class="QComboBox" name="comboBox_slope">
|
<widget class="QComboBox" name="comboBox_slope">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
|
@ -71,7 +82,7 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="3">
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_threshold">
|
<widget class="QDoubleSpinBox" name="doubleSpinBox_threshold">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<double>-9999.989999999999782</double>
|
<double>-9999.989999999999782</double>
|
||||||
|
|
@ -81,7 +92,35 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_delay">
|
||||||
|
<property name="text">
|
||||||
|
<string>Delay</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<spacer name="horizontalSpacer_delay">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="3">
|
||||||
|
<widget class="QSpinBox" name="spinBox_delay">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> ms</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>9999999</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
@ -89,7 +128,7 @@
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>SensorListWidget</class>
|
<class>SensorListWidget</class>
|
||||||
<extends>QListView</extends>
|
<extends>QListView</extends>
|
||||||
<header location="local">ui/sensorlistwidget.h</header>
|
<header>ui/sensorlistwidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue