Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raptor Engineering Public Development
dsview
Commits
1b6f16bf
Commit
1b6f16bf
authored
May 15, 2016
by
DreamSourceLab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve decode progress and content display @ LA mode
parent
f8b2d1e4
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
273 additions
and
132 deletions
+273
-132
DSView/pv/data/decoderstack.cpp
DSView/pv/data/decoderstack.cpp
+1
-1
DSView/pv/dock/protocoldock.cpp
DSView/pv/dock/protocoldock.cpp
+32
-1
DSView/pv/dock/protocoldock.h
DSView/pv/dock/protocoldock.h
+2
-0
DSView/pv/dock/triggerdock.cpp
DSView/pv/dock/triggerdock.cpp
+6
-4
DSView/pv/dock/triggerdock.h
DSView/pv/dock/triggerdock.h
+3
-0
DSView/pv/mainwindow.cpp
DSView/pv/mainwindow.cpp
+15
-4
DSView/pv/mainwindow.h
DSView/pv/mainwindow.h
+5
-0
DSView/pv/sigsession.cpp
DSView/pv/sigsession.cpp
+72
-13
DSView/pv/sigsession.h
DSView/pv/sigsession.h
+9
-1
DSView/pv/storesession.cpp
DSView/pv/storesession.cpp
+7
-2
DSView/pv/toolbars/samplingbar.cpp
DSView/pv/toolbars/samplingbar.cpp
+1
-20
DSView/pv/toolbars/samplingbar.h
DSView/pv/toolbars/samplingbar.h
+0
-1
DSView/pv/view/cursor.cpp
DSView/pv/view/cursor.cpp
+4
-4
DSView/pv/view/decodetrace.cpp
DSView/pv/view/decodetrace.cpp
+19
-4
DSView/pv/view/decodetrace.h
DSView/pv/view/decodetrace.h
+6
-0
DSView/pv/view/dsosignal.cpp
DSView/pv/view/dsosignal.cpp
+6
-6
DSView/pv/view/mathtrace.cpp
DSView/pv/view/mathtrace.cpp
+2
-2
DSView/pv/view/ruler.cpp
DSView/pv/view/ruler.cpp
+3
-3
DSView/pv/view/timemarker.cpp
DSView/pv/view/timemarker.cpp
+1
-1
DSView/pv/view/view.cpp
DSView/pv/view/view.cpp
+25
-20
DSView/pv/view/view.h
DSView/pv/view/view.h
+1
-1
DSView/pv/view/viewport.cpp
DSView/pv/view/viewport.cpp
+15
-15
libsigrok4DSL/hardware/DSL/dslogic.c
libsigrok4DSL/hardware/DSL/dslogic.c
+27
-29
libsigrok4DSL/proto.h
libsigrok4DSL/proto.h
+1
-0
libsigrok4DSL/trigger.c
libsigrok4DSL/trigger.c
+10
-0
No files found.
DSView/pv/data/decoderstack.cpp
View file @
1b6f16bf
...
...
@@ -332,6 +332,7 @@ void DecoderStack::clear()
_sample_count
=
0
;
_frame_complete
=
false
;
_samples_decoded
=
0
;
//new_decode_data();
_error_message
=
QString
();
for
(
map
<
const
Row
,
RowData
>::
const_iterator
i
=
_rows
.
begin
();
i
!=
_rows
.
end
();
i
++
)
...
...
@@ -468,7 +469,6 @@ void DecoderStack::decode_data(
}
_options_changed
=
false
;
decode_done
();
//new_decode_data();
}
void
DecoderStack
::
decode_proc
()
...
...
DSView/pv/dock/protocoldock.cpp
View file @
1b6f16bf
...
...
@@ -200,6 +200,7 @@ void ProtocolDock::add_protocol()
_set_button
->
setIcon
(
QIcon
::
fromTheme
(
"protocol"
,
QIcon
(
":/icons/gear.png"
)));
QLabel
*
_protocol_label
=
new
QLabel
(
_up_widget
);
QLabel
*
_progress_label
=
new
QLabel
(
_up_widget
);
_del_button
->
setCheckable
(
true
);
_protocol_label
->
setText
(
_protocol_combobox
->
currentText
());
...
...
@@ -212,17 +213,23 @@ void ProtocolDock::add_protocol()
_del_button_list
.
push_back
(
_del_button
);
_set_button_list
.
push_back
(
_set_button
);
_protocol_label_list
.
push_back
(
_protocol_label
);
_progress_label_list
.
push_back
(
_progress_label
);
_protocol_index_list
.
push_back
(
_protocol_combobox
->
currentIndex
());
QHBoxLayout
*
hori_layout
=
new
QHBoxLayout
();
hori_layout
->
addWidget
(
_set_button
);
hori_layout
->
addWidget
(
_del_button
);
hori_layout
->
addWidget
(
_protocol_label
);
hori_layout
->
addWidget
(
_progress_label
);
hori_layout
->
addStretch
(
1
);
_hori_layout_list
.
push_back
(
hori_layout
);
_up_layout
->
insertLayout
(
_del_button_list
.
size
(),
hori_layout
);
//_session.add_protocol_analyzer(_protocol_combobox->currentIndex(), _sel_probes, _options, _options_index);
// progress connection
const
std
::
vector
<
boost
::
shared_ptr
<
pv
::
view
::
DecodeTrace
>
>
decode_sigs
(
_session
.
get_decode_signals
());
//connect(decode_sigs.back().get(), SIGNAL(decoded_progress(int)), this, SLOT(decoded_progess(int)));
protocol_updated
();
}
}
...
...
@@ -265,6 +272,7 @@ void ProtocolDock::del_protocol()
delete
_del_button_list
.
at
(
del_index
);
delete
_set_button_list
.
at
(
del_index
);
delete
_protocol_label_list
.
at
(
del_index
);
delete
_progress_label_list
.
at
(
del_index
);
_session
.
remove_decode_signal
(
0
);
del_index
++
;
...
...
@@ -273,6 +281,7 @@ void ProtocolDock::del_protocol()
_del_button_list
.
clear
();
_set_button_list
.
clear
();
_protocol_label_list
.
clear
();
_progress_label_list
.
clear
();
_protocol_index_list
.
clear
();
}
else
{
QMessageBox
msg
(
this
);
...
...
@@ -293,11 +302,13 @@ void ProtocolDock::del_protocol()
delete
_del_button_list
.
at
(
del_index
);
delete
_set_button_list
.
at
(
del_index
);
delete
_protocol_label_list
.
at
(
del_index
);
delete
_progress_label_list
.
at
(
del_index
);
_hori_layout_list
.
remove
(
del_index
);
_del_button_list
.
remove
(
del_index
);
_set_button_list
.
remove
(
del_index
);
_protocol_label_list
.
remove
(
del_index
);
_progress_label_list
.
remove
(
del_index
);
_protocol_index_list
.
remove
(
del_index
);
_session
.
remove_decode_signal
(
del_index
);
...
...
@@ -320,6 +331,7 @@ void ProtocolDock::del_all_protocol()
delete
_del_button_list
.
at
(
del_index
);
delete
_set_button_list
.
at
(
del_index
);
delete
_protocol_label_list
.
at
(
del_index
);
delete
_progress_label_list
.
at
(
del_index
);
_session
.
remove_decode_signal
(
0
);
del_index
++
;
...
...
@@ -328,12 +340,31 @@ void ProtocolDock::del_all_protocol()
_del_button_list
.
clear
();
_set_button_list
.
clear
();
_protocol_label_list
.
clear
();
_progress_label_list
.
clear
();
_protocol_index_list
.
clear
();
protocol_updated
();
}
}
void
ProtocolDock
::
decoded_progess
(
int
progress
)
{
(
void
)
progress
;
const
std
::
vector
<
boost
::
shared_ptr
<
pv
::
view
::
DecodeTrace
>
>
decode_sigs
(
_session
.
get_decode_signals
());
int
index
=
0
;
BOOST_FOREACH
(
boost
::
shared_ptr
<
pv
::
view
::
DecodeTrace
>
d
,
decode_sigs
)
{
QString
progress_str
=
QString
::
number
(
d
->
get_progress
())
+
"%"
;
if
(
d
->
get_progress
()
==
100
)
_progress_label_list
.
at
(
index
)
->
setStyleSheet
(
"color:green;"
);
else
_progress_label_list
.
at
(
index
)
->
setStyleSheet
(
"color:red;"
);
_progress_label_list
.
at
(
index
)
->
setText
(
progress_str
);
index
++
;
}
}
void
ProtocolDock
::
set_model
()
{
pv
::
dialogs
::
ProtocolList
*
protocollist_dlg
=
new
pv
::
dialogs
::
ProtocolList
(
this
,
_session
);
...
...
DSView/pv/dock/protocoldock.h
View file @
1b6f16bf
...
...
@@ -72,6 +72,7 @@ private slots:
void
add_protocol
();
void
rst_protocol
();
void
del_protocol
();
void
decoded_progess
(
int
progress
);
void
set_model
();
void
update_model
();
void
export_table_view
();
...
...
@@ -96,6 +97,7 @@ private:
QVector
<
QPushButton
*>
_del_button_list
;
QVector
<
QPushButton
*>
_set_button_list
;
QVector
<
QLabel
*>
_protocol_label_list
;
QVector
<
QLabel
*>
_progress_label_list
;
QVector
<
int
>
_protocol_index_list
;
QVector
<
QHBoxLayout
*>
_hori_layout_list
;
QVBoxLayout
*
_up_layout
;
...
...
DSView/pv/dock/triggerdock.cpp
View file @
1b6f16bf
...
...
@@ -38,6 +38,8 @@
namespace
pv
{
namespace
dock
{
const
int
TriggerDock
::
MinTrigPosition
=
1
;
TriggerDock
::
TriggerDock
(
QWidget
*
parent
,
SigSession
&
session
)
:
QScrollArea
(
parent
),
_session
(
session
)
...
...
@@ -56,10 +58,10 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession &session) :
position_label
=
new
QLabel
(
tr
(
"Trigger Position: "
),
_widget
);
position_spinBox
=
new
QSpinBox
(
_widget
);
position_spinBox
->
setRange
(
0
,
99
);
position_spinBox
->
setRange
(
MinTrigPosition
,
99
);
position_spinBox
->
setButtonSymbols
(
QAbstractSpinBox
::
NoButtons
);
position_slider
=
new
QSlider
(
Qt
::
Horizontal
,
_widget
);
position_slider
->
setRange
(
0
,
99
);
position_slider
->
setRange
(
MinTrigPosition
,
99
);
connect
(
position_slider
,
SIGNAL
(
valueChanged
(
int
)),
position_spinBox
,
SLOT
(
setValue
(
int
)));
connect
(
position_spinBox
,
SIGNAL
(
valueChanged
(
int
)),
position_slider
,
SLOT
(
setValue
(
int
)));
...
...
@@ -356,8 +358,8 @@ void TriggerDock::device_change()
maxRange
=
99
;
else
maxRange
=
max_hd_depth
*
70
/
sample_limits
;
position_spinBox
->
setRange
(
0
,
maxRange
);
position_slider
->
setRange
(
0
,
maxRange
);
position_spinBox
->
setRange
(
MinTrigPosition
,
maxRange
);
position_slider
->
setRange
(
MinTrigPosition
,
maxRange
);
...
...
DSView/pv/dock/triggerdock.h
View file @
1b6f16bf
...
...
@@ -55,6 +55,9 @@ class TriggerDock : public QScrollArea
{
Q_OBJECT
private:
static
const
int
MinTrigPosition
;
public:
TriggerDock
(
QWidget
*
parent
,
SigSession
&
session
);
~
TriggerDock
();
...
...
DSView/pv/mainwindow.cpp
View file @
1b6f16bf
...
...
@@ -112,7 +112,7 @@ void MainWindow::setup_ui()
{
setObjectName
(
QString
::
fromUtf8
(
"MainWindow"
));
setMinimumHeight
(
680
);
setMinimumWidth
(
3
00
);
setMinimumWidth
(
5
00
);
resize
(
1024
,
768
);
// Set the window icon
...
...
@@ -192,8 +192,6 @@ void MainWindow::setup_ui()
SLOT
(
run_stop
()));
connect
(
_sampling_bar
,
SIGNAL
(
instant_stop
()),
this
,
SLOT
(
instant_stop
()));
connect
(
_sampling_bar
,
SIGNAL
(
update_scale
()),
_view
,
SLOT
(
update_scale
()),
Qt
::
DirectConnection
);
connect
(
_sampling_bar
,
SIGNAL
(
sample_count_changed
()),
_trigger_widget
,
SLOT
(
device_change
()));
connect
(
_dso_trigger_widget
,
SIGNAL
(
set_trig_pos
(
quint64
)),
_view
,
...
...
@@ -248,6 +246,8 @@ void MainWindow::setup_ui()
SLOT
(
test_data_error
()));
connect
(
&
_session
,
SIGNAL
(
malloc_error
()),
this
,
SLOT
(
malloc_error
()));
connect
(
&
_session
,
SIGNAL
(
hardware_connect_failed
()),
this
,
SLOT
(
hardware_connect_failed
()));
connect
(
_view
,
SIGNAL
(
cursor_update
()),
_measure_widget
,
SLOT
(
cursor_update
()));
...
...
@@ -471,6 +471,17 @@ void MainWindow::malloc_error()
msg
.
exec
();
}
void
MainWindow
::
hardware_connect_failed
()
{
_session
.
stop_capture
();
QMessageBox
msg
(
this
);
msg
.
setText
(
tr
(
"Hardware Connect Failed"
));
msg
.
setInformativeText
(
tr
(
"Please check hardware connection!"
));
msg
.
setStandardButtons
(
QMessageBox
::
Ok
);
msg
.
setIcon
(
QMessageBox
::
Warning
);
msg
.
exec
();
}
void
MainWindow
::
capture_state_changed
(
int
state
)
{
_file_bar
->
enable_toggle
(
state
!=
SigSession
::
Running
);
...
...
@@ -492,7 +503,7 @@ void MainWindow::capture_state_changed(int state)
if
(
gvar
!=
NULL
)
{
uint64_t
actual_samples
=
g_variant_get_uint64
(
gvar
);
g_variant_unref
(
gvar
);
if
(
actual_samples
!=
_session
.
get_device
()
->
get_sample_limit
())
{
if
(
actual_samples
!=
_session
.
cur_samplelimits
())
{
show_session_error
(
tr
(
"RLE Mode Warning"
),
tr
(
"Hardware buffer is full!
\n
Actually received samples is less than setted sample depth!"
));
}
...
...
DSView/pv/mainwindow.h
View file @
1b6f16bf
...
...
@@ -131,6 +131,11 @@ private slots:
void
device_attach
();
void
device_detach
();
/*
* errors
*/
void
hardware_connect_failed
();
private:
DeviceManager
&
_device_manager
;
...
...
DSView/pv/sigsession.cpp
View file @
1b6f16bf
...
...
@@ -151,6 +151,8 @@ void SigSession::set_device(boost::shared_ptr<device::DevInst> dev_inst) throw(Q
if
(
_dev_inst
)
{
try
{
_dev_inst
->
use
(
this
);
_cur_samplerate
=
_dev_inst
->
get_sample_rate
();
_cur_samplelimits
=
_dev_inst
->
get_sample_limit
();
}
catch
(
const
QString
e
)
{
throw
(
e
);
return
;
...
...
@@ -423,6 +425,24 @@ SigSession::capture_state SigSession::get_capture_state() const
return
_capture_state
;
}
uint64_t
SigSession
::
cur_samplelimits
()
const
{
return
_cur_samplelimits
;
}
uint64_t
SigSession
::
cur_samplerate
()
const
{
return
_cur_samplerate
;
}
double
SigSession
::
cur_sampletime
()
const
{
if
(
_cur_samplerate
==
0
)
return
0
;
else
return
_cur_samplelimits
*
1.0
/
_cur_samplerate
;
}
void
SigSession
::
start_capture
(
bool
instant
,
boost
::
function
<
void
(
const
QString
)
>
error_handler
)
{
...
...
@@ -582,36 +602,60 @@ void SigSession::sample_thread_proc(boost::shared_ptr<device::DevInst> dev_inst,
assert
(
!
_cur_analog_snapshot
);
}
void
SigSession
::
read_sample_rate
(
const
sr_dev_inst
*
const
sdi
)
void
SigSession
::
update_data_header
(
const
sr_dev_inst
*
const
sdi
)
{
GVariant
*
gvar
;
uint64_t
sample_rate
=
0
;
int
ret
;
// Read out the sample rate
if
(
sdi
->
driver
)
{
const
int
ret
=
sr_config_get
(
sdi
->
driver
,
sdi
,
NULL
,
NULL
,
SR_CONF_SAMPLERATE
,
&
gvar
);
ret
=
sr_config_get
(
sdi
->
driver
,
sdi
,
NULL
,
NULL
,
SR_CONF_SAMPLERATE
,
&
gvar
);
if
(
ret
!=
SR_OK
)
{
hardware_connect_failed
();
return
;
}
_cur_samplerate
=
g_variant_get_uint64
(
gvar
);
g_variant_unref
(
gvar
);
ret
=
sr_config_get
(
sdi
->
driver
,
sdi
,
NULL
,
NULL
,
SR_CONF_LIMIT_SAMPLES
,
&
gvar
);
if
(
ret
!=
SR_OK
)
{
qDebug
(
"Failed to get samplerate
\n
"
);
hardware_connect_failed
(
);
return
;
}
sample_rate
=
g_variant_get_uint64
(
gvar
);
_cur_samplelimits
=
g_variant_get_uint64
(
gvar
);
g_variant_unref
(
gvar
);
}
// Set the sample rate of all data
const
set
<
boost
::
shared_ptr
<
data
::
SignalData
>
>
data_set
=
get_data
();
// Set the sample rate of all SignalData
// Logic/Analog/Dso
set
<
boost
::
shared_ptr
<
data
::
SignalData
>
>
data_set
;
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
view
::
Signal
>
sig
,
_signals
)
{
assert
(
sig
);
data_set
.
insert
(
sig
->
data
());
}
BOOST_FOREACH
(
boost
::
shared_ptr
<
data
::
SignalData
>
data
,
data_set
)
{
assert
(
data
);
data
->
set_samplerate
(
sample_rate
);
data
->
set_samplerate
(
_cur_samplerate
);
}
#ifdef ENABLE_DECODE
// DecoderStack
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
view
::
DecodeTrace
>
d
,
_decode_traces
)
{
assert
(
d
);
d
->
decoder
()
->
set_samplerate
(
_cur_samplerate
);
}
#endif
// MathStack
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
view
::
MathTrace
>
m
,
_math_traces
)
{
assert
(
m
);
m
->
get_math_stack
()
->
set_samplerate
(
sample_
rate
);
m
->
get_math_stack
()
->
set_samplerate
(
_cur_sample
rate
);
}
_group_data
->
set_samplerate
(
sample_rate
);
// Group
_group_data
->
set_samplerate
(
_cur_samplerate
);
}
void
SigSession
::
feed_in_header
(
const
sr_dev_inst
*
sdi
)
...
...
@@ -623,7 +667,7 @@ void SigSession::feed_in_header(const sr_dev_inst *sdi)
i
++
)
(
*
i
)
->
decoder
()
->
stop_decode
();
#endif
read_sample_rate
(
sdi
);
update_data_header
(
sdi
);
//receive_data(0);
}
...
...
@@ -640,8 +684,9 @@ void SigSession::add_group()
if
(
probe_index_list
.
size
()
>
1
)
{
//_group_data.reset(new data::Group(_last_sample_rate));
if
(
_group_data
->
get_snapshots
().
empty
())
_group_data
->
set_samplerate
(
_dev_inst
->
get_sample_rate
());
// if (_group_data->get_snapshots().empty())
// _group_data->set_samplerate(_dev_inst->get_sample_rate());
_group_data
->
set_samplerate
(
_cur_samplerate
);
const
boost
::
shared_ptr
<
view
::
GroupSignal
>
signal
(
new
view
::
GroupSignal
(
"New Group"
,
_group_data
,
probe_index_list
,
_group_cnt
));
...
...
@@ -811,6 +856,7 @@ void SigSession::reload()
if
(
_capture_state
==
Running
)
stop_capture
();
//refresh(0);
vector
<
boost
::
shared_ptr
<
view
::
Signal
>
>
sigs
;
boost
::
shared_ptr
<
view
::
Signal
>
signal
;
...
...
@@ -869,10 +915,23 @@ void SigSession::refresh(int holdtime)
if
(
_logic_data
)
{
_logic_data
->
clear
();
_cur_logic_snapshot
.
reset
();
#ifdef ENABLE_DECODE
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
view
::
DecodeTrace
>
d
,
_decode_traces
)
{
assert
(
d
);
d
->
decoder
()
->
clear
();
}
#endif
}
if
(
_dso_data
)
{
_dso_data
->
clear
();
_cur_dso_snapshot
.
reset
();
// MathStack
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
view
::
MathTrace
>
m
,
_math_traces
)
{
assert
(
m
);
m
->
get_math_stack
()
->
clear
();
}
}
if
(
_analog_data
)
{
_analog_data
->
clear
();
...
...
DSView/pv/sigsession.h
View file @
1b6f16bf
...
...
@@ -128,6 +128,10 @@ public:
capture_state
get_capture_state
()
const
;
uint64_t
cur_samplerate
()
const
;
uint64_t
cur_samplelimits
()
const
;
double
cur_sampletime
()
const
;
void
start_capture
(
bool
instant
,
boost
::
function
<
void
(
const
QString
)
>
error_handler
);
...
...
@@ -187,7 +191,7 @@ public:
private:
void
set_capture_state
(
capture_state
state
);
void
read_sample_rate
(
const
sr_dev_inst
*
const
sdi
);
void
update_data_header
(
const
sr_dev_inst
*
const
sdi
);
private:
/**
...
...
@@ -237,6 +241,8 @@ private:
mutable
boost
::
mutex
_sampling_mutex
;
capture_state
_capture_state
;
bool
_instant
;
uint64_t
_cur_samplerate
;
uint64_t
_cur_samplelimits
;
mutable
boost
::
mutex
_signals_mutex
;
std
::
vector
<
boost
::
shared_ptr
<
view
::
Signal
>
>
_signals
;
...
...
@@ -306,6 +312,8 @@ signals:
void
show_region
(
uint64_t
start
,
uint64_t
end
);
void
hardware_connect_failed
();
public
slots
:
void
reload
();
void
refresh
(
int
holdtime
);
...
...
DSView/pv/storesession.cpp
View file @
1b6f16bf
...
...
@@ -25,6 +25,8 @@
#include <pv/data/logicsnapshot.h>
#include <pv/view/signal.h>
#include <boost/foreach.hpp>
using
boost
::
dynamic_pointer_cast
;
using
boost
::
mutex
;
using
boost
::
shared_ptr
;
...
...
@@ -70,9 +72,12 @@ const QString& StoreSession::error() const
bool
StoreSession
::
start
()
{
set
<
shared_ptr
<
data
::
SignalData
>
>
data_set
=
_session
.
get_data
();
const
vector
<
shared_ptr
<
view
::
Signal
>
>
sigs
(
_session
.
get_signals
());
set
<
boost
::
shared_ptr
<
data
::
SignalData
>
>
data_set
;
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
view
::
Signal
>
sig
,
sigs
)
{
assert
(
sig
);
data_set
.
insert
(
sig
->
data
());
}
// Check we have logic data
if
(
data_set
.
empty
()
||
sigs
.
empty
())
{
...
...
DSView/pv/toolbars/samplingbar.cpp
View file @
1b6f16bf
...
...
@@ -126,17 +126,6 @@ SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
_run_stop_button
.
setIcon
(
_icon_start
);
_instant_button
.
setIcon
(
_icon_instant
);
// for (size_t i = 0; i < countof(RecordLengths); i++)
// {
// const uint64_t &l = RecordLengths[i];
// char *const text = ds_si_string_u64(l, " samples");
// _sample_count.addItem(QString(text),
// qVariantFromValue(l));
// g_free(text);
// if (l == DefaultRecordLength)
// _sample_count.setCurrentIndex(i);
// }
_sample_count
.
setSizeAdjustPolicy
(
QComboBox
::
AdjustToContents
);
set_sampling
(
false
);
connect
(
&
_sample_count
,
SIGNAL
(
currentIndexChanged
(
int
)),
...
...
@@ -191,7 +180,6 @@ void SamplingBar::set_device_list(
update_sample_rate_selector
();
update_sample_count_selector
();
update_scale
();
_updating_device_selector
=
false
;
}
...
...
@@ -454,8 +442,7 @@ void SamplingBar::update_sample_rate_selector_value()
break
;
}
}
if
(
samplerate
!=
_sample_rate
.
itemData
(
_sample_rate
.
currentIndex
()).
value
<
uint64_t
>
())
update_scale
();
_updating_sample_rate
=
false
;
}
...
...
@@ -486,7 +473,6 @@ void SamplingBar::commit_sample_rate()
get_selected_device
()
->
set_config
(
NULL
,
NULL
,
SR_CONF_SAMPLERATE
,
g_variant_new_uint64
(
sample_rate
));
update_scale
();
}
_updating_sample_rate
=
false
;
...
...
@@ -512,7 +498,6 @@ void SamplingBar::on_samplecount_sel(int index)
g_variant_new_uint64
(
sample_count
));
sample_count_changed
();
//update_scale();
}
}
...
...
@@ -535,8 +520,6 @@ void SamplingBar::on_samplerate_sel(int index)
get_selected_device
()
->
set_config
(
NULL
,
NULL
,
SR_CONF_SAMPLERATE
,
g_variant_new_uint64
(
sample_rate
));
//update_scale();
}
}
...
...
@@ -628,7 +611,6 @@ void SamplingBar::update_sample_count_selector_value()
if
(
samplecount
!=
_sample_count
.
itemData
(
_sample_count
.
currentIndex
()).
value
<
uint64_t
>
())
{
sample_count_changed
();
update_scale
();
}
_updating_sample_count
=
false
;
}
...
...
@@ -661,7 +643,6 @@ void SamplingBar::commit_sample_count()
get_selected_device
()
->
set_config
(
NULL
,
NULL
,
SR_CONF_LIMIT_SAMPLES
,
g_variant_new_uint64
(
sample_count
));
update_scale
();
}
_updating_sample_count
=
false
;
...
...
DSView/pv/toolbars/samplingbar.h
View file @
1b6f16bf
...
...
@@ -95,7 +95,6 @@ signals:
void
instant_stop
();
void
device_selected
();
void
device_updated
();
void
update_scale
();
void
sample_count_changed
();
private:
...
...
DSView/pv/view/cursor.cpp
View file @
1b6f16bf
...
...
@@ -60,7 +60,7 @@ Cursor::Cursor(View &view, QColor color, uint64_t index) :
QRectF
Cursor
::
get_label_rect
(
const
QRect
&
rect
)
const
{
const
double
samples_per_pixel
=
_view
.
session
().
get_device
()
->
get_sample_
rate
()
*
_view
.
scale
();
const
double
samples_per_pixel
=
_view
.
session
().
cur_sample
rate
()
*
_view
.
scale
();
const
double
x
=
_index
/
samples_per_pixel
-
(
_view
.
offset
()
/
_view
.
scale
());
const
QSizeF
label_size
(
...
...
@@ -116,7 +116,7 @@ void Cursor::paint_label(QPainter &p, const QRect &rect,
p
.
drawLine
(
close
.
left
()
+
2
,
close
.
bottom
()
-
2
,
close
.
right
()
-
2
,
close
.
top
()
+
2
);
p
.
drawText
(
r
,
Qt
::
AlignCenter
|
Qt
::
AlignVCenter
,
Ruler
::
format_real_time
(
_index
,
_view
.
session
().
get_device
()
->
get_sample_
rate
()));
Ruler
::
format_real_time
(
_index
,
_view
.
session
().
cur_sample
rate
()));
const
QRectF
arrowRect
=
QRectF
(
r
.
bottomLeft
().
x
(),
r
.
bottomLeft
().
y
(),
r
.
width
(),
ArrowSize
);
p
.
drawText
(
arrowRect
,
Qt
::
AlignCenter
|
Qt
::
AlignVCenter
,
QString
::
number
(
index
));
...
...
@@ -143,7 +143,7 @@ void Cursor::paint_fix_label(QPainter &p, const QRect &rect,
p
.
setPen
(
Qt
::
white
);
p
.
drawText
(
r
,
Qt
::
AlignCenter
|
Qt
::
AlignVCenter
,
Ruler
::
format_real_time
(
_index
,
_view
.
session
().
get_device
()
->
get_sample_
rate
()));
Ruler
::
format_real_time
(
_index
,
_view
.
session
().
cur_sample
rate
()));
const
QRectF
arrowRect
=
QRectF
(
r
.
bottomLeft
().
x
(),
r
.
bottomLeft
().
y
(),
r
.
width
(),
ArrowSize
);
p
.
drawText
(
arrowRect
,
Qt
::
AlignCenter
|
Qt
::
AlignVCenter
,
label
);
...
...
@@ -153,7 +153,7 @@ void Cursor::compute_text_size(QPainter &p, unsigned int prefix)
{
(
void
)
prefix
;
_text_size
=
p
.
boundingRect
(
QRectF
(),
0
,
Ruler
::
format_real_time
(
_index
,
_view
.
session
().
get_device
()
->
get_sample_
rate
())).
size
();
Ruler
::
format_real_time
(
_index
,
_view
.
session
().
cur_sample
rate
())).
size
();
}
}
// namespace view
...
...
DSView/pv/view/decodetrace.cpp
View file @
1b6f16bf
...
...
@@ -125,6 +125,7 @@ DecodeTrace::DecodeTrace(pv::SigSession &session,
_end_index
(
0
),
_start_count
(
0
),
_end_count
(
0
),
_progress
(
0
),
_popup_form
(
NULL
),
_popup
()
{
...
...
@@ -175,7 +176,7 @@ void DecodeTrace::paint_back(QPainter &p, int left, int right)
p
.
drawLine
(
left
,
sigY
,
right
,
sigY
);
// --draw decode region control
const
double
samples_per_pixel
=
_session
.
get_device
()
->
get_sample_
rate
()
*
_view
->
scale
();
const
double
samples_per_pixel
=
_session
.
cur_sample
rate
()
*
_view
->
scale
();
const
double
startX
=
_decode_start
/
samples_per_pixel
-
(
_view
->
offset
()
/
_view
->
scale
());
const
double
endX
=
_decode_end
/
samples_per_pixel
-
(
_view
->
offset
()
/
_view
->
scale
());
const
double
regionY
=
get_y
()
-
_totalHeight
*
0.5
-
ControlRectWidth
;
...
...
@@ -665,7 +666,7 @@ bool DecodeTrace::draw_unresolved_period(QPainter &p, int h, int left,
font
.
setPointSize
(
_view
->
get_signalHeight
()
*
2
/
3
);
font
.
setBold
(
true
);
p
.
setFont
(
font
);
p
.
drawText
(
no_decode_rect
,
Qt
::
AlignCenter
|
Qt
::
AlignVCenter
,
QString
::
number
(
progress100
)
+
"%"
);
p
.
drawText
(
no_decode_rect
,
Qt
::
AlignCenter
|
Qt
::
AlignVCenter
,
QString
::
number
(
_progress
)
+
"%"
);
return
true
;
}
...
...
@@ -829,10 +830,24 @@ void DecodeTrace::commit_probes()
void
DecodeTrace
::
on_new_decode_data
()
{
const
uint64_t
need_sample_count
=
_decode_end
-
_decode_start
+
1
;
if
(
need_sample_count
==
0
)
{
_progress
=
100
;
}
else
{
const
uint64_t
samples_decoded
=
_decoder_stack
->
samples_decoded
();
_progress
=
ceil
(
samples_decoded
*
100.0
/
need_sample_count
);
}
decoded_progress
(
_progress
);
if
(
_view
&&
_view
->
session
().
get_capture_state
()
==
SigSession
::
Stopped
)
_view
->
data_updated
();
}
int
DecodeTrace
::
get_progress
()
const
{
return
_progress
;
}
void
DecodeTrace
::
on_decode_done
()
{
if
(
_view
)
{
...
...
@@ -937,7 +952,7 @@ QRectF DecodeTrace::get_rect(DecodeSetRegions type, int y, int right)
void
DecodeTrace
::
on_region_set
(
int
index
)
{
(
void
)
index
;
const
uint64_t
last_samples
=
_session
.
get_device
()
->
get_sample_limit
()
-
1
;
const
uint64_t
last_samples
=
_session
.
cur_samplelimits
()
-
1
;
const
int
index1
=
_start_comboBox
->
currentIndex
();
const
int
index2
=
_end_comboBox
->
currentIndex
();
uint64_t
decode_start
,
decode_end
;
...
...
@@ -974,7 +989,7 @@ void DecodeTrace::on_region_set(int index)
void
DecodeTrace
::
frame_ended
()
{
const
uint64_t
last_samples
=
_session
.
get_device
()
->
get_sample_limit
()
-
1
;
const
uint64_t
last_samples
=
_session
.
cur_samplelimits
()
-
1
;
if
(
_decode_start
>
last_samples
)
{
_decode_start
=
0
;
_start_index
=
0
;
...
...
DSView/pv/view/decodetrace.h
View file @
1b6f16bf
...
...
@@ -141,6 +141,8 @@ public:
**/
void
frame_ended
();
int
get_progress
()
const
;
protected:
void
paint_type_options
(
QPainter
&
p
,
int
right
,
const
QPoint
pt
);
...
...
@@ -187,6 +189,9 @@ private:
void
commit_probes
();
signals:
void
decoded_progress
(
int
progress
);
private
slots
:
void
on_new_decode_data
();
...
...
@@ -209,6 +214,7 @@ private:
int
_start_index
,
_end_index
;
int
_start_count
,
_end_count
;
QComboBox
*
_start_comboBox
,
*
_end_comboBox
;
int
_progress
;
std
::
list
<
boost
::
shared_ptr
<
pv
::
prop
::
binding
::
DecoderOptions
>
>
_bindings
;
...
...
DSView/pv/view/dsosignal.cpp
View file @
1b6f16bf
...
...
@@ -305,7 +305,7 @@ bool DsoSignal::go_hDialPre(bool setted)
{
int
ch_num
=
_view
->
session
().
get_ch_num
(
SR_CHANNEL_DSO
);
if
(
ch_num
!=
0
&&
!
_hDial
->
isMin
())
{
uint64_t
sample_rate
=
_view
->
session
().
get_device
()
->
get_sample_
rate
();
uint64_t
sample_rate
=
_view
->
session
().
cur_sample
rate
();
const
uint64_t
min_div
=
std
::
pow
(
10.0
,
9.0
)
/
sample_rate
;
if
(
_view
->
session
().
get_capture_state
()
!=
SigSession
::
Running
&&
!
_data
->
get_snapshots
().
empty
())
{
...
...
@@ -764,8 +764,8 @@ void DsoSignal::paint_back(QPainter &p, int left, int right)
p
.
setPen
(
Trace
::
dsLightBlue
);
p
.
drawLine
(
left
,
UpMargin
/
2
,
left
+
width
,
UpMargin
/
2
);
const
uint64_t
sample_len
=
_
dev_inst
->
get_sample_limit
();
const
double
samplerate
=
_
dev_inst
->
get_sample_
rate
();
const
uint64_t
sample_len
=
_
view
->
session
().
cur_samplelimits
();
const
double
samplerate
=
_
view
->
session
().
cur_sample
rate
();
const
double
samples_per_pixel
=
samplerate
*
_view
->
scale
();
const
double
shown_rate
=
min
(
samples_per_pixel
*
width
*
1.0
/
sample_len
,
1.0
);
const
double
start_time
=
_data
->
get_start_time
();
...
...
@@ -843,7 +843,7 @@ void DsoSignal::paint_mid(QPainter &p, int left, int right)
const
double
pixels_offset
=
offset
/
scale
;
//const double samplerate = _data->samplerate();
const
double
samplerate
=
_
dev_inst
->
get_sample_
rate
();
const
double
samplerate
=
_
view
->
session
().
cur_sample
rate
();
const
double
start_time
=
_data
->
get_start_time
();
const
int64_t
last_sample
=
max
((
int64_t
)(
snapshot
->
get_sample_count
()
-
1
),
(
int64_t
)
0
);
const
double
samples_per_pixel
=
samplerate
*
scale
;
...
...
@@ -1280,7 +1280,7 @@ void DsoSignal::paint_measure(QPainter &p)
double
value_p2p
=
value_max
-
value_min
;
_period
=
(
count
==
0
)
?
period
*
10.0
:
period
*
10.0
/
count
;
const
int
channel_count
=
_view
->
session
().
get_ch_num
(
SR_CHANNEL_DSO
);
uint64_t
sample_rate
=
_
dev_inst
->
get_sample_
rate
();
uint64_t
sample_rate
=
_
view
->
session
().
cur_sample
rate
();
_period
=
_period
*
200.0
/
(
channel_count
*
sample_rate
*
1.0
/
SR_MHZ
(
1
));
_ms_string
[
DSO_MS_VMAX
]
=
"Vmax: "
+
(
abs
(
value_max
)
>
1000
?
QString
::
number
(
value_max
/
1000.0
,
'f'
,
2
)
+
"V"
:
QString
::
number
(
value_max
,
'f'
,
2
)
+
"mV"
);
_ms_string
[
DSO_MS_VMIN
]
=
"Vmin: "
+
(
abs
(
value_min
)
>
1000
?
QString
::
number
(
value_min
/
1000.0
,
'f'
,
2
)
+
"V"
:
QString
::
number
(
value_min
,
'f'
,
2
)
+
"mV"
);
...
...
@@ -1455,7 +1455,7 @@ bool DsoSignal::measure(const QPointF &p)
assert
(
scale
>
0
);
const
double
offset
=
_view
->
offset
();
const
double
pixels_offset
=
offset
/
scale
;