Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
32b2264f
Commit
32b2264f
authored
May 09, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support multiple plot per xy_plot
parent
277ddb13
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
29 deletions
+67
-29
common/utils/T/tracer/gui.c
common/utils/T/tracer/gui.c
+2
-1
common/utils/T/tracer/gui/gui.h
common/utils/T/tracer/gui/gui.h
+2
-1
common/utils/T/tracer/gui/gui_defs.h
common/utils/T/tracer/gui/gui_defs.h
+8
-2
common/utils/T/tracer/gui/xy_plot.c
common/utils/T/tracer/gui/xy_plot.c
+55
-25
No files found.
common/utils/T/tracer/gui.c
View file @
32b2264f
...
...
@@ -55,7 +55,7 @@ static void *input_signal_plotter(void *_)
iqbuf
[
2
*
i
+
1
]
*
iqbuf
[
2
*
i
+
1
]));
}
xy_plot_set_points
(
eNB_data
.
g
,
eNB_data
.
input_signal
,
xy_plot_set_points
(
eNB_data
.
g
,
eNB_data
.
input_signal
,
0
,
length
,
x
,
y
);
if
(
pthread_mutex_unlock
(
&
eNB_data
.
input_signal_lock
))
abort
();
...
...
@@ -70,6 +70,7 @@ void t_gui_start(void)
widget
*
plot
=
new_xy_plot
(
g
,
512
,
100
,
"eNB 0 input signal"
,
20
);
widget_add_child
(
g
,
win
,
plot
,
-
1
);
xy_plot_set_range
(
g
,
plot
,
0
,
76800
,
30
,
70
);
xy_plot_new_plot
(
g
,
plot
,
FOREGROUND_COLOR
);
eNB_data
.
input_signal
=
plot
;
eNB_data
.
input_signal_length
=
76800
*
4
;
...
...
common/utils/T/tracer/gui/gui.h
View file @
32b2264f
...
...
@@ -32,10 +32,11 @@ void label_set_clickable(gui *gui, widget *label, int clickable);
void
container_set_child_growable
(
gui
*
_gui
,
widget
*
_this
,
widget
*
child
,
int
growable
);
int
xy_plot_new_plot
(
gui
*
gui
,
widget
*
this
,
int
color
);
void
xy_plot_set_range
(
gui
*
gui
,
widget
*
this
,
float
xmin
,
float
xmax
,
float
ymin
,
float
ymax
);
void
xy_plot_set_points
(
gui
*
gui
,
widget
*
this
,
int
npoints
,
float
*
x
,
float
*
y
);
int
plot
,
int
npoints
,
float
*
x
,
float
*
y
);
void
textlist_add
(
gui
*
gui
,
widget
*
this
,
const
char
*
text
,
int
position
,
int
color
);
...
...
common/utils/T/tracer/gui/gui_defs.h
View file @
32b2264f
...
...
@@ -95,11 +95,15 @@ struct textlist_widget {
int
background_color
;
};
struct
xy_plot_widget
{
struct
widget
common
;
struct
xy_plot_plot
{
float
*
x
;
float
*
y
;
int
npoints
;
int
color
;
};
struct
xy_plot_widget
{
struct
widget
common
;
char
*
label
;
int
label_width
;
int
label_height
;
...
...
@@ -109,6 +113,8 @@ struct xy_plot_widget {
float
ymin
,
ymax
;
int
wanted_width
;
int
wanted_height
;
struct
xy_plot_plot
*
plots
;
int
nplots
;
};
struct
button_widget
{
...
...
common/utils/T/tracer/gui/xy_plot.c
View file @
32b2264f
...
...
@@ -21,6 +21,7 @@ static void paint(gui *_gui, widget *_this)
float
allocated_ymin
,
allocated_ymax
;
float
center
;
int
i
;
int
n
;
# define FLIP(v) (-(v) + allocated_plot_height-1)
...
...
@@ -134,23 +135,25 @@ static void paint(gui *_gui, widget *_this)
+
this
->
label_baseline
,
this
->
label
);
for
(
n
=
0
;
n
<
this
->
nplots
;
n
++
)
{
/* points */
float
ax
,
bx
,
ay
,
by
;
ax
=
(
allocated_plot_width
-
1
)
/
(
allocated_xmax
-
allocated_xmin
);
bx
=
-
ax
*
allocated_xmin
;
ay
=
(
allocated_plot_height
-
1
)
/
(
allocated_ymax
-
allocated_ymin
);
by
=
-
ay
*
allocated_ymin
;
for
(
i
=
0
;
i
<
this
->
npoints
;
i
++
)
{
for
(
i
=
0
;
i
<
this
->
plots
[
n
].
npoints
;
i
++
)
{
int
x
,
y
;
x
=
ax
*
this
->
x
[
i
]
+
bx
;
y
=
ay
*
this
->
y
[
i
]
+
by
;
x
=
ax
*
this
->
plots
[
n
].
x
[
i
]
+
bx
;
y
=
ay
*
this
->
plots
[
n
].
y
[
i
]
+
by
;
if
(
x
>=
0
&&
x
<
allocated_plot_width
&&
y
>=
0
&&
y
<
allocated_plot_height
)
x_add_point
(
g
->
x
,
this
->
common
.
x
+
this
->
vrule_width
+
x
,
this
->
common
.
y
+
FLIP
(
y
));
}
x_plot_points
(
g
->
x
,
g
->
xwin
,
FOREGROUND_COLOR
);
x_plot_points
(
g
->
x
,
g
->
xwin
,
this
->
plots
[
n
].
color
);
}
}
static
void
hints
(
gui
*
_gui
,
widget
*
_w
,
int
*
width
,
int
*
height
)
...
...
@@ -186,6 +189,8 @@ widget *new_xy_plot(gui *_gui, int width, int height, char *label,
w
->
xmax
=
1
;
w
->
ymin
=
-
1
;
w
->
ymax
=
1
;
w
->
plots
=
NULL
;
w
->
nplots
=
0
;
w
->
common
.
paint
=
paint
;
w
->
common
.
hints
=
hints
;
...
...
@@ -199,6 +204,31 @@ widget *new_xy_plot(gui *_gui, int width, int height, char *label,
/* public functions */
/*************************************************************************/
int
xy_plot_new_plot
(
gui
*
_gui
,
widget
*
_this
,
int
color
)
{
int
ret
;
struct
gui
*
g
=
_gui
;
struct
xy_plot_widget
*
this
=
_this
;
glock
(
g
);
ret
=
this
->
nplots
;
this
->
nplots
++
;
this
->
plots
=
realloc
(
this
->
plots
,
this
->
nplots
*
sizeof
(
struct
xy_plot_plot
));
if
(
this
->
plots
==
NULL
)
abort
();
this
->
plots
[
ret
].
x
=
NULL
;
this
->
plots
[
ret
].
y
=
NULL
;
this
->
plots
[
ret
].
npoints
=
0
;
this
->
plots
[
ret
].
color
=
color
;
gunlock
(
g
);
return
ret
;
}
void
xy_plot_set_range
(
gui
*
_gui
,
widget
*
_this
,
float
xmin
,
float
xmax
,
float
ymin
,
float
ymax
)
{
...
...
@@ -217,7 +247,7 @@ void xy_plot_set_range(gui *_gui, widget *_this,
gunlock
(
g
);
}
void
xy_plot_set_points
(
gui
*
_gui
,
widget
*
_this
,
void
xy_plot_set_points
(
gui
*
_gui
,
widget
*
_this
,
int
plot
,
int
npoints
,
float
*
x
,
float
*
y
)
{
struct
gui
*
g
=
_gui
;
...
...
@@ -225,16 +255,16 @@ void xy_plot_set_points(gui *_gui, widget *_this,
glock
(
g
);
if
(
npoints
!=
this
->
npoints
)
{
free
(
this
->
x
);
free
(
this
->
y
);
this
->
x
=
calloc
(
sizeof
(
float
),
npoints
);
this
->
y
=
calloc
(
sizeof
(
float
),
npoints
);
this
->
npoints
=
npoints
;
if
(
npoints
!=
this
->
plots
[
plot
].
npoints
)
{
free
(
this
->
plots
[
plot
].
x
);
free
(
this
->
plots
[
plot
].
y
);
this
->
plots
[
plot
].
x
=
calloc
(
sizeof
(
float
),
npoints
);
this
->
plots
[
plot
].
y
=
calloc
(
sizeof
(
float
),
npoints
);
this
->
plots
[
plot
].
npoints
=
npoints
;
}
memcpy
(
this
->
x
,
x
,
npoints
*
sizeof
(
float
));
memcpy
(
this
->
y
,
y
,
npoints
*
sizeof
(
float
));
memcpy
(
this
->
plots
[
plot
].
x
,
x
,
npoints
*
sizeof
(
float
));
memcpy
(
this
->
plots
[
plot
].
y
,
y
,
npoints
*
sizeof
(
float
));
send_event
(
g
,
DIRTY
,
this
->
common
.
id
);
...
...
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