From b7088686f50fbdd438d908efd922fa6d6a041f84 Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Sun, 10 Jan 2021 10:23:56 +0100 Subject: [PATCH] UI: Channel: Implemented channel switching --- openrtx/src/ui/ui.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index abe365dd..39c6ce9c 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -585,6 +585,36 @@ void ui_updateFSM(event_t event, bool *sync_rtx) // Switch to VFO screen 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; // Top menu screen case MENU_TOP: