forked from Ivasoft/DSView
improve synchronism between between data acquisition and wave display
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -39,6 +39,8 @@ DSView/DSView
|
|||||||
DSView/install_manifest.txt
|
DSView/install_manifest.txt
|
||||||
DSView/qrc_DSView.cpp
|
DSView/qrc_DSView.cpp
|
||||||
DSView/qrc_style.cpp
|
DSView/qrc_style.cpp
|
||||||
|
DSView/qrc_breeze.cpp
|
||||||
|
DSView/qrc_language.cpp
|
||||||
|
|
||||||
moc_*.cpp
|
moc_*.cpp
|
||||||
moc_*.cpp_parameters
|
moc_*.cpp_parameters
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ void DsoSnapshot::enable_envelope(bool enable)
|
|||||||
const uint8_t *DsoSnapshot::get_samples(
|
const uint8_t *DsoSnapshot::get_samples(
|
||||||
int64_t start_sample, int64_t end_sample, uint16_t index) const
|
int64_t start_sample, int64_t end_sample, uint16_t index) const
|
||||||
{
|
{
|
||||||
|
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||||
(void)end_sample;
|
(void)end_sample;
|
||||||
|
|
||||||
assert(start_sample >= 0);
|
assert(start_sample >= 0);
|
||||||
|
|||||||
@@ -109,10 +109,13 @@ void MathStack::free_envelop()
|
|||||||
|
|
||||||
void MathStack::clear()
|
void MathStack::clear()
|
||||||
{
|
{
|
||||||
|
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MathStack::init()
|
void MathStack::init()
|
||||||
{
|
{
|
||||||
|
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||||
|
|
||||||
_sample_num = 0;
|
_sample_num = 0;
|
||||||
_envelope_done = false;
|
_envelope_done = false;
|
||||||
}
|
}
|
||||||
@@ -312,6 +315,8 @@ void MathStack::get_math_envelope_section(EnvelopeSection &s,
|
|||||||
|
|
||||||
void MathStack::calc_math()
|
void MathStack::calc_math()
|
||||||
{
|
{
|
||||||
|
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||||
|
|
||||||
_math_state = Running;
|
_math_state = Running;
|
||||||
|
|
||||||
const boost::shared_ptr<pv::data::Dso> data = _dsoSig1->dso_data();
|
const boost::shared_ptr<pv::data::Dso> data = _dsoSig1->dso_data();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#define DSVIEW_PV_DATA_SIGNALDATA_H
|
#define DSVIEW_PV_DATA_SIGNALDATA_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
namespace pv {
|
namespace pv {
|
||||||
namespace data {
|
namespace data {
|
||||||
@@ -43,6 +44,8 @@ public:
|
|||||||
virtual void init() = 0;
|
virtual void init() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
mutable boost::recursive_mutex _mutex;
|
||||||
|
|
||||||
double _samplerate;
|
double _samplerate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ SigSession::SigSession(DeviceManager &device_manager) :
|
|||||||
_hot_detach = false;
|
_hot_detach = false;
|
||||||
_group_cnt = 0;
|
_group_cnt = 0;
|
||||||
register_hotplug_callback();
|
register_hotplug_callback();
|
||||||
_view_timer.stop();
|
_feed_timer.stop();
|
||||||
_noData_cnt = 0;
|
_noData_cnt = 0;
|
||||||
_data_lock = false;
|
_data_lock = false;
|
||||||
_data_updated = false;
|
_data_updated = false;
|
||||||
@@ -129,7 +129,7 @@ SigSession::SigSession(DeviceManager &device_manager) :
|
|||||||
_group_data.reset(new data::Group());
|
_group_data.reset(new data::Group());
|
||||||
_group_cnt = 0;
|
_group_cnt = 0;
|
||||||
|
|
||||||
connect(&_view_timer, SIGNAL(timeout()), this, SLOT(check_update()));
|
connect(&_feed_timer, SIGNAL(timeout()), this, SLOT(data_unlock()));
|
||||||
}
|
}
|
||||||
|
|
||||||
SigSession::~SigSession()
|
SigSession::~SigSession()
|
||||||
@@ -354,9 +354,10 @@ void SigSession::capture_init()
|
|||||||
_trigger_flag = false;
|
_trigger_flag = false;
|
||||||
_hw_replied = false;
|
_hw_replied = false;
|
||||||
if (_dev_inst->dev_inst()->mode != LOGIC)
|
if (_dev_inst->dev_inst()->mode != LOGIC)
|
||||||
_view_timer.start(ViewTime);
|
_feed_timer.start(FeedInterval);
|
||||||
else
|
else
|
||||||
_view_timer.stop();
|
_feed_timer.stop();
|
||||||
|
|
||||||
_noData_cnt = 0;
|
_noData_cnt = 0;
|
||||||
data_unlock();
|
data_unlock();
|
||||||
|
|
||||||
@@ -587,7 +588,9 @@ void SigSession::sample_thread_proc(boost::shared_ptr<device::DevInst> dev_inst,
|
|||||||
|
|
||||||
void SigSession::check_update()
|
void SigSession::check_update()
|
||||||
{
|
{
|
||||||
data_unlock();
|
boost::lock_guard<boost::mutex> lock(_data_mutex);
|
||||||
|
|
||||||
|
//data_unlock(); unlock after wave rendering
|
||||||
if (_capture_state != Running)
|
if (_capture_state != Running)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -597,7 +600,7 @@ void SigSession::check_update()
|
|||||||
_noData_cnt = 0;
|
_noData_cnt = 0;
|
||||||
data_auto_unlock();
|
data_auto_unlock();
|
||||||
} else {
|
} else {
|
||||||
if (++_noData_cnt >= (WaitShowTime/ViewTime))
|
if (++_noData_cnt >= (WaitShowTime/FeedInterval))
|
||||||
nodata_timeout();
|
nodata_timeout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1070,7 +1073,7 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso)
|
|||||||
|
|
||||||
_trigger_flag = dso.trig_flag;
|
_trigger_flag = dso.trig_flag;
|
||||||
receive_data(dso.num_samples);
|
receive_data(dso.num_samples);
|
||||||
//data_updated();
|
|
||||||
if (!_instant)
|
if (!_instant)
|
||||||
data_lock();
|
data_lock();
|
||||||
_data_updated = true;
|
_data_updated = true;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ private:
|
|||||||
static const int RepeatHoldDiv = 20;
|
static const int RepeatHoldDiv = 20;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int ViewTime = 50;
|
static const int FeedInterval = 50;
|
||||||
static const int WaitShowTime = 500;
|
static const int WaitShowTime = 500;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -337,7 +337,7 @@ private:
|
|||||||
bool _hot_attach;
|
bool _hot_attach;
|
||||||
bool _hot_detach;
|
bool _hot_detach;
|
||||||
|
|
||||||
QTimer _view_timer;
|
QTimer _feed_timer;
|
||||||
int _noData_cnt;
|
int _noData_cnt;
|
||||||
bool _data_lock;
|
bool _data_lock;
|
||||||
bool _data_updated;
|
bool _data_updated;
|
||||||
@@ -413,6 +413,7 @@ public slots:
|
|||||||
void reload();
|
void reload();
|
||||||
void refresh(int holdtime);
|
void refresh(int holdtime);
|
||||||
void stop_capture();
|
void stop_capture();
|
||||||
|
void check_update();
|
||||||
// repeat
|
// repeat
|
||||||
void set_repeating(bool repeat);
|
void set_repeating(bool repeat);
|
||||||
void set_map_zoom(int index);
|
void set_map_zoom(int index);
|
||||||
@@ -422,7 +423,6 @@ public slots:
|
|||||||
private slots:
|
private slots:
|
||||||
void data_lock();
|
void data_lock();
|
||||||
void data_unlock();
|
void data_unlock();
|
||||||
void check_update();
|
|
||||||
void nodata_timeout();
|
void nodata_timeout();
|
||||||
void repeat_update();
|
void repeat_update();
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ void Viewport::paintEvent(QPaintEvent *event)
|
|||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
||||||
|
|
||||||
|
_view.session().check_update();
|
||||||
QColor fore(QWidget::palette().color(QWidget::foregroundRole()));
|
QColor fore(QWidget::palette().color(QWidget::foregroundRole()));
|
||||||
QColor back(QWidget::palette().color(QWidget::backgroundRole()));
|
QColor back(QWidget::palette().color(QWidget::backgroundRole()));
|
||||||
fore.setAlpha(View::ForeAlpha);
|
fore.setAlpha(View::ForeAlpha);
|
||||||
@@ -328,7 +329,7 @@ void Viewport::paintSignals(QPainter &p, QColor fore, QColor back)
|
|||||||
} else if (_waiting_trig > 0) {
|
} else if (_waiting_trig > 0) {
|
||||||
type_str = "Waiting Trig";
|
type_str = "Waiting Trig";
|
||||||
for (int i = 1; i < _waiting_trig; i++)
|
for (int i = 1; i < _waiting_trig; i++)
|
||||||
if (i % (WaitLoopTime / SigSession::ViewTime) == 0)
|
if (i % (WaitLoopTime / SigSession::FeedInterval) == 0)
|
||||||
type_str += ".";
|
type_str += ".";
|
||||||
} else {
|
} else {
|
||||||
type_str = "Trig'd";
|
type_str = "Trig'd";
|
||||||
@@ -1613,7 +1614,7 @@ void Viewport::set_need_update(bool update)
|
|||||||
|
|
||||||
void Viewport::show_wait_trigger()
|
void Viewport::show_wait_trigger()
|
||||||
{
|
{
|
||||||
_waiting_trig %= (WaitLoopTime / SigSession::ViewTime) * 4;
|
_waiting_trig %= (WaitLoopTime / SigSession::FeedInterval) * 4;
|
||||||
_waiting_trig++;
|
_waiting_trig++;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user