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

View File

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