mirror of
https://github.com/kamilsss655/uv-k5-firmware-custom
synced 2024-11-21 17:57:59 +00:00
Squelch tuning
This commit is contained in:
parent
5c346c8466
commit
ec5e9dde66
2
Makefile
2
Makefile
@ -29,7 +29,7 @@ ENABLE_CODE_SCAN_TIMEOUT := 0
|
||||
ENABLE_AM_FIX := 1
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 1
|
||||
#ENABLE_FASTER_CHANNEL_SCAN := 0
|
||||
ENABLE_FASTER_CHANNEL_SCAN := 0
|
||||
ENABLE_RSSI_BAR := 1
|
||||
ENABLE_AUDIO_BAR := 0
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1
|
||||
|
@ -56,7 +56,7 @@ ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan ti
|
||||
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 0 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
|
||||
#ENABLE_FASTER_CHANNEL_SCAN := 0 don't use (for now) .. increases the channel scan speed, but the squelch is also made more twitchy
|
||||
ENABLE_FASTER_CHANNEL_SCAN := 0 increases the channel scan speed, but the squelch is also made more twitchy
|
||||
ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
|
||||
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M')
|
||||
|
@ -727,7 +727,7 @@ static void MR_NextChannel(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
ScanPauseDelayIn_10ms = 8; // 80ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
||||
ScanPauseDelayIn_10ms = 10; // 100ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
||||
#else
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
#endif
|
||||
|
@ -354,7 +354,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
// if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
// #endif
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // user is entering frequency
|
||||
{ // user is entering a frequency
|
||||
|
||||
uint32_t Frequency;
|
||||
|
||||
|
@ -53,7 +53,9 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
uint16_t Channel;
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
INPUTBOX_Append(Key);
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
|
||||
if (gInputBoxIndex < 3)
|
||||
@ -65,8 +67,8 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
|
||||
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
if (Channel <= MR_CHANNEL_LAST)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
|
76
app/uart.c
76
app/uart.c
@ -48,7 +48,7 @@ typedef struct {
|
||||
} Header_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t Padding[2];
|
||||
uint8_t Padding[2];
|
||||
uint16_t ID;
|
||||
} Footer_t;
|
||||
|
||||
@ -60,10 +60,10 @@ typedef struct {
|
||||
typedef struct {
|
||||
Header_t Header;
|
||||
struct {
|
||||
char Version[16];
|
||||
bool bHasCustomAesKey;
|
||||
bool bIsInLockScreen;
|
||||
uint8_t Padding[2];
|
||||
char Version[16];
|
||||
bool bHasCustomAesKey;
|
||||
bool bIsInLockScreen;
|
||||
uint8_t Padding[2];
|
||||
uint32_t Challenge[4];
|
||||
} Data;
|
||||
} REPLY_0514_t;
|
||||
@ -71,8 +71,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
Header_t Header;
|
||||
uint16_t Offset;
|
||||
uint8_t Size;
|
||||
uint8_t Padding;
|
||||
uint8_t Size;
|
||||
uint8_t Padding;
|
||||
uint32_t Timestamp;
|
||||
} CMD_051B_t;
|
||||
|
||||
@ -80,19 +80,19 @@ typedef struct {
|
||||
Header_t Header;
|
||||
struct {
|
||||
uint16_t Offset;
|
||||
uint8_t Size;
|
||||
uint8_t Padding;
|
||||
uint8_t Data[128];
|
||||
uint8_t Size;
|
||||
uint8_t Padding;
|
||||
uint8_t Data[128];
|
||||
} Data;
|
||||
} REPLY_051B_t;
|
||||
|
||||
typedef struct {
|
||||
Header_t Header;
|
||||
uint16_t Offset;
|
||||
uint8_t Size;
|
||||
bool bAllowPassword;
|
||||
uint8_t Size;
|
||||
bool bAllowPassword;
|
||||
uint32_t Timestamp;
|
||||
uint8_t Data[0];
|
||||
uint8_t Data[0];
|
||||
} CMD_051D_t;
|
||||
|
||||
typedef struct {
|
||||
@ -106,8 +106,8 @@ typedef struct {
|
||||
Header_t Header;
|
||||
struct {
|
||||
uint16_t RSSI;
|
||||
uint8_t ExNoiseIndicator;
|
||||
uint8_t GlitchIndicator;
|
||||
uint8_t ExNoiseIndicator;
|
||||
uint8_t GlitchIndicator;
|
||||
} Data;
|
||||
} REPLY_0527_t;
|
||||
|
||||
@ -137,7 +137,10 @@ typedef struct {
|
||||
uint32_t Timestamp;
|
||||
} CMD_052F_t;
|
||||
|
||||
static const uint8_t Obfuscation[16] = { 0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80 };
|
||||
static const uint8_t Obfuscation[16] =
|
||||
{
|
||||
0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80
|
||||
};
|
||||
|
||||
static union
|
||||
{
|
||||
@ -157,12 +160,11 @@ static void SendReply(void *pReply, uint16_t Size)
|
||||
{
|
||||
Header_t Header;
|
||||
Footer_t Footer;
|
||||
uint8_t *pBytes;
|
||||
uint16_t i;
|
||||
|
||||
if (bIsEncrypted)
|
||||
{
|
||||
pBytes = (uint8_t *)pReply;
|
||||
uint8_t *pBytes = (uint8_t *)pReply;
|
||||
unsigned int i;
|
||||
for (i = 0; i < Size; i++)
|
||||
pBytes[i] ^= Obfuscation[i % 16];
|
||||
}
|
||||
@ -171,6 +173,7 @@ static void SendReply(void *pReply, uint16_t Size)
|
||||
Header.Size = Size;
|
||||
UART_Send(&Header, sizeof(Header));
|
||||
UART_Send(pReply, Size);
|
||||
|
||||
if (bIsEncrypted)
|
||||
{
|
||||
Footer.Padding[0] = Obfuscation[(Size + 0) % 16] ^ 0xFF;
|
||||
@ -205,14 +208,16 @@ static void SendVersion(void)
|
||||
|
||||
static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse)
|
||||
{
|
||||
uint8_t i;
|
||||
uint32_t IV[4];
|
||||
unsigned int i;
|
||||
uint32_t IV[4];
|
||||
|
||||
IV[0] = 0;
|
||||
IV[1] = 0;
|
||||
IV[2] = 0;
|
||||
IV[3] = 0;
|
||||
|
||||
AES_Encrypt(pKey, IV, pIn, IV, true);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
if (IV[i] != pResponse[i])
|
||||
return true;
|
||||
@ -254,10 +259,10 @@ static void CMD_051B(const uint8_t *pBuffer)
|
||||
#endif
|
||||
|
||||
memset(&Reply, 0, sizeof(Reply));
|
||||
Reply.Header.ID = 0x051C;
|
||||
Reply.Header.ID = 0x051C;
|
||||
Reply.Header.Size = pCmd->Size + 4;
|
||||
Reply.Data.Offset = pCmd->Offset;
|
||||
Reply.Data.Size = pCmd->Size;
|
||||
Reply.Data.Size = pCmd->Size;
|
||||
|
||||
if (bHasCustomAesKey)
|
||||
bLocked = gIsLocked;
|
||||
@ -294,7 +299,7 @@ static void CMD_051D(const uint8_t *pBuffer)
|
||||
|
||||
if (!bIsLocked)
|
||||
{
|
||||
uint16_t i;
|
||||
unsigned int i;
|
||||
for (i = 0; i < (pCmd->Size / 8); i++)
|
||||
{
|
||||
const uint16_t Offset = pCmd->Offset + (i * 8U);
|
||||
@ -331,23 +336,25 @@ static void CMD_0529(void)
|
||||
{
|
||||
REPLY_0529_t Reply;
|
||||
|
||||
Reply.Header.ID = 0x52A;
|
||||
Reply.Header.ID = 0x52A;
|
||||
Reply.Header.Size = sizeof(Reply.Data);
|
||||
|
||||
// Original doesn't actually send current!
|
||||
BOARD_ADC_GetBatteryInfo(&Reply.Data.Voltage, &Reply.Data.Current);
|
||||
|
||||
SendReply(&Reply, sizeof(Reply));
|
||||
}
|
||||
|
||||
static void CMD_052D(const uint8_t *pBuffer)
|
||||
{
|
||||
const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer;
|
||||
REPLY_052D_t Reply;
|
||||
bool bIsLocked;
|
||||
REPLY_052D_t Reply;
|
||||
bool bIsLocked;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||
#endif
|
||||
Reply.Header.ID = 0x052E;
|
||||
Reply.Header.ID = 0x052E;
|
||||
Reply.Header.Size = sizeof(Reply.Data);
|
||||
|
||||
bIsLocked = bHasCustomAesKey;
|
||||
@ -413,15 +420,13 @@ static void CMD_052F(const uint8_t *pBuffer)
|
||||
|
||||
bool UART_IsCommandAvailable(void)
|
||||
{
|
||||
uint16_t DmaLength;
|
||||
uint16_t CommandLength;
|
||||
uint16_t Index;
|
||||
uint16_t TailIndex;
|
||||
uint16_t Size;
|
||||
uint16_t CRC;
|
||||
uint16_t i;
|
||||
uint16_t CommandLength;
|
||||
uint16_t DmaLength = DMA_CH0->ST & 0xFFFU;
|
||||
|
||||
DmaLength = DMA_CH0->ST & 0xFFFU;
|
||||
while (1)
|
||||
{
|
||||
if (gUART_WriteIndex == DmaLength)
|
||||
@ -495,9 +500,12 @@ bool UART_IsCommandAvailable(void)
|
||||
bIsEncrypted = true;
|
||||
|
||||
if (bIsEncrypted)
|
||||
for (i = 0; i < Size + 2; i++)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < (Size + 2u); i++)
|
||||
UART_Command.Buffer[i] ^= Obfuscation[i % 16];
|
||||
|
||||
}
|
||||
|
||||
CRC = UART_Command.Buffer[Size] | (UART_Command.Buffer[Size + 1] << 8);
|
||||
|
||||
return (CRC_Calculate(UART_Command.Buffer, Size) != CRC) ? false : true;
|
||||
|
@ -738,7 +738,7 @@ void BK4819_SetupSquelch(
|
||||
//
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0);
|
||||
|
||||
// Glitch threshold for Squelch
|
||||
// Glitch threshold for Squelch = close
|
||||
//
|
||||
// 0 ~ 255
|
||||
//
|
||||
@ -748,47 +748,49 @@ void BK4819_SetupSquelch(
|
||||
//
|
||||
// <15:14> 1 ???
|
||||
//
|
||||
// <13:11> 5 Squelch = 1 Delay Setting
|
||||
// <13:11> 5 Squelch = open Delay Setting
|
||||
// 0 ~ 7
|
||||
//
|
||||
// <10:9> 7 Squelch = 0 Delay Setting
|
||||
// <10:9> 7 Squelch = close Delay Setting
|
||||
// 0 ~ 3
|
||||
//
|
||||
// <8> 0 ???
|
||||
//
|
||||
// <7:0> 8 Glitch threshold for Squelch = 1
|
||||
// <7:0> 8 Glitch threshold for Squelch = open
|
||||
// 0 ~ 255
|
||||
//
|
||||
BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000
|
||||
#ifndef ENABLE_FASTER_CHANNEL_SCAN
|
||||
// original
|
||||
(1u << 14) | // 1 ???
|
||||
(5u << 11) | // 5 squelch = 1 delay .. 0 ~ 7
|
||||
(3u << 9) | // 3 squelch = 0 delay .. 0 ~ 3
|
||||
SquelchOpenGlitchThresh); // 0 ~ 255
|
||||
// original (*)
|
||||
(1u << 14) | // 1 ???
|
||||
(3u << 11) | // *5 squelch = open delay .. 0 ~ 7
|
||||
(2u << 9) | // *3 squelch = close delay .. 0 ~ 3
|
||||
SquelchOpenGlitchThresh); // 0 ~ 255
|
||||
#else
|
||||
// faster (but twitchier)
|
||||
(1u << 14) | // 1 ???
|
||||
SquelchOpenGlitchThresh); // 0 ~ 255
|
||||
(1u << 14) | // 1 ???
|
||||
(2u << 11) | // *5 squelch = open delay .. 0 ~ 7
|
||||
(1u << 9) | // *3 squelch = close delay .. 0 ~ 3
|
||||
SquelchOpenGlitchThresh); // 0 ~ 255
|
||||
#endif
|
||||
|
||||
// REG_4F
|
||||
//
|
||||
// <14:8> 47 Ex-noise threshold for Squelch = 0
|
||||
// <14:8> 47 Ex-noise threshold for Squelch = close
|
||||
// 0 ~ 127
|
||||
//
|
||||
// <7> ???
|
||||
//
|
||||
// <6:0> 46 Ex-noise threshold for Squelch = 1
|
||||
// <6:0> 46 Ex-noise threshold for Squelch = open
|
||||
// 0 ~ 127
|
||||
//
|
||||
BK4819_WriteRegister(BK4819_REG_4F, ((uint16_t)SquelchCloseNoiseThresh << 8) | SquelchOpenNoiseThresh);
|
||||
|
||||
// REG_78
|
||||
//
|
||||
// <15:8> 72 RSSI threshold for Squelch = 1 0.5dB/step
|
||||
// <15:8> 72 RSSI threshold for Squelch = open 0.5dB/step
|
||||
//
|
||||
// <7:0> 70 RSSI threshold for Squelch = 0 0.5dB/step
|
||||
// <7:0> 70 RSSI threshold for Squelch = close 0.5dB/step
|
||||
//
|
||||
BK4819_WriteRegister(BK4819_REG_78, ((uint16_t)SquelchOpenRSSIThresh << 8) | SquelchCloseRSSIThresh);
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
14
init.c
14
init.c
@ -30,21 +30,17 @@ void DATA_Init(void);
|
||||
void BSS_Init(void)
|
||||
{
|
||||
uint32_t *pBss;
|
||||
|
||||
for (pBss = __bss_start__; pBss < __bss_end__; pBss++) {
|
||||
for (pBss = __bss_start__; pBss < __bss_end__; pBss++)
|
||||
*pBss = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DATA_Init(void)
|
||||
{
|
||||
volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start;
|
||||
volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start;
|
||||
volatile uint32_t *pDataFlash = (volatile uint32_t *)flash_data_start;
|
||||
uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
|
||||
uint32_t i;
|
||||
uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < Size / 4; i++) {
|
||||
for (i = 0; i < (Size / 4); i++)
|
||||
*pDataRam++ = *pDataFlash++;
|
||||
}
|
||||
}
|
||||
|
||||
|
63
radio.c
63
radio.c
@ -426,8 +426,13 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
{
|
||||
uint8_t Txp[3];
|
||||
FREQUENCY_Band_t Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
|
||||
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
||||
FREQUENCY_Band_t Band;
|
||||
|
||||
// *******************************
|
||||
// squelch
|
||||
|
||||
Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
|
||||
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
||||
|
||||
if (gEeprom.SQUELCH_LEVEL == 0)
|
||||
{ // squelch == 0 (off)
|
||||
@ -441,7 +446,7 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
}
|
||||
else
|
||||
{ // squelch >= 1
|
||||
Base += gEeprom.SQUELCH_LEVEL; // my squelch-1
|
||||
Base += gEeprom.SQUELCH_LEVEL; // my eeprom squelch-1
|
||||
// VHF UHF
|
||||
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
|
||||
EEPROM_ReadBuffer(Base + 0x10, &pInfo->SquelchCloseRSSIThresh, 1); // 40 5
|
||||
@ -467,40 +472,35 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
|
||||
|
||||
#if 0
|
||||
rssi_open = (rssi_open * 8) / 9;
|
||||
rssi_close = (rssi_close * 8) / 9;
|
||||
|
||||
noise_open = (noise_open * 9) / 8;
|
||||
noise_close = (noise_close * 9) / 8;
|
||||
|
||||
glitch_open = (glitch_open * 9) / 8;
|
||||
glitch_close = (glitch_close * 9) / 8;
|
||||
rssi_open = (rssi_open * 8) / 9;
|
||||
noise_open = (noise_open * 9) / 8;
|
||||
glitch_open = (glitch_open * 9) / 8;
|
||||
#else
|
||||
// even more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
||||
|
||||
rssi_open = (rssi_open * 1) / 2;
|
||||
rssi_close = (rssi_close * 1) / 2;
|
||||
|
||||
noise_open = (noise_open * 2) / 1;
|
||||
noise_close = (noise_close * 2) / 1;
|
||||
|
||||
glitch_open = (glitch_open * 2) / 1;
|
||||
glitch_close = (glitch_close * 2) / 1;
|
||||
rssi_open = (rssi_open * 1) / 2;
|
||||
noise_open = (noise_open * 2) / 1;
|
||||
glitch_open = (glitch_open * 2) / 1;
|
||||
#endif
|
||||
|
||||
#else
|
||||
// more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
||||
|
||||
rssi_open = (rssi_open * 3) / 4;
|
||||
rssi_close = (rssi_close * 3) / 4;
|
||||
|
||||
noise_open = (noise_open * 4) / 3;
|
||||
noise_close = (noise_close * 4) / 3;
|
||||
|
||||
glitch_open = (glitch_open * 4) / 3;
|
||||
glitch_close = (glitch_close * 4) / 3;
|
||||
rssi_open = (rssi_open * 3) / 4;
|
||||
noise_open = (noise_open * 4) / 3;
|
||||
glitch_open = (glitch_open * 4) / 3;
|
||||
#endif
|
||||
|
||||
rssi_close = (rssi_open * 9) / 10;
|
||||
noise_close = (noise_open * 10) / 9;
|
||||
glitch_close = (glitch_open * 10) / 9;
|
||||
|
||||
// ensure the 'close' threshold is lower than the 'open' threshold
|
||||
if (rssi_close == rssi_open && rssi_close > 0)
|
||||
rssi_close--;
|
||||
if (noise_close == noise_open && noise_close < 127)
|
||||
noise_close++;
|
||||
if (glitch_close == glitch_open && glitch_close < 255)
|
||||
glitch_close++;
|
||||
|
||||
pInfo->SquelchOpenRSSIThresh = (rssi_open > 255) ? 255 : rssi_open;
|
||||
pInfo->SquelchCloseRSSIThresh = (rssi_close > 255) ? 255 : rssi_close;
|
||||
pInfo->SquelchOpenNoiseThresh = (noise_open > 127) ? 127 : noise_open;
|
||||
@ -509,6 +509,9 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
pInfo->SquelchCloseGlitchThresh = (glitch_close > 255) ? 255 : glitch_close;
|
||||
}
|
||||
|
||||
// *******************************
|
||||
// output power
|
||||
|
||||
Band = FREQUENCY_GetBand(pInfo->pTX->Frequency);
|
||||
|
||||
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (pInfo->OUTPUT_POWER * 3), Txp, 3);
|
||||
@ -521,6 +524,8 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
(frequencyBandTable[Band].lower + frequencyBandTable[Band].upper) / 2,
|
||||
frequencyBandTable[Band].upper,
|
||||
pInfo->pTX->Frequency);
|
||||
|
||||
// *******************************
|
||||
}
|
||||
|
||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||
|
@ -16,13 +16,12 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "driver/keyboard.h"
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
char gInputBox[8];
|
||||
uint8_t gInputBoxIndex;
|
||||
|
||||
void INPUTBOX_Append(const char Digit)
|
||||
void INPUTBOX_Append(const KEY_Code_t Digit)
|
||||
{
|
||||
if (gInputBoxIndex >= sizeof(gInputBox))
|
||||
return;
|
||||
@ -30,6 +29,7 @@ void INPUTBOX_Append(const char Digit)
|
||||
if (gInputBoxIndex == 0)
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
|
||||
gInputBox[gInputBoxIndex++] = Digit - KEY_0;
|
||||
if (Digit >= KEY_0 && Digit != KEY_INVALID)
|
||||
gInputBox[gInputBoxIndex++] = (char)(Digit - KEY_0);
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
extern char gInputBox[8];
|
||||
extern uint8_t gInputBoxIndex;
|
||||
|
||||
void INPUTBOX_Append(const char Digit);
|
||||
void INPUTBOX_Append(const KEY_Code_t Digit);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user