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
9d871219
Commit
9d871219
authored
Jun 19, 2015
by
DreamSourceLab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add horizontal&vertical measure function @ DSO mode
parent
618f7c92
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
313 additions
and
74 deletions
+313
-74
DSView/pv/dock/measuredock.cpp
DSView/pv/dock/measuredock.cpp
+44
-49
DSView/pv/dock/measuredock.h
DSView/pv/dock/measuredock.h
+0
-1
DSView/pv/mainwindow.cpp
DSView/pv/mainwindow.cpp
+1
-1
DSView/pv/mainwindow.h
DSView/pv/mainwindow.h
+1
-0
DSView/pv/view/decodetrace.cpp
DSView/pv/view/decodetrace.cpp
+1
-1
DSView/pv/view/dsosignal.cpp
DSView/pv/view/dsosignal.cpp
+14
-3
DSView/pv/view/dsosignal.h
DSView/pv/view/dsosignal.h
+1
-0
DSView/pv/view/trace.cpp
DSView/pv/view/trace.cpp
+1
-1
DSView/pv/view/view.cpp
DSView/pv/view/view.cpp
+15
-0
DSView/pv/view/view.h
DSView/pv/view/view.h
+1
-0
DSView/pv/view/viewport.cpp
DSView/pv/view/viewport.cpp
+213
-18
DSView/pv/view/viewport.h
DSView/pv/view/viewport.h
+21
-0
No files found.
DSView/pv/dock/measuredock.cpp
View file @
9d871219
...
...
@@ -32,6 +32,9 @@
#include "../view/logicsignal.h"
#include "../data/signaldata.h"
#include "../data/snapshot.h"
#include "../devicemanager.h"
#include "../device/device.h"
#include "../device/file.h"
#include <QObject>
#include <QPainter>
...
...
@@ -64,21 +67,19 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
_duty_label
=
new
QLabel
(
"#####"
,
_widget
);
_mouse_layout
=
new
QGridLayout
();
_mouse_layout
->
addWidget
(
_fen_checkBox
,
0
,
0
,
1
,
2
);
_mouse_layout
->
addWidget
(
new
QLabel
(
tr
(
"W
idth
: "
),
_widget
),
1
,
0
);
_mouse_layout
->
addWidget
(
_fen_checkBox
,
0
,
0
,
1
,
4
);
_mouse_layout
->
addWidget
(
new
QLabel
(
tr
(
"W: "
),
_widget
),
1
,
0
);
_mouse_layout
->
addWidget
(
_width_label
,
1
,
1
);
_mouse_layout
->
addWidget
(
new
QLabel
(
tr
(
"Period: "
),
_widget
),
2
,
0
);
_mouse_layout
->
addWidget
(
_period_label
,
2
,
1
);
_mouse_layout
->
addWidget
(
new
QLabel
(
tr
(
"Frequency: "
),
_widget
),
3
,
0
);
_mouse_layout
->
addWidget
(
_freq_label
,
3
,
1
);
_mouse_layout
->
addWidget
(
new
QLabel
(
tr
(
"Duty Cycle: "
),
_widget
),
4
,
0
);
_mouse_layout
->
addWidget
(
_duty_label
,
4
,
1
);
_mouse_layout
->
addWidget
(
new
QLabel
(
_widget
),
0
,
2
);
_mouse_layout
->
addWidget
(
new
QLabel
(
_widget
),
1
,
2
);
_mouse_layout
->
addWidget
(
new
QLabel
(
_widget
),
2
,
2
);
_mouse_layout
->
addWidget
(
new
QLabel
(
_widget
),
3
,
2
);
_mouse_layout
->
addWidget
(
new
QLabel
(
_widget
),
4
,
2
);
_mouse_layout
->
setColumnStretch
(
2
,
1
);
_mouse_layout
->
addWidget
(
new
QLabel
(
tr
(
"P: "
),
_widget
),
1
,
2
);
_mouse_layout
->
addWidget
(
_period_label
,
1
,
3
);
_mouse_layout
->
addWidget
(
new
QLabel
(
tr
(
"F: "
),
_widget
),
2
,
2
);
_mouse_layout
->
addWidget
(
_freq_label
,
2
,
3
);
_mouse_layout
->
addWidget
(
new
QLabel
(
tr
(
"D: "
),
_widget
),
2
,
0
);
_mouse_layout
->
addWidget
(
_duty_label
,
2
,
1
);
_mouse_layout
->
addWidget
(
new
QLabel
(
_widget
),
0
,
4
);
_mouse_layout
->
addWidget
(
new
QLabel
(
_widget
),
1
,
4
);
_mouse_layout
->
addWidget
(
new
QLabel
(
_widget
),
2
,
4
);
_mouse_layout
->
setColumnStretch
(
5
,
1
);
_mouse_groupBox
->
setLayout
(
_mouse_layout
);
...
...
@@ -86,12 +87,9 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
_t1_comboBox
=
new
QComboBox
(
_widget
);
_t2_comboBox
=
new
QComboBox
(
_widget
);
_t3_comboBox
=
new
QComboBox
(
_widget
);
_delta_label_t1t2
=
new
QLabel
(
"#####"
,
_widget
);
_cnt_label_t1t2
=
new
QLabel
(
"#####"
,
_widget
);
_delta_label_t2t3
=
new
QLabel
(
"#####"
,
_widget
);
_cnt_label_t2t3
=
new
QLabel
(
"#####"
,
_widget
);
_delta_label_t1t3
=
new
QLabel
(
"#####"
,
_widget
);
_cnt_label_t1t3
=
new
QLabel
(
"#####"
,
_widget
);
_delta_label_t1t2
=
new
QLabel
(
"##########/##########"
,
_widget
);
_delta_label_t2t3
=
new
QLabel
(
"##########/##########"
,
_widget
);
_delta_label_t1t3
=
new
QLabel
(
"##########/##########"
,
_widget
);
_t1_last_index
=
0
;
_t2_last_index
=
0
;
_t3_last_index
=
0
;
...
...
@@ -104,31 +102,25 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"T3: "
),
_widget
),
2
,
0
);
_cursor_layout
->
addWidget
(
_t3_comboBox
,
2
,
1
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"|T2 - T1|: "
),
_widget
),
3
,
0
);
_cursor_layout
->
addWidget
(
_delta_label_t1t2
,
3
,
1
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"Delta Samples: "
),
_widget
),
3
,
2
);
_cursor_layout
->
addWidget
(
_cnt_label_t1t2
,
3
,
3
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"Time/Samples"
),
_widget
),
3
,
1
,
1
,
2
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"|T2 - T1|: "
),
_widget
),
4
,
0
);
_cursor_layout
->
addWidget
(
_delta_label_t1t2
,
4
,
1
,
1
,
2
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"|T3 - T2|: "
),
_widget
),
4
,
0
);
_cursor_layout
->
addWidget
(
_delta_label_t2t3
,
4
,
1
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"Delta Samples: "
),
_widget
),
4
,
2
);
_cursor_layout
->
addWidget
(
_cnt_label_t2t3
,
4
,
3
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"|T3 - T2|: "
),
_widget
),
5
,
0
);
_cursor_layout
->
addWidget
(
_delta_label_t2t3
,
5
,
1
,
1
,
2
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"|T3 - T1|: "
),
_widget
),
5
,
0
);
_cursor_layout
->
addWidget
(
_delta_label_t1t3
,
5
,
1
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"Delta Samples: "
),
_widget
),
5
,
2
);
_cursor_layout
->
addWidget
(
_cnt_label_t1t3
,
5
,
3
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"|T3 - T1|: "
),
_widget
),
6
,
0
);
_cursor_layout
->
addWidget
(
_delta_label_t1t3
,
6
,
1
,
1
,
2
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"Cursors"
),
_widget
),
6
,
0
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"Time/Samples"
),
_widget
),
6
,
1
,
1
,
4
);
_cursor_layout
->
addWidget
(
new
QLabel
(
_widget
),
7
,
0
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"Cursors"
),
_widget
),
8
,
0
);
_cursor_layout
->
addWidget
(
new
QLabel
(
tr
(
"Time/Samples"
),
_widget
),
8
,
1
,
1
,
2
);
_cursor_layout
->
addWidget
(
new
QLabel
(
_widget
),
0
,
4
);
_cursor_layout
->
addWidget
(
new
QLabel
(
_widget
),
1
,
4
);
_cursor_layout
->
addWidget
(
new
QLabel
(
_widget
),
2
,
4
);
_cursor_layout
->
addWidget
(
new
QLabel
(
_widget
),
3
,
4
);
_cursor_layout
->
addWidget
(
new
QLabel
(
_widget
),
4
,
4
);
_cursor_layout
->
addWidget
(
new
QLabel
(
_widget
),
0
,
2
);
_cursor_layout
->
addWidget
(
new
QLabel
(
_widget
),
1
,
2
);
_cursor_layout
->
addWidget
(
new
QLabel
(
_widget
),
2
,
2
);
_cursor_layout
->
setColumnStretch
(
2
,
1
);
_cursor_layout
->
setColumnStretch
(
4
,
1
);
_cursor_groupBox
->
setLayout
(
_cursor_layout
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
_widget
);
...
...
@@ -205,9 +197,8 @@ void MeasureDock::cursor_update()
_curpos_label_list
.
push_back
(
_curpos_label
);
_space_label_list
.
push_back
(
_space_label
);
_cursor_layout
->
addWidget
(
_cursor_pushButton
,
6
+
index
,
0
);
_cursor_layout
->
addWidget
(
_curpos_label
,
6
+
index
,
1
,
1
,
4
);
_cursor_layout
->
addWidget
(
_space_label
,
6
+
index
,
2
);
_cursor_layout
->
addWidget
(
_cursor_pushButton
,
8
+
index
,
0
);
_cursor_layout
->
addWidget
(
_curpos_label
,
8
+
index
,
1
,
1
,
2
);
connect
(
_cursor_pushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
goto_cursor
()));
...
...
@@ -255,28 +246,32 @@ void MeasureDock::cursor_moved()
void
MeasureDock
::
delta_update
()
{
QString
delta_text
;
_t1_last_index
=
std
::
max
(
_t1_comboBox
->
currentIndex
(),
0
);
_t2_last_index
=
std
::
max
(
_t2_comboBox
->
currentIndex
(),
0
);
_t3_last_index
=
std
::
max
(
_t3_comboBox
->
currentIndex
(),
0
);
if
(
_t1_comboBox
->
count
()
!=
0
&&
_t2_comboBox
->
count
()
!=
0
)
{
uint64_t
delta
=
abs
(
_view
.
get_cursor_samples
(
_t1_last_index
)
-
_view
.
get_cursor_samples
(
_t2_last_index
));
_delta_label_t1t2
->
setText
(
_view
.
get_cm_delta
(
_t1_last_index
,
_t2_last_index
));
_cnt_label_t1t2
->
setText
(
QString
::
number
(
delta
));
delta_text
=
_view
.
get_cm_delta
(
_t1_last_index
,
_t2_last_index
)
+
"/"
+
QString
::
number
(
delta
);
_delta_label_t1t2
->
setText
(
delta_text
);
}
if
(
_t2_comboBox
->
count
()
!=
0
&&
_t2_comboBox
->
count
()
!=
0
)
{
uint64_t
delta
=
abs
(
_view
.
get_cursor_samples
(
_t2_last_index
)
-
_view
.
get_cursor_samples
(
_t3_last_index
));
_delta_label_t2t3
->
setText
(
_view
.
get_cm_delta
(
_t2_last_index
,
_t3_last_index
));
_cnt_label_t2t3
->
setText
(
QString
::
number
(
delta
));
delta_text
=
_view
.
get_cm_delta
(
_t2_last_index
,
_t3_last_index
)
+
"/"
+
QString
::
number
(
delta
);
_delta_label_t2t3
->
setText
(
delta_text
);
}
if
(
_t1_comboBox
->
count
()
!=
0
&&
_t3_comboBox
->
count
()
!=
0
)
{
uint64_t
delta
=
abs
(
_view
.
get_cursor_samples
(
_t1_last_index
)
-
_view
.
get_cursor_samples
(
_t3_last_index
));
_delta_label_t1t3
->
setText
(
_view
.
get_cm_delta
(
_t1_last_index
,
_t3_last_index
));
_cnt_label_t1t3
->
setText
(
QString
::
number
(
delta
));
delta_text
=
_view
.
get_cm_delta
(
_t1_last_index
,
_t3_last_index
)
+
"/"
+
QString
::
number
(
delta
);
_delta_label_t1t3
->
setText
(
delta_text
);
}
}
...
...
DSView/pv/dock/measuredock.h
View file @
9d871219
...
...
@@ -65,7 +65,6 @@ public:
~
MeasureDock
();
void
paintEvent
(
QPaintEvent
*
);
signals:
private
slots
:
...
...
DSView/pv/mainwindow.cpp
View file @
9d871219
...
...
@@ -206,7 +206,7 @@ void MainWindow::setup_ui()
_measure_dock
->
setFeatures
(
QDockWidget
::
DockWidgetMovable
);
_measure_dock
->
setAllowedAreas
(
Qt
::
RightDockWidgetArea
);
_measure_dock
->
setVisible
(
false
);
dock
::
MeasureDock
*
_measure_widget
=
new
dock
::
MeasureDock
(
_measure_dock
,
*
_view
,
_session
);
_measure_widget
=
new
dock
::
MeasureDock
(
_measure_dock
,
*
_view
,
_session
);
_measure_dock
->
setWidget
(
_measure_widget
);
// search dock
_search_dock
=
new
QDockWidget
(
tr
(
"Search..."
),
this
);
...
...
DSView/pv/mainwindow.h
View file @
9d871219
...
...
@@ -165,6 +165,7 @@ private:
dock
::
TriggerDock
*
_trigger_widget
;
dock
::
DsoTriggerDock
*
_dso_trigger_widget
;
QDockWidget
*
_measure_dock
;
dock
::
MeasureDock
*
_measure_widget
;
QDockWidget
*
_search_dock
;
dock
::
SearchDock
*
_search_widget
;
...
...
DSView/pv/view/decodetrace.cpp
View file @
9d871219
...
...
@@ -278,7 +278,7 @@ void DecodeTrace::paint_fore(QPainter &p, int left, int right)
const
QRect
r
(
left
+
ArrowSize
*
2
,
y
-
row_height
/
2
,
right
-
left
,
row_height
);
const
QString
h
(
_cur_row_headings
[
i
]);
const
int
f
=
Qt
::
AlignLeft
|
Qt
::
AlignVCenter
|
const
int
f
=
Qt
::
AlignLeft
|
Qt
::
AlignBottom
|
Qt
::
TextDontClip
;
// Draw the outline
...
...
DSView/pv/view/dsosignal.cpp
View file @
9d871219
...
...
@@ -198,6 +198,11 @@ void DsoSignal::set_scale(float scale)
_scale
=
scale
;
}
float
DsoSignal
::
get_scale
()
{
return
_scale
;
}
void
DsoSignal
::
set_enable
(
bool
enable
)
{
if
((
strcmp
(
_dev_inst
->
dev_inst
()
->
driver
->
name
,
"DSLogic"
)
==
0
)
&&
...
...
@@ -845,7 +850,9 @@ void DsoSignal::paint_trace(QPainter &p,
const
uint8_t
*
const
samples
=
snapshot
->
get_samples
(
start
,
end
,
get_index
());
assert
(
samples
);
p
.
setPen
(
_colour
);
QColor
trace_colour
=
_colour
;
trace_colour
.
setAlpha
(
100
);
p
.
setPen
(
trace_colour
);
//p.setPen(QPen(_colour, 3, Qt::SolidLine));
QPointF
*
points
=
new
QPointF
[
sample_count
];
...
...
@@ -899,7 +906,9 @@ void DsoSignal::paint_envelope(QPainter &p,
p
.
setPen
(
QPen
(
NoPen
));
//p.setPen(QPen(_colour, 2, Qt::SolidLine));
p
.
setBrush
(
_colour
);
QColor
envelope_colour
=
_colour
;
envelope_colour
.
setAlpha
(
150
);
p
.
setBrush
(
envelope_colour
);
QRectF
*
const
rects
=
new
QRectF
[
e
.
length
];
QRectF
*
rect
=
rects
;
...
...
@@ -1019,7 +1028,9 @@ void DsoSignal::paint_measure(QPainter &p)
abs
(
_period
)
>
1000
?
QString
::
number
(
_period
/
1000
,
'f'
,
2
)
+
"uS"
:
QString
::
number
(
_period
,
'f'
,
2
)
+
"nS"
;
QString
freq_string
=
abs
(
_period
)
>
1000000
?
QString
::
number
(
1000000000
/
_period
,
'f'
,
2
)
+
"Hz"
:
abs
(
_period
)
>
1000
?
QString
::
number
(
1000000
/
_period
,
'f'
,
2
)
+
"kHz"
:
QString
::
number
(
1000
/
_period
,
'f'
,
2
)
+
"MHz"
;
p
.
setPen
(
_colour
);
QColor
measure_colour
=
_colour
;
measure_colour
.
setAlpha
(
180
);
p
.
setPen
(
measure_colour
);
p
.
drawText
(
QRectF
(
0
,
100
*
index
+
UpMargin
,
get_view_rect
().
width
()
*
0.9
,
20
),
Qt
::
AlignRight
|
Qt
::
AlignVCenter
,
tr
(
"Max: "
)
+
max_string
+
" "
);
p
.
drawText
(
QRectF
(
0
,
100
*
index
+
UpMargin
+
20
,
get_view_rect
().
width
()
*
0.9
,
20
),
Qt
::
AlignRight
|
Qt
::
AlignVCenter
,
tr
(
"Min: "
)
+
min_string
+
" "
);
p
.
drawText
(
QRectF
(
0
,
100
*
index
+
UpMargin
+
40
,
get_view_rect
().
width
()
*
0.9
,
20
),
Qt
::
AlignRight
|
Qt
::
AlignVCenter
,
tr
(
"Period: "
)
+
period_string
+
" "
);
...
...
DSView/pv/view/dsosignal.h
View file @
9d871219
...
...
@@ -73,6 +73,7 @@ public:
void
set_view
(
pv
::
view
::
View
*
view
);
void
set_scale
(
float
scale
);
float
get_scale
();
/**
*
...
...
DSView/pv/view/trace.cpp
View file @
9d871219
...
...
@@ -43,7 +43,7 @@ const QColor Trace::dsRed = QColor(213, 15, 37, 255);
const
QColor
Trace
::
dsGreen
=
QColor
(
0
,
153
,
37
,
200
);
const
QColor
Trace
::
dsGray
=
QColor
(
0x88
,
0x8A
,
0x85
,
60
);
const
QColor
Trace
::
dsFore
=
QColor
(
0xff
,
0xff
,
0xff
,
100
);
const
QColor
Trace
::
dsBack
=
QColor
(
0x16
,
0x18
,
0x23
,
255
);
const
QColor
Trace
::
dsBack
=
QColor
(
0x16
,
0x18
,
0x23
,
180
);
const
QColor
Trace
::
dsDisable
=
QColor
(
0x88
,
0x8A
,
0x85
,
200
);
const
QColor
Trace
::
dsActive
=
QColor
(
17
,
133
,
209
,
255
);
const
QColor
Trace
::
dsLightBlue
=
QColor
(
17
,
133
,
209
,
150
);
...
...
DSView/pv/view/view.cpp
View file @
9d871219
...
...
@@ -785,6 +785,21 @@ int View::get_view_width()
return
view_width
;
}
int
View
::
get_view_height
()
{
int
view_height
=
0
;
if
(
_session
.
get_device
()
->
dev_inst
()
->
mode
==
DSO
)
{
const
vector
<
boost
::
shared_ptr
<
Signal
>
>
sigs
(
_session
.
get_signals
());
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Signal
>
s
,
sigs
)
{
view_height
=
max
((
double
)
view_height
,
s
->
get_view_rect
().
height
());
}
}
else
{
view_height
=
_viewport
->
width
();
}
return
view_height
;
}
double
View
::
get_min_offset
()
{
return
-
(
_scale
*
(
get_view_width
()
*
(
1
-
MaxViewRate
)));
...
...
DSView/pv/view/view.h
View file @
9d871219
...
...
@@ -175,6 +175,7 @@ public:
void
on_state_changed
(
bool
stop
);
int
get_view_width
();
int
get_view_height
();
void
update_sample
(
bool
instant
);
...
...
DSView/pv/view/viewport.cpp
View file @
9d871219
This diff is collapsed.
Click to expand it.
DSView/pv/view/viewport.h
View file @
9d871219
...
...
@@ -51,8 +51,14 @@ public:
static
const
double
HitCursorTimeMargin
;
static
const
int
DragTimerInterval
=
100
;
static
const
int
MinorDragOffsetUp
=
100
;
static
const
int
DsoMeasureStages
=
3
;
static
const
double
MinorDragRateUp
;
static
const
double
DragDamping
;
enum
MeasureType
{
NO_MEASURE
,
LOGIC_FREQ
,
DSO_FREQ
};
public:
explicit
Viewport
(
View
&
parent
);
...
...
@@ -133,10 +139,25 @@ private:
uint64_t
_hover_index
;
bool
_hover_hit
;
uint16_t
_hover_sig_index
;
double
_hover_sig_value
;
QTime
_time
;
QTimer
_drag_timer
;
int
_drag_strength
;
bool
_dso_xm
;
int
_dso_xm_stage
;
int
_dso_xm_y
;
uint64_t
_dso_xm_index
[
DsoMeasureStages
];
bool
_dso_ym
;
bool
_dso_ym_done
;
uint16_t
_dso_ym_sig_index
;
double
_dso_ym_sig_value
;
uint64_t
_dso_ym_index
;
int
_dso_ym_start
;
int
_dso_ym_end
;
};
}
// namespace view
...
...
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