mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-01-08 19:17:39 +00:00
added steps config and thus possibility to adjust config / see under 240 MHz
This commit is contained in:
parent
62b9fa2b6a
commit
49bda24079
@ -184,6 +184,7 @@ namespace ui
|
|||||||
&field_lna,
|
&field_lna,
|
||||||
&field_vga,
|
&field_vga,
|
||||||
&text_range,
|
&text_range,
|
||||||
|
&steps_config,
|
||||||
&filter_config,
|
&filter_config,
|
||||||
&field_rf_amp,
|
&field_rf_amp,
|
||||||
&range_presets,
|
&range_presets,
|
||||||
@ -194,21 +195,51 @@ namespace ui
|
|||||||
load_Presets(); // Load available presets from TXT files (or default)
|
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_value(presets_db[0].min); // Defaults to first preset
|
||||||
|
field_frequency_min.set_step( steps );
|
||||||
field_frequency_min.on_change = [this](int32_t v)
|
field_frequency_min.on_change = [this](int32_t v)
|
||||||
{
|
{
|
||||||
if (v >= field_frequency_max.value())
|
if( v > 7200 - steps )
|
||||||
field_frequency_max.set_value(v + 240);
|
v = 7200 - steps ;
|
||||||
|
if (v >= (field_frequency_max.value() - steps ) )
|
||||||
|
field_frequency_max.set_value( v + steps );
|
||||||
this->on_range_changed();
|
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_value(presets_db[0].max); // Defaults to first preset
|
||||||
|
field_frequency_max.set_step( steps );
|
||||||
field_frequency_max.on_change = [this](int32_t v)
|
field_frequency_max.on_change = [this](int32_t v)
|
||||||
{
|
{
|
||||||
if (v <= field_frequency_min.value())
|
if( v < steps )
|
||||||
field_frequency_min.set_value(v - 240);
|
v = steps ;
|
||||||
|
if (v < (field_frequency_min.value() + steps) )
|
||||||
|
field_frequency_min.set_value(v - steps);
|
||||||
this->on_range_changed();
|
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.set_value(receiver_model.lna());
|
||||||
field_lna.on_change = [this](int32_t v)
|
field_lna.on_change = [this](int32_t v)
|
||||||
{
|
{
|
||||||
@ -221,11 +252,12 @@ namespace ui
|
|||||||
this->on_vga_changed(v_db);
|
this->on_vga_changed(v_db);
|
||||||
};
|
};
|
||||||
|
|
||||||
filter_config.set_selected_index(0);
|
steps_config.set_selected_index(3); //default of 250 Mhz steps
|
||||||
filter_config.on_change = [this](size_t n, OptionsField::value_t v)
|
steps_config.on_change = [this](size_t n, OptionsField::value_t v)
|
||||||
{
|
{
|
||||||
(void)n;
|
(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)
|
range_presets.on_change = [this](size_t n, OptionsField::value_t v)
|
||||||
|
@ -91,28 +91,29 @@
|
|||||||
std::array<Color, 240> spectrum_row = { 0 };
|
std::array<Color, 240> spectrum_row = { 0 };
|
||||||
ChannelSpectrumFIFO* fifo { nullptr };
|
ChannelSpectrumFIFO* fifo { nullptr };
|
||||||
uint8_t max_power = 0;
|
uint8_t max_power = 0;
|
||||||
|
int32_t steps = 250 ; // default of 250 Mhz steps
|
||||||
|
|
||||||
Labels labels{
|
Labels labels{
|
||||||
{{0, 0}, "MIN: MAX: LNA VGA ", Color::light_grey()},
|
{{0, 0}, "MIN: MAX: LNA VGA ", Color::light_grey()},
|
||||||
{{0, 1 * 16}, " RANGE: FILTER: AMP:", Color::light_grey()},
|
{{0, 1 * 16}, " RANGE: FILTER: AMP:", Color::light_grey()},
|
||||||
{{0, 2 * 16}, "PRESET:", 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()}
|
{{0, 4 * 16}, "RESOLUTION: STEPS:", Color::light_grey()}
|
||||||
};
|
};
|
||||||
|
|
||||||
NumberField field_frequency_min {
|
NumberField field_frequency_min {
|
||||||
{ 4 * 8, 0 * 16 },
|
{ 4 * 8, 0 * 16 },
|
||||||
4,
|
4,
|
||||||
{ 0, 6960 },
|
{ 0, 7199 },
|
||||||
240,
|
1, // number of steps by encoder delta
|
||||||
' '
|
' '
|
||||||
};
|
};
|
||||||
|
|
||||||
NumberField field_frequency_max {
|
NumberField field_frequency_max {
|
||||||
{ 13 * 8, 0 * 16 },
|
{ 13 * 8, 0 * 16 },
|
||||||
4,
|
4,
|
||||||
{ 240, 7200 },
|
{ 1, 7200 },
|
||||||
240,
|
1, // number of steps by encoder delta
|
||||||
' '
|
' '
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -128,6 +129,18 @@
|
|||||||
{7 * 8, 1 * 16, 4 * 8, 16},
|
{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{
|
OptionsField filter_config{
|
||||||
{19 * 8, 1 * 16},
|
{19 * 8, 1 * 16},
|
||||||
4,
|
4,
|
||||||
@ -184,7 +197,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user