summaryrefslogtreecommitdiffhomepage
path: root/video-ps3eye/module.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2020-06-13 02:25:31 +0200
committerStanislaw Halik <sthalik@misaki.pl>2020-06-13 02:25:31 +0200
commit9a959381f412bbc8e761cdceb9237aa5ba664e48 (patch)
tree87d43a60c53697dd29b135c938fd73536df86e11 /video-ps3eye/module.cpp
parent5adb85b446cd02d89e3b0b216b7e13b4c255704f (diff)
Revert "video/ps3eye: don't reset sensor that much"
Causes lag and eventually crashes in Qt timer subsystem. This reverts commit 58d857673ed0fdd801da53b7c7b6dec1dc26d60a.
Diffstat (limited to 'video-ps3eye/module.cpp')
-rw-r--r--video-ps3eye/module.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/video-ps3eye/module.cpp b/video-ps3eye/module.cpp
index 812e523c..7266dc53 100644
--- a/video-ps3eye/module.cpp
+++ b/video-ps3eye/module.cpp
@@ -247,19 +247,16 @@ OTR_REGISTER_CAMERA(ps3eye_camera_)
dialog::dialog(QWidget* parent) : QWidget(parent)
{
ui.setupUi(this);
- t.setSingleShot(true);
- t.setInterval(500);
tie_setting(s.exposure, ui.exposure_slider);
tie_setting(s.gain, ui.gain_slider);
ui.exposure_label->setValue((int)*s.exposure);
ui.gain_label->setValue((int)*s.gain);
- connect(&s.exposure, value_::value_changed<slider_value>(), this, [this](const slider_value&) { s.set_exposure(); t.stop(); t.start(); });
- connect(&s.gain, value_::value_changed<slider_value>(), this, [this](const slider_value&) { s.set_gain(); t.stop(); t.start(); });
+ connect(&s.exposure, value_::value_changed<slider_value>(), this, [this](const slider_value&) { s.set_exposure(); });
+ connect(&s.gain, value_::value_changed<slider_value>(), this, [this](const slider_value&) { s.set_gain(); });
connect(ui.exposure_slider, &QSlider::valueChanged, ui.exposure_label, &QSpinBox::setValue);
connect(ui.gain_slider, &QSlider::valueChanged, ui.gain_label, &QSpinBox::setValue);
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &dialog::do_ok);
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &dialog::do_cancel);
- connect(&t, &QTimer::timeout, this, [this]() { s.apply(); });
}
// XXX copypasta -sh 20200329
@@ -270,7 +267,7 @@ void settings::set_gain()
auto& ptr = *(ps3eye::shm volatile*)shm.ptr();
ptr.in.gain = (unsigned char)*gain;
- //++ptr.in.settings_updated;
+ ++ptr.in.settings_updated;
std::atomic_thread_fence(std::memory_order_seq_cst);
}
@@ -281,16 +278,6 @@ void settings::set_exposure()
auto& ptr = *(ps3eye::shm volatile*)shm.ptr();
ptr.in.exposure = (unsigned char)*exposure;
- //++ptr.in.settings_updated;
- std::atomic_thread_fence(std::memory_order_seq_cst);
-}
-
-void settings::apply()
-{
- if (!shm.success())
- return;
-
- auto& ptr = *(ps3eye::shm volatile*)shm.ptr();
++ptr.in.settings_updated;
std::atomic_thread_fence(std::memory_order_seq_cst);
}