Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
uhd_spectrum
提交
86388722
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 搜索 >>
提交
86388722
编写于
1月 19, 2021
作者:
M
manjaro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add channel selection
上级
a0742c64
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
128 addition
and
39 deletion
+128
-39
specwidget.cpp
specwidget.cpp
+52
-9
specwidget.h
specwidget.h
+5
-0
specwidget.ui
specwidget.ui
+69
-28
uhd_device.cpp
uhd_device.cpp
+1
-1
uhdspectrum.pro
uhdspectrum.pro
+1
-1
未找到文件。
specwidget.cpp
浏览文件 @
86388722
...
...
@@ -5,7 +5,8 @@
specWidget
::
specWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
specWidget
),
m_runth
(
new
uhd_io_thread
(
this
))
m_runth
(
new
uhd_io_thread
(
this
)),
m_attenMod
(
new
QStandardItemModel
(
this
))
{
ui
->
setupUi
(
this
);
Bookmarks
::
create
();
...
...
@@ -20,13 +21,15 @@ specWidget::specWidget(QWidget *parent) :
//选择带宽
ui
->
plotter
->
setFilterBoxEnabled
(
true
);
//中心频率
//ui->plotter->setCenterFreq(101700000);
//选择频率
//ui->plotter->setDemodCenterFreq(102300000);
ui
->
plotter
->
setTooltipsEnabled
(
true
);
ui
->
plotter
->
setPeakDetection
(
false
,
128.0
);
m_attenMod
->
appendRow
(
new
QStandardItem
(
"TX/RX"
));
m_attenMod
->
appendRow
(
new
QStandardItem
(
"RX2"
));
m_attenMod
->
appendRow
(
new
QStandardItem
(
"RX"
));
m_attenMod
->
appendRow
(
new
QStandardItem
(
"TX"
));
ui
->
comboBox_atn
->
setModel
(
m_attenMod
);
//连接
//connect (ui->plotter,&CPlotter::newDemodFreq,ui->freqCtrl,&CFreqCtrl::setFrequency);
...
...
@@ -199,8 +202,22 @@ bool specWidget::saveWaterfall(const QString & filename)
void
specWidget
::
on_pushButton_reset_clicked
()
{
saveSettings
();
loadSettings
();
resetFFT
();
if
(
m_runth
->
isRunning
())
{
if
(
m_nTimerID
>=
0
)
killTimer
(
m_nTimerID
);
if
(
usrp
)
{
close_device
();
}
ui
->
pushButton_reset
->
setText
(
tr
(
"Start"
));
}
else
{
loadSettings
();
resetFFT
();
}
}
void
specWidget
::
loadSettings
()
...
...
@@ -286,6 +303,8 @@ void specWidget::freeFFT()
}
void
specWidget
::
resetFFT
()
{
ui
->
pushButton_reset
->
setText
(
tr
(
"Start"
));
m_channel
=
ui
->
spinBox_chan
->
value
();
freeFFT
();
m_pFFTIn
=
(
fftw_complex
*
)
fftw_malloc
(
sizeof
(
fftw_complex
)
*
m_nFFTSize
);
m_pFFTOut
=
(
fftw_complex
*
)
fftw_malloc
(
sizeof
(
fftw_complex
)
*
m_nFFTSize
);
...
...
@@ -312,7 +331,9 @@ void specWidget::resetFFT()
setSampleRate
(
getSampleRate
());
setCenterFreq
(
ui
->
plotter
->
getCenterFreq
());
QString
atn
=
ui
->
comboBox_atn
->
currentText
();
if
(
atn
.
size
())
usrp
->
set_rx_antenna
(
atn
.
toStdString
(),
m_channel
);
if
(
m_runth
->
isRunning
())
{
stop_signal_called
=
true
;
...
...
@@ -324,7 +345,7 @@ void specWidget::resetFFT()
});
m_runth
->
start
();
m_nTimerID
=
startTimer
(
updateIntelv
);
ui
->
pushButton_reset
->
setText
(
tr
(
"Stop"
));
}
void
specWidget
::
appendWavComplex
(
const
double
(
*
pWav
)[
2
],
const
int
count
,
double
voltage_ref
)
...
...
@@ -390,7 +411,15 @@ void specWidget::timerEvent(QTimerEvent * e)
ui
->
sMeter
->
setLevel
(
m_dFFTAmp
[
m_nCurrentCenter
]);
//ui->sMeter->setSqlLevel(m_dFFTAmp[m_nCurrentCenter]);
}
static
int
ccct
=
0
;
if
(
++
ccct
%
10
==
0
)
{
if
(
!
m_runth
->
isRunning
())
ui
->
pushButton_reset
->
setText
(
tr
(
"Start"
));
else
ui
->
pushButton_reset
->
setText
(
tr
(
"Stop"
));
}
}
}
...
...
@@ -437,3 +466,17 @@ void specWidget::on_doubleSpinBox_range_min_valueChanged(double arg1)
{
ui
->
plotter
->
setWaterfallRange
(
ui
->
doubleSpinBox_range_min
->
value
(),
ui
->
doubleSpinBox_range_max
->
value
());
}
void
specWidget
::
on_comboBox_atn_currentIndexChanged
(
const
QString
&
arg1
)
{
if
(
arg1
.
size
())
{
if
(
usrp
)
usrp
->
set_rx_antenna
(
arg1
.
toStdString
(),
m_channel
);
}
}
void
specWidget
::
on_spinBox_chan_valueChanged
(
int
arg1
)
{
m_channel
=
arg1
;
}
specwidget.h
浏览文件 @
86388722
...
...
@@ -103,6 +103,10 @@ private slots:
void
on_doubleSpinBox_range_min_valueChanged
(
double
arg1
);
void
on_comboBox_atn_currentIndexChanged
(
const
QString
&
arg1
);
void
on_spinBox_chan_valueChanged
(
int
arg1
);
private:
void
loadSettings
();
void
saveSettings
();
...
...
@@ -110,6 +114,7 @@ private:
void
freeFFT
();
private:
Ui
::
specWidget
*
ui
=
nullptr
;
QStandardItemModel
*
m_attenMod
=
nullptr
;
private:
int
m_nFFTSize
=
16384
;
std
::
vector
<
double
>
m_dHammingWnd
;
...
...
specwidget.ui
浏览文件 @
86388722
...
...
@@ -6,7 +6,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
7
38
</width>
<width>
7
87
</width>
<height>
466
</height>
</rect>
</property>
...
...
@@ -33,7 +33,7 @@
<item>
<widget
class=
"QPushButton"
name=
"pushButton_reset"
>
<property
name=
"text"
>
<string>
Apply
</string>
<string>
Start
</string>
</property>
<property
name=
"icon"
>
<iconset>
...
...
@@ -241,14 +241,14 @@
<x>
0
</x>
<y>
0
</y>
<width>
310
</width>
<height>
3
80
</height>
<height>
3
48
</height>
</rect>
</property>
<attribute
name=
"label"
>
<string>
Radio
</string>
</attribute>
<layout
class=
"QGridLayout"
name=
"gridLayout_2"
>
<item
row=
"
4
"
column=
"1"
>
<item
row=
"
7
"
column=
"1"
>
<spacer
name=
"verticalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
@@ -261,7 +261,26 @@
</property>
</spacer>
</item>
<item
row=
"1"
column=
"1"
>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_dev"
/>
</item>
<item
row=
"4"
column=
"1"
>
<widget
class=
"QDoubleSpinBox"
name=
"doubleSpinBox_spr"
>
<property
name=
"decimals"
>
<number>
6
</number>
</property>
<property
name=
"minimum"
>
<double>
0.000001000000000
</double>
</property>
<property
name=
"maximum"
>
<double>
1024.000000000000000
</double>
</property>
<property
name=
"value"
>
<double>
10.000000000000000
</double>
</property>
</widget>
</item>
<item
row=
"3"
column=
"1"
>
<widget
class=
"QDoubleSpinBox"
name=
"doubleSpinBox_center"
>
<property
name=
"decimals"
>
<number>
6
</number>
...
...
@@ -277,36 +296,41 @@
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"lineEdit_dev"
/>
<item
row=
"5"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"text"
>
<string>
Gain
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"1"
>
<widget
class=
"QSpinBox"
name=
"spinBox_gain"
/>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QSpinBox"
name=
"spinBox_chan"
>
<property
name=
"maximum"
>
<number>
1
</number>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_
2
"
>
<widget
class=
"QLabel"
name=
"label_
6
"
>
<property
name=
"text"
>
<string>
C
enter Freq(Mhz)
</string>
<string>
C
hannel
</string>
</property>
</widget>
</item>
<item
row=
"
2
"
column=
"0"
>
<item
row=
"
4
"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Sample Rate(Mhz)
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QDoubleSpinBox"
name=
"doubleSpinBox_spr"
>
<property
name=
"decimals"
>
<number>
6
</number>
</property>
<property
name=
"minimum"
>
<double>
0.000001000000000
</double>
</property>
<property
name=
"maximum"
>
<double>
1024.000000000000000
</double>
</property>
<property
name=
"value"
>
<double>
10.000000000000000
</double>
<item
row=
"3"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Center Freq(Mhz)
</string>
</property>
</widget>
</item>
...
...
@@ -317,15 +341,19 @@
</property>
</widget>
</item>
<item
row=
"
3
"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_
5
"
>
<item
row=
"
2
"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_
10
"
>
<property
name=
"text"
>
<string>
Gain
</string>
<string>
Antenna
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"1"
>
<widget
class=
"QSpinBox"
name=
"spinBox_gain"
/>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"comboBox_atn"
>
<property
name=
"editable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
</layout>
</widget>
...
...
@@ -493,6 +521,19 @@
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"save"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
310
</width>
<height>
348
</height>
</rect>
</property>
<attribute
name=
"label"
>
<string>
Save
</string>
</attribute>
</widget>
</widget>
</item>
</layout>
...
...
uhd_device.cpp
浏览文件 @
86388722
...
...
@@ -108,7 +108,7 @@ void uhd_device::run_IO()
{
//创建流对象实例
uhd
::
stream_args_t
stream_args_rx
(
"sc16"
,
"sc16"
);
stream_args_rx
.
channels
.
push_back
(
0
);
stream_args_rx
.
channels
.
push_back
(
m_channel
);
rx_streamer
::
sptr
rx_stream
=
usrp
->
get_rx_stream
(
stream_args_rx
);
rx_count
=
0
;
...
...
uhdspectrum.pro
浏览文件 @
86388722
...
...
@@ -3,7 +3,7 @@ QT += core gui network
greaterThan
(
QT_MAJOR_VERSION
,
4
)
:
QT
+=
widgets
CONFIG
+=
c
++
11
CONFIG
+=
console
#
The
following
define
makes
your
compiler
emit
warnings
if
you
use
#
any
Qt
feature
that
has
been
marked
deprecated
(
the
exact
warnings
#
depend
on
your
compiler
).
Please
consult
the
documentation
of
the
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录