mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-04-18 06:56:03 -04:00
Remove forced amp settings and add persistent user settings
This commit is contained in:
parent
052b6ae933
commit
794ba9ccb9
27
firmware/application/external/gfxeq/ui_gfxeq.cpp
vendored
27
firmware/application/external/gfxeq/ui_gfxeq.cpp
vendored
@ -14,7 +14,12 @@ namespace ui::external_app::gfxeq {
|
||||
|
||||
gfxEQView::gfxEQView(NavigationView& nav)
|
||||
: nav_{nav}, bar_heights(NUM_BARS, 0), prev_bar_heights(NUM_BARS, 0) {
|
||||
std::vector<BoundSetting> bindings;
|
||||
bindings.push_back(BoundSetting{"current_theme"sv, ¤t_theme});
|
||||
ui_settings = SettingsStore{"gfx_eq"sv, bindings};
|
||||
|
||||
baseband::run_image(spi_flash::image_tag_wfm_audio);
|
||||
|
||||
add_children({&field_frequency, &field_lna, &field_vga, &options_modulation,
|
||||
&field_volume, &text_ctcss, &record_view, &button_mood, &dummy});
|
||||
|
||||
@ -24,15 +29,8 @@ gfxEQView::gfxEQView(NavigationView& nav)
|
||||
receiver_model.set_modulation(ReceiverModel::Mode::WidebandFMAudio);
|
||||
receiver_model.set_sampling_rate(3072000);
|
||||
receiver_model.set_target_frequency(93100000);
|
||||
receiver_model.set_rf_amp(true);
|
||||
receiver_model.enable();
|
||||
|
||||
const baseband::WFMConfig wfm_40k_config{taps_40k_wfm_decim_0, taps_40k_wfm_decim_1};
|
||||
wfm_40k_config.apply();
|
||||
|
||||
field_lna.set_value(40);
|
||||
field_vga.set_value(62);
|
||||
|
||||
options_modulation.set_by_value(toUType(ReceiverModel::Mode::WidebandFMAudio));
|
||||
options_modulation.on_change = [this](size_t, OptionsField::value_t v) {
|
||||
this->on_modulation_changed(static_cast<ReceiverModel::Mode>(v));
|
||||
@ -41,12 +39,6 @@ gfxEQView::gfxEQView(NavigationView& nav)
|
||||
|
||||
field_frequency.set_value(93100000);
|
||||
|
||||
record_view.set_filename_date_frequency(true);
|
||||
record_view.on_error = [&nav](std::string message) {
|
||||
nav.display_modal("Error", message);
|
||||
};
|
||||
|
||||
record_view.set_sampling_rate(48000);
|
||||
audio::output::start();
|
||||
|
||||
button_mood.on_select = [this](Button&) { this->cycle_theme(); };
|
||||
@ -220,18 +212,11 @@ void gfxEQView::update_modulation(ReceiverModel::Mode modulation) {
|
||||
|
||||
baseband::run_image(image_tag);
|
||||
if (modulation == ReceiverModel::Mode::SpectrumAnalysis) {
|
||||
baseband::set_spectrum(receiver_model.sampling_rate(), 63);
|
||||
baseband::set_spectrum(receiver_model.sampling_rate(), 40);
|
||||
}
|
||||
|
||||
receiver_model.set_modulation(modulation);
|
||||
receiver_model.set_sampling_rate(3072000);
|
||||
receiver_model.set_rf_amp(true);
|
||||
|
||||
if (modulation == ReceiverModel::Mode::WidebandFMAudio) {
|
||||
const baseband::WFMConfig wfm_40k_config{taps_40k_wfm_decim_0, taps_40k_wfm_decim_1};
|
||||
wfm_40k_config.apply();
|
||||
}
|
||||
|
||||
receiver_model.enable();
|
||||
|
||||
size_t record_sampling_rate = 0;
|
||||
|
52
firmware/application/external/gfxeq/ui_gfxeq.hpp
vendored
52
firmware/application/external/gfxeq/ui_gfxeq.hpp
vendored
@ -10,6 +10,8 @@
|
||||
#include "ui_record_view.hpp"
|
||||
#include "ui_spectrum.hpp"
|
||||
#include "ui_freq_field.hpp"
|
||||
#include "app_settings.hpp"
|
||||
#include "radio_state.hpp"
|
||||
|
||||
namespace ui::external_app::gfxeq {
|
||||
|
||||
@ -46,29 +48,28 @@ class gfxEQView : public View {
|
||||
std::vector<int> bar_heights;
|
||||
std::vector<int> prev_bar_heights;
|
||||
bool running{false};
|
||||
size_t current_theme{0};
|
||||
uint32_t current_theme{0};
|
||||
const std::array<ColorTheme, 20> themes{
|
||||
ColorTheme{Color(255, 0, 255), Color(255, 255, 255)}, // Neon Fury
|
||||
ColorTheme{Color(0, 255, 0), Color(255, 0, 0)}, // Toxic Blaze
|
||||
ColorTheme{Color(0, 0, 255), Color(255, 255, 0)}, // Midnight Venom
|
||||
ColorTheme{Color(255, 128, 0), Color(255, 0, 128)}, // Inferno Pulse
|
||||
ColorTheme{Color(128, 0, 255), Color(0, 255, 255)}, // Cyber Vortex
|
||||
ColorTheme{Color(255, 255, 0), Color(0, 255, 128)}, // Solar Flare
|
||||
ColorTheme{Color(255, 0, 0), Color(0, 128, 255)}, // Blood Eclipse
|
||||
ColorTheme{Color(0, 255, 128), Color(255, 128, 255)}, // Acid Horizon
|
||||
ColorTheme{Color(128, 128, 128), Color(255, 255, 255)}, // Steel Phantom
|
||||
ColorTheme{Color(255, 64, 0), Color(0, 255, 64)}, // Ember Storm
|
||||
ColorTheme{Color(0, 128, 128), Color(255, 192, 0)}, // Teal Abyss
|
||||
ColorTheme{Color(0, 255, 0), Color(0, 128, 0)}, // Matrix Rain
|
||||
ColorTheme{Color(32, 64, 32), Color(0, 255, 0)}, // Hacker Terminal
|
||||
ColorTheme{Color(64, 0, 128), Color(255, 0, 255)}, // BBS Neon
|
||||
ColorTheme{Color(0, 64, 0), Color(0, 255, 128)}, // CRT Glow
|
||||
ColorTheme{Color(255, 255, 255), Color(0, 0, 255)}, // Digital Grid
|
||||
ColorTheme{Color(128, 0, 0), Color(255, 128, 0)}, // Redline Hack
|
||||
ColorTheme{Color(0, 128, 255), Color(255, 255, 128)}, // Cybernet Blue
|
||||
ColorTheme{Color(64, 64, 64), Color(255, 0, 0)}, // Shadow Net
|
||||
ColorTheme{Color(255, 192, 0), Color(0, 64, 128)} // Amber Code
|
||||
};
|
||||
ColorTheme{Color(255, 0, 255), Color(255, 255, 255)},
|
||||
ColorTheme{Color(0, 255, 0), Color(255, 0, 0)},
|
||||
ColorTheme{Color(0, 0, 255), Color(255, 255, 0)},
|
||||
ColorTheme{Color(255, 128, 0), Color(255, 0, 128)},
|
||||
ColorTheme{Color(128, 0, 255), Color(0, 255, 255)},
|
||||
ColorTheme{Color(255, 255, 0), Color(0, 255, 128)},
|
||||
ColorTheme{Color(255, 0, 0), Color(0, 128, 255)},
|
||||
ColorTheme{Color(0, 255, 128), Color(255, 128, 255)},
|
||||
ColorTheme{Color(128, 128, 128), Color(255, 255, 255)},
|
||||
ColorTheme{Color(255, 64, 0), Color(0, 255, 64)},
|
||||
ColorTheme{Color(0, 128, 128), Color(255, 192, 0)},
|
||||
ColorTheme{Color(0, 255, 0), Color(0, 128, 0)},
|
||||
ColorTheme{Color(32, 64, 32), Color(0, 255, 0)},
|
||||
ColorTheme{Color(64, 0, 128), Color(255, 0, 255)},
|
||||
ColorTheme{Color(0, 64, 0), Color(0, 255, 128)},
|
||||
ColorTheme{Color(255, 255, 255), Color(0, 0, 255)},
|
||||
ColorTheme{Color(128, 0, 0), Color(255, 128, 0)},
|
||||
ColorTheme{Color(0, 128, 255), Color(255, 255, 128)},
|
||||
ColorTheme{Color(64, 64, 64), Color(255, 0, 0)},
|
||||
ColorTheme{Color(255, 192, 0), Color(0, 64, 128)}};
|
||||
|
||||
RxFrequencyField field_frequency{{5 * 8, 0 * 16}, nav_};
|
||||
LNAGainField field_lna{Point{15 * 8, 0 * 16}};
|
||||
@ -94,6 +95,13 @@ class gfxEQView : public View {
|
||||
Button button_mood{{21 * 8, 0, 6 * 8, 16}, "MOOD"};
|
||||
Button dummy{{240, 0, 0, 0}, ""};
|
||||
|
||||
RxRadioState rx_radio_state_{};
|
||||
|
||||
app_settings::SettingsManager settings_{
|
||||
"rx_gfx_eq"sv, app_settings::Mode::RX};
|
||||
|
||||
SettingsStore ui_settings{"gfx_eq"sv, {}};
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void update_audio_spectrum(const AudioSpectrum& spectrum);
|
||||
|
Loading…
x
Reference in New Issue
Block a user