Skip to content

Commit

Permalink
Fix issue #192
Browse files Browse the repository at this point in the history
  • Loading branch information
armel committed Jul 17, 2024
1 parent 3d59dad commit 1260bc8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
6 changes: 6 additions & 0 deletions app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
52 changes: 30 additions & 22 deletions app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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...

Expand Down
2 changes: 1 addition & 1 deletion app/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1260bc8

Please sign in to comment.