mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-29 23:01:26 +03:00
Hold down keys 0-9 to bypass F-key
This commit is contained in:
parent
84087c3d13
commit
5c664164b2
9
Makefile
9
Makefile
@ -14,6 +14,7 @@ ENABLE_CHAN_NAME_FREQ := 1
|
|||||||
ENABLE_WIDE_RX := 1
|
ENABLE_WIDE_RX := 1
|
||||||
ENABLE_TX_WHEN_AM := 0
|
ENABLE_TX_WHEN_AM := 0
|
||||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||||
|
ENABLE_MAIN_KEY_HOLD := 1
|
||||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||||
#ENABLE_BAND_SCOPE := 1
|
#ENABLE_BAND_SCOPE := 1
|
||||||
|
|
||||||
@ -129,7 +130,9 @@ ifeq ($(ENABLE_OVERLAY),1)
|
|||||||
ASFLAGS += -DENABLE_OVERLAY
|
ASFLAGS += -DENABLE_OVERLAY
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
||||||
|
#CFLAGS = -O2 -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD -fdata-sections -ffunction-sections
|
||||||
|
CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD -fdata-sections -ffunction-sections
|
||||||
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
||||||
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
||||||
ifeq ($(ENABLE_AIRCOPY),1)
|
ifeq ($(ENABLE_AIRCOPY),1)
|
||||||
@ -171,6 +174,9 @@ endif
|
|||||||
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
||||||
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_MAIN_KEY_HOLD),1)
|
||||||
|
CFLAGS += -DENABLE_MAIN_KEY_HOLD
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_SINGLE_VFO_CHAN),1)
|
ifeq ($(ENABLE_SINGLE_VFO_CHAN),1)
|
||||||
CFLAGS += -DENABLE_SINGLE_VFO_CHAN
|
CFLAGS += -DENABLE_SINGLE_VFO_CHAN
|
||||||
endif
|
endif
|
||||||
@ -179,6 +185,7 @@ ifeq ($(ENABLE_BAND_SCOPE),1)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
||||||
|
#LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld,--gc-sections
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
ASFLAGS += -g
|
ASFLAGS += -g
|
||||||
|
@ -24,6 +24,7 @@ You can edit those changes by (currently) editing the MakeFile, look for these l
|
|||||||
* ENABLE_WIDE_RX := 1 enable the RX in the full 18MHz to 1300MHz (though frontend is not tuned for full range)
|
* ENABLE_WIDE_RX := 1 enable the RX in the full 18MHz to 1300MHz (though frontend is not tuned for full range)
|
||||||
* ENABLE_TX_WHEN_AM := 0 allow TX when RX set to AM
|
* ENABLE_TX_WHEN_AM := 0 allow TX when RX set to AM
|
||||||
* ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 use CTCSS tail phase shift rather than QS's 55Hz tone method
|
* ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 use CTCSS tail phase shift rather than QS's 55Hz tone method
|
||||||
|
* ENABLE_MAIN_KEY_HOLD := 1 keys 0-9 can be held down to bypass having to press the F-key
|
||||||
* #ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented
|
* #ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented
|
||||||
* #ENABLE_BAND_SCOPE := 1 not yet implemented
|
* #ENABLE_BAND_SCOPE := 1 not yet implemented
|
||||||
|
|
||||||
|
43
app/app.c
43
app/app.c
@ -1031,7 +1031,6 @@ void APP_Update(void)
|
|||||||
// called every 10ms
|
// called every 10ms
|
||||||
void APP_CheckKeys(void)
|
void APP_CheckKeys(void)
|
||||||
{
|
{
|
||||||
const uint16_t key_repeat_delay = 60; // 600ms
|
|
||||||
KEY_Code_t Key;
|
KEY_Code_t Key;
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
@ -1095,23 +1094,25 @@ void APP_CheckKeys(void)
|
|||||||
else
|
else
|
||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
|
|
||||||
|
// *****************
|
||||||
|
|
||||||
|
// scan the hardware keys
|
||||||
Key = KEYBOARD_Poll();
|
Key = KEYBOARD_Poll();
|
||||||
|
|
||||||
if (gKeyReading0 != Key)
|
if (gKeyReading0 != Key)
|
||||||
{
|
{ // new key pressed
|
||||||
|
|
||||||
if (gKeyReading0 != KEY_INVALID && Key != KEY_INVALID)
|
if (gKeyReading0 != KEY_INVALID && Key != KEY_INVALID)
|
||||||
APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld);
|
APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld); // key pressed without releasing previous key
|
||||||
|
|
||||||
gKeyReading0 = Key;
|
gKeyReading0 = Key;
|
||||||
|
|
||||||
gDebounceCounter = 0;
|
gDebounceCounter = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gDebounceCounter++;
|
if (++gDebounceCounter == key_debounce)
|
||||||
|
{ // debounced new key pressed
|
||||||
|
|
||||||
if (gDebounceCounter == 2)
|
|
||||||
{
|
|
||||||
if (Key == KEY_INVALID)
|
if (Key == KEY_INVALID)
|
||||||
{
|
{
|
||||||
if (gKeyReading1 != KEY_INVALID)
|
if (gKeyReading1 != KEY_INVALID)
|
||||||
@ -1127,23 +1128,36 @@ void APP_CheckKeys(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gKeyBeingHeld = false;
|
gKeyBeingHeld = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// key is being held pressed
|
||||||
|
|
||||||
if (gDebounceCounter == key_repeat_delay)
|
if (gDebounceCounter == key_repeat_delay)
|
||||||
{
|
{ // initial delay after pressed
|
||||||
if (Key == KEY_STAR || Key == KEY_F || Key == KEY_SIDE2 || Key == KEY_SIDE1 || Key == KEY_UP || Key == KEY_DOWN)
|
if (Key == KEY_STAR ||
|
||||||
|
Key == KEY_F ||
|
||||||
|
Key == KEY_SIDE2 ||
|
||||||
|
Key == KEY_SIDE1 ||
|
||||||
|
Key == KEY_UP ||
|
||||||
|
Key == KEY_DOWN
|
||||||
|
#ifdef ENABLE_MAIN_KEY_HOLD
|
||||||
|
|| Key <= KEY_9 // keys 0-9 can be held down to bypass pressing the F-Key
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
gKeyBeingHeld = true;
|
gKeyBeingHeld = true;
|
||||||
APP_ProcessKey(Key, true, true);
|
APP_ProcessKey(Key, true, true);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if (gDebounceCounter > key_repeat_delay)
|
if (gDebounceCounter > key_repeat_delay)
|
||||||
{
|
{ // key repeat
|
||||||
if (Key == KEY_UP || Key == KEY_DOWN)
|
if (Key == KEY_UP || Key == KEY_DOWN)
|
||||||
{
|
{
|
||||||
gKeyBeingHeld = true;
|
gKeyBeingHeld = true;
|
||||||
if ((gDebounceCounter & 15) == 0)
|
if ((gDebounceCounter % key_repeat) == 0)
|
||||||
APP_ProcessKey(Key, true, true);
|
APP_ProcessKey(Key, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1151,6 +1165,7 @@ void APP_CheckKeys(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
gDebounceCounter = key_repeat_delay;
|
gDebounceCounter = key_repeat_delay;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1481,7 +1496,7 @@ void APP_TimeSlice500ms(void)
|
|||||||
{
|
{
|
||||||
if (--gVoltageMenuCountdown == 0)
|
if (--gVoltageMenuCountdown == 0)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU)
|
if (gInputBoxIndex > 0 || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU)
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex)
|
if (gInputBoxIndex > 0)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed)
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
|
303
app/main.c
303
app/main.c
@ -37,147 +37,11 @@
|
|||||||
// #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
// #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
static void processFKeyFunction(const KEY_Code_t Key)
|
||||||
{
|
{
|
||||||
uint8_t Band;
|
uint8_t Band;
|
||||||
uint8_t Vfo = gEeprom.TX_CHANNEL;
|
uint8_t Vfo = gEeprom.TX_CHANNEL;
|
||||||
|
|
||||||
if (bKeyHeld)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!bKeyPressed)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
|
|
||||||
if (!gWasFKeyPressed)
|
|
||||||
{
|
|
||||||
INPUTBOX_Append(Key);
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
|
||||||
{
|
|
||||||
uint16_t Channel;
|
|
||||||
|
|
||||||
if (gInputBoxIndex != 3)
|
|
||||||
{
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
|
||||||
#endif
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
|
||||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
uint32_t Frequency;
|
|
||||||
|
|
||||||
if (gInputBoxIndex < 6)
|
|
||||||
{
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
|
|
||||||
NUMBER_Get(gInputBox, &Frequency);
|
|
||||||
|
|
||||||
if (gSetting_350EN || Frequency < 35000000 || Frequency >= 40000000)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
for (i = 0; i < 7; i++)
|
|
||||||
{
|
|
||||||
if (Frequency >= LowerLimitFrequencyBandTable[i] && Frequency <= UpperLimitFrequencyBandTable[i])
|
|
||||||
{
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gTxVfo->Band != i)
|
|
||||||
{
|
|
||||||
gTxVfo->Band = i;
|
|
||||||
gEeprom.ScreenChannel[Vfo] = i + FREQ_CHANNEL_FIRST;
|
|
||||||
gEeprom.FreqChannel[Vfo] = i + FREQ_CHANNEL_FIRST;
|
|
||||||
|
|
||||||
SETTINGS_SaveVfoIndices();
|
|
||||||
|
|
||||||
RADIO_ConfigureChannel(Vfo, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
Frequency += 75;
|
|
||||||
|
|
||||||
gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]);
|
|
||||||
|
|
||||||
gRequestSaveChannel = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef ENABLE_NOAA
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uint8_t Channel;
|
|
||||||
|
|
||||||
if (gInputBoxIndex != 2)
|
|
||||||
{
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
|
||||||
#endif
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
|
|
||||||
Channel = (gInputBox[0] * 10) + gInputBox[1];
|
|
||||||
if (Channel >= 1 && Channel <= 10)
|
|
||||||
{
|
|
||||||
Channel += NOAA_CHANNEL_FIRST;
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
|
||||||
#endif
|
|
||||||
gEeprom.NoaaChannel[Vfo] = Channel;
|
|
||||||
gEeprom.ScreenChannel[Vfo] = Channel;
|
|
||||||
gRequestSaveVFO = true;
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gWasFKeyPressed = false;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
|
|
||||||
switch (Key)
|
switch (Key)
|
||||||
{
|
{
|
||||||
case KEY_0:
|
case KEY_0:
|
||||||
@ -347,6 +211,171 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||||
|
{
|
||||||
|
if (bKeyHeld)
|
||||||
|
{ // key held down
|
||||||
|
|
||||||
|
#ifdef ENABLE_MAIN_KEY_HOLD
|
||||||
|
if (bKeyPressed)
|
||||||
|
{
|
||||||
|
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||||
|
{ // we're going to go straight to the function key function
|
||||||
|
// without the F-key being first pressed
|
||||||
|
if (gInputBoxIndex > 0)
|
||||||
|
{ // delete last char inputted
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
}
|
||||||
|
gWasFKeyPressed = false;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
processFKeyFunction(Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bKeyPressed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
|
if (!gWasFKeyPressed)
|
||||||
|
{
|
||||||
|
uint8_t Vfo = gEeprom.TX_CHANNEL;
|
||||||
|
|
||||||
|
INPUTBOX_Append(Key);
|
||||||
|
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
|
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
|
{
|
||||||
|
uint16_t Channel;
|
||||||
|
|
||||||
|
if (gInputBoxIndex != 3)
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
|
#endif
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_NOAA
|
||||||
|
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
uint32_t Frequency;
|
||||||
|
|
||||||
|
if (gInputBoxIndex < 6)
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
|
NUMBER_Get(gInputBox, &Frequency);
|
||||||
|
|
||||||
|
if (gSetting_350EN || Frequency < 35000000 || Frequency >= 40000000)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
for (i = 0; i < 7; i++)
|
||||||
|
{
|
||||||
|
if (Frequency >= LowerLimitFrequencyBandTable[i] && Frequency <= UpperLimitFrequencyBandTable[i])
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (gTxVfo->Band != i)
|
||||||
|
{
|
||||||
|
gTxVfo->Band = i;
|
||||||
|
gEeprom.ScreenChannel[Vfo] = i + FREQ_CHANNEL_FIRST;
|
||||||
|
gEeprom.FreqChannel[Vfo] = i + FREQ_CHANNEL_FIRST;
|
||||||
|
|
||||||
|
SETTINGS_SaveVfoIndices();
|
||||||
|
|
||||||
|
RADIO_ConfigureChannel(Vfo, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
Frequency += 75;
|
||||||
|
|
||||||
|
gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]);
|
||||||
|
|
||||||
|
gRequestSaveChannel = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef ENABLE_NOAA
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uint8_t Channel;
|
||||||
|
|
||||||
|
if (gInputBoxIndex != 2)
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
|
#endif
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
|
Channel = (gInputBox[0] * 10) + gInputBox[1];
|
||||||
|
if (Channel >= 1 && Channel <= 10)
|
||||||
|
{
|
||||||
|
Channel += NOAA_CHANNEL_FIRST;
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
|
#endif
|
||||||
|
gEeprom.NoaaChannel[Vfo] = Channel;
|
||||||
|
gEeprom.ScreenChannel[Vfo] = Channel;
|
||||||
|
gRequestSaveVFO = true;
|
||||||
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gWasFKeyPressed = false;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
|
||||||
|
processFKeyFunction(Key);
|
||||||
|
}
|
||||||
|
|
||||||
static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed)
|
||||||
|
@ -102,7 +102,7 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if (gInputBoxIndex)
|
if (gInputBoxIndex > 0)
|
||||||
{
|
{
|
||||||
gInputBox[--gInputBoxIndex] = 10;
|
gInputBox[--gInputBoxIndex] = 10;
|
||||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||||
|
@ -36,6 +36,7 @@ KEY_Code_t KEYBOARD_Poll(void)
|
|||||||
|
|
||||||
SYSTICK_DelayUs(1);
|
SYSTICK_DelayUs(1);
|
||||||
|
|
||||||
|
// *****************
|
||||||
// Keys connected to gnd
|
// Keys connected to gnd
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
||||||
@ -52,7 +53,9 @@ KEY_Code_t KEYBOARD_Poll(void)
|
|||||||
|
|
||||||
// Original doesn't do PTT
|
// Original doesn't do PTT
|
||||||
|
|
||||||
|
// *****************
|
||||||
// First row
|
// First row
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
||||||
SYSTICK_DelayUs(1);
|
SYSTICK_DelayUs(1);
|
||||||
|
|
||||||
@ -80,7 +83,9 @@ KEY_Code_t KEYBOARD_Poll(void)
|
|||||||
goto Bye;
|
goto Bye;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *****************
|
||||||
// Second row
|
// Second row
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
||||||
SYSTICK_DelayUs(1);
|
SYSTICK_DelayUs(1);
|
||||||
|
|
||||||
@ -111,7 +116,9 @@ KEY_Code_t KEYBOARD_Poll(void)
|
|||||||
goto Bye;
|
goto Bye;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *****************
|
||||||
// Third row
|
// Third row
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
||||||
SYSTICK_DelayUs(1);
|
SYSTICK_DelayUs(1);
|
||||||
|
|
||||||
@ -148,7 +155,9 @@ KEY_Code_t KEYBOARD_Poll(void)
|
|||||||
goto Bye;
|
goto Bye;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *****************
|
||||||
// Fourth row
|
// Fourth row
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
||||||
SYSTICK_DelayUs(1);
|
SYSTICK_DelayUs(1);
|
||||||
|
|
||||||
@ -179,6 +188,8 @@ KEY_Code_t KEYBOARD_Poll(void)
|
|||||||
goto Bye;
|
goto Bye;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *****************
|
||||||
|
|
||||||
Bye:
|
Bye:
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
5
misc.c
5
misc.c
@ -18,8 +18,11 @@
|
|||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
|
const uint16_t key_repeat_delay = 40; // 400ms
|
||||||
|
const uint16_t key_repeat = 8; // was 15 (150ms) .. MUST be less than 'key_repeat_delay'
|
||||||
|
const uint16_t key_debounce = 2; // 20ms
|
||||||
|
|
||||||
const uint8_t g_scan_delay = 21; // 210ms
|
const uint8_t g_scan_delay = 21; // 210ms
|
||||||
//const uint8_t g_scan_delay = 2; // 20ms
|
|
||||||
|
|
||||||
const uint8_t g_menu_timeout = 2 * 30; // 30 seconds
|
const uint8_t g_menu_timeout = 2 * 30; // 30 seconds
|
||||||
|
|
||||||
|
4
misc.h
4
misc.h
@ -74,6 +74,10 @@ enum CssScanMode_t
|
|||||||
|
|
||||||
typedef enum CssScanMode_t CssScanMode_t;
|
typedef enum CssScanMode_t CssScanMode_t;
|
||||||
|
|
||||||
|
extern const uint16_t key_repeat_delay;
|
||||||
|
extern const uint16_t key_repeat;
|
||||||
|
extern const uint16_t key_debounce;
|
||||||
|
|
||||||
extern const uint8_t g_scan_delay;
|
extern const uint8_t g_scan_delay;
|
||||||
|
|
||||||
extern const uint8_t g_menu_timeout;
|
extern const uint8_t g_menu_timeout;
|
||||||
|
@ -81,7 +81,7 @@ void UI_DisplayFM(void)
|
|||||||
UI_PrintString(String, 0, 127, 2, 10);
|
UI_PrintString(String, 0, 127, 2, 10);
|
||||||
|
|
||||||
memset(String, 0, sizeof(String));
|
memset(String, 0, sizeof(String));
|
||||||
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex))
|
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0))
|
||||||
{
|
{
|
||||||
UI_GenerateChannelString(String, gFM_ChannelPosition);
|
UI_GenerateChannelString(String, gFM_ChannelPosition);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ void UI_GenerateChannelString(char *pString, const uint8_t Channel)
|
|||||||
|
|
||||||
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber)
|
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex)
|
if (gInputBoxIndex > 0)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
|
|
||||||
char gInputBox[8];
|
char gInputBox[8];
|
||||||
@ -22,11 +23,12 @@ uint8_t gInputBoxIndex;
|
|||||||
|
|
||||||
void INPUTBOX_Append(char Digit)
|
void INPUTBOX_Append(char Digit)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex == 0) {
|
if (gInputBoxIndex == 0)
|
||||||
memset(gInputBox, 10, sizeof(gInputBox));
|
memset(gInputBox, 10, sizeof(gInputBox));
|
||||||
} else if (gInputBoxIndex >= sizeof(gInputBox)) {
|
else
|
||||||
|
if (gInputBoxIndex >= sizeof(gInputBox))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
gInputBox[gInputBoxIndex++] = Digit;
|
gInputBox[gInputBoxIndex++] = Digit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,11 +62,12 @@ void UI_DisplayLock(void)
|
|||||||
// TODO: Original code doesn't do the below, but is needed for proper key debounce
|
// TODO: Original code doesn't do the below, but is needed for proper key debounce
|
||||||
|
|
||||||
gNextTimeslice = false;
|
gNextTimeslice = false;
|
||||||
|
|
||||||
Key = KEYBOARD_Poll();
|
Key = KEYBOARD_Poll();
|
||||||
|
|
||||||
if (gKeyReading0 == Key)
|
if (gKeyReading0 == Key)
|
||||||
{
|
{
|
||||||
if (++gDebounceCounter == 2)
|
if (++gDebounceCounter == key_debounce)
|
||||||
{
|
{
|
||||||
if (Key == KEY_INVALID)
|
if (Key == KEY_INVALID)
|
||||||
{
|
{
|
||||||
@ -89,7 +90,8 @@ void UI_DisplayLock(void)
|
|||||||
case KEY_8:
|
case KEY_8:
|
||||||
case KEY_9:
|
case KEY_9:
|
||||||
INPUTBOX_Append(Key - KEY_0);
|
INPUTBOX_Append(Key - KEY_0);
|
||||||
if (gInputBoxIndex < 6)
|
|
||||||
|
if (gInputBoxIndex < 6) // 6 frequency digits
|
||||||
{
|
{
|
||||||
Beep = BEEP_1KHZ_60MS_OPTIONAL;
|
Beep = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
}
|
}
|
||||||
@ -118,7 +120,7 @@ void UI_DisplayLock(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_EXIT:
|
case KEY_EXIT:
|
||||||
if (gInputBoxIndex)
|
if (gInputBoxIndex > 0)
|
||||||
{
|
{
|
||||||
gInputBox[--gInputBoxIndex] = 10;
|
gInputBox[--gInputBoxIndex] = 10;
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
|
@ -170,11 +170,10 @@ void UI_DisplayMain(void)
|
|||||||
// show the memory channel symbol
|
// show the memory channel symbol
|
||||||
memcpy(pLine1 + x, BITMAP_M, sizeof(BITMAP_M));
|
memcpy(pLine1 + x, BITMAP_M, sizeof(BITMAP_M));
|
||||||
|
|
||||||
// show the memory channel number
|
|
||||||
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num)
|
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num)
|
||||||
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String);
|
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number
|
||||||
else
|
else
|
||||||
memcpy(String + 5, gInputBox, 3);
|
memcpy(String + 5, gInputBox, 3); // show the input text
|
||||||
UI_DisplaySmallDigits(3, String + 5, x + sizeof(BITMAP_M), Line + 1, false);
|
UI_DisplaySmallDigits(3, String + 5, x + sizeof(BITMAP_M), Line + 1, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -258,7 +257,7 @@ void UI_DisplayMain(void)
|
|||||||
else
|
else
|
||||||
{ // normal state
|
{ // normal state
|
||||||
|
|
||||||
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
|
if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
|
||||||
{ // user is entering a new frequency
|
{ // user is entering a new frequency
|
||||||
UI_DisplayFrequency(gInputBox, 31, Line, true, false);
|
UI_DisplayFrequency(gInputBox, 31, Line, true, false);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user