From 17cdb34fea79193b775d6ab9730d2748aee44254 Mon Sep 17 00:00:00 2001 From: GullCode Date: Mon, 27 Mar 2023 14:15:28 +0200 Subject: [PATCH] added set of functions for up/down/enable/disable converter --- .../common/portapack_persistent_memory.cpp | 49 ++++++++++++++----- .../common/portapack_persistent_memory.hpp | 12 +++-- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/firmware/common/portapack_persistent_memory.cpp b/firmware/common/portapack_persistent_memory.cpp index 7c2f39a8..4b12824c 100644 --- a/firmware/common/portapack_persistent_memory.cpp +++ b/firmware/common/portapack_persistent_memory.cpp @@ -288,9 +288,14 @@ struct data_t { // Recon App uint64_t recon_config; - // HamItUp (+125MHz offset by default, configurable) - bool hamitup; - int64_t hamitup_freq; + // converter: show or hide icon. Hiding cause auto disable to avoid mistakes + bool hide_converter ; + // enable or disable converter + bool converter ; + // set up converter (false) or down converter (true) converter + bool updown_converter ; + // up/down converter offset + int64_t converter_frequency_offset ; constexpr data_t() : structure_version(data_structure_version_enum::VERSION_CURRENT), @@ -320,8 +325,10 @@ struct data_t { hardware_config(0), recon_config(0), - hamitup(0), - hamitup_freq(125000000) + hide_converter(0), + converter(0), + updown_converter(0), + converter_frequency_offset(0) { } }; @@ -739,17 +746,33 @@ void set_recon_load_hamradios(const bool v ){ void set_recon_match_mode(const bool v ) { data->recon_config = (data->recon_config & ~0x00800000UL) | (v << 23); } -bool config_hamitup() { - return data->hamitup; +bool config_hide_converter() { + return data->hide_converter; } -void set_config_hamitup(const bool v ){ - data-> hamitup = v ; +bool config_converter() { + return data->converter; } -int64_t config_hamitup_freq() { - return data->hamitup_freq ; +bool config_updown_converter() { + return data->updown_converter; } -void set_config_hamitup_freq(const int64_t v ){ - data-> hamitup_freq = v ; +int64_t config_converter_freq() { + return data->converter_frequency_offset ; +} +void set_config_hide_converter(const bool v ){ + data-> hide_converter = v ; + if( v ) + { + data -> converter = false ; + } +} +void set_config_converter(const bool v ){ + data-> converter = v ; +} +void set_config_updown_converter(const bool v){ + data-> updown_converter = v ; +} +void set_config_converter_freq(const int64_t v ){ + data-> converter_frequency_offset = v ; } } /* namespace persistent_memory */ } /* namespace portapack */ diff --git a/firmware/common/portapack_persistent_memory.hpp b/firmware/common/portapack_persistent_memory.hpp index e7141c13..3fb505f6 100644 --- a/firmware/common/portapack_persistent_memory.hpp +++ b/firmware/common/portapack_persistent_memory.hpp @@ -151,8 +151,10 @@ uint8_t config_cpld(); void set_config_cpld(uint8_t i); bool config_splash(); -bool config_hamitup(); -int64_t config_hamitup_freq(); +bool config_hide_converter(); +bool config_converter(); +bool config_updown_converter(); +int64_t config_converter_freq(); bool show_gui_return_icon(); bool load_app_settings(); bool save_app_settings(); @@ -169,8 +171,10 @@ void set_load_app_settings(bool v); void set_save_app_settings(bool v); void set_show_bigger_qr_code(bool v); void set_config_splash(bool v); -void set_config_hamitup(bool v); -void set_config_hamitup_freq(const int64_t v ); +void set_config_hide_converter(bool v); +void set_config_converter(bool v); +void set_config_updown_converter(const bool v); +void set_config_converter_freq(const int64_t v ); void set_clock_hidden(bool v); void set_clock_with_date(bool v); void set_config_login(bool v);