Simplify frequency limits check for VFO input

This commit is contained in:
Federico Amedeo Izzo 2021-06-05 10:08:15 +02:00
parent 49cb28c5b8
commit 5b3f2b7e23
1 changed files with 7 additions and 15 deletions

View File

@ -501,23 +501,15 @@ void _ui_fsm_confirmVFOInput(bool *sync_rtx) {
// If TX frequency was not set, TX = RX // If TX frequency was not set, TX = RX
if(ui_state.new_tx_frequency == 0) if(ui_state.new_tx_frequency == 0)
{ {
if(_ui_freq_check_limits(ui_state.new_rx_frequency)) ui_state.new_tx_frequency = ui_state.new_rx_frequency;
{
state.channel.rx_frequency = ui_state.new_rx_frequency;
state.channel.tx_frequency = ui_state.new_rx_frequency;
*sync_rtx = true;
}
} }
// Otherwise set both frequencies // Apply new frequencies if they are valid
else if(_ui_freq_check_limits(ui_state.new_rx_frequency) &&
_ui_freq_check_limits(ui_state.new_tx_frequency))
{ {
if(_ui_freq_check_limits(ui_state.new_rx_frequency) && state.channel.rx_frequency = ui_state.new_rx_frequency;
_ui_freq_check_limits(ui_state.new_tx_frequency)) state.channel.tx_frequency = ui_state.new_tx_frequency;
{ *sync_rtx = true;
state.channel.rx_frequency = ui_state.new_rx_frequency;
state.channel.tx_frequency = ui_state.new_tx_frequency;
*sync_rtx = true;
}
} }
state.ui_screen = MAIN_VFO; state.ui_screen = MAIN_VFO;
} }