From 8c9bdaacbc92e46b72fa9cc11b283d3904e4ece0 Mon Sep 17 00:00:00 2001 From: Krzysiek Egzmont Date: Thu, 2 Nov 2023 18:11:13 +0100 Subject: [PATCH] Add "switch demodulation mode" function for programmable buttons --- app/action.c | 11 +++++++++++ app/action.h | 1 + settings.h | 1 + ui/menu.c | 3 ++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/action.c b/app/action.c index db5a46d..3914894 100644 --- a/app/action.c +++ b/app/action.c @@ -324,6 +324,14 @@ void ACTION_Scan(bool bRestart) } #endif +void ACTION_SwitchDemodul(void) +{ + gTxVfo->Modulation++; + if(gTxVfo->Modulation == MODULATION_UKNOWN) + gTxVfo->Modulation = MODULATION_FM; + gRequestSaveChannel = 1; +} + void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { if (gScreenToDisplay == DISPLAY_MAIN && gDTMF_InputMode) // entering DTMF code @@ -439,5 +447,8 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) case ACTION_OPT_VFO_MR: COMMON_SwitchVFOMode(); break; + case ACTION_OPT_SWITCH_DEMODUL: + ACTION_SwitchDemodul(); + break; } } diff --git a/app/action.h b/app/action.h index 2ba6432..9cb0d7e 100644 --- a/app/action.h +++ b/app/action.h @@ -32,6 +32,7 @@ void ACTION_Scan(bool bRestart); #ifdef ENABLE_FMRADIO void ACTION_FM(void); #endif +void ACTION_SwitchDemodul(void); void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); diff --git a/settings.h b/settings.h index d4bce95..d6cc664 100644 --- a/settings.h +++ b/settings.h @@ -84,6 +84,7 @@ enum { ACTION_OPT_KEYLOCK, ACTION_OPT_A_B, ACTION_OPT_VFO_MR, + ACTION_OPT_SWITCH_DEMODUL, ACTION_OPT_LEN }; diff --git a/ui/menu.c b/ui/menu.c index 2fe0920..54f8959 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -359,7 +359,8 @@ const t_sidefunction SIDEFUNCTIONS[] = #endif {"LOCK\nKEYPAD", ACTION_OPT_KEYLOCK}, {"SWITCH\nVFO", ACTION_OPT_A_B}, - {"VFO/MR", ACTION_OPT_VFO_MR}, + {"VFO/MR", ACTION_OPT_VFO_MR}, + {"SWITCH\nDEMODUL", ACTION_OPT_SWITCH_DEMODUL}, }; const t_sidefunction* gSubMenu_SIDEFUNCTIONS = SIDEFUNCTIONS; const uint8_t gSubMenu_SIDEFUNCTIONS_size = ARRAY_SIZE(SIDEFUNCTIONS);