Restoring min step of 1, forcing 20Mhz minimum wide view

This commit is contained in:
GullCode 2023-03-16 11:56:24 +01:00
parent 63d0201b71
commit 149cd755ca
2 changed files with 18 additions and 10 deletions

View File

@ -198,13 +198,17 @@ namespace ui
field_frequency_min.set_step( steps ); 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 > 7200 - steps ) int32_t steps_ = steps ;
if( steps_ < 20 )
steps_ = 20 ;
if( v > 7200 - steps_ )
{ {
v = 7200 - steps ; v = 7200 - steps_ ;
field_frequency_min.set_value( v ); 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();
}; };
@ -224,14 +228,18 @@ namespace ui
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.set_step( steps );
field_frequency_max.on_change = [this](int32_t v) field_frequency_max.on_change = [this](int32_t v)
{ {
if( v < steps ) int32_t steps_ = steps ;
if( steps_ < 20 )
steps_ = 20 ;
if( v < steps_ )
{ {
v = steps ; v = steps_ ;
field_frequency_max.set_value( v ); 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();
}; };

View File

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