This commit is contained in:
Armel FAUVEAU
2024-07-17 23:36:04 +02:00
parent 3d59dada22
commit 1260bc8fb2
3 changed files with 37 additions and 23 deletions

View File

@@ -1469,6 +1469,12 @@ void APP_TimeSlice500ms(void)
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE) && (gInputBoxIndex == 1 || gInputBoxIndex == 2))
{
channelMoveSwitch();
if (gBeepToPlay == BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL) {
AUDIO_PlayBeep(gBeepToPlay);
}
SETTINGS_SaveVfoIndices();
}

View File

@@ -314,20 +314,20 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
}
}
void channelMove(uint16_t Channel, bool End)
void channelMove(uint16_t Channel)
{
const uint8_t Vfo = gEeprom.TX_VFO;
if(End)
{
gInputBoxIndex = 0;
}
if (!RADIO_CheckValidChannel(Channel, false, 0)) {
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
if (gKeyInputCountdown <= 1) {
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
}
return;
}
gBeepToPlay = BEEP_NONE;
#ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key;
#endif
@@ -338,34 +338,40 @@ void channelMove(uint16_t Channel, bool End)
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);
if(End)
{
SETTINGS_SaveVfoIndices();
}
return;
}
void channelMoveSwitch(void) {
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering channel number
uint16_t Channel = 0;
switch (gInputBoxIndex)
{
case 1:
if (gInputBox[0] != 0) {
channelMove(gInputBox[0] - 1, false);
}
Channel = gInputBox[0];
break;
case 2:
if (!((gInputBox[0] == 0) && (gInputBox[1] == 0))) {
channelMove(((gInputBox[0] * 10) + gInputBox[1]) - 1, false);
}
Channel = (gInputBox[0] * 10) + gInputBox[1];
break;
case 3:
channelMove(((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1, true);
Channel = (gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2];
break;
}
if ((Channel == 0) && (gInputBoxIndex != 3)) {
return;
}
if (gInputBoxIndex == 3) {
gInputBoxIndex = 0;
gKeyInputCountdown = 1;
channelMove(Channel - 1);
return;
}
channelMove(Channel - 1);
}
}
@@ -425,10 +431,12 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
const uint8_t Vfo = gEeprom.TX_VFO;
INPUTBOX_Append(Key);
gKeyInputCountdown = key_input_timeout_500ms;
channelMoveSwitch();
gRequestDisplayScreen = DISPLAY_MAIN;
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering channel number
channelMoveSwitch();
gKeyInputCountdown = (key_input_timeout_500ms / 5); // short time...

View File

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