From 4d8db8f0b969ffea634a3795af112b1d3ce62f54 Mon Sep 17 00:00:00 2001 From: OneOfEleven Date: Thu, 5 Oct 2023 10:03:07 +0100 Subject: [PATCH] Updated 5/7 function key operation (see README.md) --- Makefile | 4 -- README.md | 5 ++- app/app.c | 11 ++--- app/main.c | 105 ++++++++++++++++++++------------------------ firmware.bin | Bin 53908 -> 53908 bytes firmware.packed.bin | Bin 53926 -> 53926 bytes 6 files changed, 55 insertions(+), 70 deletions(-) diff --git a/Makefile b/Makefile index 50543085..26c4ed98 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,6 @@ ENABLE_WIDE_RX := 1 ENABLE_TX_WHEN_AM := 0 ENABLE_F_CAL_MENU := 0 ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 -ENABLE_MAIN_KEY_HOLD := 1 ENABLE_BOOT_BEEPS := 0 ENABLE_SHOW_CHARGE_LEVEL := 1 ENABLE_REVERSE_BAT_SYMBOL := 1 @@ -231,9 +230,6 @@ endif ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1) CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT endif -ifeq ($(ENABLE_MAIN_KEY_HOLD),1) - CFLAGS += -DENABLE_MAIN_KEY_HOLD -endif ifeq ($(ENABLE_BOOT_BEEPS),1) CFLAGS += -DENABLE_BOOT_BEEPS endif diff --git a/README.md b/README.md index 57d63148..cdee8d28 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,6 @@ ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front- ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method -ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead just hold down keys 0-9 to access the secondary butt functions ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right) @@ -63,7 +62,11 @@ ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO # New/modified function keys * Long-press 'M' = Copy selected channel into the same VFO, then switches to frequency mode +* +* Long-press '7' = Toggle a selected channels scanlist setting .. if VOX is disable in Makefile + or * Long-press '5' = Toggle a selected channels scanlist setting .. if NOAA is disable in Makefile +* * Long-press '*' = Toggles the scanlist number 1, 2 or ALL channels .. if in channel scan mode # Some changes made from the Quansheng firmware diff --git a/app/app.c b/app/app.c index e883a7fc..975f5571 100644 --- a/app/app.c +++ b/app/app.c @@ -1370,11 +1370,8 @@ void APP_CheckKeys(void) Key == KEY_UP || Key == KEY_DOWN || Key == KEY_EXIT || - Key == KEY_MENU - #ifdef ENABLE_MAIN_KEY_HOLD - || Key <= KEY_9 // keys 0-9 can be held down to bypass pressing the F-Key - #endif - ) + Key == KEY_MENU || + Key <= KEY_9) // keys 0-9 can be held down to bypass pressing the F-Key { gKeyBeingHeld = true; APP_ProcessKey(Key, true, true); @@ -2326,9 +2323,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) case DISPLAY_MAIN: MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld); - #ifdef ENABLE_MAIN_KEY_HOLD - bKeyHeld = false; // allow the channel setting to be saved - #endif + bKeyHeld = false; // allow the channel setting to be saved break; diff --git a/app/main.c b/app/main.c index fa706224..bf2baea7 100644 --- a/app/main.c +++ b/app/main.c @@ -35,6 +35,33 @@ #include "ui/inputbox.h" #include "ui/ui.h" +void toggle_chan_scanlist(void) +{ // toggle the selected channels scanlist setting + + if (gScreenToDisplay == DISPLAY_SCANNER || !IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) + return; + + if (gTxVfo->SCANLIST1_PARTICIPATION) + { + if (gTxVfo->SCANLIST2_PARTICIPATION) + gTxVfo->SCANLIST1_PARTICIPATION = 0; + else + gTxVfo->SCANLIST2_PARTICIPATION = 1; + } + else + { + if (gTxVfo->SCANLIST2_PARTICIPATION) + gTxVfo->SCANLIST2_PARTICIPATION = 0; + else + gTxVfo->SCANLIST1_PARTICIPATION = 1; + } + + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); + + gVfoConfigureMode = VFO_CONFIGURE; + gFlagResetVfos = true; +} + static void processFKeyFunction(const KEY_Code_t Key, const bool beep) { uint8_t Band; @@ -185,32 +212,9 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) gVfoConfigureMode = VFO_CONFIGURE_RELOAD; #else - // toggle the selected channels scanlist setting - - if (gScreenToDisplay != DISPLAY_SCANNER) - { - if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) - { - if (gTxVfo->SCANLIST1_PARTICIPATION) - { - if (gTxVfo->SCANLIST2_PARTICIPATION) - gTxVfo->SCANLIST1_PARTICIPATION = 0; - else - gTxVfo->SCANLIST2_PARTICIPATION = 1; - } - else - { - if (gTxVfo->SCANLIST2_PARTICIPATION) - gTxVfo->SCANLIST2_PARTICIPATION = 0; - else - gTxVfo->SCANLIST1_PARTICIPATION = 1; - } - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); - gVfoConfigureMode = VFO_CONFIGURE; - gFlagResetVfos = true; - } - } - + #ifdef ENABLE_VOX + toggle_chan_scanlist(); + #endif #endif break; @@ -223,11 +227,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) #ifdef ENABLE_VOX ACTION_Vox(); #else - - - // TODO: make use of this function key - - + toggle_chan_scanlist(); #endif break; @@ -270,40 +270,31 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) if (bKeyHeld) { // key held down - #ifdef ENABLE_MAIN_KEY_HOLD - if (bKeyPressed) + if (bKeyPressed) + { + if (gScreenToDisplay == DISPLAY_MAIN) { - if (gScreenToDisplay == DISPLAY_MAIN) - { - if (gInputBoxIndex > 0) - { // delete any inputted chars - gInputBoxIndex = 0; - gRequestDisplayScreen = DISPLAY_MAIN; - } + if (gInputBoxIndex > 0) + { // delete any inputted chars + gInputBoxIndex = 0; + gRequestDisplayScreen = DISPLAY_MAIN; + } - gWasFKeyPressed = false; - gUpdateStatus = true; + gWasFKeyPressed = false; + gUpdateStatus = true; - processFKeyFunction(Key, false); - } + processFKeyFunction(Key, false); } - #endif + } return; } - #ifdef ENABLE_MAIN_KEY_HOLD - if (bKeyPressed) - { // key is pressed - gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed - return; // don't use the key till it's released - } - #else - if (!bKeyPressed) - return; - - gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; - #endif + if (bKeyPressed) + { // key is pressed + gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed + return; // don't use the key till it's released + } if (!gWasFKeyPressed) { // F-key wasn't pressed diff --git a/firmware.bin b/firmware.bin index b1151ebadb8c111373cb10da4ead7f0f8037d445..a203a704a87e0c61b3c5cc060660f3949e5f565a 100644 GIT binary patch delta 112 zcmbQTlzGZh<_*<;%rik>rTGhEDnu9(qLe_Vs%X4d58 z{_^sfe;Jh|y(48$m9rV&Di3}xQtFNhYre=bw-_WAGcn}2w3e(kT2!=7qjVw7ZLxLIhA M9UGhze#lk;04UNejQ{`u diff --git a/firmware.packed.bin b/firmware.packed.bin index b2a72b54ddf896df76e83c5e574fc5619a4cf606..0552c32cad3414d5a568c2ec52af385601a2e063 100644 GIT binary patch delta 154 zcmV;L0A>HCr30p=1F!}l2Y#f81P1O2vkf4AE(6^Dcax4zO6@o?v#~_N zx*#o4MmLA)FyTC1alz_NF>gxMy%L>`$AM--x;2sa8hucqv9<(g^Ynf7O8{F6h>+tz zuCe&FS?dG)XLI5)uO9XMV#1PKBU#0>`%fTj2T70GFk{?Yvm(4c1_!6>gE<28n6qcX IJrDvS9Z~W}o&W#< delta 154 zcmV;L0A>HCr30p=1F!}l2Q8$9QUd8-vkf4AE(1!}vN7Tqv$1A@ zGLD6wXNF>N{K+Lg7F}n;wi2+C$#rlPvB;hU03%vcO=EK9^YofYd*F~?m*`+B zG9l{raC=ZPa?=E+K-cJ8npK8OjL~DW`%fTj2O5vpW@p