Fixing 20MHz boudaries

This commit is contained in:
GullCode 2023-03-16 12:09:13 +01:00
parent 7b5f138dfb
commit 93f966bdcd

View File

@ -201,7 +201,6 @@ namespace ui
int32_t steps_ = steps ;
if( steps_ < 20 )
steps_ = 20 ;
if( v > 7200 - steps_ )
{
v = 7200 - steps_ ;
@ -216,11 +215,14 @@ namespace ui
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 ;
int32_t steps_ = steps ;
if( steps_ < 20 )
steps_ = 20 ;
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 );
if( field_frequency_max.value() < ( freq + steps_ ) )
field_frequency_max.set_value( freq + steps_ );
this->on_range_changed();
};
};
@ -232,7 +234,6 @@ namespace ui
int32_t steps_ = steps ;
if( steps_ < 20 )
steps_ = 20 ;
if( v < steps_ )
{
v = steps_ ;
@ -246,6 +247,9 @@ namespace ui
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 steps_ = steps ;
if( steps_ < 20 )
steps_ = 20 ;
int32_t freq = f / 1000000 ;
if( freq < 20 )
freq = 20 ;