From fbf9138410e82ab8b21c9e0f0a39e217d9f3ca21 Mon Sep 17 00:00:00 2001 From: GullCode Date: Fri, 7 Apr 2023 17:01:09 +0200 Subject: [PATCH] live frequency view integration controls --- .../application/apps/ui_looking_glass_app.cpp | 18 +++++++--- .../application/apps/ui_looking_glass_app.hpp | 33 ++++++++++++++----- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/firmware/application/apps/ui_looking_glass_app.cpp b/firmware/application/apps/ui_looking_glass_app.cpp index aa5f2acb..7f7100ea 100644 --- a/firmware/application/apps/ui_looking_glass_app.cpp +++ b/firmware/application/apps/ui_looking_glass_app.cpp @@ -51,9 +51,9 @@ namespace ui void GlassView::add_spectrum_pixel(int16_t color) { - spectrum_row[pixel_index] = spectrum_rgb3_lut[color] ; - spectrum_data[pixel_index] = ( 3 * spectrum_data[pixel_index] + color ) / 4 ; // smoothing - pixel_index ++ ; + spectrum_row[pixel_index] = spectrum_rgb3_lut[color] ; + spectrum_data[pixel_index] = ( live_frequency_integrate * spectrum_data[pixel_index] + color ) / (live_frequency_integrate + 1); // smoothing + pixel_index ++ ; if (pixel_index == 240) // got an entire waterfall line { @@ -214,6 +214,7 @@ namespace ui &text_range, &steps_config, &view_config, + &level_integration, &filter_config, &field_rf_amp, &range_presets, @@ -310,7 +311,6 @@ namespace ui steps = v ; }; - view_config.set_selected_index(0); //default spectrum view_config.on_change = [this](size_t n, OptionsField::value_t v) { (void)n; @@ -318,15 +318,25 @@ namespace ui if( v ) { display.scroll_disable(); + level_integration.hidden( false ); } else { + level_integration.hidden( true ); + set_dirty(); display.scroll_set_area(109, 319); // Restart scroll on the correct coordinates } // clear between changes display.fill_rectangle( { { 0 , 108 } , { 240 , 320 - 108 } } , { 0 , 0 , 0 } ); }; + view_config.set_selected_index(0); //default spectrum + level_integration.on_change = [this](size_t n, OptionsField::value_t v) + { + (void)n; + live_frequency_integrate = v ; + }; + level_integration.set_selected_index(2); //default integration of ( 3 * old value + new_value ) / 4 range_presets.on_change = [this](size_t n, OptionsField::value_t v) { diff --git a/firmware/application/apps/ui_looking_glass_app.hpp b/firmware/application/apps/ui_looking_glass_app.hpp index 48aca7ad..0e97b3be 100644 --- a/firmware/application/apps/ui_looking_glass_app.hpp +++ b/firmware/application/apps/ui_looking_glass_app.hpp @@ -93,14 +93,15 @@ namespace ui ChannelSpectrumFIFO* fifo { nullptr }; uint8_t max_power = 0; int32_t steps = 250 ; // default of 250 Mhz steps - bool live_frequency_view = false ; + bool live_frequency_view = false ; + int16_t live_frequency_integrate = 3 ; Labels labels{ {{0, 0}, "MIN: MAX: LNA VGA ", Color::light_grey()}, {{0, 1 * 16}, " RANGE: FILTER: AMP:", Color::light_grey()}, {{0, 2 * 16}, "PRESET:", Color::light_grey()}, {{0, 3 * 16}, "MARKER: MHz +/- MHz", Color::light_grey()}, - {{0, 4 * 16}, "RESOLUTION: STEPS:", Color::light_grey()} + {{0, 4 * 16}, "RES: STEP:", Color::light_grey()} }; NumberField field_frequency_min { @@ -132,7 +133,7 @@ namespace ui ""}; OptionsField steps_config{ - { 21 * 8, 4 * 16}, + { 14 * 8, 4 * 16}, 4, { {"1", 1}, @@ -143,13 +144,29 @@ namespace ui }}; OptionsField view_config{ - {25 * 8, 4 * 16}, - 5, + { 19 * 8, 4 * 16}, + 7, { - {"SPCTR", false }, - {"LVL-V", true }, + {"SPCTR-V", false }, + {"LEVEL-V", true }, }}; + OptionsField level_integration{ + { 27 * 8, 4 * 16}, + 2, + { + {"x1", 1 }, + {"x2", 2 }, + {"x3", 3 }, + {"x4", 4 }, + {"x5", 5 }, + {"x6", 6 }, + {"x7", 7 }, + {"x8", 8 }, + {"x9", 9 }, + }}; + + OptionsField filter_config{ {19 * 8, 1 * 16}, 4, @@ -181,7 +198,7 @@ namespace ui ""}; NumberField field_trigger{ - {11 * 8, 4 * 16}, + {4 * 8, 4 * 16}, 3, {2, 128}, 2,