Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Raptor Engineering Public Development
dsview
Commits
44051a29
Commit
44051a29
authored
9 years ago
by
DreamSourceLab
Browse files
Options
Download
Email Patches
Plain Diff
fix channel disable/enalbe issues @ DSO mode
parent
248a446d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
14 deletions
+59
-14
DSView/pv/sigsession.cpp
DSView/pv/sigsession.cpp
+20
-1
DSView/pv/sigsession.h
DSView/pv/sigsession.h
+7
-1
DSView/pv/view/dsosignal.cpp
DSView/pv/view/dsosignal.cpp
+12
-10
DSView/pv/view/header.cpp
DSView/pv/view/header.cpp
+2
-1
DSView/pv/view/viewport.cpp
DSView/pv/view/viewport.cpp
+2
-0
libsigrok4DSL/hardware/DSL/dscope.c
libsigrok4DSL/hardware/DSL/dscope.c
+8
-1
libsigrok4DSL/hardware/DSL/dslogic.c
libsigrok4DSL/hardware/DSL/dslogic.c
+8
-0
No files found.
DSView/pv/sigsession.cpp
View file @
44051a29
...
...
@@ -98,8 +98,12 @@ SigSession::SigSession(DeviceManager &device_manager) :
register_hotplug_callback
();
_view_timer
.
stop
();
_view_timer
.
setSingleShot
(
true
);
_refresh_timer
.
stop
();
_refresh_timer
.
setSingleShot
(
true
);
_data_lock
=
false
;
connect
(
this
,
SIGNAL
(
start_timer
(
int
)),
&
_view_timer
,
SLOT
(
start
(
int
)));
connect
(
&
_view_timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
refresh
()));
connect
(
&
_refresh_timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
data_unlock
()));
}
SigSession
::~
SigSession
()
...
...
@@ -814,7 +818,7 @@ void SigSession::reload()
signals_changed
();
}
void
SigSession
::
refresh
()
void
SigSession
::
refresh
(
int
holdtime
)
{
if
(
_logic_data
)
{
_logic_data
->
clear
();
...
...
@@ -829,6 +833,18 @@ void SigSession::refresh()
_cur_analog_snapshot
.
reset
();
}
data_updated
();
_data_lock
=
true
;
_refresh_timer
.
start
(
holdtime
);
}
void
SigSession
::
data_unlock
()
{
_data_lock
=
false
;
}
bool
SigSession
::
get_data_lock
()
{
return
_data_lock
;
}
void
SigSession
::
feed_in_meta
(
const
sr_dev_inst
*
sdi
,
...
...
@@ -987,6 +1003,9 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi,
assert
(
sdi
);
assert
(
packet
);
if
(
_data_lock
)
return
;
switch
(
packet
->
type
)
{
case
SR_DF_HEADER
:
feed_in_header
(
sdi
);
...
...
This diff is collapsed.
Click to expand it.
DSView/pv/sigsession.h
View file @
44051a29
...
...
@@ -91,6 +91,7 @@ class SigSession : public QObject
private:
static
constexpr
float
Oversampling
=
2.0
f
;
static
const
int
ViewTime
=
800
;
static
const
int
RefreshTime
=
500
;
bool
saveFileThreadRunning
=
false
;
public:
...
...
@@ -176,6 +177,8 @@ public:
bool
get_instant
();
bool
get_data_lock
();
private:
void
set_capture_state
(
capture_state
state
);
...
...
@@ -258,6 +261,8 @@ private:
bool
_adv_trigger
;
QTimer
_view_timer
;
QTimer
_refresh_timer
;
bool
_data_lock
;
signals:
void
capture_state_changed
(
int
state
);
...
...
@@ -294,10 +299,11 @@ signals:
public
slots
:
void
reload
();
void
refresh
();
void
refresh
(
int
holdtime
);
private
slots
:
void
cancelSaveFile
();
void
data_unlock
();
private:
// TODO: This should not be necessary. Multiple concurrent
...
...
This diff is collapsed.
Click to expand it.
DSView/pv/view/dsosignal.cpp
View file @
44051a29
...
...
@@ -203,7 +203,7 @@ void DsoSignal::set_enable(bool enable)
if
((
strcmp
(
_dev_inst
->
dev_inst
()
->
driver
->
name
,
"DSLogic"
)
==
0
)
&&
get_index
()
==
0
)
return
;
_view
->
session
().
refresh
();
_view
->
session
().
refresh
(
INT_MAX
);
set_vDialActive
(
false
);
_dev_inst
->
set_config
(
_probe
,
NULL
,
SR_CONF_EN_CH
,
g_variant_new_boolean
(
enable
));
...
...
@@ -237,6 +237,7 @@ void DsoSignal::set_enable(bool enable)
_view
->
set_sample_limit
(
sample_limit
,
true
);
_view
->
set_need_update
(
true
);
_view
->
update
();
_view
->
session
().
refresh
(
800
);
}
bool
DsoSignal
::
get_vDialActive
()
const
...
...
@@ -300,7 +301,8 @@ void DsoSignal::set_hDialActive(bool active)
bool
DsoSignal
::
go_hDialPre
(
bool
setted
)
{
if
(
!
_hDial
->
isMin
())
{
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
();
const
uint64_t
min_div
=
std
::
pow
(
10.0
,
9.0
)
/
sample_rate
;
if
(
_view
->
session
().
get_capture_state
()
!=
SigSession
::
Running
&&
...
...
@@ -310,11 +312,10 @@ bool DsoSignal::go_hDialPre(bool setted)
}
else
if
((
_view
->
session
().
get_capture_state
()
==
SigSession
::
Running
||
_data
->
get_snapshots
().
empty
())
&&
!
_view
->
session
().
get_instant
())
{
_view
->
session
().
refresh
();
_view
->
session
().
refresh
(
100
);
_hDial
->
set_sel
(
_hDial
->
get_sel
()
-
1
);
if
(
!
setted
)
{
int
ch_num
=
_view
->
session
().
get_ch_num
(
SR_CHANNEL_DSO
);
uint64_t
sample_limit
=
_view
->
session
().
get_device
()
->
get_sample_limit
();
GVariant
*
gvar
;
uint64_t
max_sample_rate
;
...
...
@@ -349,9 +350,11 @@ bool DsoSignal::go_hDialPre(bool setted)
bool
DsoSignal
::
go_hDialCur
()
{
_view
->
session
().
refresh
();
int
ch_num
=
_view
->
session
().
get_ch_num
(
SR_CHANNEL_DSO
);
if
(
ch_num
==
0
)
return
false
;
_view
->
session
().
refresh
(
100
);
uint64_t
sample_limit
=
_view
->
session
().
get_device
()
->
get_sample_limit
();
GVariant
*
gvar
;
uint64_t
max_sample_rate
;
...
...
@@ -377,19 +380,18 @@ bool DsoSignal::go_hDialCur()
bool
DsoSignal
::
go_hDialNext
(
bool
setted
)
{
if
(
!
_hDial
->
isMax
())
{
int
ch_num
=
_view
->
session
().
get_ch_num
(
SR_CHANNEL_DSO
);
if
(
ch_num
!=
0
&&
!
_hDial
->
isMax
())
{
if
(
_view
->
session
().
get_capture_state
()
!=
SigSession
::
Running
&&
!
_data
->
get_snapshots
().
empty
())
{
_hDial
->
set_sel
(
_hDial
->
get_sel
()
+
1
);
}
else
if
((
_view
->
session
().
get_capture_state
()
==
SigSession
::
Running
||
_data
->
get_snapshots
().
empty
())
&&
!
_view
->
session
().
get_instant
())
{
_view
->
session
().
refresh
();
_view
->
session
().
refresh
(
100
);
_hDial
->
set_sel
(
_hDial
->
get_sel
()
+
1
);
if
(
!
setted
)
{
int
ch_num
=
_view
->
session
().
get_ch_num
(
SR_CHANNEL_DSO
);
uint64_t
sample_limit
=
_view
->
session
().
get_device
()
->
get_sample_limit
();
GVariant
*
gvar
;
...
...
This diff is collapsed.
Click to expand it.
DSView/pv/view/header.cpp
View file @
44051a29
...
...
@@ -272,7 +272,8 @@ void Header::mousePressEvent(QMouseEvent *event)
}
else
if
(
action
==
Trace
::
CHEN
&&
mTrace
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
dsoSig
->
set_enable
(
!
dsoSig
->
enabled
());
if
(
!
_view
.
session
().
get_data_lock
())
dsoSig
->
set_enable
(
!
dsoSig
->
enabled
());
}
}
else
if
(
action
==
Trace
::
ACDC
&&
mTrace
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
...
...
This diff is collapsed.
Click to expand it.
DSView/pv/view/viewport.cpp
View file @
44051a29
...
...
@@ -388,6 +388,8 @@ void Viewport::mousePressEvent(QMouseEvent *event)
const
vector
<
boost
::
shared_ptr
<
Signal
>
>
sigs
(
_view
.
session
().
get_signals
());
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Signal
>
s
,
sigs
)
{
assert
(
s
);
if
(
!
s
->
enabled
())
continue
;
boost
::
shared_ptr
<
DsoSignal
>
dsoSig
;
if
((
dsoSig
=
dynamic_pointer_cast
<
DsoSignal
>
(
s
))
&&
dsoSig
->
get_trig_rect
(
0
,
_view
.
get_view_width
()).
contains
(
_mouse_point
))
{
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/hardware/DSL/dscope.c
View file @
44051a29
...
...
@@ -1430,7 +1430,14 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
if
(
sdi
->
mode
==
DSO
)
{
ret
=
command_dso_ctrl
(
usb
->
devhdl
,
dso_cmd_gen
(
sdi
,
ch
,
SR_CONF_EN_CH
));
ret
=
command_dso_ctrl
(
usb
->
devhdl
,
dso_cmd_gen
(
sdi
,
0
,
SR_CONF_SAMPLERATE
));
uint16_t
channel_cnt
=
0
;
GSList
*
l
;
for
(
l
=
sdi
->
channels
;
l
;
l
=
l
->
next
)
{
struct
sr_channel
*
probe
=
(
struct
sr_channel
*
)
l
->
data
;
channel_cnt
+=
probe
->
enabled
;
}
if
(
channel_cnt
!=
0
)
ret
=
command_dso_ctrl
(
usb
->
devhdl
,
dso_cmd_gen
(
sdi
,
0
,
SR_CONF_SAMPLERATE
));
}
if
(
ret
==
SR_OK
)
sr_dbg
(
"%s: setting ENABLE of channel %d to %d"
,
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/hardware/DSL/dslogic.c
View file @
44051a29
...
...
@@ -1552,6 +1552,14 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
ch
->
enabled
=
g_variant_get_boolean
(
data
);
if
(
sdi
->
mode
==
DSO
)
{
ret
=
command_dso_ctrl
(
usb
->
devhdl
,
dso_cmd_gen
(
sdi
,
ch
,
SR_CONF_EN_CH
));
uint16_t
channel_cnt
=
0
;
GSList
*
l
;
for
(
l
=
sdi
->
channels
;
l
;
l
=
l
->
next
)
{
struct
sr_channel
*
probe
=
(
struct
sr_channel
*
)
l
->
data
;
channel_cnt
+=
probe
->
enabled
;
}
if
(
channel_cnt
!=
0
)
ret
=
command_dso_ctrl
(
usb
->
devhdl
,
dso_cmd_gen
(
sdi
,
0
,
SR_CONF_SAMPLERATE
));
}
if
(
ret
==
SR_OK
)
sr_dbg
(
"%s: setting ENABLE of channel %d to %d"
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment