Add F + SIDE1 and F + SIDE2 for Step

This commit is contained in:
Armel FAUVEAU
2024-03-02 21:01:52 +01:00
parent 68e1cb5442
commit 14378eaa7a
2 changed files with 43 additions and 1 deletions

View File

@@ -1834,7 +1834,11 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
} }
} }
#ifdef ENABLE_FEAT_F4HWN // For F + SIDE1 or F + SIDE2
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT)) {
#else
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2)) { if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2)) {
#endif
// cancel the F-key // cancel the F-key
gWasFKeyPressed = false; gWasFKeyPressed = false;
gUpdateStatus = true; gUpdateStatus = true;
@@ -1914,9 +1918,18 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
} }
#endif #endif
} }
#ifdef ENABLE_FEAT_F4HWN // For F + SIDE1 or F + SIDE2
else if (gWasFKeyPressed && (Key == KEY_SIDE1 || Key == KEY_SIDE2)) {
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
}
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) { else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) {
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld); ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
} }
#else
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) {
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
}
#endif
else if (!SCANNER_IsScanning() else if (!SCANNER_IsScanning()
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
&& gScreenToDisplay != DISPLAY_AIRCOPY && gScreenToDisplay != DISPLAY_AIRCOPY

View File

@@ -250,7 +250,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
break; break;
#ifdef ENABLE_FEAT_F4HWN // Set Squelch F + UP or Down #ifdef ENABLE_FEAT_F4HWN // Set Squelch F + UP or Down and Step F + SIDE1 or F + SIDE2
case KEY_UP: case KEY_UP:
gEeprom.SQUELCH_LEVEL = (gEeprom.SQUELCH_LEVEL < 9) ? gEeprom.SQUELCH_LEVEL + 1: 9; gEeprom.SQUELCH_LEVEL = (gEeprom.SQUELCH_LEVEL < 9) ? gEeprom.SQUELCH_LEVEL + 1: 9;
gVfoConfigureMode = VFO_CONFIGURE; gVfoConfigureMode = VFO_CONFIGURE;
@@ -263,6 +263,33 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
//gRequestDisplayScreen = DISPLAY_MAIN; //gRequestDisplayScreen = DISPLAY_MAIN;
gWasFKeyPressed = false; gWasFKeyPressed = false;
break; break;
case KEY_SIDE1:
uint8_t a = FREQUENCY_GetSortedIdxFromStepIdx(gTxVfo->STEP_SETTING);
if (a < STEP_N_ELEM - 1)
{
gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromSortedIdx(a + 1);
}
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
{
gRequestSaveChannel = 1;
}
gVfoConfigureMode = VFO_CONFIGURE;
gWasFKeyPressed = false;
break;
case KEY_SIDE2:
uint8_t b = FREQUENCY_GetSortedIdxFromStepIdx(gTxVfo->STEP_SETTING);
if (b > 0)
{
gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromSortedIdx(b - 1);
}
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
{
gRequestSaveChannel = 1;
}
gVfoConfigureMode = VFO_CONFIGURE;
gWasFKeyPressed = false;
break;
#endif #endif
default: default:
@@ -742,6 +769,8 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// } // }
switch (Key) { switch (Key) {
case KEY_SIDE1:
case KEY_SIDE2:
case KEY_0...KEY_9: case KEY_0...KEY_9:
MAIN_Key_DIGITS(Key, bKeyPressed, bKeyHeld); MAIN_Key_DIGITS(Key, bKeyPressed, bKeyHeld);
break; break;