From 95a48e5693930ec26dd9cc254ea8a443ad982016 Mon Sep 17 00:00:00 2001 From: Mark Thompson <129641948+NotherNgineer@users.noreply.github.com> Date: Mon, 21 Aug 2023 03:16:49 -0500 Subject: [PATCH] Store search range in settings file (#1397) * MAX_UFREQ * Use settings file for search range --- firmware/application/apps/ui_level.hpp | 1 - firmware/application/apps/ui_recon_settings.hpp | 3 --- firmware/application/apps/ui_scanner.cpp | 3 --- firmware/application/apps/ui_scanner.hpp | 6 ++++-- firmware/application/ui/ui_receiver.hpp | 2 ++ 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/firmware/application/apps/ui_level.hpp b/firmware/application/apps/ui_level.hpp index 14b47613..f1d10522 100644 --- a/firmware/application/apps/ui_level.hpp +++ b/firmware/application/apps/ui_level.hpp @@ -64,7 +64,6 @@ class LevelView : public View { // TODO: needed? int32_t db{0}; - long long int MAX_UFREQ = {7200000000}; // maximum usable freq rf::Frequency freq_ = {0}; Labels labels{ diff --git a/firmware/application/apps/ui_recon_settings.hpp b/firmware/application/apps/ui_recon_settings.hpp index 3c4ba858..3a95f05b 100644 --- a/firmware/application/apps/ui_recon_settings.hpp +++ b/firmware/application/apps/ui_recon_settings.hpp @@ -31,9 +31,6 @@ #include "ui_navigation.hpp" #include "string_format.hpp" -// maximum usable freq -#define MAX_UFREQ 7200000000 - // 1Mhz helper #ifdef OneMHz #undef OneMHz diff --git a/firmware/application/apps/ui_scanner.cpp b/firmware/application/apps/ui_scanner.cpp index 04fc273d..63e64e65 100644 --- a/firmware/application/apps/ui_scanner.cpp +++ b/firmware/application/apps/ui_scanner.cpp @@ -319,10 +319,7 @@ ScannerView::ScannerView( field_step.set_by_value(receiver_model.frequency_step()); // Default step interval (Hz) change_mode((freqman_index_t)field_mode.selected_index_value()); - rf::Frequency stored_freq = receiver_model.target_frequency(); - frequency_range.min = stored_freq - 1000000; button_manual_start.set_text(to_string_short_freq(frequency_range.min)); - frequency_range.max = stored_freq + 1000000; button_manual_end.set_text(to_string_short_freq(frequency_range.max)); // Button to load a Freqman file. diff --git a/firmware/application/apps/ui_scanner.hpp b/firmware/application/apps/ui_scanner.hpp index 1fd31ad8..c2bc4c3e 100644 --- a/firmware/application/apps/ui_scanner.hpp +++ b/firmware/application/apps/ui_scanner.hpp @@ -37,7 +37,7 @@ #define SCANNER_SLEEP_MS 50 // ms that Scanner Thread sleeps per loop #define STATISTICS_UPDATES_PER_SEC 10 -#define MAX_FREQ_LOCK 10 //# of 50ms cycles scanner locks into freq when signal detected, to verify signal is not spureous +#define MAX_FREQ_LOCK 10 //# of 50ms cycles scanner locks into freq when signal detected, to verify signal is not spurious namespace ui { @@ -116,6 +116,7 @@ class ScannerView : public View { uint32_t browse_wait{5}; uint32_t lock_wait{2}; int32_t squelch{-30}; + scanner_range_t frequency_range{0, MAX_UFREQ}; app_settings::SettingsManager settings_{ "rx_scanner"sv, app_settings::Mode::RX, @@ -123,6 +124,8 @@ class ScannerView : public View { {"browse_wait"sv, &browse_wait}, {"lock_wait"sv, &lock_wait}, {"scanner_squelch"sv, &squelch}, + {"range_min"sv, &frequency_range.min}, + {"range_max"sv, &frequency_range.max}, }}; NavigationView& nav_; @@ -142,7 +145,6 @@ class ScannerView : public View { std::string loaded_filename() const; - scanner_range_t frequency_range{0, 0}; uint32_t browse_timer{0}; uint32_t lock_timer{0}; uint32_t color_timer{0}; diff --git a/firmware/application/ui/ui_receiver.hpp b/firmware/application/ui/ui_receiver.hpp index 0b7b8976..d9be0a0b 100644 --- a/firmware/application/ui/ui_receiver.hpp +++ b/firmware/application/ui/ui_receiver.hpp @@ -35,6 +35,8 @@ #include #include +#define MAX_UFREQ 7200000000 // maximum usable frequency + namespace ui { class FrequencyField : public Widget {