Fixing set freq and min step value

This commit is contained in:
GullCode 2023-03-16 11:32:26 +01:00
parent cf19408784
commit 63d0201b71
2 changed files with 10 additions and 1 deletions

View File

@ -199,7 +199,10 @@ namespace ui
field_frequency_min.on_change = [this](int32_t v) field_frequency_min.on_change = [this](int32_t v)
{ {
if( v > 7200 - steps ) if( v > 7200 - steps )
{
v = 7200 - steps ; v = 7200 - steps ;
field_frequency_min.set_value( v );
}
if (v >= (field_frequency_max.value() - steps ) ) if (v >= (field_frequency_max.value() - steps ) )
field_frequency_max.set_value( v + steps ); field_frequency_max.set_value( v + steps );
this->on_range_changed(); this->on_range_changed();
@ -214,6 +217,7 @@ namespace ui
field_frequency_min.set_value( freq ); field_frequency_min.set_value( freq );
if( field_frequency_max.value() < ( freq + steps ) ) if( field_frequency_max.value() < ( freq + steps ) )
field_frequency_max.set_value( freq + steps ); field_frequency_max.set_value( freq + steps );
this->on_range_changed();
}; };
}; };
@ -222,7 +226,10 @@ namespace ui
field_frequency_max.on_change = [this](int32_t v) field_frequency_max.on_change = [this](int32_t v)
{ {
if( v < steps ) if( v < steps )
{
v = steps ; v = steps ;
field_frequency_max.set_value( v );
}
if (v < (field_frequency_min.value() + steps) ) if (v < (field_frequency_min.value() + steps) )
field_frequency_min.set_value(v - steps); field_frequency_min.set_value(v - steps);
this->on_range_changed(); this->on_range_changed();
@ -237,6 +244,7 @@ namespace ui
field_frequency_max.set_value( freq ); field_frequency_max.set_value( freq );
if( field_frequency_min.value() > ( freq - steps) ) if( field_frequency_min.value() > ( freq - steps) )
field_frequency_min.set_value( freq - steps ); field_frequency_min.set_value( freq - steps );
this->on_range_changed();
}; };
}; };
@ -258,6 +266,7 @@ namespace ui
(void)n; (void)n;
field_frequency_min.set_step( v ); field_frequency_min.set_step( v );
field_frequency_max.set_step( v ); field_frequency_max.set_step( v );
steps = 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)

View File

@ -133,7 +133,7 @@ namespace ui
{ 22 * 8, 4 * 16}, { 22 * 8, 4 * 16},
4, 4,
{ {
{"1", 1}, {"20", 20},
{"50", 50}, {"50", 50},
{"100", 100}, {"100", 100},
{"250", 250}, {"250", 250},