mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-03 12:06:52 -04:00
Add lots of value constructors.
This commit is contained in:
parent
cd31ae86d7
commit
4eb0facacb
54 changed files with 194 additions and 217 deletions
|
@ -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<AISRecentEntries>;
|
|||
|
||||
class AISRecentEntryDetailView : public View {
|
||||
public:
|
||||
std::function<void(void)> on_close;
|
||||
std::function<void(void)> 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<AISLogger> logger;
|
||||
AISRecentEntries recent { };
|
||||
std::unique_ptr<AISLogger> 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;
|
||||
|
||||
|
|
|
@ -139,14 +139,14 @@ private:
|
|||
' ',
|
||||
};
|
||||
|
||||
std::unique_ptr<Widget> options_widget;
|
||||
std::unique_ptr<Widget> 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);
|
||||
|
|
|
@ -92,7 +92,7 @@ private:
|
|||
u"BBD_????", RecordView::FileType::RawS16, 16384, 3
|
||||
};
|
||||
|
||||
spectrum::WaterfallWidget waterfall;
|
||||
spectrum::WaterfallWidget waterfall { };
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
std::unique_ptr<stream::Writer> writer;
|
||||
std::function<void()> success_callback;
|
||||
std::function<void(File::Error)> error_callback;
|
||||
Thread* thread;
|
||||
Thread* thread { nullptr };
|
||||
|
||||
static msg_t static_fn(void* arg);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
mask_t mask;
|
||||
mask_t mask { };
|
||||
};
|
||||
|
||||
#endif/*__DIRTY_REGISTERS_H__*/
|
||||
|
|
|
@ -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<ERTRecentEntry>;
|
||||
|
@ -126,8 +126,8 @@ public:
|
|||
std::string title() const override { return "ERT"; };
|
||||
|
||||
private:
|
||||
ERTRecentEntries recent;
|
||||
std::unique_ptr<ERTLogger> logger;
|
||||
ERTRecentEntries recent { };
|
||||
std::unique_ptr<ERTLogger> logger { };
|
||||
|
||||
const RecentEntriesColumns columns { {
|
||||
{ "ID", 10 },
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
private:
|
||||
using MapType = std::array<MessageHandler, toUType(Message::ID::MAX)>;
|
||||
MapType map_;
|
||||
MapType map_ { };
|
||||
};
|
||||
|
||||
static MessageHandlerMap message_map;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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> impl;
|
||||
const path pattern;
|
||||
std::shared_ptr<Impl> impl { };
|
||||
const path pattern { };
|
||||
|
||||
friend bool operator!=(const directory_iterator& lhs, const directory_iterator& rhs);
|
||||
|
||||
|
@ -320,7 +317,7 @@ public:
|
|||
Optional<Error> sync();
|
||||
|
||||
private:
|
||||
FIL f;
|
||||
FIL f { };
|
||||
|
||||
Optional<Error> open_fatfs(const std::filesystem::path& filename, BYTE mode);
|
||||
};
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
File::Result<File::Size> write(const void* const buffer, const File::Size bytes) override;
|
||||
|
||||
protected:
|
||||
File file;
|
||||
File file { };
|
||||
uint64_t bytes_written { 0 };
|
||||
};
|
||||
|
||||
|
|
|
@ -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<File::Error> update_header();
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
Optional<File::Error> write_entry(const rtc::RTC& datetime, const std::string& entry);
|
||||
|
||||
private:
|
||||
File file;
|
||||
File file { };
|
||||
|
||||
Optional<File::Error> write_line(const std::string& message);
|
||||
};
|
||||
|
|
|
@ -897,7 +897,7 @@ private:
|
|||
spi::arbiter::Target& _target;
|
||||
|
||||
RegisterMap _map { initial_register_values };
|
||||
DirtyRegisters<Register, reg_count> _dirty;
|
||||
DirtyRegisters<Register, reg_count> _dirty { };
|
||||
|
||||
void flush_one(const Register reg);
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class RecentEntriesTable : public Widget {
|
|||
public:
|
||||
using Entry = typename Entries::value_type;
|
||||
|
||||
std::function<void(const Entry& entry)> on_select;
|
||||
std::function<void(const Entry& entry)> on_select { };
|
||||
|
||||
RecentEntriesTable(
|
||||
Entries& recent
|
||||
|
@ -231,7 +231,7 @@ class RecentEntriesView : public View {
|
|||
public:
|
||||
using Entry = typename Entries::value_type;
|
||||
|
||||
std::function<void(const Entry& entry)> on_select;
|
||||
std::function<void(const Entry& entry)> on_select { };
|
||||
|
||||
RecentEntriesView(
|
||||
const RecentEntriesColumns& columns,
|
||||
|
|
|
@ -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<Register, reg_count> _dirty;
|
||||
DirtyRegisters<Register, reg_count> _dirty { };
|
||||
|
||||
void write(const address_t reg_num, const reg_t value);
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ private:
|
|||
|
||||
using EntryType = std::unique_ptr<CallbackEntry>;
|
||||
|
||||
std::list<EntryType> entries;
|
||||
std::list<EntryType> entries { };
|
||||
SignalToken next_token = 1;
|
||||
};
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
std::vector<sample_t> history() const;
|
||||
|
||||
private:
|
||||
std::array<sample_t, 128> samples;
|
||||
std::array<sample_t, 128> samples { };
|
||||
|
||||
static constexpr size_t sample_interval = 5;
|
||||
size_t sample_phase = 0;
|
||||
|
|
|
@ -154,13 +154,7 @@ const Calibration default_calibration();
|
|||
template<size_t N>
|
||||
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<sample_t, N> history;
|
||||
uint32_t history_history;
|
||||
uint32_t accumulator;
|
||||
size_t n;
|
||||
std::array<sample_t, N> 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<void(ui::TouchEvent)> on_event;
|
||||
std::function<void(ui::TouchEvent)> 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<touch_count_threshold> filter_x;
|
||||
Filter<touch_count_threshold> filter_y;
|
||||
Filter<touch_count_threshold> filter_x { };
|
||||
Filter<touch_count_threshold> filter_y { };
|
||||
|
||||
//Debounce touch_debounce;
|
||||
|
||||
|
|
|
@ -54,9 +54,9 @@ struct TPMSRecentEntry {
|
|||
|
||||
size_t received_count { 0 };
|
||||
|
||||
Optional<Pressure> last_pressure;
|
||||
Optional<Temperature> last_temperature;
|
||||
Optional<tpms::Flags> last_flags;
|
||||
Optional<Pressure> last_pressure { };
|
||||
Optional<Temperature> last_temperature { };
|
||||
Optional<tpms::Flags> 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<TPMSLogger> logger;
|
||||
TPMSRecentEntries recent { };
|
||||
std::unique_ptr<TPMSLogger> logger { };
|
||||
|
||||
const RecentEntriesColumns columns { {
|
||||
{ "Tp", 2 },
|
||||
|
|
|
@ -193,7 +193,7 @@ public:
|
|||
void focus();
|
||||
|
||||
private:
|
||||
Text text_title;
|
||||
Text text_title { };
|
||||
|
||||
RegistersWidget registers_widget;
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ private:
|
|||
|
||||
class MenuView : public View {
|
||||
public:
|
||||
std::function<void(void)> on_left;
|
||||
std::function<void(void)> on_left { };
|
||||
|
||||
MenuView() {
|
||||
set_focusable(true);
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace ui {
|
|||
|
||||
class SystemStatusView : public View {
|
||||
public:
|
||||
std::function<void(void)> on_back;
|
||||
std::function<void(void)> on_back { };
|
||||
|
||||
SystemStatusView();
|
||||
|
||||
|
@ -86,9 +86,9 @@ private:
|
|||
|
||||
class NavigationView : public View {
|
||||
public:
|
||||
std::function<void(const View&)> on_view_changed;
|
||||
std::function<void(const View&)> on_view_changed { };
|
||||
|
||||
NavigationView() { }
|
||||
NavigationView() = default;
|
||||
|
||||
NavigationView(const NavigationView&) = delete;
|
||||
NavigationView(NavigationView&&) = delete;
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
void focus() override;
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<View>> view_stack;
|
||||
std::vector<std::unique_ptr<View>> 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_;
|
||||
};
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ namespace ui {
|
|||
|
||||
class FrequencyField : public Widget {
|
||||
public:
|
||||
std::function<void(rf::Frequency)> on_change;
|
||||
std::function<void(void)> on_edit;
|
||||
std::function<void(void)> on_show_options;
|
||||
std::function<void(rf::Frequency)> on_change { };
|
||||
std::function<void(void)> on_edit { };
|
||||
std::function<void(void)> 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<char, N>;
|
||||
|
||||
array_type s;
|
||||
Justify justify;
|
||||
array_type s { };
|
||||
Justify justify { Justify::Left };
|
||||
|
||||
template<typename Iterator>
|
||||
void remove_zeros(Iterator begin, Iterator end) {
|
||||
|
@ -174,7 +174,7 @@ private:
|
|||
|
||||
class FrequencyKeypadView : public View {
|
||||
public:
|
||||
std::function<void(rf::Frequency)> on_changed;
|
||||
std::function<void(rf::Frequency)> on_changed { };
|
||||
|
||||
FrequencyKeypadView(
|
||||
NavigationView& nav,
|
||||
|
@ -201,7 +201,7 @@ private:
|
|||
{ 0, 0, text_digits * button_w, button_h }
|
||||
};
|
||||
|
||||
std::array<Button, 12> buttons;
|
||||
std::array<Button, 12> 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<void(rf::Frequency)> on_change_step;
|
||||
std::function<void(int32_t)> on_change_reference_ppm_correction;
|
||||
std::function<void(rf::Frequency)> on_change_step { };
|
||||
std::function<void(int32_t)> 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<void(void)> on_show_options;
|
||||
std::function<void(void)> on_show_options { };
|
||||
|
||||
LNAGainField(Point parent_pos);
|
||||
|
||||
|
@ -323,7 +323,7 @@ public:
|
|||
|
||||
class VGAGainField : public NumberField {
|
||||
public:
|
||||
std::function<void(void)> on_show_options;
|
||||
std::function<void(void)> on_show_options { };
|
||||
|
||||
VGAGainField(Point parent_pos);
|
||||
|
||||
|
@ -332,7 +332,7 @@ public:
|
|||
|
||||
class TXGainField : public NumberField {
|
||||
public:
|
||||
std::function<void(void)> on_show_options;
|
||||
std::function<void(void)> on_show_options { };
|
||||
|
||||
TXGainField(Point parent_pos);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace ui {
|
|||
|
||||
class RecordView : public View {
|
||||
public:
|
||||
std::function<void(std::string)> on_error;
|
||||
std::function<void(std::string)> 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<CaptureThread> capture_thread;
|
||||
std::unique_ptr<CaptureThread> capture_thread { };
|
||||
|
||||
MessageHandlerRegistration message_handler_capture_thread_error {
|
||||
Message::ID::CaptureThreadDone,
|
||||
|
|
|
@ -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<SDCardTestThread*>(arg);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -65,9 +65,9 @@ private:
|
|||
|
||||
uint32_t samples_count { 0 };
|
||||
|
||||
touch::DigitizerPoint average;
|
||||
touch::DigitizerPoint average { };
|
||||
|
||||
std::array<touch::DigitizerPoint, 3> digitizer_points;
|
||||
std::array<touch::DigitizerPoint, 3> digitizer_points { };
|
||||
|
||||
touch::Calibration calibration;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue