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
235a863b
Commit
235a863b
authored
Jan 09, 2020
by
DreamSourceLab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix wave shake when measure high frequency signals @ dso mode
parent
7328b0b2
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
213 additions
and
126 deletions
+213
-126
DSView/pv/sigsession.cpp
DSView/pv/sigsession.cpp
+24
-3
DSView/pv/sigsession.h
DSView/pv/sigsession.h
+4
-1
DSView/pv/view/cursor.cpp
DSView/pv/view/cursor.cpp
+4
-4
DSView/pv/view/cursor.h
DSView/pv/view/cursor.h
+2
-2
DSView/pv/view/dsosignal.cpp
DSView/pv/view/dsosignal.cpp
+59
-17
DSView/pv/view/dsosignal.h
DSView/pv/view/dsosignal.h
+7
-0
DSView/pv/view/mathtrace.cpp
DSView/pv/view/mathtrace.cpp
+5
-17
DSView/pv/view/ruler.cpp
DSView/pv/view/ruler.cpp
+4
-5
DSView/pv/view/timemarker.cpp
DSView/pv/view/timemarker.cpp
+2
-5
DSView/pv/view/timemarker.h
DSView/pv/view/timemarker.h
+2
-5
DSView/pv/view/trace.cpp
DSView/pv/view/trace.cpp
+7
-0
DSView/pv/view/trace.h
DSView/pv/view/trace.h
+5
-0
DSView/pv/view/view.cpp
DSView/pv/view/view.cpp
+32
-0
DSView/pv/view/view.h
DSView/pv/view/view.h
+15
-0
DSView/pv/view/viewport.cpp
DSView/pv/view/viewport.cpp
+28
-63
libsigrok4DSL/hardware/DSL/dscope.c
libsigrok4DSL/hardware/DSL/dscope.c
+3
-1
libsigrok4DSL/hardware/DSL/dsl.c
libsigrok4DSL/hardware/DSL/dsl.c
+6
-3
libsigrok4DSL/libsigrok.h
libsigrok4DSL/libsigrok.h
+4
-0
No files found.
DSView/pv/sigsession.cpp
View file @
235a863b
...
...
@@ -130,7 +130,7 @@ SigSession::SigSession(DeviceManager &device_manager) :
_group_data
.
reset
(
new
data
::
Group
());
_group_cnt
=
0
;
connect
(
&
_feed_timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
data_unlock
()));
connect
(
&
_feed_timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
feed_timeout
()));
}
SigSession
::~
SigSession
()
...
...
@@ -353,6 +353,7 @@ void SigSession::capture_init()
set_cur_samplelimits
(
_dev_inst
->
get_sample_limit
());
_data_updated
=
false
;
_trigger_flag
=
false
;
_trigger_ch
=
0
;
_hw_replied
=
false
;
if
(
_dev_inst
->
dev_inst
()
->
mode
!=
LOGIC
)
_feed_timer
.
start
(
FeedInterval
);
...
...
@@ -591,7 +592,6 @@ void SigSession::check_update()
{
boost
::
lock_guard
<
boost
::
mutex
>
lock
(
_data_mutex
);
//data_unlock(); unlock after wave rendering
if
(
_capture_state
!=
Running
)
return
;
...
...
@@ -883,7 +883,7 @@ void SigSession::refresh(int holdtime)
//_cur_analog_snapshot.reset();
}
QTimer
::
singleShot
(
holdtime
,
this
,
SLOT
(
data_unlock
()));
QTimer
::
singleShot
(
holdtime
,
this
,
SLOT
(
feed_timeout
()));
//data_updated();
_data_updated
=
true
;
}
...
...
@@ -1039,6 +1039,12 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso)
_cur_dso_snapshot
->
append_payload
(
dso
);
}
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
view
::
Signal
>
s
,
_signals
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
((
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
s
))
&&
(
dsoSig
->
enabled
()))
dsoSig
->
paint_prepare
();
}
if
(
dso
.
num_samples
!=
0
)
{
// update current sample rate
set_cur_snap_samplerate
(
_dev_inst
->
get_sample_rate
());
...
...
@@ -1073,6 +1079,7 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso)
}
_trigger_flag
=
dso
.
trig_flag
;
_trigger_ch
=
dso
.
trig_ch
;
receive_data
(
dso
.
num_samples
);
if
(
!
_instant
)
...
...
@@ -1597,6 +1604,11 @@ bool SigSession::trigd() const
return
_trigger_flag
;
}
uint8_t
SigSession
::
trigd_ch
()
const
{
return
_trigger_ch
;
}
void
SigSession
::
nodata_timeout
()
{
GVariant
*
gvar
=
_dev_inst
->
get_config
(
NULL
,
NULL
,
SR_CONF_TRIGGER_SOURCE
);
...
...
@@ -1607,6 +1619,15 @@ void SigSession::nodata_timeout()
}
}
void
SigSession
::
feed_timeout
()
{
data_unlock
();
if
(
!
_data_updated
)
{
if
(
++
_noData_cnt
>=
(
WaitShowTime
/
FeedInterval
))
nodata_timeout
();
}
}
boost
::
shared_ptr
<
data
::
Snapshot
>
SigSession
::
get_snapshot
(
int
type
)
{
if
(
type
==
SR_CHANNEL_LOGIC
)
...
...
DSView/pv/sigsession.h
View file @
235a863b
...
...
@@ -23,6 +23,7 @@
#ifndef DSVIEW_PV_SIGSESSION_H
#define DSVIEW_PV_SIGSESSION_H
#include <libsigrok4DSL/libsigrok.h>
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
...
...
@@ -46,7 +47,6 @@
#include <QtConcurrent/QtConcurrent>
#include <QJsonObject>
#include <libsigrok4DSL/libsigrok.h>
#include <libusb.h>
#include "view/mathtrace.h"
...
...
@@ -231,6 +231,7 @@ public:
void
math_disable
();
bool
trigd
()
const
;
uint8_t
trigd_ch
()
const
;
boost
::
shared_ptr
<
data
::
Snapshot
>
get_snapshot
(
int
type
);
...
...
@@ -348,6 +349,7 @@ private:
QDateTime
_session_time
;
uint64_t
_trigger_pos
;
bool
_trigger_flag
;
uint8_t
_trigger_ch
;
bool
_hw_replied
;
error_state
_error
;
...
...
@@ -427,6 +429,7 @@ private slots:
void
data_lock
();
void
data_unlock
();
void
nodata_timeout
();
void
feed_timeout
();
void
repeat_update
();
private:
...
...
DSView/pv/view/cursor.cpp
View file @
235a863b
...
...
@@ -57,7 +57,7 @@ Cursor::Cursor(View &view, QColor color, uint64_t index) :
{
}
QRect
Cursor
::
get_label_rect
(
const
QRect
&
rect
,
bool
&
visible
)
const
QRect
Cursor
::
get_label_rect
(
const
QRect
&
rect
,
bool
&
visible
,
bool
has_hoff
)
const
{
const
double
samples_per_pixel
=
_view
.
session
().
cur_snap_samplerate
()
*
_view
.
scale
();
const
double
cur_offset
=
_index
/
samples_per_pixel
;
...
...
@@ -66,7 +66,7 @@ QRect Cursor::get_label_rect(const QRect &rect, bool &visible) const
visible
=
false
;
return
QRect
(
-
1
,
-
1
,
0
,
0
);
}
const
int64_t
x
=
_
index
/
samples_per_pixel
-
_view
.
offset
(
);
const
int64_t
x
=
_
view
.
index2pixel
(
_index
,
has_hoff
);
const
QSize
label_size
(
_text_size
.
width
()
+
View
::
LabelPadding
.
width
()
*
2
,
...
...
@@ -131,13 +131,13 @@ void Cursor::paint_label(QPainter &p, const QRect &rect,
}
void
Cursor
::
paint_fix_label
(
QPainter
&
p
,
const
QRect
&
rect
,
unsigned
int
prefix
,
QChar
label
,
QColor
color
)
unsigned
int
prefix
,
QChar
label
,
QColor
color
,
bool
has_hoff
)
{
using
pv
::
view
::
Ruler
;
bool
visible
;
compute_text_size
(
p
,
prefix
);
const
QRect
r
(
get_label_rect
(
rect
,
visible
));
const
QRect
r
(
get_label_rect
(
rect
,
visible
,
has_hoff
));
if
(
!
visible
)
return
;
...
...
DSView/pv/view/cursor.h
View file @
235a863b
...
...
@@ -64,7 +64,7 @@ public:
* @param rect The rectangle of the ruler client area.
* @return Returns the label rectangle.
*/
QRect
get_label_rect
(
const
QRect
&
rect
,
bool
&
visible
)
const
;
QRect
get_label_rect
(
const
QRect
&
rect
,
bool
&
visible
,
bool
has_hoff
=
true
)
const
;
QRect
get_close_rect
(
const
QRect
&
rect
)
const
;
...
...
@@ -78,7 +78,7 @@ public:
unsigned
int
prefix
,
int
index
);
void
paint_fix_label
(
QPainter
&
p
,
const
QRect
&
rect
,
unsigned
int
prefix
,
QChar
label
,
QColor
color
);
unsigned
int
prefix
,
QChar
label
,
QColor
color
,
bool
has_hoff
);
private:
void
compute_text_size
(
QPainter
&
p
,
unsigned
int
prefix
);
...
...
DSView/pv/view/dsosignal.cpp
View file @
235a863b
...
...
@@ -701,6 +701,58 @@ QRect DsoSignal::get_view_rect() const
_viewport
->
height
()
-
UpMargin
-
DownMargin
);
}
void
DsoSignal
::
paint_prepare
()
{
assert
(
_view
);
const
deque
<
boost
::
shared_ptr
<
pv
::
data
::
DsoSnapshot
>
>
&
snapshots
=
_data
->
get_snapshots
();
if
(
snapshots
.
empty
())
return
;
const
boost
::
shared_ptr
<
pv
::
data
::
DsoSnapshot
>
&
snapshot
=
snapshots
.
front
();
if
(
snapshot
->
empty
())
return
;
if
(
!
snapshot
->
has_data
(
get_index
()))
return
;
const
uint16_t
enabled_channels
=
snapshot
->
get_channel_num
();
if
(
_view
->
session
().
trigd
())
{
if
(
get_index
()
==
_view
->
session
().
trigd_ch
())
{
uint8_t
slope
=
DSO_TRIGGER_RISING
;
GVariant
*
gvar
=
_view
->
session
().
get_device
()
->
get_config
(
NULL
,
NULL
,
SR_CONF_TRIGGER_SLOPE
);
if
(
gvar
!=
NULL
)
{
slope
=
g_variant_get_byte
(
gvar
);
g_variant_unref
(
gvar
);
}
int64_t
trig_index
=
_view
->
get_trig_cursor
()
->
index
();
if
(
trig_index
>=
(
int64_t
)
snapshot
->
get_sample_count
())
return
;
const
uint8_t
*
const
trig_samples
=
snapshot
->
get_samples
(
0
,
0
,
get_index
());
for
(
uint16_t
i
=
0
;
i
<
TrigHRng
;
i
++
)
{
const
int64_t
i0
=
(
trig_index
-
i
-
1
)
*
enabled_channels
;
const
int64_t
i1
=
(
trig_index
-
i
)
*
enabled_channels
;
if
(
i1
<
0
)
break
;
const
uint8_t
t0
=
trig_samples
[
i0
];
const
uint8_t
t1
=
trig_samples
[
i1
];
if
((
slope
==
DSO_TRIGGER_RISING
&&
t0
>=
_trig_value
&&
t1
<=
_trig_value
)
||
(
slope
==
DSO_TRIGGER_FALLING
&&
t0
<=
_trig_value
&&
t1
>=
_trig_value
))
{
const
double
xoff
=
(
t1
==
t0
)
?
0
:
(
_trig_value
-
t0
)
*
1.0
/
(
t1
-
t0
);
_view
->
set_trig_hoff
(
i
+
1
-
xoff
);
break
;
}
}
}
//if (_view->trig_hoff() == 0 && trig_samples[3] != _trig_value)
// _view->set_trig_hoff(0);
}
else
{
_view
->
set_trig_hoff
(
0
);
}
}
void
DsoSignal
::
paint_back
(
QPainter
&
p
,
int
left
,
int
right
,
QColor
fore
,
QColor
back
)
{
assert
(
_view
);
...
...
@@ -818,7 +870,7 @@ void DsoSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColor
//const double samplerate = _view->session().cur_snap_samplerate();
const
int64_t
last_sample
=
max
((
int64_t
)(
snapshot
->
get_sample_count
()
-
1
),
(
int64_t
)
0
);
const
double
samples_per_pixel
=
samplerate
*
scale
;
const
double
start
=
offset
*
samples_per_pixel
;
const
double
start
=
offset
*
samples_per_pixel
-
_view
->
trig_hoff
()
;
const
double
end
=
start
+
samples_per_pixel
*
width
;
const
int64_t
start_sample
=
min
(
max
((
int64_t
)
floor
(
start
),
...
...
@@ -999,10 +1051,11 @@ void DsoSignal::paint_trace(QPainter &p,
float
top
=
get_view_rect
().
top
();
float
bottom
=
get_view_rect
().
bottom
();
float
x
=
(
start
/
samples_per_pixel
-
pixels_offset
)
+
left
;
double
pixels_per_sample
=
1.0
/
samples_per_pixel
;
uint8_t
value
;
int64_t
sample_end
=
sample_count
*
num_channels
;
float
x
=
(
start
/
samples_per_pixel
-
pixels_offset
)
+
left
+
_view
->
trig_hoff
()
*
pixels_per_sample
;
for
(
int64_t
sample
=
0
;
sample
<
sample_end
;
sample
+=
num_channels
)
{
value
=
samples
[
sample
];
const
float
y
=
min
(
max
(
top
,
zeroY
+
(
value
-
hw_offset
)
*
_scale
),
bottom
);
...
...
@@ -1045,7 +1098,7 @@ void DsoSignal::paint_envelope(QPainter &p,
float
bottom
=
get_view_rect
().
bottom
();
for
(
uint64_t
sample
=
0
;
sample
<
e
.
length
-
1
;
sample
++
)
{
const
float
x
=
((
e
.
scale
*
sample
+
e
.
start
)
/
samples_per_pixel
-
pixels_offset
)
+
left
;
samples_per_pixel
-
pixels_offset
)
+
left
+
_view
->
trig_hoff
()
/
samples_per_pixel
;
const
DsoSnapshot
::
EnvelopeSample
*
const
s
=
e
.
samples
+
sample
;
...
...
@@ -1401,6 +1454,7 @@ void DsoSignal::auto_start()
_view
->
session
().
data_auto_lock
(
AutoLock
);
_autoV
=
true
;
_autoH
=
true
;
_view
->
auto_trig
(
get_index
());
QTimer
::
singleShot
(
AutoTime
,
&
_view
->
session
(),
SLOT
(
auto_end
()));
}
}
...
...
@@ -1428,13 +1482,7 @@ bool DsoSignal::measure(const QPointF &p)
if
(
snapshot
->
empty
())
return
false
;
const
double
scale
=
_view
->
scale
();
assert
(
scale
>
0
);
const
int64_t
pixels_offset
=
_view
->
offset
();
const
double
samplerate
=
_view
->
session
().
cur_snap_samplerate
();
const
double
samples_per_pixel
=
samplerate
*
scale
;
_hover_index
=
floor
((
p
.
x
()
+
pixels_offset
)
*
samples_per_pixel
+
0.5
);
_hover_index
=
_view
->
pixel2index
(
p
.
x
());
if
(
_hover_index
>=
snapshot
->
get_sample_count
())
return
false
;
...
...
@@ -1471,12 +1519,6 @@ QPointF DsoSignal::get_point(uint64_t index, float &value)
if
(
snapshot
->
empty
())
return
pt
;
const
double
scale
=
_view
->
scale
();
assert
(
scale
>
0
);
const
int64_t
pixels_offset
=
_view
->
offset
();
const
double
samplerate
=
_view
->
session
().
cur_snap_samplerate
();
const
double
samples_per_pixel
=
samplerate
*
scale
;
if
(
index
>=
snapshot
->
get_sample_count
())
return
pt
;
...
...
@@ -1484,7 +1526,7 @@ QPointF DsoSignal::get_point(uint64_t index, float &value)
const
float
top
=
get_view_rect
().
top
();
const
float
bottom
=
get_view_rect
().
bottom
();
const
int
hw_offset
=
get_hw_offset
();
const
float
x
=
(
index
/
samples_per_pixel
-
pixels_offset
);
const
float
x
=
_view
->
index2pixel
(
index
);
const
float
y
=
min
(
max
(
top
,
get_zero_vpos
()
+
(
value
-
hw_offset
)
*
_scale
),
bottom
);
pt
=
QPointF
(
x
,
y
);
...
...
DSView/pv/view/dsosignal.h
View file @
235a863b
...
...
@@ -63,6 +63,8 @@ private:
static
const
int
AutoTime
=
10000
;
static
const
int
AutoLock
=
3
;
static
const
int
TrigHRng
=
2
;
public:
enum
DsoSetRegions
{
DSO_NONE
=
-
1
,
...
...
@@ -166,6 +168,11 @@ public:
double
value2ratio
(
int
value
)
const
;
double
pos2ratio
(
int
pos
)
const
;
/**
* paint prepare
**/
void
paint_prepare
();
/**
* Paints the background layer of the trace with a QPainter
* @param p the QPainter to paint into.
...
...
DSView/pv/view/mathtrace.cpp
View file @
235a863b
...
...
@@ -222,7 +222,7 @@ void MathTrace::paint_mid(QPainter &p, int left, int right, QColor fore, QColor
const
double
samplerate
=
_math_stack
->
samplerate
();
const
int64_t
last_sample
=
max
((
int64_t
)(
_math_stack
->
get_sample_num
()
-
1
),
(
int64_t
)
0
);
const
double
samples_per_pixel
=
samplerate
*
scale
;
const
double
start
=
offset
*
samples_per_pixel
;
const
double
start
=
offset
*
samples_per_pixel
-
_view
->
trig_hoff
()
;
const
double
end
=
start
+
samples_per_pixel
*
width
;
const
int64_t
start_sample
=
min
(
max
((
int64_t
)
floor
(
start
),
...
...
@@ -287,7 +287,7 @@ void MathTrace::paint_trace(QPainter &p,
double
top
=
get_view_rect
().
top
();
double
bottom
=
get_view_rect
().
bottom
();
float
x
=
(
start
/
samples_per_pixel
-
pixels_offset
)
+
left
;
float
x
=
(
start
/
samples_per_pixel
-
pixels_offset
)
+
left
+
_view
->
trig_hoff
()
/
samples_per_pixel
;
double
pixels_per_sample
=
1.0
/
samples_per_pixel
;
for
(
int64_t
index
=
0
;
index
<
sample_count
;
index
++
)
{
...
...
@@ -326,7 +326,7 @@ void MathTrace::paint_envelope(QPainter &p,
double
bottom
=
get_view_rect
().
bottom
();
for
(
uint64_t
sample
=
0
;
sample
<
e
.
length
-
1
;
sample
++
)
{
const
float
x
=
((
e
.
scale
*
sample
+
e
.
start
)
/
samples_per_pixel
-
pixels_offset
)
+
left
;
samples_per_pixel
-
pixels_offset
)
+
left
+
_view
->
trig_hoff
()
/
samples_per_pixel
;
const
data
::
MathStack
::
EnvelopeSample
*
const
s
=
e
.
samples
+
sample
;
...
...
@@ -458,13 +458,7 @@ bool MathTrace::measure(const QPointF &p)
if
(
!
window
.
contains
(
p
))
return
false
;
const
double
scale
=
_view
->
scale
();
assert
(
scale
>
0
);
const
int64_t
pixels_offset
=
_view
->
offset
();
const
double
samplerate
=
_view
->
session
().
cur_snap_samplerate
();
const
double
samples_per_pixel
=
samplerate
*
scale
;
_hover_index
=
floor
((
p
.
x
()
+
pixels_offset
)
*
samples_per_pixel
+
0.5
);
_hover_index
=
_view
->
pixel2index
(
p
.
x
());
if
(
_hover_index
>=
_math_stack
->
get_sample_num
())
return
false
;
...
...
@@ -477,16 +471,10 @@ QPointF MathTrace::get_point(uint64_t index, float &value)
{
QPointF
pt
=
QPointF
(
0
,
0
);
const
double
scale
=
_view
->
scale
();
assert
(
scale
>
0
);
const
int64_t
pixels_offset
=
_view
->
offset
();
const
double
samplerate
=
_view
->
session
().
cur_snap_samplerate
();
const
double
samples_per_pixel
=
samplerate
*
scale
;
const
float
top
=
get_view_rect
().
top
();
const
float
bottom
=
get_view_rect
().
bottom
();
const
float
zeroP
=
_zero_vrate
*
get_view_rect
().
height
()
+
top
;
const
float
x
=
(
index
/
samples_per_pixel
-
pixels_offset
);
const
float
x
=
_view
->
index2pixel
(
index
);
value
=
*
_math_stack
->
get_math
(
index
);
float
y
=
min
(
max
(
top
,
zeroP
-
(
value
*
_scale
)),
bottom
);
...
...
DSView/pv/view/ruler.cpp
View file @
235a863b
...
...
@@ -194,8 +194,7 @@ void Ruler::mouseMoveEvent(QMouseEvent *e)
(
void
)
e
;
if
(
_grabbed_marker
)
{
_grabbed_marker
->
set_index
((
_view
.
offset
()
+
_view
.
hover_point
().
x
())
*
_view
.
scale
()
*
_view
.
session
().
cur_snap_samplerate
());
_grabbed_marker
->
set_index
(
_view
.
pixel2index
(
_view
.
hover_point
().
x
()));
_view
.
cursor_moving
();
_curs_moved
=
true
;
}
...
...
@@ -253,7 +252,7 @@ void Ruler::mouseReleaseEvent(QMouseEvent *event)
_cursor_sel_visible
=
true
;
}
else
{
int
overCursor
;
uint64_t
index
=
(
_view
.
offset
()
+
_cursor_sel_x
+
0.5
)
*
_view
.
scale
()
*
_view
.
session
().
cur_snap_samplerate
(
);
uint64_t
index
=
_view
.
pixel2index
(
_cursor_sel_x
);
overCursor
=
in_cursor_sel_rect
(
event
->
pos
());
if
(
overCursor
==
0
)
{
_view
.
add_cursor
(
CursorColor
[
_view
.
get_cursorList
().
size
()
%
8
],
index
);
...
...
@@ -440,10 +439,10 @@ void Ruler::draw_logic_tick_mark(QPainter &p)
}
}
if
(
_view
.
trig_cursor_shown
())
{
_view
.
get_trig_cursor
()
->
paint_fix_label
(
p
,
rect
(),
prefix
,
'T'
,
_view
.
get_trig_cursor
()
->
colour
());
_view
.
get_trig_cursor
()
->
paint_fix_label
(
p
,
rect
(),
prefix
,
'T'
,
_view
.
get_trig_cursor
()
->
colour
()
,
false
);
}
if
(
_view
.
search_cursor_shown
())
{
_view
.
get_search_cursor
()
->
paint_fix_label
(
p
,
rect
(),
prefix
,
'S'
,
_view
.
get_search_cursor
()
->
colour
());
_view
.
get_search_cursor
()
->
paint_fix_label
(
p
,
rect
(),
prefix
,
'S'
,
_view
.
get_search_cursor
()
->
colour
()
,
true
);
}
}
...
...
DSView/pv/view/timemarker.cpp
View file @
235a863b
...
...
@@ -78,12 +78,9 @@ void TimeMarker::set_index(uint64_t index)
time_changed
();
}
void
TimeMarker
::
paint
(
QPainter
&
p
,
const
QRect
&
rect
,
const
bool
highlight
,
int
order
)
void
TimeMarker
::
paint
(
QPainter
&
p
,
const
QRect
&
rect
,
const
bool
highlight
,
int
order
,
bool
trig_hoff
)
{
const
uint64_t
sample_rate
=
_view
.
session
().
cur_snap_samplerate
();
const
double
scale
=
_view
.
scale
();
const
double
samples_per_pixel
=
sample_rate
*
scale
;
const
int64_t
x
=
_index
/
samples_per_pixel
-
_view
.
offset
();
const
int64_t
x
=
_view
.
index2pixel
(
_index
,
trig_hoff
);
if
(
x
<=
rect
.
right
())
{
QColor
color
=
(
order
==
-
1
)
?
_colour
:
Ruler
::
CursorColor
[
order
%
8
];
p
.
setPen
((
_grabbed
|
highlight
)
?
QPen
(
color
.
lighter
(),
2
,
Qt
::
DashLine
)
:
QPen
(
color
,
1
,
Qt
::
DashLine
));
...
...
DSView/pv/view/timemarker.h
View file @
235a863b
...
...
@@ -84,7 +84,7 @@ public:
* @param p The painter to draw with.
* @param rect The rectangle of the viewport client area.
*/
virtual
void
paint
(
QPainter
&
p
,
const
QRect
&
rect
,
const
bool
highlight
,
int
order
);
virtual
void
paint
(
QPainter
&
p
,
const
QRect
&
rect
,
const
bool
highlight
,
int
order
,
bool
trig_hoff
=
true
);
/**
* Gets the marker label rectangle.
...
...
@@ -92,7 +92,7 @@ public:
* @param visible is this marker in visible area
* @return Returns the label rectangle.
*/
virtual
QRect
get_label_rect
(
const
QRect
&
rect
,
bool
&
visible
)
const
=
0
;
virtual
QRect
get_label_rect
(
const
QRect
&
rect
,
bool
&
visible
,
bool
has_hoff
=
true
)
const
=
0
;
/**
* Paints the marker's label to the ruler.
...
...
@@ -103,9 +103,6 @@ public:
virtual
void
paint_label
(
QPainter
&
p
,
const
QRect
&
rect
,
unsigned
int
prefix
,
int
index
)
=
0
;
virtual
void
paint_fix_label
(
QPainter
&
p
,
const
QRect
&
rect
,
unsigned
int
prefix
,
QChar
label
,
QColor
color
)
=
0
;
signals:
void
time_changed
();
...
...
DSView/pv/view/trace.cpp
View file @
235a863b
...
...
@@ -211,6 +211,13 @@ pv::view::Viewport* Trace::get_viewport() const
return
_viewport
;
}
void
Trace
::
paint_prepare
()
{
assert
(
_view
);
_view
->
set_trig_hoff
(
0
);
}
void
Trace
::
paint_back
(
QPainter
&
p
,
int
left
,
int
right
,
QColor
fore
,
QColor
back
)
{
(
void
)
back
;
...
...
DSView/pv/view/trace.h
View file @
235a863b
...
...
@@ -153,6 +153,11 @@ public:
virtual
void
set_viewport
(
pv
::
view
::
Viewport
*
viewport
);
pv
::
view
::
Viewport
*
get_viewport
()
const
;
/**
* Paints prepare
**/
virtual
void
paint_prepare
();
/**
* Paints the background layer of the trace with a QPainter
* @param p the QPainter to paint into.
...
...
DSView/pv/view/view.cpp
View file @
235a863b
...
...
@@ -90,6 +90,7 @@ View::View(SigSession &session, pv::toolbars::SamplingBar *sampling_bar, QWidget
_offset
(
0
),
_preOffset
(
0
),
_updating_scroll
(
false
),
_trig_hoff
(
0
),
_show_cursors
(
false
),
_search_hit
(
false
),
_show_xcursors
(
false
),
...
...
@@ -229,6 +230,16 @@ int64_t View::offset() const
return
_offset
;
}
double
View
::
trig_hoff
()
const
{
return
_trig_hoff
;
}
void
View
::
set_trig_hoff
(
double
hoff
)
{
_trig_hoff
=
hoff
;
}
double
View
::
get_minscale
()
const
{
return
_minscale
;
...
...
@@ -251,6 +262,7 @@ void View::capture_init()
set_scale_offset
(
_maxscale
,
0
);
status_clear
();
_trig_time_setted
=
false
;
_trig_hoff
=
0
;
}
void
View
::
zoom
(
double
steps
)
...
...
@@ -1275,5 +1287,25 @@ void View::set_back(bool ready)
_back_ready
=
ready
;
}
double
View
::
index2pixel
(
uint64_t
index
,
bool
has_hoff
)
{
const
double
samples_per_pixel
=
session
().
cur_snap_samplerate
()
*
scale
();
double
pixels
;
if
(
has_hoff
)
pixels
=
index
/
samples_per_pixel
-
offset
()
+
trig_hoff
()
/
samples_per_pixel
;
else
pixels
=
index
/
samples_per_pixel
-
offset
();
return
pixels
;
}
uint64_t
View
::
pixel2index
(
double
pixel
)
{
const
double
samples_per_pixel
=
session
().
cur_snap_samplerate
()
*
scale
();
uint64_t
index
=
(
pixel
+
offset
())
*
samples_per_pixel
-
trig_hoff
();
return
index
;
}
}
// namespace view
}
// namespace pv
DSView/pv/view/view.h
View file @
235a863b
...
...
@@ -118,6 +118,12 @@ public:
int64_t
offset
()
const
;
int
v_offset
()
const
;
/**
* trigger position fix
*/
double
trig_hoff
()
const
;
void
set_trig_hoff
(
double
hoff
);
int64_t
get_min_offset
();
int64_t
get_max_offset
();
...
...
@@ -227,6 +233,12 @@ public:
bool
back_ready
()
const
;
void
set_back
(
bool
ready
);
/*
* untils
*/
double
index2pixel
(
uint64_t
index
,
bool
has_hoff
=
true
);
uint64_t
pixel2index
(
double
pixel
);
signals:
void
hover_point_changed
();
...
...
@@ -351,6 +363,9 @@ private:
int
_signalHeight
;
bool
_updating_scroll
;
// trigger position fix
double
_trig_hoff
;
bool
_show_cursors
;
std
::
list
<
Cursor
*>
_cursorList
;
Cursor
*
_trig_cursor
;
...
...
DSView/pv/view/viewport.cpp
View file @
235a863b
This diff is collapsed.
Click to expand it.
libsigrok4DSL/hardware/DSL/dscope.c
View file @
235a863b
...
...
@@ -1048,7 +1048,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
for
(
l
=
sdi
->
channels
;
l
;
l
=
l
->
next
)
{
struct
sr_channel
*
probe
=
(
struct
sr_channel
*
)
l
->
data
;
probe
->
vpos_trans
=
devc
->
profile
->
dev_caps
.
default_pwmtrans
;
probe
->
comb_comp
=
devc
->
profile
->
dev_caps
.
default_comb_comp
;
//probe->comb_comp = devc->profile->dev_caps.default_comb_comp;
//probe->digi_fgain = 0;
if
(
probe
->
vga_ptr
!=
NULL
)
{
for
(
i
=
0
;
devc
->
profile
->
dev_caps
.
vdivs
[
i
];
i
++
)
{
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
vga_defaults
);
j
++
)
{
...
...
@@ -1206,6 +1207,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
}
else
if
(
id
==
SR_CONF_PROBE_COMB_COMP
)
{
ch
->
comb_comp
=
g_variant_get_int16
(
data
);
ret
=
dsl_wr_dso
(
sdi
,
dso_cmd_gen
(
sdi
,
ch
,
SR_CONF_PROBE_VDIV
));
ret
=
dsl_wr_dso
(
sdi
,
dso_cmd_gen
(
sdi
,
ch
,
SR_CONF_PROBE_OFFSET
));
if
(
ret
==
SR_OK
)
sr_dbg
(
"%s: setting COMB_COMP of channel %d to %d mv"
,
__func__
,
ch
->
index
,
ch
->
comb_comp
);
...
...
libsigrok4DSL/hardware/DSL/dsl.c
View file @
235a863b
...
...
@@ -728,8 +728,9 @@ SR_PRIV int dsl_fpga_arm(const struct sr_dev_inst *sdi)
setting
.
count_header
=
0x0302
;
setting
.
trig_pos_header
=
0x0502
;
setting
.
trig_glb_header
=
0x0701
;
setting
.
ch_en_header
=
0x0801
;
setting
.
dso_count_header
=
0x0902
;
setting
.
dso_count_header
=
0x0802
;
setting
.
ch_en_header
=
0x0a02
;
setting
.
fgain_header
=
0x0c01
;
setting
.
trig_header
=
0x40a0
;
setting
.
end_sync
=
0xfa5afa5a
;
...
...
@@ -1760,9 +1761,11 @@ static void get_measure(const struct sr_dev_inst *sdi, uint8_t *buf, uint32_t of
devc
->
mstatus
.
vlen
=
*
((
const
uint32_t
*
)
buf
+
offset
/
2
+
2
/
2
)
&
0x0fffffff
;
devc
->
mstatus
.
stream_mode
=
(
*
((
const
uint32_t
*
)
buf
+
offset
/
2
+
2
/
2
)
&
0x80000000
)
!=
0
;
devc
->
mstatus
.
measure_valid
=
*
((
const
uint32_t
*
)
buf
+
offset
/
2
+
2
/
2
)
&
0x40000000
;
devc
->
mstatus
.
sample_divider
=
*
((
const
uint32_t
*
)
buf
+
offset
/
2
+
4
/
2
)
&
0x0
f
ffffff
;
devc
->
mstatus
.
sample_divider
=
*
((
const
uint32_t
*
)
buf
+
offset
/
2
+
4
/
2
)
&
0x0
0
ffffff
;
devc
->
mstatus
.
sample_divider_tog
=
(
*
((
const
uint32_t
*
)
buf
+
offset
/
2
+
4
/
2
)
&
0x80000000
)
!=
0
;
devc
->
mstatus
.
trig_flag
=
(
*
((
const
uint32_t
*
)
buf
+
offset
/
2
+
4
/
2
)
&
0x40000000
)
!=
0
;
devc
->
mstatus
.
trig_ch
=
(
*
((
const
uint8_t
*
)
buf
+
offset
*
2
+
5
*
2
+
1
)
&
0x38
)
>>
3
;
devc
->
mstatus
.
trig_offset
=
*
((
const
uint8_t
*
)
buf
+
offset
*
2
+
5
*
2
+
1
)
&
0x07
;
devc
->
mstatus
.
ch0_max
=
*
((
const
uint8_t
*
)
buf
+
offset
*
2
+
33
*
2
);
devc
->
mstatus
.
ch0_min
=
*
((
const
uint8_t
*
)
buf
+
offset
*
2
+
33
*
2
+
1
);
...
...
libsigrok4DSL/libsigrok.h
View file @
235a863b
...
...
@@ -387,6 +387,8 @@ struct sr_datafeed_dso {
gboolean
samplerate_tog
;
/** trig flag */
gboolean
trig_flag
;
/** trig channel */
uint8_t
trig_ch
;
/** The analog value(s). The data is interleaved according to
* the probes list. */
void
*
data
;
...
...
@@ -703,6 +705,8 @@ struct sr_status {
uint32_t
sample_divider
;
gboolean
sample_divider_tog
;
gboolean
trig_flag
;
uint8_t
trig_ch
;
uint8_t
trig_offset
;
uint8_t
ch0_max
;
uint8_t
ch0_min
;
...
...
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