UI: Save and restore VFO channel when switching to MEM mode

replace/d79168a4e903839c4c09cc7faeee4ff8ccd915b9
Federico Amedeo Izzo 2021-01-12 19:25:47 +01:00
rodzic d46772219d
commit 1a894c67df
2 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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;
}