Try to improve channel input

This commit is contained in:
Armel FAUVEAU
2024-06-29 03:50:49 +02:00
parent 3c2984cfd5
commit 2119f1a931
3 changed files with 44 additions and 19 deletions

View File

@@ -1474,6 +1474,20 @@ void APP_TimeSlice500ms(void)
gBeepToPlay = BEEP_NONE;
}
}
else
{
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering channel number
switch (gInputBoxIndex)
{
case 1:
channelMove(gInputBox[0] - 1, false);
break;
case 2:
channelMove(((gInputBox[0] * 10) + gInputBox[1]) - 1, false);
break;
}
}
}
}
if (gDTMF_RX_live_timeout > 0)

View File

@@ -316,6 +316,32 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
}
}
void channelMove(uint16_t Channel, bool End)
{
const uint8_t Vfo = gEeprom.TX_VFO;
if(End)
{
gInputBoxIndex = 0;
}
if (!RADIO_CheckValidChannel(Channel, false, 0)) {
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
}
#ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key;
#endif
gEeprom.MrChannel[Vfo] = (uint8_t)Channel;
gEeprom.ScreenChannel[Vfo] = (uint8_t)Channel;
gRequestSaveVFO = true;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
return;
}
static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{
if (bKeyHeld) { // key held down
@@ -349,6 +375,8 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering channel number
gKeyInputCountdown = (key_input_timeout_500ms / 8); // short time...
if (gInputBoxIndex != 3) {
#ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key;
@@ -357,25 +385,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
return;
}
gInputBoxIndex = 0;
const uint16_t Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
if (!RADIO_CheckValidChannel(Channel, false, 0)) {
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
}
#ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key;
#endif
gEeprom.MrChannel[Vfo] = (uint8_t)Channel;
gEeprom.ScreenChannel[Vfo] = (uint8_t)Channel;
gRequestSaveVFO = true;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
return;
channelMove(((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1, true);
}
// #ifdef ENABLE_NOAA

View File

@@ -20,6 +20,7 @@
#include "driver/keyboard.h"
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
void channelMove(uint16_t Channel, bool End);
#endif