added steps config and thus possibility to adjust config / see under 240 MHz

This commit is contained in:
GullCode 2023-03-16 10:33:36 +01:00
parent 62b9fa2b6a
commit 49bda24079
2 changed files with 220 additions and 176 deletions

View File

@ -184,6 +184,7 @@ namespace ui
&field_lna,
&field_vga,
&text_range,
&steps_config,
&filter_config,
&field_rf_amp,
&range_presets,
@ -194,21 +195,51 @@ namespace ui
load_Presets(); // Load available presets from TXT files (or default)
field_frequency_min.set_value(presets_db[0].min); // Defaults to first preset
field_frequency_min.set_step( steps );
field_frequency_min.on_change = [this](int32_t v)
{
if (v >= field_frequency_max.value())
field_frequency_max.set_value(v + 240);
if( v > 7200 - steps )
v = 7200 - steps ;
if (v >= (field_frequency_max.value() - steps ) )
field_frequency_max.set_value( v + steps );
this->on_range_changed();
};
field_frequency_min.on_select = [this, &nav](NumberField& field) {
auto new_view = nav_.push<FrequencyKeypadView>(field_frequency_min.value()*1000000);
new_view->on_changed = [this, &field](rf::Frequency f) {
int32_t freq = f / 1000000 ;
if( freq > (7200 - steps ) )
freq= 7200 - steps ;
field_frequency_min.set_value( freq );
if( field_frequency_max.value() < ( freq + steps ) )
field_frequency_max.set_value( freq + steps );
};
};
field_frequency_max.set_value(presets_db[0].max); // Defaults to first preset
field_frequency_max.set_step( steps );
field_frequency_max.on_change = [this](int32_t v)
{
if (v <= field_frequency_min.value())
field_frequency_min.set_value(v - 240);
if( v < steps )
v = steps ;
if (v < (field_frequency_min.value() + steps) )
field_frequency_min.set_value(v - steps);
this->on_range_changed();
};
field_frequency_max.on_select = [this, &nav](NumberField& field) {
auto new_view = nav_.push<FrequencyKeypadView>(field_frequency_max.value()*1000000);
new_view->on_changed = [this, &field](rf::Frequency f) {
int32_t freq = f / 1000000 ;
if( freq < steps )
freq= steps ;
field_frequency_max.set_value( freq );
if( field_frequency_min.value() > ( freq - steps) )
field_frequency_min.set_value( freq - steps );
};
};
field_lna.set_value(receiver_model.lna());
field_lna.on_change = [this](int32_t v)
{
@ -221,11 +252,12 @@ namespace ui
this->on_vga_changed(v_db);
};
filter_config.set_selected_index(0);
filter_config.on_change = [this](size_t n, OptionsField::value_t v)
steps_config.set_selected_index(3); //default of 250 Mhz steps
steps_config.on_change = [this](size_t n, OptionsField::value_t v)
{
(void)n;
min_color_power = v;
field_frequency_min.set_step( v );
field_frequency_max.set_step( v );
};
range_presets.on_change = [this](size_t n, OptionsField::value_t v)

View File

@ -23,22 +23,22 @@
#ifndef _UI_GLASS
#define _UI_GLASS
#include "ui.hpp"
#include "portapack.hpp"
#include "baseband_api.hpp"
#include "receiver_model.hpp"
#include "ui_widget.hpp"
#include "ui_navigation.hpp"
#include "ui_receiver.hpp"
#include "string_format.hpp"
#include "analog_audio_app.hpp"
#include "spectrum_color_lut.hpp"
#include "ui.hpp"
#include "portapack.hpp"
#include "baseband_api.hpp"
#include "receiver_model.hpp"
#include "ui_widget.hpp"
#include "ui_navigation.hpp"
#include "ui_receiver.hpp"
#include "string_format.hpp"
#include "analog_audio_app.hpp"
#include "spectrum_color_lut.hpp"
namespace ui
{
#define LOOKING_GLASS_SLICE_WIDTH 20000000 // Each slice bandwidth 20 MHz
#define MHZ_DIV 1000000
#define X2_MHZ_DIV 2000000
namespace ui
{
#define LOOKING_GLASS_SLICE_WIDTH 20000000 // Each slice bandwidth 20 MHz
#define MHZ_DIV 1000000
#define X2_MHZ_DIV 2000000
class GlassView : public View
{
@ -91,28 +91,29 @@
std::array<Color, 240> spectrum_row = { 0 };
ChannelSpectrumFIFO* fifo { nullptr };
uint8_t max_power = 0;
int32_t steps = 250 ; // default of 250 Mhz steps
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: (fft trigger)", Color::light_grey()}
{{0, 4 * 16}, "RESOLUTION: STEPS:", Color::light_grey()}
};
NumberField field_frequency_min {
{ 4 * 8, 0 * 16 },
4,
{ 0, 6960 },
240,
{ 0, 7199 },
1, // number of steps by encoder delta
' '
};
NumberField field_frequency_max {
{ 13 * 8, 0 * 16 },
4,
{ 240, 7200 },
240,
{ 1, 7200 },
1, // number of steps by encoder delta
' '
};
@ -128,6 +129,18 @@
{7 * 8, 1 * 16, 4 * 8, 16},
""};
OptionsField steps_config{
{ 22 * 8, 4 * 16},
4,
{
{"1", 1},
{"50", 50},
{"100", 100},
{"250", 250},
{"500", 500},
{"1000", 1000},
}};
OptionsField filter_config{
{19 * 8, 1 * 16},
4,
@ -184,7 +197,6 @@
}
}
};
};
}
}
#endif