Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
portapack-mayhem
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mcules
portapack-mayhem
Commits
646b7b56
Unverified
Commit
646b7b56
authored
4 years ago
by
Erwin Ried
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #110 from strijar/audio-spectrum
Audio spectrum
parents
cc2046b6
7ec7a9e0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
firmware/application/apps/analog_audio_app.cpp
+56
-4
56 additions, 4 deletions
firmware/application/apps/analog_audio_app.cpp
firmware/application/apps/analog_audio_app.hpp
+48
-1
48 additions, 1 deletion
firmware/application/apps/analog_audio_app.hpp
with
104 additions
and
5 deletions
firmware/application/apps/analog_audio_app.cpp
+
56
−
4
View file @
646b7b56
...
...
@@ -83,6 +83,32 @@ NBFMOptionsView::NBFMOptionsView(
};
}
/* SPECOptionsView *******************************************************/
SPECOptionsView
::
SPECOptionsView
(
AnalogAudioView
*
view
,
const
Rect
parent_rect
,
const
Style
*
const
style
)
:
View
{
parent_rect
}
{
set_style
(
style
);
add_children
({
&
label_config
,
&
options_config
,
&
text_speed
,
&
field_speed
});
options_config
.
set_selected_index
(
view
->
get_spec_bw_index
());
options_config
.
on_change
=
[
this
,
view
](
size_t
n
,
OptionsField
::
value_t
bw
)
{
view
->
set_spec_bw
(
n
,
bw
);
};
field_speed
.
set_value
(
view
->
get_spec_trigger
());
field_speed
.
on_change
=
[
this
,
view
](
int32_t
v
)
{
view
->
set_spec_trigger
(
v
);
};
}
/* AnalogAudioView *******************************************************/
AnalogAudioView
::
AnalogAudioView
(
...
...
@@ -157,6 +183,29 @@ AnalogAudioView::AnalogAudioView(
on_modulation_changed
(
static_cast
<
ReceiverModel
::
Mode
>
(
modulation
));
}
size_t
AnalogAudioView
::
get_spec_bw_index
()
{
return
spec_bw_index
;
}
void
AnalogAudioView
::
set_spec_bw
(
size_t
index
,
uint32_t
bw
)
{
spec_bw_index
=
index
;
spec_bw
=
bw
;
baseband
::
set_spectrum
(
bw
,
spec_trigger
);
receiver_model
.
set_sampling_rate
(
bw
);
receiver_model
.
set_baseband_bandwidth
(
bw
/
2
);
}
uint16_t
AnalogAudioView
::
get_spec_trigger
()
{
return
spec_trigger
;
}
void
AnalogAudioView
::
set_spec_trigger
(
uint16_t
trigger
)
{
spec_trigger
=
trigger
;
baseband
::
set_spectrum
(
spec_bw
,
spec_trigger
);
}
AnalogAudioView
::~
AnalogAudioView
()
{
// TODO: Manipulating audio codec here, and in ui_receiver.cpp. Good to do
// both?
...
...
@@ -272,6 +321,7 @@ void AnalogAudioView::on_show_options_modulation() {
break
;
case
ReceiverModel
::
Mode
::
SpectrumAnalysis
:
widget
=
std
::
make_unique
<
SPECOptionsView
>
(
this
,
nbfm_view_rect
,
&
style_options_group
);
waterfall
.
show_audio_spectrum_view
(
false
);
text_ctcss
.
hidden
(
true
);
break
;
...
...
@@ -315,15 +365,17 @@ void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) {
}
baseband
::
run_image
(
image_tag
);
if
(
modulation
==
ReceiverModel
::
Mode
::
SpectrumAnalysis
)
{
baseband
::
set_spectrum
(
20000000
,
127
);
baseband
::
set_spectrum
(
spec_bw
,
spec_trigger
);
}
const
auto
is_wideband_spectrum_mode
=
(
modulation
==
ReceiverModel
::
Mode
::
SpectrumAnalysis
);
receiver_model
.
set_modulation
(
modulation
);
receiver_model
.
set_sampling_rate
(
is_wideband_spectrum_mode
?
20000000
:
3072000
);
receiver_model
.
set_baseband_bandwidth
(
is_wideband_spectrum_mode
?
12000000
:
1750000
);
receiver_model
.
set_sampling_rate
(
is_wideband_spectrum_mode
?
spec_bw
:
3072000
);
receiver_model
.
set_baseband_bandwidth
(
is_wideband_spectrum_mode
?
spec_bw
/
2
:
1750000
);
receiver_model
.
enable
();
// TODO: This doesn't belong here! There's a better way.
...
...
This diff is collapsed.
Click to expand it.
firmware/application/apps/analog_audio_app.hpp
+
48
−
1
View file @
646b7b56
...
...
@@ -94,6 +94,43 @@ private:
};
};
class
AnalogAudioView
;
class
SPECOptionsView
:
public
View
{
public:
SPECOptionsView
(
AnalogAudioView
*
view
,
const
Rect
parent_rect
,
const
Style
*
const
style
);
private:
Text
label_config
{
{
0
*
8
,
0
*
16
,
2
*
8
,
1
*
16
},
"BW"
,
};
OptionsField
options_config
{
{
3
*
8
,
0
*
16
},
4
,
{
{
"20m "
,
20000000
},
{
"10m "
,
10000000
},
{
" 5m "
,
5000000
},
{
" 2m "
,
2000000
},
{
" 1m "
,
1000000
},
{
"500k"
,
500000
},
}
};
Text
text_speed
{
{
9
*
8
,
0
*
16
,
8
*
8
,
1
*
16
},
"SP /63"
};
NumberField
field_speed
{
{
12
*
8
,
0
*
16
},
2
,
{
0
,
63
},
1
,
' '
,
};
};
class
AnalogAudioView
:
public
View
{
public:
AnalogAudioView
(
NavigationView
&
nav
);
...
...
@@ -106,13 +143,23 @@ public:
void
focus
()
override
;
std
::
string
title
()
const
override
{
return
"Analog audio"
;
};
size_t
get_spec_bw_index
();
void
set_spec_bw
(
size_t
index
,
uint32_t
bw
);
uint16_t
get_spec_trigger
();
void
set_spec_trigger
(
uint16_t
trigger
);
private
:
static
constexpr
ui
::
Dim
header_height
=
3
*
16
;
const
Rect
options_view_rect
{
0
*
8
,
1
*
16
,
30
*
8
,
1
*
16
};
const
Rect
nbfm_view_rect
{
0
*
8
,
1
*
16
,
18
*
8
,
1
*
16
};
size_t
spec_bw_index
=
0
;
uint32_t
spec_bw
=
20000000
;
uint16_t
spec_trigger
=
63
;
NavigationView
&
nav_
;
//bool exit_on_squelch { false };
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment