From 4eb0facacb891b758f5457c7cec3660155a290c4 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sat, 26 Nov 2016 16:50:44 -0800 Subject: [PATCH] Add lots of value constructors. --- firmware/application/ais_app.hpp | 19 +++++----- firmware/application/analog_audio_app.hpp | 4 +-- firmware/application/capture_app.hpp | 2 +- firmware/application/capture_thread.hpp | 2 +- firmware/application/dirty_registers.hpp | 2 +- firmware/application/ert_app.hpp | 8 ++--- firmware/application/event_m0.cpp | 2 +- firmware/application/event_m0.hpp | 2 +- firmware/application/file.hpp | 13 +++---- firmware/application/io_file.hpp | 2 +- firmware/application/io_wave.hpp | 4 +-- firmware/application/log_file.hpp | 2 +- firmware/application/max2837.hpp | 2 +- firmware/application/recent_entries.hpp | 4 +-- firmware/application/rffc507x.hpp | 4 +-- firmware/application/signal.hpp | 2 +- firmware/application/temperature_logger.hpp | 2 +- firmware/application/touch.hpp | 22 +++++------- firmware/application/tpms_app.hpp | 12 +++---- firmware/application/ui_debug.hpp | 2 +- firmware/application/ui_menu.hpp | 2 +- firmware/application/ui_navigation.hpp | 12 +++---- firmware/application/ui_receiver.hpp | 26 +++++++------- firmware/application/ui_record_view.hpp | 6 ++-- firmware/application/ui_sd_card_debug.cpp | 2 +- firmware/application/ui_sd_card_debug.hpp | 2 +- .../application/ui_sd_card_status_view.hpp | 2 +- firmware/application/ui_spectrum.hpp | 4 +-- firmware/application/ui_touch_calibration.hpp | 4 +-- firmware/baseband/audio_output.hpp | 10 +++--- firmware/baseband/audio_stats_collector.hpp | 2 +- firmware/baseband/baseband_processor.hpp | 2 +- firmware/baseband/baseband_thread.hpp | 4 +-- firmware/baseband/block_decimator.hpp | 2 +- firmware/baseband/channel_decimator.hpp | 24 +++++-------- firmware/baseband/clock_recovery.hpp | 8 ++--- firmware/baseband/dsp_decimate.hpp | 35 ++++++++----------- firmware/baseband/matched_filter.hpp | 4 +-- firmware/baseband/packet_builder.hpp | 10 +++--- firmware/baseband/proc_ais.hpp | 8 ++--- firmware/baseband/proc_am_audio.hpp | 22 ++++++------ firmware/baseband/proc_capture.hpp | 10 +++--- firmware/baseband/proc_nfm_audio.hpp | 16 ++++----- firmware/baseband/proc_tpms.hpp | 6 ++-- firmware/baseband/proc_wfm_audio.hpp | 18 +++++----- firmware/baseband/proc_wideband_spectrum.hpp | 4 +-- firmware/baseband/rssi_stats_collector.hpp | 2 +- firmware/baseband/spectrum_collector.hpp | 14 +++----- firmware/baseband/stream_input.hpp | 8 ++--- firmware/common/baseband_packet.hpp | 2 +- firmware/common/buffer_exchange.hpp | 6 ++-- firmware/common/message_queue.hpp | 2 +- firmware/common/png_writer.hpp | 4 +-- firmware/common/ui_widget.hpp | 16 ++++----- 54 files changed, 194 insertions(+), 217 deletions(-) diff --git a/firmware/application/ais_app.hpp b/firmware/application/ais_app.hpp index 2e26d2ab..ba95e70b 100644 --- a/firmware/application/ais_app.hpp +++ b/firmware/application/ais_app.hpp @@ -49,8 +49,8 @@ using namespace lpc43xx; struct AISPosition { rtc::RTC timestamp { }; - ais::Latitude latitude; - ais::Longitude longitude; + ais::Latitude latitude { }; + ais::Longitude longitude { }; ais::RateOfTurn rate_of_turn { -128 }; ais::SpeedOverGround speed_over_ground { 1023 }; ais::CourseOverGround course_over_ground { 3600 }; @@ -78,6 +78,9 @@ struct AISRecentEntry { AISRecentEntry( const ais::MMSI& mmsi ) : mmsi { mmsi }, + name { }, + call_sign { }, + destination { }, last_position { }, received_count { 0 }, navigational_status { -1 } @@ -102,7 +105,7 @@ public: void on_packet(const ais::Packet& packet); private: - LogFile log_file; + LogFile log_file { }; }; namespace ui { @@ -111,7 +114,7 @@ using AISRecentEntriesView = RecentEntriesView; class AISRecentEntryDetailView : public View { public: - std::function on_close; + std::function on_close { }; AISRecentEntryDetailView(); @@ -122,7 +125,7 @@ public: void paint(Painter&) override; private: - AISRecentEntry entry_; + AISRecentEntry entry_ { }; Button button_done { { 72, 216, 96, 24 }, @@ -158,15 +161,15 @@ private: static constexpr uint32_t sampling_rate = 2457600; static constexpr uint32_t baseband_bandwidth = 1750000; - AISRecentEntries recent; - std::unique_ptr logger; + AISRecentEntries recent { }; + std::unique_ptr logger { }; const RecentEntriesColumns columns { { { "MMSI", 9 }, { "Name/Call", 20 }, } }; AISRecentEntriesView recent_entries_view { columns, recent }; - AISRecentEntryDetailView recent_entry_detail_view; + AISRecentEntryDetailView recent_entry_detail_view { }; static constexpr auto header_height = 1 * 16; diff --git a/firmware/application/analog_audio_app.hpp b/firmware/application/analog_audio_app.hpp index 697a199a..566b63d9 100644 --- a/firmware/application/analog_audio_app.hpp +++ b/firmware/application/analog_audio_app.hpp @@ -139,14 +139,14 @@ private: ' ', }; - std::unique_ptr options_widget; + std::unique_ptr options_widget { }; RecordView record_view { { 0 * 8, 2 * 16, 30 * 8, 1 * 16 }, u"AUD_????", RecordView::FileType::WAV, 4096, 4 }; - spectrum::WaterfallWidget waterfall; + spectrum::WaterfallWidget waterfall { }; void on_tuning_frequency_changed(rf::Frequency f); void on_baseband_bandwidth_changed(uint32_t bandwidth_hz); diff --git a/firmware/application/capture_app.hpp b/firmware/application/capture_app.hpp index 76d287f0..7764c76b 100644 --- a/firmware/application/capture_app.hpp +++ b/firmware/application/capture_app.hpp @@ -92,7 +92,7 @@ private: u"BBD_????", RecordView::FileType::RawS16, 16384, 3 }; - spectrum::WaterfallWidget waterfall; + spectrum::WaterfallWidget waterfall { }; }; } /* namespace ui */ diff --git a/firmware/application/capture_thread.hpp b/firmware/application/capture_thread.hpp index 5a4398b0..218a2867 100644 --- a/firmware/application/capture_thread.hpp +++ b/firmware/application/capture_thread.hpp @@ -53,7 +53,7 @@ private: std::unique_ptr writer; std::function success_callback; std::function error_callback; - Thread* thread; + Thread* thread { nullptr }; static msg_t static_fn(void* arg); diff --git a/firmware/application/dirty_registers.hpp b/firmware/application/dirty_registers.hpp index cde1914c..e2143ab2 100644 --- a/firmware/application/dirty_registers.hpp +++ b/firmware/application/dirty_registers.hpp @@ -58,7 +58,7 @@ public: } private: - mask_t mask; + mask_t mask { }; }; #endif/*__DIRTY_REGISTERS_H__*/ diff --git a/firmware/application/ert_app.hpp b/firmware/application/ert_app.hpp index 6a774ede..d7488860 100644 --- a/firmware/application/ert_app.hpp +++ b/firmware/application/ert_app.hpp @@ -72,7 +72,7 @@ struct ERTRecentEntry { size_t received_count { 0 }; - ert::Consumption last_consumption; + ert::Consumption last_consumption { }; ERTRecentEntry( const Key& key @@ -97,7 +97,7 @@ public: void on_packet(const ert::Packet& packet); private: - LogFile log_file; + LogFile log_file { }; }; using ERTRecentEntries = RecentEntries; @@ -126,8 +126,8 @@ public: std::string title() const override { return "ERT"; }; private: - ERTRecentEntries recent; - std::unique_ptr logger; + ERTRecentEntries recent { }; + std::unique_ptr logger { }; const RecentEntriesColumns columns { { { "ID", 10 }, diff --git a/firmware/application/event_m0.cpp b/firmware/application/event_m0.cpp index bb32041c..8c35a523 100644 --- a/firmware/application/event_m0.cpp +++ b/firmware/application/event_m0.cpp @@ -85,7 +85,7 @@ public: private: using MapType = std::array; - MapType map_; + MapType map_ { }; }; static MessageHandlerMap message_map; diff --git a/firmware/application/event_m0.hpp b/firmware/application/event_m0.hpp index f89f0b75..f8442106 100644 --- a/firmware/application/event_m0.hpp +++ b/firmware/application/event_m0.hpp @@ -94,7 +94,7 @@ private: static Thread* thread_event_loop; - touch::Manager touch_manager; + touch::Manager touch_manager { }; ui::Widget* const top_widget; ui::Painter painter; ui::Context& context; diff --git a/firmware/application/file.hpp b/firmware/application/file.hpp index 57e63fd9..4c59f7f0 100644 --- a/firmware/application/file.hpp +++ b/firmware/application/file.hpp @@ -37,10 +37,7 @@ namespace std { namespace filesystem { struct filesystem_error { - constexpr filesystem_error( - ) : err { FR_OK } - { - } + constexpr filesystem_error() = default; constexpr filesystem_error( FRESULT fatfs_error @@ -61,7 +58,7 @@ struct filesystem_error { std::string what() const; private: - uint32_t err; + uint32_t err { FR_OK }; }; struct path { @@ -196,8 +193,8 @@ class directory_iterator { } }; - std::shared_ptr impl; - const path pattern; + std::shared_ptr impl { }; + const path pattern { }; friend bool operator!=(const directory_iterator& lhs, const directory_iterator& rhs); @@ -320,7 +317,7 @@ public: Optional sync(); private: - FIL f; + FIL f { }; Optional open_fatfs(const std::filesystem::path& filename, BYTE mode); }; diff --git a/firmware/application/io_file.hpp b/firmware/application/io_file.hpp index c9049dde..a71b1afa 100644 --- a/firmware/application/io_file.hpp +++ b/firmware/application/io_file.hpp @@ -44,7 +44,7 @@ public: File::Result write(const void* const buffer, const File::Size bytes) override; protected: - File file; + File file { }; uint64_t bytes_written { 0 }; }; diff --git a/firmware/application/io_wave.hpp b/firmware/application/io_wave.hpp index e048be8e..13b3a432 100644 --- a/firmware/application/io_wave.hpp +++ b/firmware/application/io_wave.hpp @@ -97,8 +97,8 @@ public: ); private: - uint32_t sampling_rate; - uint32_t bytes_written; + uint32_t sampling_rate { 0 }; + uint32_t bytes_written { 0 }; Optional update_header(); }; diff --git a/firmware/application/log_file.hpp b/firmware/application/log_file.hpp index 5f222a79..01861c1b 100644 --- a/firmware/application/log_file.hpp +++ b/firmware/application/log_file.hpp @@ -38,7 +38,7 @@ public: Optional write_entry(const rtc::RTC& datetime, const std::string& entry); private: - File file; + File file { }; Optional write_line(const std::string& message); }; diff --git a/firmware/application/max2837.hpp b/firmware/application/max2837.hpp index 3f1beb70..20d319a8 100644 --- a/firmware/application/max2837.hpp +++ b/firmware/application/max2837.hpp @@ -897,7 +897,7 @@ private: spi::arbiter::Target& _target; RegisterMap _map { initial_register_values }; - DirtyRegisters _dirty; + DirtyRegisters _dirty { }; void flush_one(const Register reg); diff --git a/firmware/application/recent_entries.hpp b/firmware/application/recent_entries.hpp index 568f5e6c..2af1e485 100644 --- a/firmware/application/recent_entries.hpp +++ b/firmware/application/recent_entries.hpp @@ -127,7 +127,7 @@ class RecentEntriesTable : public Widget { public: using Entry = typename Entries::value_type; - std::function on_select; + std::function on_select { }; RecentEntriesTable( Entries& recent @@ -231,7 +231,7 @@ class RecentEntriesView : public View { public: using Entry = typename Entries::value_type; - std::function on_select; + std::function on_select { }; RecentEntriesView( const RecentEntriesColumns& columns, diff --git a/firmware/application/rffc507x.hpp b/firmware/application/rffc507x.hpp index 016f0f11..e6c903a9 100644 --- a/firmware/application/rffc507x.hpp +++ b/firmware/application/rffc507x.hpp @@ -813,10 +813,10 @@ public: reg_t read(const address_t reg_num); private: - spi::SPI _bus; + spi::SPI _bus { }; RegisterMap _map { default_hackrf_one }; - DirtyRegisters _dirty; + DirtyRegisters _dirty { }; void write(const address_t reg_num, const reg_t value); diff --git a/firmware/application/signal.hpp b/firmware/application/signal.hpp index 09baf777..262e4798 100644 --- a/firmware/application/signal.hpp +++ b/firmware/application/signal.hpp @@ -78,7 +78,7 @@ private: using EntryType = std::unique_ptr; - std::list entries; + std::list entries { }; SignalToken next_token = 1; }; diff --git a/firmware/application/temperature_logger.hpp b/firmware/application/temperature_logger.hpp index 51f8e451..01f6715c 100644 --- a/firmware/application/temperature_logger.hpp +++ b/firmware/application/temperature_logger.hpp @@ -39,7 +39,7 @@ public: std::vector history() const; private: - std::array samples; + std::array samples { }; static constexpr size_t sample_interval = 5; size_t sample_phase = 0; diff --git a/firmware/application/touch.hpp b/firmware/application/touch.hpp index bc451e36..0c421f7d 100644 --- a/firmware/application/touch.hpp +++ b/firmware/application/touch.hpp @@ -154,13 +154,7 @@ const Calibration default_calibration(); template class Filter { public: - constexpr Filter( - ) : history(), - history_history { 0 }, - accumulator { 0 }, - n { 0 } - { - } + constexpr Filter() = default; void reset() { history.fill(0); @@ -196,10 +190,10 @@ public: private: static constexpr uint32_t history_history_mask { (1U << N) - 1 }; - std::array history; - uint32_t history_history; - uint32_t accumulator; - size_t n; + std::array history { }; + uint32_t history_history { 0 }; + uint32_t accumulator { 0 }; + size_t n { 0 }; bool history_valid() const { return (history_history & history_history_mask) == history_history_mask; @@ -208,7 +202,7 @@ private: class Manager { public: - std::function on_event; + std::function on_event { }; void feed(const Frame& frame); @@ -224,8 +218,8 @@ private: // Ensure filter length is equal or less than touch_count_threshold, // or coordinates from the last touch will be in the initial averages. - Filter filter_x; - Filter filter_y; + Filter filter_x { }; + Filter filter_y { }; //Debounce touch_debounce; diff --git a/firmware/application/tpms_app.hpp b/firmware/application/tpms_app.hpp index 771efd7f..ee17c6eb 100644 --- a/firmware/application/tpms_app.hpp +++ b/firmware/application/tpms_app.hpp @@ -54,9 +54,9 @@ struct TPMSRecentEntry { size_t received_count { 0 }; - Optional last_pressure; - Optional last_temperature; - Optional last_flags; + Optional last_pressure { }; + Optional last_temperature { }; + Optional last_flags { }; TPMSRecentEntry( const Key& key @@ -83,7 +83,7 @@ public: void on_packet(const tpms::Packet& packet, const uint32_t target_frequency); private: - LogFile log_file; + LogFile log_file { }; }; namespace ui { @@ -150,8 +150,8 @@ private: { 18 * 8, 0 * 16 } }; - TPMSRecentEntries recent; - std::unique_ptr logger; + TPMSRecentEntries recent { }; + std::unique_ptr logger { }; const RecentEntriesColumns columns { { { "Tp", 2 }, diff --git a/firmware/application/ui_debug.hpp b/firmware/application/ui_debug.hpp index e6297c14..33108dcc 100644 --- a/firmware/application/ui_debug.hpp +++ b/firmware/application/ui_debug.hpp @@ -193,7 +193,7 @@ public: void focus(); private: - Text text_title; + Text text_title { }; RegistersWidget registers_widget; diff --git a/firmware/application/ui_menu.hpp b/firmware/application/ui_menu.hpp index 7d10dbf6..d3f9c1e6 100644 --- a/firmware/application/ui_menu.hpp +++ b/firmware/application/ui_menu.hpp @@ -61,7 +61,7 @@ private: class MenuView : public View { public: - std::function on_left; + std::function on_left { }; MenuView() { set_focusable(true); diff --git a/firmware/application/ui_navigation.hpp b/firmware/application/ui_navigation.hpp index 65fcf2fe..9e3c7df2 100644 --- a/firmware/application/ui_navigation.hpp +++ b/firmware/application/ui_navigation.hpp @@ -41,7 +41,7 @@ namespace ui { class SystemStatusView : public View { public: - std::function on_back; + std::function on_back { }; SystemStatusView(); @@ -86,9 +86,9 @@ private: class NavigationView : public View { public: - std::function on_view_changed; + std::function on_view_changed { }; - NavigationView() { } + NavigationView() = default; NavigationView(const NavigationView&) = delete; NavigationView(NavigationView&&) = delete; @@ -107,7 +107,7 @@ public: void focus() override; private: - std::vector> view_stack; + std::vector> view_stack { }; Widget* modal_view { nullptr }; Widget* view() const; @@ -142,8 +142,8 @@ public: Context& context() const override; private: - SystemStatusView status_view; - NavigationView navigation_view; + SystemStatusView status_view { }; + NavigationView navigation_view { }; Context& context_; }; diff --git a/firmware/application/ui_receiver.hpp b/firmware/application/ui_receiver.hpp index eb012f4d..162e5d2c 100644 --- a/firmware/application/ui_receiver.hpp +++ b/firmware/application/ui_receiver.hpp @@ -38,9 +38,9 @@ namespace ui { class FrequencyField : public Widget { public: - std::function on_change; - std::function on_edit; - std::function on_show_options; + std::function on_change { }; + std::function on_edit { }; + std::function on_show_options { }; using range_t = rf::FrequencyRange; @@ -61,7 +61,7 @@ public: private: const size_t length_; const range_t range; - rf::Frequency value_; + rf::Frequency value_ { 0 }; rf::Frequency step { 25000 }; rf::Frequency clamp_value(rf::Frequency value); @@ -135,8 +135,8 @@ public: private: using array_type = std::array; - array_type s; - Justify justify; + array_type s { }; + Justify justify { Justify::Left }; template void remove_zeros(Iterator begin, Iterator end) { @@ -174,7 +174,7 @@ private: class FrequencyKeypadView : public View { public: - std::function on_changed; + std::function on_changed { }; FrequencyKeypadView( NavigationView& nav, @@ -201,7 +201,7 @@ private: { 0, 0, text_digits * button_w, button_h } }; - std::array buttons; + std::array buttons { }; Button button_close { { 0, button_h * 4 + button_h, button_w * 3, button_h }, @@ -257,8 +257,8 @@ public: class FrequencyOptionsView : public View { public: - std::function on_change_step; - std::function on_change_reference_ppm_correction; + std::function on_change_step { }; + std::function on_change_reference_ppm_correction { }; FrequencyOptionsView(const Rect parent_rect, const Style* const style); @@ -314,7 +314,7 @@ private: class LNAGainField : public NumberField { public: - std::function on_show_options; + std::function on_show_options { }; LNAGainField(Point parent_pos); @@ -323,7 +323,7 @@ public: class VGAGainField : public NumberField { public: - std::function on_show_options; + std::function on_show_options { }; VGAGainField(Point parent_pos); @@ -332,7 +332,7 @@ public: class TXGainField : public NumberField { public: - std::function on_show_options; + std::function on_show_options { }; TXGainField(Point parent_pos); diff --git a/firmware/application/ui_record_view.hpp b/firmware/application/ui_record_view.hpp index 203d334c..7564d798 100644 --- a/firmware/application/ui_record_view.hpp +++ b/firmware/application/ui_record_view.hpp @@ -37,7 +37,7 @@ namespace ui { class RecordView : public View { public: - std::function on_error; + std::function on_error { }; enum FileType { RawS16 = 2, @@ -77,7 +77,7 @@ private: const size_t write_size; const size_t buffer_count; size_t sampling_rate { 0 }; - SignalToken signal_token_tick_second; + SignalToken signal_token_tick_second { }; Rectangle rect_background { Color::black() @@ -105,7 +105,7 @@ private: "", }; - std::unique_ptr capture_thread; + std::unique_ptr capture_thread { }; MessageHandlerRegistration message_handler_capture_thread_error { Message::ID::CaptureThreadDone, diff --git a/firmware/application/ui_sd_card_debug.cpp b/firmware/application/ui_sd_card_debug.cpp index 12dc5293..74367210 100644 --- a/firmware/application/ui_sd_card_debug.cpp +++ b/firmware/application/ui_sd_card_debug.cpp @@ -86,7 +86,7 @@ private: static Thread* thread; volatile Result _result { Result::Incomplete }; - Stats _stats; + Stats _stats { }; static msg_t static_fn(void* arg) { auto obj = static_cast(arg); diff --git a/firmware/application/ui_sd_card_debug.hpp b/firmware/application/ui_sd_card_debug.hpp index d051fd3c..170c2a68 100644 --- a/firmware/application/ui_sd_card_debug.hpp +++ b/firmware/application/ui_sd_card_debug.hpp @@ -39,7 +39,7 @@ public: void focus() override; private: - SignalToken sd_card_status_signal_token; + SignalToken sd_card_status_signal_token { }; void on_status(const sd_card::Status status); void on_test(); diff --git a/firmware/application/ui_sd_card_status_view.hpp b/firmware/application/ui_sd_card_status_view.hpp index 31388cfa..9e68c91f 100644 --- a/firmware/application/ui_sd_card_status_view.hpp +++ b/firmware/application/ui_sd_card_status_view.hpp @@ -37,7 +37,7 @@ public: void paint(Painter& painter) override; private: - SignalToken sd_card_status_signal_token; + SignalToken sd_card_status_signal_token { }; void on_status(const sd_card::Status status); }; diff --git a/firmware/application/ui_spectrum.hpp b/firmware/application/ui_spectrum.hpp index 70fe83d5..cbf45644 100644 --- a/firmware/application/ui_spectrum.hpp +++ b/firmware/application/ui_spectrum.hpp @@ -84,8 +84,8 @@ public: void paint(Painter& painter) override; private: - WaterfallView waterfall_view; - FrequencyScale frequency_scale; + WaterfallView waterfall_view { }; + FrequencyScale frequency_scale { }; ChannelSpectrumFIFO* fifo { nullptr }; MessageHandlerRegistration message_handler_spectrum_config { diff --git a/firmware/application/ui_touch_calibration.hpp b/firmware/application/ui_touch_calibration.hpp index 40329020..c9a17aed 100644 --- a/firmware/application/ui_touch_calibration.hpp +++ b/firmware/application/ui_touch_calibration.hpp @@ -65,9 +65,9 @@ private: uint32_t samples_count { 0 }; - touch::DigitizerPoint average; + touch::DigitizerPoint average { }; - std::array digitizer_points; + std::array digitizer_points { }; touch::Calibration calibration; diff --git a/firmware/baseband/audio_output.hpp b/firmware/baseband/audio_output.hpp index 6462e061..21d19f8d 100644 --- a/firmware/baseband/audio_output.hpp +++ b/firmware/baseband/audio_output.hpp @@ -55,13 +55,13 @@ private: BlockDecimator block_buffer { 1 }; - IIRBiquadFilter hpf; - IIRBiquadFilter deemph; - FMSquelch squelch; + IIRBiquadFilter hpf { }; + IIRBiquadFilter deemph { }; + FMSquelch squelch { }; - std::unique_ptr stream; + std::unique_ptr stream { }; - AudioStatsCollector audio_stats; + AudioStatsCollector audio_stats { }; uint64_t audio_present_history = 0; diff --git a/firmware/baseband/audio_stats_collector.hpp b/firmware/baseband/audio_stats_collector.hpp index 10e17edc..9eddfd88 100644 --- a/firmware/baseband/audio_stats_collector.hpp +++ b/firmware/baseband/audio_stats_collector.hpp @@ -50,7 +50,7 @@ private: float max_squared { 0 }; size_t count { 0 }; - AudioStatistics statistics; + AudioStatistics statistics { }; void consume_audio_buffer(const buffer_f32_t& src); diff --git a/firmware/baseband/baseband_processor.hpp b/firmware/baseband/baseband_processor.hpp index 28ef5063..074853b2 100644 --- a/firmware/baseband/baseband_processor.hpp +++ b/firmware/baseband/baseband_processor.hpp @@ -40,7 +40,7 @@ protected: void feed_channel_stats(const buffer_c16_t& channel); private: - ChannelStatsCollector channel_stats; + ChannelStatsCollector channel_stats { }; }; #endif/*__BASEBAND_PROCESSOR_H__*/ diff --git a/firmware/baseband/baseband_thread.hpp b/firmware/baseband/baseband_thread.hpp index 4d06e326..ce05dec7 100644 --- a/firmware/baseband/baseband_thread.hpp +++ b/firmware/baseband/baseband_thread.hpp @@ -48,8 +48,8 @@ private: static Thread* thread; BasebandProcessor* baseband_processor { nullptr }; - baseband::Direction _direction; - uint32_t sampling_rate; + baseband::Direction _direction { baseband::Direction::Receive }; + uint32_t sampling_rate { 0 }; void run() override; }; diff --git a/firmware/baseband/block_decimator.hpp b/firmware/baseband/block_decimator.hpp index 7782dc37..a3a771c4 100644 --- a/firmware/baseband/block_decimator.hpp +++ b/firmware/baseband/block_decimator.hpp @@ -85,7 +85,7 @@ public: } private: - std::array buffer; + std::array buffer { }; uint32_t input_sampling_rate_ { 0 }; size_t factor_ { 1 }; size_t src_i { 0 }; diff --git a/firmware/baseband/channel_decimator.hpp b/firmware/baseband/channel_decimator.hpp index 956964b0..4b527ee2 100644 --- a/firmware/baseband/channel_decimator.hpp +++ b/firmware/baseband/channel_decimator.hpp @@ -38,12 +38,6 @@ public: By16, By32, }; - - constexpr ChannelDecimator( - ) : decimation_factor { DecimationFactor::By32 }, - fs_over_4_downconvert { true } - { - } constexpr ChannelDecimator( const DecimationFactor decimation_factor, @@ -64,17 +58,17 @@ public: } private: - std::array work_baseband; + std::array work_baseband { }; - dsp::decimate::TranslateByFSOver4AndDecimateBy2CIC3 translate; - dsp::decimate::Complex8DecimateBy2CIC3 cic_0; - dsp::decimate::DecimateBy2CIC3 cic_1; - dsp::decimate::DecimateBy2CIC3 cic_2; - dsp::decimate::DecimateBy2CIC3 cic_3; - dsp::decimate::DecimateBy2CIC3 cic_4; + dsp::decimate::TranslateByFSOver4AndDecimateBy2CIC3 translate { }; + dsp::decimate::Complex8DecimateBy2CIC3 cic_0 { }; + dsp::decimate::DecimateBy2CIC3 cic_1 { }; + dsp::decimate::DecimateBy2CIC3 cic_2 { }; + dsp::decimate::DecimateBy2CIC3 cic_3 { }; + dsp::decimate::DecimateBy2CIC3 cic_4 { }; - DecimationFactor decimation_factor; - const bool fs_over_4_downconvert; + DecimationFactor decimation_factor { DecimationFactor::By32 }; + const bool fs_over_4_downconvert { true }; buffer_c16_t execute_decimation(const buffer_c8_t& buffer); diff --git a/firmware/baseband/clock_recovery.hpp b/firmware/baseband/clock_recovery.hpp index 9a6904a3..70d7f003 100644 --- a/firmware/baseband/clock_recovery.hpp +++ b/firmware/baseband/clock_recovery.hpp @@ -60,7 +60,7 @@ public: } private: - std::array t { { 0.0f, 0.0f, 0.0f } }; + std::array t { }; size_t symbol_phase { 0 }; }; @@ -154,9 +154,9 @@ public: } private: - dsp::interpolation::LinearResampler resampler; - GardnerTimingErrorDetector timing_error_detector; - ErrorFilter error_filter; + dsp::interpolation::LinearResampler resampler { }; + GardnerTimingErrorDetector timing_error_detector { }; + ErrorFilter error_filter { }; const SymbolHandler symbol_handler; void resampler_callback(const float interpolated_sample) { diff --git a/firmware/baseband/dsp_decimate.hpp b/firmware/baseband/dsp_decimate.hpp index 52727075..4437ef88 100644 --- a/firmware/baseband/dsp_decimate.hpp +++ b/firmware/baseband/dsp_decimate.hpp @@ -86,8 +86,8 @@ public: ); private: - std::array z; - std::array taps; + std::array z { }; + std::array taps { }; }; class FIRC8xR16x24FS4Decim4 { @@ -115,8 +115,8 @@ public: ); private: - std::array z_; - std::array taps_; + std::array z_ { }; + std::array taps_ { }; int32_t output_scale = 0; }; @@ -145,8 +145,8 @@ public: ); private: - std::array z_; - std::array taps_; + std::array z_ { }; + std::array taps_ { }; int32_t output_scale = 0; }; @@ -169,8 +169,8 @@ public: ); private: - std::array z_; - std::array taps_; + std::array z_ { }; + std::array taps_ { }; int32_t output_scale = 0; }; @@ -193,8 +193,8 @@ public: ); private: - std::array z_; - std::array taps_; + std::array z_ { }; + std::array taps_ { }; int32_t output_scale = 0; }; @@ -208,11 +208,6 @@ public: /* NOTE! Current code makes an assumption that block of samples to be * processed will be a multiple of the taps_count. */ - FIRAndDecimateComplex( - ) : taps_count_ { 0 }, - decimation_factor_ { 1 } - { - } template void configure( @@ -230,10 +225,10 @@ public: private: using samples_t = sample_t[]; - std::unique_ptr samples_; - std::unique_ptr taps_reversed_; - size_t taps_count_; - size_t decimation_factor_; + std::unique_ptr samples_ { }; + std::unique_ptr taps_reversed_ { }; + size_t taps_count_ { 0 }; + size_t decimation_factor_ { 1 }; template void configure( @@ -259,7 +254,7 @@ public: ); private: - int16_t z[5]; + int16_t z[5] { }; }; } /* namespace decimate */ diff --git a/firmware/baseband/matched_filter.hpp b/firmware/baseband/matched_filter.hpp index 49045db8..a9c6f099 100644 --- a/firmware/baseband/matched_filter.hpp +++ b/firmware/baseband/matched_filter.hpp @@ -66,8 +66,8 @@ public: private: using samples_t = sample_t[]; - std::unique_ptr samples_; - std::unique_ptr taps_reversed_; + std::unique_ptr samples_ { }; + std::unique_ptr taps_reversed_ { }; size_t taps_count_ { 0 }; size_t decimation_factor_ { 1 }; size_t decimation_phase { 0 }; diff --git a/firmware/baseband/packet_builder.hpp b/firmware/baseband/packet_builder.hpp index c8a9ea5b..6a24e803 100644 --- a/firmware/baseband/packet_builder.hpp +++ b/firmware/baseband/packet_builder.hpp @@ -122,13 +122,13 @@ private: const PayloadHandlerFunc payload_handler; - BitHistory bit_history; - PreambleMatcher preamble; - UnstuffMatcher unstuff; - EndMatcher end; + BitHistory bit_history { }; + PreambleMatcher preamble { }; + UnstuffMatcher unstuff { }; + EndMatcher end { }; State state { State::Preamble }; - baseband::Packet packet; + baseband::Packet packet { }; void reset_state() { packet.clear(); diff --git a/firmware/baseband/proc_ais.hpp b/firmware/baseband/proc_ais.hpp index 97e813ff..1130c05c 100644 --- a/firmware/baseband/proc_ais.hpp +++ b/firmware/baseband/proc_ais.hpp @@ -54,21 +54,21 @@ private: BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 }; RSSIThread rssi_thread { NORMALPRIO + 10 }; - std::array dst; + std::array dst { }; const buffer_c16_t dst_buffer { dst.data(), dst.size() }; - dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0; - dsp::decimate::FIRC16xR16x32Decim8 decim_1; + dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0 { }; + dsp::decimate::FIRC16xR16x32Decim8 decim_1 { }; dsp::matched_filter::MatchedFilter mf { baseband::ais::square_taps_38k4_1t_p, 2 }; clock_recovery::ClockRecovery clock_recovery { 19200, 9600, { 0.0555f }, [this](const float symbol) { this->consume_symbol(symbol); } }; - symbol_coding::NRZIDecoder nrzi_decode; + symbol_coding::NRZIDecoder nrzi_decode { }; PacketBuilder packet_builder { { 0b0101010101111110, 16, 1 }, { 0b111110, 6 }, diff --git a/firmware/baseband/proc_am_audio.hpp b/firmware/baseband/proc_am_audio.hpp index 08cca3e5..55827ea0 100644 --- a/firmware/baseband/proc_am_audio.hpp +++ b/firmware/baseband/proc_am_audio.hpp @@ -49,31 +49,31 @@ private: BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 }; RSSIThread rssi_thread { NORMALPRIO + 10 }; - std::array dst; + std::array dst { }; const buffer_c16_t dst_buffer { dst.data(), dst.size() }; - std::array audio; + std::array audio { }; const buffer_f32_t audio_buffer { audio.data(), audio.size() }; - dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0; - dsp::decimate::FIRC16xR16x32Decim8 decim_1; - dsp::decimate::FIRAndDecimateComplex decim_2; - dsp::decimate::FIRAndDecimateComplex channel_filter; + dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0 { }; + dsp::decimate::FIRC16xR16x32Decim8 decim_1 { }; + dsp::decimate::FIRAndDecimateComplex decim_2 { }; + dsp::decimate::FIRAndDecimateComplex channel_filter { }; uint32_t channel_filter_pass_f = 0; uint32_t channel_filter_stop_f = 0; bool modulation_ssb = false; - dsp::demodulate::AM demod_am; - dsp::demodulate::SSB demod_ssb; - FeedForwardCompressor audio_compressor; - AudioOutput audio_output; + dsp::demodulate::AM demod_am { }; + dsp::demodulate::SSB demod_ssb { }; + FeedForwardCompressor audio_compressor { }; + AudioOutput audio_output { }; - SpectrumCollector channel_spectrum; + SpectrumCollector channel_spectrum { }; bool configured { false }; void configure(const AMConfigureMessage& message); diff --git a/firmware/baseband/proc_capture.hpp b/firmware/baseband/proc_capture.hpp index c2b48b0c..b30a7889 100644 --- a/firmware/baseband/proc_capture.hpp +++ b/firmware/baseband/proc_capture.hpp @@ -51,20 +51,20 @@ private: BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 }; RSSIThread rssi_thread { NORMALPRIO + 10 }; - std::array dst; + std::array dst { }; const buffer_c16_t dst_buffer { dst.data(), dst.size() }; - dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0; - dsp::decimate::FIRC16xR16x16Decim2 decim_1; + dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0 { }; + dsp::decimate::FIRC16xR16x16Decim2 decim_1 { }; uint32_t channel_filter_pass_f = 0; uint32_t channel_filter_stop_f = 0; - std::unique_ptr stream; + std::unique_ptr stream { }; - SpectrumCollector channel_spectrum; + SpectrumCollector channel_spectrum { }; size_t spectrum_interval_samples = 0; size_t spectrum_samples = 0; diff --git a/firmware/baseband/proc_nfm_audio.hpp b/firmware/baseband/proc_nfm_audio.hpp index f4529a73..9eba9ef7 100644 --- a/firmware/baseband/proc_nfm_audio.hpp +++ b/firmware/baseband/proc_nfm_audio.hpp @@ -46,28 +46,28 @@ private: BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 }; RSSIThread rssi_thread { NORMALPRIO + 10 }; - std::array dst; + std::array dst { }; const buffer_c16_t dst_buffer { dst.data(), dst.size() }; - std::array audio; + std::array audio { }; const buffer_f32_t audio_buffer { audio.data(), audio.size() }; - dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0; - dsp::decimate::FIRC16xR16x32Decim8 decim_1; - dsp::decimate::FIRAndDecimateComplex channel_filter; + dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0 { }; + dsp::decimate::FIRC16xR16x32Decim8 decim_1 { }; + dsp::decimate::FIRAndDecimateComplex channel_filter { }; uint32_t channel_filter_pass_f = 0; uint32_t channel_filter_stop_f = 0; - dsp::demodulate::FM demod; + dsp::demodulate::FM demod { }; - AudioOutput audio_output; + AudioOutput audio_output { }; - SpectrumCollector channel_spectrum; + SpectrumCollector channel_spectrum { }; bool configured { false }; void configure(const NBFMConfigureMessage& message); diff --git a/firmware/baseband/proc_tpms.hpp b/firmware/baseband/proc_tpms.hpp index f81c4800..2a09bb71 100644 --- a/firmware/baseband/proc_tpms.hpp +++ b/firmware/baseband/proc_tpms.hpp @@ -69,14 +69,14 @@ private: BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 }; RSSIThread rssi_thread { NORMALPRIO + 10 }; - std::array dst; + std::array dst { }; const buffer_c16_t dst_buffer { dst.data(), dst.size() }; - dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0; - dsp::decimate::FIRC16xR16x16Decim2 decim_1; + dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0 { }; + dsp::decimate::FIRC16xR16x16Decim2 decim_1 { }; dsp::matched_filter::MatchedFilter mf_38k4_1t_19k2 { rect_taps_307k2_38k4_1t_19k2_p, 8 }; diff --git a/firmware/baseband/proc_wfm_audio.hpp b/firmware/baseband/proc_wfm_audio.hpp index 446990f5..2b21133d 100644 --- a/firmware/baseband/proc_wfm_audio.hpp +++ b/firmware/baseband/proc_wfm_audio.hpp @@ -45,7 +45,7 @@ private: BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 }; RSSIThread rssi_thread { NORMALPRIO + 10 }; - std::array dst; + std::array dst { }; const buffer_c16_t dst_buffer { dst.data(), dst.size() @@ -55,19 +55,19 @@ private: sizeof(dst) / sizeof(int16_t) }; - dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0; - dsp::decimate::FIRC16xR16x16Decim2 decim_1; + dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0 { }; + dsp::decimate::FIRC16xR16x16Decim2 decim_1 { }; uint32_t channel_filter_pass_f = 0; uint32_t channel_filter_stop_f = 0; - dsp::demodulate::FM demod; - dsp::decimate::DecimateBy2CIC4Real audio_dec_1; - dsp::decimate::DecimateBy2CIC4Real audio_dec_2; - dsp::decimate::FIR64AndDecimateBy2Real audio_filter; + dsp::demodulate::FM demod { }; + dsp::decimate::DecimateBy2CIC4Real audio_dec_1 { }; + dsp::decimate::DecimateBy2CIC4Real audio_dec_2 { }; + dsp::decimate::FIR64AndDecimateBy2Real audio_filter { }; - AudioOutput audio_output; + AudioOutput audio_output { }; - SpectrumCollector channel_spectrum; + SpectrumCollector channel_spectrum { }; size_t spectrum_interval_samples = 0; size_t spectrum_samples = 0; diff --git a/firmware/baseband/proc_wideband_spectrum.hpp b/firmware/baseband/proc_wideband_spectrum.hpp index 7a650ee0..117a1f5b 100644 --- a/firmware/baseband/proc_wideband_spectrum.hpp +++ b/firmware/baseband/proc_wideband_spectrum.hpp @@ -46,9 +46,9 @@ private: BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 }; RSSIThread rssi_thread { NORMALPRIO + 10 }; - SpectrumCollector channel_spectrum; + SpectrumCollector channel_spectrum { }; - std::array spectrum; + std::array spectrum { }; size_t phase = 0; }; diff --git a/firmware/baseband/rssi_stats_collector.hpp b/firmware/baseband/rssi_stats_collector.hpp index 7a1cd494..68143768 100644 --- a/firmware/baseband/rssi_stats_collector.hpp +++ b/firmware/baseband/rssi_stats_collector.hpp @@ -69,7 +69,7 @@ public: private: static constexpr float update_interval { 0.1f }; - RSSIStatistics statistics; + RSSIStatistics statistics { }; }; #endif/*__RSSI_STATS_COLLECTOR_H__*/ diff --git a/firmware/baseband/spectrum_collector.hpp b/firmware/baseband/spectrum_collector.hpp index b238c1fe..83d30a42 100644 --- a/firmware/baseband/spectrum_collector.hpp +++ b/firmware/baseband/spectrum_collector.hpp @@ -34,12 +34,6 @@ class SpectrumCollector { public: - constexpr SpectrumCollector( - ) : channel_spectrum_decimator { 1 }, - fifo { fifo_data, ChannelSpectrumConfigMessage::fifo_k } - { - } - void on_message(const Message* const message); void set_decimation_factor(const size_t decimation_factor); @@ -51,13 +45,13 @@ public: ); private: - BlockDecimator channel_spectrum_decimator; - ChannelSpectrumFIFO fifo; - ChannelSpectrum fifo_data[1 << ChannelSpectrumConfigMessage::fifo_k]; + BlockDecimator channel_spectrum_decimator { 1 }; + ChannelSpectrum fifo_data[1 << ChannelSpectrumConfigMessage::fifo_k] { }; + ChannelSpectrumFIFO fifo { fifo_data, ChannelSpectrumConfigMessage::fifo_k }; volatile bool channel_spectrum_request_update { false }; bool streaming { false }; - std::array, 256> channel_spectrum; + std::array, 256> channel_spectrum { }; uint32_t channel_spectrum_sampling_rate { 0 }; uint32_t channel_filter_pass_frequency { 0 }; uint32_t channel_filter_stop_frequency { 0 }; diff --git a/firmware/baseband/stream_input.hpp b/firmware/baseband/stream_input.hpp index ce4a29a4..1e73b8c0 100644 --- a/firmware/baseband/stream_input.hpp +++ b/firmware/baseband/stream_input.hpp @@ -42,12 +42,12 @@ private: FIFO fifo_buffers_empty; FIFO fifo_buffers_full; - std::array buffers; - std::array buffers_empty; - std::array buffers_full; + std::array buffers { }; + std::array buffers_empty { }; + std::array buffers_full { }; StreamBuffer* active_buffer { nullptr }; CaptureConfig* const config { nullptr }; - std::unique_ptr data; + std::unique_ptr data { }; }; #endif/*__STREAM_INPUT_H__*/ diff --git a/firmware/common/baseband_packet.hpp b/firmware/common/baseband_packet.hpp index f5bf161c..eb9fd9fb 100644 --- a/firmware/common/baseband_packet.hpp +++ b/firmware/common/baseband_packet.hpp @@ -62,7 +62,7 @@ public: } private: - std::bitset<1408> data; + std::bitset<1408> data { }; Timestamp timestamp_ { }; size_t count { 0 }; }; diff --git a/firmware/common/buffer_exchange.hpp b/firmware/common/buffer_exchange.hpp index 091a6ea2..1f12da3d 100644 --- a/firmware/common/buffer_exchange.hpp +++ b/firmware/common/buffer_exchange.hpp @@ -68,9 +68,9 @@ public: private: CaptureConfig* const config; - FIFO* fifo_buffers_for_baseband; - FIFO* fifo_buffers_for_application; - Thread* thread; + FIFO* fifo_buffers_for_baseband { nullptr }; + FIFO* fifo_buffers_for_application { nullptr }; + Thread* thread { nullptr }; static BufferExchange* obj; void check_fifo_isr() { diff --git a/firmware/common/message_queue.hpp b/firmware/common/message_queue.hpp index 84bbaa9c..0a12fb62 100644 --- a/firmware/common/message_queue.hpp +++ b/firmware/common/message_queue.hpp @@ -80,7 +80,7 @@ public: private: FIFO fifo; - Mutex mutex_write; + Mutex mutex_write { }; Message* peek(std::array& buf) { Message* const p = reinterpret_cast(buf.data()); diff --git a/firmware/common/png_writer.hpp b/firmware/common/png_writer.hpp index 020a118a..bf0fcc8a 100644 --- a/firmware/common/png_writer.hpp +++ b/firmware/common/png_writer.hpp @@ -44,10 +44,10 @@ private: static constexpr int width { 240 }; static constexpr int height { 320 }; - File file; + File file { }; int scanline_count { 0 }; CRC<32, true, true> crc { 0x04c11db7, 0xffffffff, 0xffffffff }; - Adler32 adler_32; + Adler32 adler_32 { }; void write_chunk_header(const size_t length, const std::array& type); void write_chunk_content(const void* const p, const size_t count); diff --git a/firmware/common/ui_widget.hpp b/firmware/common/ui_widget.hpp index 18a03158..008bdaaf 100644 --- a/firmware/common/ui_widget.hpp +++ b/firmware/common/ui_widget.hpp @@ -46,7 +46,7 @@ public: } private: - FocusManager focus_manager_; + FocusManager focus_manager_ { }; }; class Widget { @@ -161,7 +161,7 @@ public: virtual std::string title() const; protected: - std::vector children_; + std::vector children_ { }; void invalidate_child(Widget* const widget); }; @@ -198,7 +198,7 @@ private: class Button : public Widget { public: - std::function on_select; + std::function on_select { }; Button(Rect parent_rect, std::string text); @@ -243,7 +243,7 @@ private: class ImageButton : public Image { public: - std::function on_select; + std::function on_select { }; ImageButton( const Rect parent_rect, @@ -263,8 +263,8 @@ public: using option_t = std::pair; using options_t = std::vector; - std::function on_change; - std::function on_show_options; + std::function on_change { }; + std::function on_show_options { }; OptionsField(Point parent_pos, size_t length, options_t options); @@ -287,7 +287,7 @@ private: class NumberField : public Widget { public: - std::function on_change; + std::function on_change { }; using range_t = std::pair; @@ -309,7 +309,7 @@ private: const int32_t step; const size_t length_; const char fill_char; - int32_t value_; + int32_t value_ { 0 }; int32_t clip_value(int32_t value); };