0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 06:39:49 +03:00

Hold down keys 0-9 to bypass F-key

This commit is contained in:
OneOfEleven
2023-09-14 19:38:28 +01:00
parent 84087c3d13
commit 5c664164b2
19 changed files with 294 additions and 221 deletions

View File

@ -81,7 +81,7 @@ void UI_DisplayFM(void)
UI_PrintString(String, 0, 127, 2, 10);
memset(String, 0, sizeof(String));
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex))
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0))
{
UI_GenerateChannelString(String, gFM_ChannelPosition);
}

View File

@ -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)
{
if (gInputBoxIndex)
if (gInputBoxIndex > 0)
{
unsigned int i;
for (i = 0; i < 3; i++)

View File

@ -15,18 +15,20 @@
*/
#include <string.h>
#include "ui/inputbox.h"
char gInputBox[8];
char gInputBox[8];
uint8_t gInputBoxIndex;
void INPUTBOX_Append(char Digit)
{
if (gInputBoxIndex == 0) {
if (gInputBoxIndex == 0)
memset(gInputBox, 10, sizeof(gInputBox));
} else if (gInputBoxIndex >= sizeof(gInputBox)) {
else
if (gInputBoxIndex >= sizeof(gInputBox))
return;
}
gInputBox[gInputBoxIndex++] = Digit;
}

View File

@ -19,7 +19,7 @@
#include <stdint.h>
extern char gInputBox[8];
extern char gInputBox[8];
extern uint8_t gInputBoxIndex;
void INPUTBOX_Append(char Digit);

View File

@ -62,11 +62,12 @@ void UI_DisplayLock(void)
// TODO: Original code doesn't do the below, but is needed for proper key debounce
gNextTimeslice = false;
Key = KEYBOARD_Poll();
Key = KEYBOARD_Poll();
if (gKeyReading0 == Key)
{
if (++gDebounceCounter == 2)
if (++gDebounceCounter == key_debounce)
{
if (Key == KEY_INVALID)
{
@ -89,7 +90,8 @@ void UI_DisplayLock(void)
case KEY_8:
case KEY_9:
INPUTBOX_Append(Key - KEY_0);
if (gInputBoxIndex < 6)
if (gInputBoxIndex < 6) // 6 frequency digits
{
Beep = BEEP_1KHZ_60MS_OPTIONAL;
}
@ -118,7 +120,7 @@ void UI_DisplayLock(void)
break;
case KEY_EXIT:
if (gInputBoxIndex)
if (gInputBoxIndex > 0)
{
gInputBox[--gInputBoxIndex] = 10;
gUpdateDisplay = true;

View File

@ -170,11 +170,10 @@ void UI_DisplayMain(void)
// show the memory channel symbol
memcpy(pLine1 + x, BITMAP_M, sizeof(BITMAP_M));
// show the memory channel number
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
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);
}
else
@ -258,7 +257,7 @@ void UI_DisplayMain(void)
else
{ // 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
UI_DisplayFrequency(gInputBox, 31, Line, true, false);
}