From 13ce56f7bf44b1020840bfe82fc7200356ebbb1a Mon Sep 17 00:00:00 2001 From: euquiq <31453004+euquiq@users.noreply.github.com> Date: Mon, 26 Oct 2020 23:43:35 -0300 Subject: [PATCH] Added "RESOLUTION" parameter Discord User jteich did some investigation (Thanks!) and helped me understanding this rather obscure parameter: Internally, is called "TRIGGER", and is passed into the baseband when configuring the desired spectrum sample rate. Please forgive me in advance if this explanation is not 100% correct. It's only my interpretation, based on my own observation and jteich's comments over Discord chat. This trigger parameter apparently determines the amount of data over time used for calculating the signal's power inside each specttrum's bin, before considering it "done". In short, if you lower this resolution value then the cascade will tend to be rendered a bit faster, while kind of blind to tiny signals. On the other hand, a bigger value will help rendering and distinguishing different signals on the cascade. Too big a value can easily clutter up the cascade. But then it may be a "blessing" when inspecting higher freuqencies -where hackrf is more deaf" The default value of 32 is quite decent. But then, now you can experiment with it. Cheers --- .../application/apps/ui_looking_glass_app.cpp | 17 +++++++++++++---- .../application/apps/ui_looking_glass_app.hpp | 12 ++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/firmware/application/apps/ui_looking_glass_app.cpp b/firmware/application/apps/ui_looking_glass_app.cpp index c690983b8..e18bba627 100644 --- a/firmware/application/apps/ui_looking_glass_app.cpp +++ b/firmware/application/apps/ui_looking_glass_app.cpp @@ -100,7 +100,7 @@ void GlassView::on_channel_spectrum(const ChannelSpectrum &spectrum) } if (pixel_index) - f_center += SEARCH_SLICE_WIDTH; //Move into the next bandwidth slice + f_center += SEARCH_SLICE_WIDTH; //Move into the next bandwidth slice NOTE: spectrum.sampling_rate = SEARCH_SLICE_WIDTH else f_center = f_center_ini; //Start a new sweep @@ -153,7 +153,7 @@ void GlassView::on_range_changed() max_power = 0; bins_Hz_size = 0; //reset amount of Hz filled up by pixels - baseband::set_spectrum(SEARCH_SLICE_WIDTH, 31); // Trigger was 31. Need to understand this parameter. + baseband::set_spectrum(SEARCH_SLICE_WIDTH, field_trigger.value()); receiver_model.set_tuning_frequency(f_center_ini); //tune rx for this slice } @@ -184,7 +184,8 @@ GlassView::GlassView( &field_rf_amp, &range_presets, &field_marker, - &text_marker_pm + &text_marker_pm, + &field_trigger }); load_Presets(); //Load available presets from TXT files (or default) @@ -237,8 +238,16 @@ GlassView::GlassView( nav_.push(); //Jump into audio view }; + field_trigger.set_value(32); //Defaults to 32, as normal triggering resolution + field_trigger.on_change = [this](int32_t v) { + baseband::set_spectrum(SEARCH_SLICE_WIDTH, v); + }; + display.scroll_set_area( 109, 319); - baseband::set_spectrum(SEARCH_SLICE_WIDTH, 31); // Trigger was 31. Need to understand this parameter. + baseband::set_spectrum(SEARCH_SLICE_WIDTH, field_trigger.value()); //trigger: + // Discord User jteich: WidebandSpectrum::on_message to set the trigger value. In WidebandSpectrum::execute , + // it keeps adding the output of the fft to the buffer until "trigger" number of calls are made, + //at which time it pushes the buffer up with channel_spectrum.feed on_range_changed(); diff --git a/firmware/application/apps/ui_looking_glass_app.hpp b/firmware/application/apps/ui_looking_glass_app.hpp index bb6d61346..3313a55f4 100644 --- a/firmware/application/apps/ui_looking_glass_app.hpp +++ b/firmware/application/apps/ui_looking_glass_app.hpp @@ -89,8 +89,8 @@ {{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, 3 * 16}, "MARKER: MHz +/- MHz", Color::light_grey()}, + {{0, 4 * 16}, "RESOLUTION: (fft trigger)", Color::light_grey()} }; NumberField field_frequency_min { @@ -151,6 +151,14 @@ {20 * 8, 3 * 16, 2 * 8, 16}, ""}; + NumberField field_trigger{ + {11 * 8, 4 * 16}, + 3, + {2, 128}, + 2, + ' '}; + + MessageHandlerRegistration message_handler_spectrum_config { Message::ID::ChannelSpectrumConfig, [this](const Message* const p) {