UI: Channel: Implemented channel switching
This commit is contained in:
parent
73c9ab56a6
commit
b7088686f5
|
|
@ -585,6 +585,36 @@ void ui_updateFSM(event_t event, bool *sync_rtx)
|
||||||
// Switch to VFO screen
|
// Switch to VFO screen
|
||||||
state.ui_screen = MAIN_VFO;
|
state.ui_screen = MAIN_VFO;
|
||||||
}
|
}
|
||||||
|
else if(msg.keys & KEY_UP)
|
||||||
|
{
|
||||||
|
// Try to load selected channel
|
||||||
|
channel_t channel;
|
||||||
|
int result = nvm_readChannelData(&channel, state.channel_index + 1);
|
||||||
|
// Read successful and channel is valid
|
||||||
|
if(result != -1 && _ui_channel_valid(&channel))
|
||||||
|
{
|
||||||
|
// Set new channel index
|
||||||
|
state.channel_index += 1;
|
||||||
|
// Copy channel read to state
|
||||||
|
state.channel = channel;
|
||||||
|
*sync_rtx = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(msg.keys & KEY_DOWN)
|
||||||
|
{
|
||||||
|
// Try to load selected channel
|
||||||
|
channel_t channel;
|
||||||
|
int result = nvm_readChannelData(&channel, state.channel_index - 1);
|
||||||
|
// Read successful and channel is valid
|
||||||
|
if(result != -1 && _ui_channel_valid(&channel))
|
||||||
|
{
|
||||||
|
// Set new channel index
|
||||||
|
state.channel_index -= 1;
|
||||||
|
// Copy channel read to state
|
||||||
|
state.channel = channel;
|
||||||
|
*sync_rtx = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
// Top menu screen
|
// Top menu screen
|
||||||
case MENU_TOP:
|
case MENU_TOP:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue