From e9bf500bfceaae54db137bb8f7914f2f7ae02f01 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 1 Dec 2015 21:00:31 -0800 Subject: [PATCH] Move ReceiverMode enum to receiver_model.hpp --- firmware/application/receiver_model.hpp | 10 ++++++++++ firmware/application/ui_receiver.cpp | 22 ++++++++++----------- firmware/application/ui_receiver.hpp | 26 ++++++++----------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/firmware/application/receiver_model.hpp b/firmware/application/receiver_model.hpp index 5b91c153..c2479c97 100644 --- a/firmware/application/receiver_model.hpp +++ b/firmware/application/receiver_model.hpp @@ -33,6 +33,16 @@ class ReceiverModel { public: + enum class Mode : int32_t { + AMAudio = 0, + NarrowbandFMAudio = 1, + WidebandFMAudio = 2, + AIS = 3, + SpectrumAnalysis = 4, + TPMS = 5, + ERT = 6, + }; + constexpr ReceiverModel( ClockManager& clock_manager ) : clock_manager(clock_manager) diff --git a/firmware/application/ui_receiver.cpp b/firmware/application/ui_receiver.cpp index d40dbc3a..2ce21cdd 100644 --- a/firmware/application/ui_receiver.cpp +++ b/firmware/application/ui_receiver.cpp @@ -456,7 +456,7 @@ ReceiverView::ReceiverView( options_modulation.set_by_value(receiver_model.modulation()); options_modulation.on_change = [this](size_t n, OptionsField::value_t v) { (void)n; - this->on_modulation_changed(static_cast(v)); + this->on_modulation_changed(static_cast(v)); }; /* options_baseband_oversampling.set_by_value(receiver_model.baseband_oversampling()); @@ -585,7 +585,7 @@ static ManchesterFormatted format_manchester( class AnalogAudioModel { public: - AnalogAudioModel(ReceiverMode mode) { + AnalogAudioModel(ReceiverModel::Mode mode) { receiver_model.set_baseband_configuration({ .mode = toUType(mode), .sampling_rate = 3072000, @@ -598,7 +598,7 @@ public: class AnalogAudioView : public spectrum::WaterfallWidget { public: AnalogAudioView( - ReceiverMode mode + ReceiverModel::Mode mode ) : model { mode } { } @@ -864,30 +864,30 @@ void ReceiverView::on_vga_changed(int32_t v_db) { receiver_model.set_vga(v_db); } -void ReceiverView::on_modulation_changed(ReceiverMode mode) { +void ReceiverView::on_modulation_changed(ReceiverModel::Mode mode) { remove_child(widget_content.get()); widget_content.reset(); switch(mode) { - case ReceiverMode::AMAudio: - case ReceiverMode::NarrowbandFMAudio: - case ReceiverMode::WidebandFMAudio: + case ReceiverModel::Mode::AMAudio: + case ReceiverModel::Mode::NarrowbandFMAudio: + case ReceiverModel::Mode::WidebandFMAudio: widget_content = std::make_unique(mode); break; - case ReceiverMode::AIS: + case ReceiverModel::Mode::AIS: widget_content = std::make_unique(); break; - case ReceiverMode::SpectrumAnalysis: + case ReceiverModel::Mode::SpectrumAnalysis: widget_content = std::make_unique(); break; - case ReceiverMode::TPMS: + case ReceiverModel::Mode::TPMS: widget_content = std::make_unique(); break; - case ReceiverMode::ERT: + case ReceiverModel::Mode::ERT: widget_content = std::make_unique(); break; diff --git a/firmware/application/ui_receiver.hpp b/firmware/application/ui_receiver.hpp index 9827cdc7..26dbe68b 100644 --- a/firmware/application/ui_receiver.hpp +++ b/firmware/application/ui_receiver.hpp @@ -357,16 +357,6 @@ constexpr Style style_options_group { .foreground = Color::white(), }; -enum class ReceiverMode : int32_t { - AMAudio = 0, - NarrowbandFMAudio = 1, - WidebandFMAudio = 2, - AIS = 3, - SpectrumAnalysis = 4, - TPMS = 5, - ERT = 6, -}; - class ReceiverView : public View { public: ReceiverView(NavigationView& nav, ReceiverModel& receiver_model); @@ -421,13 +411,13 @@ private: { 19 * 8, 1 * 16 }, 4, { - { " AM ", toUType(ReceiverMode::AMAudio) }, - { "NFM ", toUType(ReceiverMode::NarrowbandFMAudio) }, - { "WFM ", toUType(ReceiverMode::WidebandFMAudio) }, - { "AIS ", toUType(ReceiverMode::AIS) }, - { "TPMS", toUType(ReceiverMode::TPMS) }, - { "ERT", toUType(ReceiverMode::ERT) }, - { "SPEC", toUType(ReceiverMode::SpectrumAnalysis) }, + { " AM ", toUType(ReceiverModel::Mode::AMAudio) }, + { "NFM ", toUType(ReceiverModel::Mode::NarrowbandFMAudio) }, + { "WFM ", toUType(ReceiverModel::Mode::WidebandFMAudio) }, + { "AIS ", toUType(ReceiverModel::Mode::AIS) }, + { "TPMS", toUType(ReceiverModel::Mode::TPMS) }, + { "ERT", toUType(ReceiverModel::Mode::ERT) }, + { "SPEC", toUType(ReceiverModel::Mode::SpectrumAnalysis) }, } }; /* @@ -474,7 +464,7 @@ private: void on_rf_amp_changed(bool v); void on_lna_changed(int32_t v_db); void on_vga_changed(int32_t v_db); - void on_modulation_changed(ReceiverMode mode); + void on_modulation_changed(ReceiverModel::Mode mode); void on_show_options_frequency(); void on_show_options_rf_gain(); void on_frequency_step_changed(rf::Frequency f);