Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
uhd_spectrum
提交
334517de
uhd_spectrum
项目概览
colorEagleStdio
/
uhd_spectrum
通知
18
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
uhd_spectrum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
334517de
编写于
2月 24, 2021
作者:
M
manjaro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
界面改进
上级
17d75488
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
92 addition
and
81 deletion
+92
-81
main.cpp
main.cpp
+3
-0
qtgui/plotter.cpp
qtgui/plotter.cpp
+2
-2
specwidget.cpp
specwidget.cpp
+4
-1
uhd_device.cpp
uhd_device.cpp
+55
-52
uhd_device.h
uhd_device.h
+6
-4
uhd_device_win32.cpp
uhd_device_win32.cpp
+16
-17
uhd_device_win32.h
uhd_device_win32.h
+6
-5
未找到文件。
main.cpp
浏览文件 @
334517de
...
@@ -9,7 +9,10 @@ int main(int argc, char *argv[])
...
@@ -9,7 +9,10 @@ int main(int argc, char *argv[])
{
{
#ifdef Q_OS_LINUX
#ifdef Q_OS_LINUX
nice
(
0
);
nice
(
0
);
#else
QThread
::
currentThread
()
->
setPriority
(
QThread
::
HighestPriority
);
#endif
#endif
QApplication
a
(
argc
,
argv
);
QApplication
a
(
argc
,
argv
);
//Install translators
//Install translators
QTranslator
qtTranslator
;
QTranslator
qtTranslator
;
...
...
qtgui/plotter.cpp
浏览文件 @
334517de
...
@@ -72,8 +72,8 @@ int gettimeofday(struct timeval * tp, struct timezone * tzp)
...
@@ -72,8 +72,8 @@ int gettimeofday(struct timeval * tp, struct timezone * tzp)
#define CUR_CUT_DELTA 5 //cursor capture delta in pixels
#define CUR_CUT_DELTA 5 //cursor capture delta in pixels
#define FFT_MIN_DB -
16
0.0
#define FFT_MIN_DB -
30
0.0
#define FFT_MAX_DB 0.0
#define FFT_MAX_DB
3
0.0
// Colors of type QRgb in 0xAARRGGBB format (unsigned int)
// Colors of type QRgb in 0xAARRGGBB format (unsigned int)
#define PLOTTER_BGD_COLOR 0xFF1F1D1D
#define PLOTTER_BGD_COLOR 0xFF1F1D1D
...
...
specwidget.cpp
浏览文件 @
334517de
...
@@ -699,7 +699,10 @@ void specWidget::on_comboBox_fftSize_activated(int index)
...
@@ -699,7 +699,10 @@ void specWidget::on_comboBox_fftSize_activated(int index)
if
(
m_nFFTSize
<
128
)
if
(
m_nFFTSize
<
128
)
m_nFFTSize
=
128
;
m_nFFTSize
=
128
;
if
(
usrp
)
if
(
usrp
)
resetProgram
();
{
freeFFTW
();
initFFTW
();
}
saveSettings
();
saveSettings
();
}
}
...
...
uhd_device.cpp
浏览文件 @
334517de
...
@@ -38,6 +38,7 @@ uhd_device::uhd_device()
...
@@ -38,6 +38,7 @@ uhd_device::uhd_device()
:
stop_signal_called
(
false
)
:
stop_signal_called
(
false
)
,
m_rx_streaming
(
false
)
,
m_rx_streaming
(
false
)
,
m_rx_points
(
0
)
,
m_rx_points
(
0
)
,
m_initThread
(
new
uhd_io_thread
(
0
))
{
{
m_data_iq_rx
=
new
short
[
m_rx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
m_data_iq_rx
=
new
short
[
m_rx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
m_data_iq_tx
=
new
short
[
m_tx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
m_data_iq_tx
=
new
short
[
m_tx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
...
@@ -48,6 +49,7 @@ uhd_device::uhd_device(const std::string &args)
...
@@ -48,6 +49,7 @@ uhd_device::uhd_device(const std::string &args)
,
m_rx_streaming
(
false
)
,
m_rx_streaming
(
false
)
,
m_dev_args
(
args
)
,
m_dev_args
(
args
)
,
m_rx_points
(
0
)
,
m_rx_points
(
0
)
,
m_initThread
(
new
uhd_io_thread
(
0
))
{
{
m_data_iq_rx
=
new
short
[
m_rx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
m_data_iq_rx
=
new
short
[
m_rx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
...
@@ -56,6 +58,8 @@ uhd_device::uhd_device(const std::string &args)
...
@@ -56,6 +58,8 @@ uhd_device::uhd_device(const std::string &args)
uhd_device
::~
uhd_device
()
uhd_device
::~
uhd_device
()
{
{
stop_signal_called
=
true
;
stop_signal_called
=
true
;
m_initThread
->
terminate
();
m_initThread
->
deleteLater
();
while
(
m_rx_streaming
)
while
(
m_rx_streaming
)
{
{
QThread
::
msleep
(
100
);
QThread
::
msleep
(
100
);
...
@@ -80,7 +84,7 @@ bool uhd_device::open_device()
...
@@ -80,7 +84,7 @@ bool uhd_device::open_device()
{
{
string
ref
=
"internal"
;
string
ref
=
"internal"
;
std
::
atomic
<
bool
>
finished
(
false
);
std
::
atomic
<
bool
>
finished
(
false
);
std
::
thread
th
r
([
&
]()
->
void
{
m_initThread
->
setRunne
r
([
&
]()
->
void
{
try
{
try
{
usrp
=
multi_usrp
::
make
(
m_dev_args
);
usrp
=
multi_usrp
::
make
(
m_dev_args
);
}
}
...
@@ -91,12 +95,11 @@ bool uhd_device::open_device()
...
@@ -91,12 +95,11 @@ bool uhd_device::open_device()
finished
=
true
;
finished
=
true
;
});
});
while
(
!
finished
)
m_initThread
->
start
();
while
(
!
m_initThread
->
wait
(
100
))
{
{
QCoreApplication
::
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
QCoreApplication
::
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
QThread
::
msleep
(
20
);
}
}
thr
.
join
();
...
...
uhd_device.h
浏览文件 @
334517de
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include <atomic>
#include <atomic>
#include <QThread>
#include <QThread>
#include <string>
#include <string>
#include <QAtomicInteger>
class
uhd_io_thread
:
public
QThread
{
class
uhd_io_thread
:
public
QThread
{
Q_OBJECT
Q_OBJECT
public:
public:
...
@@ -40,6 +41,7 @@ public:
...
@@ -40,6 +41,7 @@ public:
void
run_RxIO
();
void
run_RxIO
();
void
run_TxIO
();
void
run_TxIO
();
protected:
protected:
uhd_io_thread
*
m_initThread
;
std
::
atomic
<
bool
>
stop_signal_called
;
std
::
atomic
<
bool
>
stop_signal_called
;
std
::
atomic
<
bool
>
m_rx_streaming
;
std
::
atomic
<
bool
>
m_rx_streaming
;
std
::
atomic
<
bool
>
m_tx_streaming
;
std
::
atomic
<
bool
>
m_tx_streaming
;
...
@@ -53,11 +55,11 @@ protected:
...
@@ -53,11 +55,11 @@ protected:
//初始化队列
//初始化队列
short
(
*
m_data_iq_rx
)[
2
]
=
nullptr
;
short
(
*
m_data_iq_rx
)[
2
]
=
nullptr
;
short
(
*
m_data_iq_tx
)[
2
]
=
nullptr
;
short
(
*
m_data_iq_tx
)[
2
]
=
nullptr
;
size_t
m_rx_bufsz
=
1024
*
1024
*
4
;
size_t
m_rx_bufsz
=
1024
*
1024
;
size_t
m_tx_bufsz
=
1024
*
1024
*
4
;
size_t
m_tx_bufsz
=
1024
*
1024
;
//收发计数
//收发计数
unsigned
long
long
m_rx_points
=
0
;
QAtomicInteger
<
unsigned
long
long
>
m_rx_points
=
0
;
unsigned
long
long
m_tx_points
=
0
;
QAtomicInteger
<
unsigned
long
long
>
m_tx_points
=
0
;
public:
public:
quint64
set_rx_freq
(
const
quint64
freq_in_hz
);
quint64
set_rx_freq
(
const
quint64
freq_in_hz
);
double
set_rx_rate
(
const
double
sprate
);
double
set_rx_rate
(
const
double
sprate
);
...
...
uhd_device_win32.cpp
浏览文件 @
334517de
...
@@ -44,6 +44,7 @@ uhd_device::uhd_device()
...
@@ -44,6 +44,7 @@ uhd_device::uhd_device()
:
stop_signal_called
(
false
)
:
stop_signal_called
(
false
)
,
m_rx_streaming
(
false
)
,
m_rx_streaming
(
false
)
,
m_rx_points
(
0
)
,
m_rx_points
(
0
)
,
m_initThread
(
new
uhd_io_thread
(
0
))
{
{
m_data_iq_rx
=
new
short
[
m_rx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
m_data_iq_rx
=
new
short
[
m_rx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
m_data_iq_tx
=
new
short
[
m_tx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
m_data_iq_tx
=
new
short
[
m_tx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
...
@@ -54,7 +55,7 @@ uhd_device::uhd_device(const std::string &args)
...
@@ -54,7 +55,7 @@ uhd_device::uhd_device(const std::string &args)
,
m_rx_streaming
(
false
)
,
m_rx_streaming
(
false
)
,
m_dev_args
(
args
)
,
m_dev_args
(
args
)
,
m_rx_points
(
0
)
,
m_rx_points
(
0
)
,
m_initThread
(
new
uhd_io_thread
(
0
))
{
{
m_data_iq_rx
=
new
short
[
m_rx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
m_data_iq_rx
=
new
short
[
m_rx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
m_data_iq_tx
=
new
short
[
m_tx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
m_data_iq_tx
=
new
short
[
m_tx_bufsz
+
1024
*
1024
][
2
]{{
0
,
0
}};
...
@@ -62,6 +63,8 @@ uhd_device::uhd_device(const std::string &args)
...
@@ -62,6 +63,8 @@ uhd_device::uhd_device(const std::string &args)
uhd_device
::~
uhd_device
()
uhd_device
::~
uhd_device
()
{
{
stop_signal_called
=
true
;
stop_signal_called
=
true
;
m_initThread
->
terminate
();
m_initThread
->
deleteLater
();
while
(
m_rx_streaming
)
while
(
m_rx_streaming
)
{
{
QThread
::
msleep
(
100
);
QThread
::
msleep
(
100
);
...
@@ -86,8 +89,7 @@ std::string uhd_device::devArgs() const
...
@@ -86,8 +89,7 @@ std::string uhd_device::devArgs() const
bool
uhd_device
::
open_device
()
bool
uhd_device
::
open_device
()
{
{
string
ref
=
"internal"
;
string
ref
=
"internal"
;
std
::
atomic
<
bool
>
finished
(
false
);
m_initThread
->
setRunner
([
&
]()
->
void
{
std
::
thread
thr
([
&
]()
->
void
{
try
{
try
{
UHD_DO
(
uhd_usrp_make
(
&
usrp
,
m_dev_args
.
c_str
()));
UHD_DO
(
uhd_usrp_make
(
&
usrp
,
m_dev_args
.
c_str
()));
}
}
...
@@ -95,16 +97,13 @@ bool uhd_device::open_device()
...
@@ -95,16 +97,13 @@ bool uhd_device::open_device()
{
{
fputs
(
er
.
c_str
(),
stderr
);
fputs
(
er
.
c_str
(),
stderr
);
}
}
finished
=
true
;
});
});
while
(
!
finished
)
m_initThread
->
start
();
while
(
!
m_initThread
->
wait
(
100
))
{
{
QCoreApplication
::
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
QCoreApplication
::
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
QThread
::
msleep
(
20
);
}
}
thr
.
join
();
if
(
!
usrp
)
if
(
!
usrp
)
return
false
;
return
false
;
...
...
uhd_device_win32.h
浏览文件 @
334517de
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#include <atomic>
#include <atomic>
#include <QThread>
#include <QThread>
#include <uhd.h>
#include <uhd.h>
#include <QAtomicInteger>
class
uhd_io_thread
:
public
QThread
{
class
uhd_io_thread
:
public
QThread
{
Q_OBJECT
Q_OBJECT
public:
public:
...
@@ -44,14 +44,15 @@ protected:
...
@@ -44,14 +44,15 @@ protected:
int
m_rx_channel
=
0
;
int
m_rx_channel
=
0
;
int
m_tx_channel
=
0
;
int
m_tx_channel
=
0
;
protected:
protected:
uhd_io_thread
*
m_initThread
;
//初始化队列
//初始化队列
short
(
*
m_data_iq_rx
)[
2
]
=
nullptr
;
short
(
*
m_data_iq_rx
)[
2
]
=
nullptr
;
size_t
m_rx_bufsz
=
1024
*
1024
*
8
;
size_t
m_rx_bufsz
=
1024
*
1024
;
short
(
*
m_data_iq_tx
)[
2
]
=
nullptr
;
short
(
*
m_data_iq_tx
)[
2
]
=
nullptr
;
size_t
m_tx_bufsz
=
1024
*
1024
*
8
;
size_t
m_tx_bufsz
=
1024
*
1024
;
//收发计数
//收发计数
unsigned
long
long
m_rx_points
=
0
;
QAtomicInteger
<
unsigned
long
long
>
m_rx_points
=
0
;
unsigned
long
long
m_tx_points
=
0
;
QAtomicInteger
<
unsigned
long
long
>
m_tx_points
=
0
;
public:
public:
quint64
set_rx_freq
(
const
quint64
freq_in_hz
);
quint64
set_rx_freq
(
const
quint64
freq_in_hz
);
double
set_rx_rate
(
const
double
sprate
);
double
set_rx_rate
(
const
double
sprate
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录