From 1a894c67df049b9eecfd9774ba6a01f2028bc8b1 Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Tue, 12 Jan 2021 19:25:47 +0100 Subject: [PATCH] UI: Save and restore VFO channel when switching to MEM mode --- openrtx/include/state.h | 1 + openrtx/src/ui/ui.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/openrtx/include/state.h b/openrtx/include/state.h index a02fc7a2..8413a6b9 100644 --- a/openrtx/include/state.h +++ b/openrtx/include/state.h @@ -51,6 +51,7 @@ typedef struct bool channelInfoUpdated; uint16_t channel_index; channel_t channel; + channel_t vfo_channel; uint8_t rtxStatus; uint8_t sqlLevel; uint8_t voxLevel; diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 718824cd..082ac420 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -440,6 +440,8 @@ void ui_updateFSM(event_t event, bool *sync_rtx) // Read successful and channel is valid if(result != -1 && _ui_channel_valid(&channel)) { + // Save VFO channel + state.vfo_channel = state.channel; // Copy channel read to state state.channel = channel; *sync_rtx = true; @@ -509,6 +511,7 @@ void ui_updateFSM(event_t event, bool *sync_rtx) } else if(msg.keys & KEY_ESC) { + // Cancel frequency input, return to VFO mode state.ui_screen = MAIN_VFO; } else if(msg.keys & KEY_UP || msg.keys & KEY_DOWN) @@ -582,6 +585,8 @@ void ui_updateFSM(event_t event, bool *sync_rtx) } else if(msg.keys & KEY_ESC) { + // Restore VFO channel + state.channel = state.vfo_channel; // Switch to VFO screen state.ui_screen = MAIN_VFO; }