From 35cece1cb0b611aec2dcee474168798883da2819 Mon Sep 17 00:00:00 2001 From: Brumi-2021 <86470699+Brumi-2021@users.noreply.github.com> Date: Sun, 24 Oct 2021 01:40:08 +0200 Subject: [PATCH 1/7] Update spectrum_collector.cpp lower case correction --- firmware/baseband/spectrum_collector.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/firmware/baseband/spectrum_collector.cpp b/firmware/baseband/spectrum_collector.cpp index 4256b362..c15d0cbd 100644 --- a/firmware/baseband/spectrum_collector.cpp +++ b/firmware/baseband/spectrum_collector.cpp @@ -106,12 +106,12 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) { } /* 3 types of Windowing time domain shapes declaration , but only used Hamming , shapes for FFT - GCC10 compile sintax error c/m (1/2), + gcc10 compile sintax error c/m (1/2), The primary diff. between const and constexpr variables is that the initialization of a const var can be deferred until run time. A constexpr var. must be initialized at compile time. ... A var. can be declared with constexpr , when it has a literal type and is initialized. - GCC compile sintax error c/m (2/2) + gcc10 compile sintax error c/m (2/2) Static assert --> Tests a software assertion at compile time for debugging. we keep the same safety compile protection , just changing slightly the sintax checking that the size of the called array is power of 2. if the bool "constant expression" is TRUE (normal case) , the declaration has no effect. @@ -119,24 +119,24 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) { */ -template // Although currently we are not using that Windowing shape, we apply the same GCC10 compile error c/m +template // Although currently we are not using that Windowing shape, we apply the same gcc10 compile error c/m static typename T::value_type spectrum_window_none(const T& s, const size_t i) { - static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions. + static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error gcc10 , OK for all gcc versions. return s[i]; }; template // Currently we are calling and using that Window shape. static typename T::value_type spectrum_window_hamming_3(const T& s, const size_t i) { - static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions. - const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const + static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error gcc10 , OK for all gcc versions. + const size_t mask = s.size() - 1; // c/m compile error gcc10 , constexpr->const // Three point Hamming window. return s[i] * 0.54f + (s[(i-1) & mask] + s[(i+1) & mask]) * -0.23f; }; -template // Although currently we are not using that Windowing shape, we apply the same GCC10 compile error c/m +template // Although currently we are not using that Windowing shape, we apply the same gcc10 compile error c/m static typename T::value_type spectrum_window_blackman_3(const T& s, const size_t i) { - static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions. - const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const + static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error gcc10 , OK for all gcc versions. + const size_t mask = s.size() - 1; // c/m compile error gcc10 , constexpr->const // Three term Blackman window. constexpr float alpha = 0.42f; constexpr float beta = 0.5f * 0.5f; From 4a6fc35384dd3007a4cc91c319b68d2b17232a8c Mon Sep 17 00:00:00 2001 From: Brumi-2021 <86470699+Brumi-2021@users.noreply.github.com> Date: Sun, 24 Oct 2021 01:47:42 +0200 Subject: [PATCH 2/7] Update spectrum_collector.cpp Description changed , better explanation. --- firmware/baseband/spectrum_collector.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/baseband/spectrum_collector.cpp b/firmware/baseband/spectrum_collector.cpp index c15d0cbd..771746ec 100644 --- a/firmware/baseband/spectrum_collector.cpp +++ b/firmware/baseband/spectrum_collector.cpp @@ -105,7 +105,7 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) { } } -/* 3 types of Windowing time domain shapes declaration , but only used Hamming , shapes for FFT +/* 3 types of Spectrum Windowing shapes declaration , but only used Hamming , shapes for FFT gcc10 compile sintax error c/m (1/2), The primary diff. between const and constexpr variables is that the initialization of a const var can be deferred until run time. @@ -113,7 +113,7 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) { A var. can be declared with constexpr , when it has a literal type and is initialized. gcc10 compile sintax error c/m (2/2) Static assert --> Tests a software assertion at compile time for debugging. - we keep the same safety compile protection , just changing slightly the sintax checking that the size of the called array is power of 2. + we keep the same safety compile protection , just changing slightly the sintax but checking the array_size = power of 2. if the bool "constant expression" is TRUE (normal case) , the declaration has no effect. if the bool "constant expression" is FALSE (abnormal array size) , it is aborted the compile with a msg error. */ From bfd614b51fee1ec615f0ac1157b17623bd3b9312 Mon Sep 17 00:00:00 2001 From: Brumi-2021 <86470699+Brumi-2021@users.noreply.github.com> Date: Sun, 24 Oct 2021 01:58:06 +0200 Subject: [PATCH 3/7] Revert "Update spectrum_collector.cpp" This reverts commit 4a6fc35384dd3007a4cc91c319b68d2b17232a8c. --- firmware/baseband/spectrum_collector.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/baseband/spectrum_collector.cpp b/firmware/baseband/spectrum_collector.cpp index 771746ec..c15d0cbd 100644 --- a/firmware/baseband/spectrum_collector.cpp +++ b/firmware/baseband/spectrum_collector.cpp @@ -105,7 +105,7 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) { } } -/* 3 types of Spectrum Windowing shapes declaration , but only used Hamming , shapes for FFT +/* 3 types of Windowing time domain shapes declaration , but only used Hamming , shapes for FFT gcc10 compile sintax error c/m (1/2), The primary diff. between const and constexpr variables is that the initialization of a const var can be deferred until run time. @@ -113,7 +113,7 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) { A var. can be declared with constexpr , when it has a literal type and is initialized. gcc10 compile sintax error c/m (2/2) Static assert --> Tests a software assertion at compile time for debugging. - we keep the same safety compile protection , just changing slightly the sintax but checking the array_size = power of 2. + we keep the same safety compile protection , just changing slightly the sintax checking that the size of the called array is power of 2. if the bool "constant expression" is TRUE (normal case) , the declaration has no effect. if the bool "constant expression" is FALSE (abnormal array size) , it is aborted the compile with a msg error. */ From 28ee69baae9521b76050ae4b223ea03ea1dbc852 Mon Sep 17 00:00:00 2001 From: Brumi-2021 <86470699+Brumi-2021@users.noreply.github.com> Date: Sun, 24 Oct 2021 01:58:58 +0200 Subject: [PATCH 4/7] Revert "Update spectrum_collector.cpp" This reverts commit 35cece1cb0b611aec2dcee474168798883da2819. --- firmware/baseband/spectrum_collector.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/firmware/baseband/spectrum_collector.cpp b/firmware/baseband/spectrum_collector.cpp index c15d0cbd..4256b362 100644 --- a/firmware/baseband/spectrum_collector.cpp +++ b/firmware/baseband/spectrum_collector.cpp @@ -106,12 +106,12 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) { } /* 3 types of Windowing time domain shapes declaration , but only used Hamming , shapes for FFT - gcc10 compile sintax error c/m (1/2), + GCC10 compile sintax error c/m (1/2), The primary diff. between const and constexpr variables is that the initialization of a const var can be deferred until run time. A constexpr var. must be initialized at compile time. ... A var. can be declared with constexpr , when it has a literal type and is initialized. - gcc10 compile sintax error c/m (2/2) + GCC compile sintax error c/m (2/2) Static assert --> Tests a software assertion at compile time for debugging. we keep the same safety compile protection , just changing slightly the sintax checking that the size of the called array is power of 2. if the bool "constant expression" is TRUE (normal case) , the declaration has no effect. @@ -119,24 +119,24 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) { */ -template // Although currently we are not using that Windowing shape, we apply the same gcc10 compile error c/m +template // Although currently we are not using that Windowing shape, we apply the same GCC10 compile error c/m static typename T::value_type spectrum_window_none(const T& s, const size_t i) { - static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error gcc10 , OK for all gcc versions. + static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions. return s[i]; }; template // Currently we are calling and using that Window shape. static typename T::value_type spectrum_window_hamming_3(const T& s, const size_t i) { - static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error gcc10 , OK for all gcc versions. - const size_t mask = s.size() - 1; // c/m compile error gcc10 , constexpr->const + static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions. + const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const // Three point Hamming window. return s[i] * 0.54f + (s[(i-1) & mask] + s[(i+1) & mask]) * -0.23f; }; -template // Although currently we are not using that Windowing shape, we apply the same gcc10 compile error c/m +template // Although currently we are not using that Windowing shape, we apply the same GCC10 compile error c/m static typename T::value_type spectrum_window_blackman_3(const T& s, const size_t i) { - static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error gcc10 , OK for all gcc versions. - const size_t mask = s.size() - 1; // c/m compile error gcc10 , constexpr->const + static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions. + const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const // Three term Blackman window. constexpr float alpha = 0.42f; constexpr float beta = 0.5f * 0.5f; From d0b356a7ef7439d62501ac575369674cb6f74e4d Mon Sep 17 00:00:00 2001 From: Brumi-2021 <86470699+Brumi-2021@users.noreply.github.com> Date: Sun, 24 Oct 2021 01:59:25 +0200 Subject: [PATCH 5/7] Revert "Solving Compile error on gcc10 . Keeping same safety protection about the size of the array ,but with slightly different sintax." This reverts commit f4db4e2b535cd722ce0f5ee6cd8094d4ba717c4f. --- firmware/baseband/spectrum_collector.cpp | 32 +++++++----------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/firmware/baseband/spectrum_collector.cpp b/firmware/baseband/spectrum_collector.cpp index 4256b362..5d1687b6 100644 --- a/firmware/baseband/spectrum_collector.cpp +++ b/firmware/baseband/spectrum_collector.cpp @@ -27,7 +27,7 @@ #include "event_m4.hpp" #include "portapack_shared_memory.hpp" -/* #include "event_m4.hpp" that line is duplicated, we can delete it .*/ +#include "event_m4.hpp" #include @@ -105,38 +105,24 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) { } } -/* 3 types of Windowing time domain shapes declaration , but only used Hamming , shapes for FFT - GCC10 compile sintax error c/m (1/2), - The primary diff. between const and constexpr variables is that - the initialization of a const var can be deferred until run time. - A constexpr var. must be initialized at compile time. ... - A var. can be declared with constexpr , when it has a literal type and is initialized. - GCC compile sintax error c/m (2/2) - Static assert --> Tests a software assertion at compile time for debugging. - we keep the same safety compile protection , just changing slightly the sintax checking that the size of the called array is power of 2. - if the bool "constant expression" is TRUE (normal case) , the declaration has no effect. - if the bool "constant expression" is FALSE (abnormal array size) , it is aborted the compile with a msg error. - */ - - -template // Although currently we are not using that Windowing shape, we apply the same GCC10 compile error c/m +template static typename T::value_type spectrum_window_none(const T& s, const size_t i) { - static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions. + static_assert(power_of_two(s.size()), "Array size must be power of 2"); return s[i]; }; -template // Currently we are calling and using that Window shape. +template static typename T::value_type spectrum_window_hamming_3(const T& s, const size_t i) { - static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions. - const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const + static_assert(power_of_two(s.size()), "Array size must be power of 2"); + constexpr size_t mask = s.size() - 1; // Three point Hamming window. return s[i] * 0.54f + (s[(i-1) & mask] + s[(i+1) & mask]) * -0.23f; }; -template // Although currently we are not using that Windowing shape, we apply the same GCC10 compile error c/m +template static typename T::value_type spectrum_window_blackman_3(const T& s, const size_t i) { - static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions. - const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const + static_assert(power_of_two(s.size()), "Array size must be power of 2"); + constexpr size_t mask = s.size() - 1; // Three term Blackman window. constexpr float alpha = 0.42f; constexpr float beta = 0.5f * 0.5f; From 961a4c45885a0e0ce300fa8c69057c1c210b3f57 Mon Sep 17 00:00:00 2001 From: Brumi-2021 Date: Sun, 21 Aug 2022 10:24:04 +0200 Subject: [PATCH 6/7] Addition_bias_DC_ERP_TPMS --- firmware/application/apps/ert_app.cpp | 8 ++++++-- firmware/application/apps/tpms_app.cpp | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/firmware/application/apps/ert_app.cpp b/firmware/application/apps/ert_app.cpp index 5ab68fa9..7d2d8197 100644 --- a/firmware/application/apps/ert_app.cpp +++ b/firmware/application/apps/ert_app.cpp @@ -113,8 +113,12 @@ ERTAppView::ERTAppView(NavigationView&) { field_rf_amp.set_value(app_settings.rx_amp); } + receiver_model.set_tuning_frequency(initial_target_frequency); + receiver_model.set_sampling_rate(sampling_rate); + receiver_model.set_baseband_bandwidth(baseband_bandwidth); + receiver_model.enable(); // Before using radio::enable(), but not updating Ant.DC-Bias. - radio::enable({ +/* radio::enable({ initial_target_frequency, sampling_rate, baseband_bandwidth, @@ -122,7 +126,7 @@ ERTAppView::ERTAppView(NavigationView&) { receiver_model.rf_amp(), static_cast(receiver_model.lna()), static_cast(receiver_model.vga()), - }); + }); */ logger = std::make_unique(); if( logger ) { diff --git a/firmware/application/apps/tpms_app.cpp b/firmware/application/apps/tpms_app.cpp index 69e137e9..45fc4c18 100644 --- a/firmware/application/apps/tpms_app.cpp +++ b/firmware/application/apps/tpms_app.cpp @@ -161,7 +161,12 @@ TPMSAppView::TPMSAppView(NavigationView&) { } else options_band.set_by_value(receiver_model.tuning_frequency()); - radio::enable({ + receiver_model.set_tuning_frequency(tuning_frequency()); + receiver_model.set_sampling_rate(sampling_rate); + receiver_model.set_baseband_bandwidth(baseband_bandwidth); + receiver_model.enable(); // Before using radio::enable(), but not updating Ant.DC-Bias. + +/* radio::enable({ tuning_frequency(), sampling_rate, baseband_bandwidth, @@ -169,7 +174,7 @@ TPMSAppView::TPMSAppView(NavigationView&) { receiver_model.rf_amp(), static_cast(receiver_model.lna()), static_cast(receiver_model.vga()), - }); + }); */ options_band.on_change = [this](size_t, OptionsField::value_t v) { this->on_band_changed(v); From 5021a0357207f5e4ebe15a46ce09196fae45d9f6 Mon Sep 17 00:00:00 2001 From: Brumi-2021 Date: Tue, 23 Aug 2022 00:04:48 +0200 Subject: [PATCH 7/7] Minor change radio,disable-->receiver.disable --- firmware/application/apps/ert_app.cpp | 2 +- firmware/application/apps/tpms_app.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/application/apps/ert_app.cpp b/firmware/application/apps/ert_app.cpp index 7d2d8197..e046736b 100644 --- a/firmware/application/apps/ert_app.cpp +++ b/firmware/application/apps/ert_app.cpp @@ -139,7 +139,7 @@ ERTAppView::~ERTAppView() { // save app settings settings.save("rx_ert", &app_settings); - radio::disable(); + receiver_model.disable(); // to switch off all, including DC bias and change flag enabled_ baseband::shutdown(); } diff --git a/firmware/application/apps/tpms_app.cpp b/firmware/application/apps/tpms_app.cpp index 45fc4c18..4ee75354 100644 --- a/firmware/application/apps/tpms_app.cpp +++ b/firmware/application/apps/tpms_app.cpp @@ -205,7 +205,7 @@ TPMSAppView::~TPMSAppView() { app_settings.rx_frequency = target_frequency_; settings.save("rx_tpms", &app_settings); - radio::disable(); + receiver_model.disable(); // to switch off all, including DC bias and change flag enabled_ baseband::shutdown(); }