From a75932644c4198c791d914a994bb5518bd0153da Mon Sep 17 00:00:00 2001 From: HTotoo Date: Fri, 8 Dec 2023 22:38:48 +0100 Subject: [PATCH] Added 4msps, and fixes --- firmware/application/apps/ui_subghzd.cpp | 3 ++- firmware/application/apps/ui_subghzd.hpp | 6 +++--- firmware/application/apps/ui_weatherstation.cpp | 1 + firmware/baseband/proc_weather.hpp | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/application/apps/ui_subghzd.cpp b/firmware/application/apps/ui_subghzd.cpp index 60d304b7..1fd8110a 100644 --- a/firmware/application/apps/ui_subghzd.cpp +++ b/firmware/application/apps/ui_subghzd.cpp @@ -85,6 +85,7 @@ SubGhzDView::SubGhzDView(NavigationView& nav) nav_.push(entry); }; baseband::set_subghzd(0); // am + receiver_model.set_sampling_rate(4'000'000); receiver_model.enable(); signal_token_tick_second = rtc_time::signal_tick_second += [this]() { on_tick_second(); @@ -98,7 +99,7 @@ void SubGhzDView::on_tick_second() { recent_entries_view.set_dirty(); } -void SubGhzDView::on_data(const WeatherDataMessage* data) { +void SubGhzDView::on_data(const SubGhzDDataMessage* data) { SubGhzDRecentEntry key{data->sensorType, data->id}; auto matching_recent = find(recent, key.key()); if (matching_recent != std::end(recent)) { diff --git a/firmware/application/apps/ui_subghzd.hpp b/firmware/application/apps/ui_subghzd.hpp index 65ace46a..c70399da 100644 --- a/firmware/application/apps/ui_subghzd.hpp +++ b/firmware/application/apps/ui_subghzd.hpp @@ -80,7 +80,7 @@ class SubGhzDView : public View { private: void on_tick_second(); - void on_data(const WeatherDataMessage* data); // TODO + void on_data(const SubGhzDDataMessage* data); // TODO NavigationView& nav_; RxRadioState radio_state_{ @@ -123,9 +123,9 @@ class SubGhzDView : public View { SubGhzDRecentEntriesView recent_entries_view{columns, recent}; MessageHandlerRegistration message_handler_packet{ - Message::ID::WeatherData, + Message::ID::SubGhzDData, [this](Message* const p) { - const auto message = static_cast(p); + const auto message = static_cast(p); this->on_data(message); }}; }; diff --git a/firmware/application/apps/ui_weatherstation.cpp b/firmware/application/apps/ui_weatherstation.cpp index 79dd184f..a09ae7f2 100644 --- a/firmware/application/apps/ui_weatherstation.cpp +++ b/firmware/application/apps/ui_weatherstation.cpp @@ -116,6 +116,7 @@ WeatherView::WeatherView(NavigationView& nav) nav_.push(entry); }; baseband::set_weather(); + receiver_model.set_sampling_rate(4'000'000); receiver_model.enable(); signal_token_tick_second = rtc_time::signal_tick_second += [this]() { on_tick_second(); diff --git a/firmware/baseband/proc_weather.hpp b/firmware/baseband/proc_weather.hpp index 99f99192..c6c7dd8a 100644 --- a/firmware/baseband/proc_weather.hpp +++ b/firmware/baseband/proc_weather.hpp @@ -42,7 +42,7 @@ class WeatherProcessor : public BasebandProcessor { private: static constexpr size_t baseband_fs = 4'000'000; // it works, I think we need to write that master clock in the baseband_threat , even later we decimate it. - static constexpr uint32_t nsPerDecSamp = 500 * 8; // In current sw , we do not scale it due to clock. We scaled it due to less array buffer sampes due to /8 decimation. + static constexpr uint32_t nsPerDecSamp = 250 * 8; // In current sw , we do not scale it due to clock. We scaled it due to less array buffer sampes due to /8 decimation. // TODO , Pending to investigate , why ticks are not proportional to the SR clock, 500 nseg (2Mhz) , 250 nseg (4Mhz) ??? ;previous comment : "we nees ms to has to divide by 1000" /* Array Buffer aux. used in decim0 and decim1 IQ c16 signed data ; (decim0 defines the max length of the array) */