mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
Added freq cal menu option (hidden) + 8.33kHz step bug fix
This commit is contained in:
parent
43b9c0944a
commit
eb7dcceaab
35
app/app.c
35
app/app.c
@ -475,14 +475,29 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
||||
|
||||
void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
|
||||
{
|
||||
uint32_t Frequency = pInfo->ConfigRX.Frequency + (Step * pInfo->StepFrequency);
|
||||
uint32_t Frequency;
|
||||
|
||||
Frequency = pInfo->ConfigRX.Frequency + (Step * pInfo->StepFrequency);
|
||||
|
||||
if (pInfo->StepFrequency == 833)
|
||||
{
|
||||
const uint32_t Lower = LowerLimitFrequencyBandTable[pInfo->Band];
|
||||
const uint32_t Delta = Frequency - Lower;
|
||||
uint32_t Base = (Delta / 2500) * 2500;
|
||||
const uint32_t Index = ((Delta - Base) % 2500) / 833;
|
||||
|
||||
if (Index == 2)
|
||||
Base++;
|
||||
|
||||
Frequency = Lower + Base + (Index * 833);
|
||||
}
|
||||
|
||||
if (Frequency < LowerLimitFrequencyBandTable[pInfo->Band])
|
||||
Frequency = FREQUENCY_FloorToStep(UpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, LowerLimitFrequencyBandTable[pInfo->Band]);
|
||||
else
|
||||
if (Frequency > UpperLimitFrequencyBandTable[pInfo->Band])
|
||||
Frequency = LowerLimitFrequencyBandTable[pInfo->Band];
|
||||
|
||||
pInfo->ConfigRX.Frequency = LowerLimitFrequencyBandTable[pInfo->Band];
|
||||
else
|
||||
if (Frequency < LowerLimitFrequencyBandTable[pInfo->Band])
|
||||
pInfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(UpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, LowerLimitFrequencyBandTable[pInfo->Band]);
|
||||
else
|
||||
pInfo->ConfigRX.Frequency = Frequency;
|
||||
}
|
||||
|
||||
@ -614,6 +629,14 @@ void APP_CheckRadioInterrupts(void)
|
||||
// fetch the interrupt status bits
|
||||
interrupt_status_bits = BK4819_ReadRegister(BK4819_REG_02);
|
||||
|
||||
// 0 = no phase shift
|
||||
// 1 = 120deg phase shift
|
||||
// 2 = 180deg phase shift
|
||||
// 3 = 240deg phase shift
|
||||
// const uint8_t ctcss_shift = BK4819_GetCTCShift();
|
||||
// if (ctcss_shift > 0)
|
||||
// g_CTCSS_Lost = true;
|
||||
|
||||
if (interrupt_status_bits & BK4819_REG_02_DTMF_5TONE_FOUND)
|
||||
{
|
||||
gDTMF_RequestPending = true;
|
||||
|
69
app/menu.c
69
app/menu.c
@ -24,6 +24,8 @@
|
||||
#include "board.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "driver/backlight.h"
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/eeprom.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "frequencies.h"
|
||||
@ -61,9 +63,9 @@
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_BEEP_PROMPT,
|
||||
VOICE_ID_TRANSMIT_OVER_TIME,
|
||||
// #ifdef ENABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
VOICE_ID_VOICE_PROMPT,
|
||||
// #endif
|
||||
#endif
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
@ -72,6 +74,9 @@
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
#ifdef ENABLE_COMPANDER
|
||||
VOICE_ID_INVALID,
|
||||
#endif
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
@ -98,11 +103,16 @@
|
||||
#endif
|
||||
VOICE_ID_DELETE_CHANNEL,
|
||||
VOICE_ID_INITIALISATION,
|
||||
|
||||
// hidden items
|
||||
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
VOICE_ID_INVALID,
|
||||
|
||||
VOICE_ID_INVALID
|
||||
};
|
||||
#endif
|
||||
@ -127,7 +137,7 @@ void MENU_StopCssScan(void)
|
||||
RADIO_SetupRegisters(true);
|
||||
}
|
||||
|
||||
int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax)
|
||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
{
|
||||
switch (Cursor)
|
||||
{
|
||||
@ -305,6 +315,11 @@ int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax)
|
||||
*pMax = 16;
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
*pMin = -1000;
|
||||
*pMax = +1000;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@ -314,8 +329,8 @@ int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax)
|
||||
|
||||
void MENU_AcceptSetting(void)
|
||||
{
|
||||
uint8_t Min;
|
||||
uint8_t Max;
|
||||
int32_t Min;
|
||||
int32_t Max;
|
||||
uint8_t Code;
|
||||
FREQ_Config_t *pConfig = &gTxVfo->ConfigRX;
|
||||
|
||||
@ -657,6 +672,27 @@ void MENU_AcceptSetting(void)
|
||||
gFlagReconfigureVfos = true;
|
||||
return;
|
||||
|
||||
case MENU_F_CALI:
|
||||
gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection;
|
||||
BK4819_WriteRegister(BK4819_REG_3B, 22656 + gEeprom.BK4819_XTAL_FREQ_LOW);
|
||||
{
|
||||
struct
|
||||
{
|
||||
int16_t BK4819_XtalFreqLow;
|
||||
uint16_t EEPROM_1F8A;
|
||||
uint16_t EEPROM_1F8C;
|
||||
uint8_t VOLUME_GAIN;
|
||||
uint8_t DAC_GAIN;
|
||||
} __attribute__((packed)) Misc;
|
||||
|
||||
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
||||
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
||||
EEPROM_ReadBuffer(0x1F88, &Misc, 8);
|
||||
Misc.BK4819_XtalFreqLow = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
EEPROM_WriteBuffer(0x1F88, &Misc);
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -666,13 +702,14 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
void MENU_SelectNextCode(void)
|
||||
{
|
||||
uint8_t UpperLimit;
|
||||
int32_t UpperLimit;
|
||||
|
||||
if (gMenuCursor == MENU_R_DCS)
|
||||
UpperLimit = 208;
|
||||
//UpperLimit = ARRAY_SIZE(DCS_Options);
|
||||
else
|
||||
if (gMenuCursor == MENU_R_CTCS)
|
||||
UpperLimit = 50;
|
||||
UpperLimit = ARRAY_SIZE(CTCSS_Options) - 1;
|
||||
else
|
||||
return;
|
||||
|
||||
@ -707,11 +744,11 @@ void MENU_SelectNextCode(void)
|
||||
|
||||
static void MENU_ClampSelection(int8_t Direction)
|
||||
{
|
||||
uint8_t Min;
|
||||
uint8_t Max;
|
||||
int32_t Min;
|
||||
int32_t Max;
|
||||
if (!MENU_GetLimits(gMenuCursor, &Min, &Max))
|
||||
{
|
||||
uint8_t Selection = gSubMenuSelection;
|
||||
int32_t Selection = gSubMenuSelection;
|
||||
if (Selection < Min) Selection = Min;
|
||||
else
|
||||
if (Selection > Max) Selection = Max;
|
||||
@ -976,6 +1013,10 @@ void MENU_ShowCurrentSetting(void)
|
||||
case MENU_SCREN:
|
||||
gSubMenuSelection = gSetting_ScrambleEnable;
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1073,8 +1114,8 @@ static void MENU_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t Min;
|
||||
uint8_t Max;
|
||||
int32_t Min;
|
||||
int32_t Max;
|
||||
|
||||
if (!MENU_GetLimits(gMenuCursor, &Min, &Max))
|
||||
{
|
||||
@ -1322,12 +1363,16 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
case MENU_1_CALL:
|
||||
bCheckScanList = false;
|
||||
break;
|
||||
|
||||
case MENU_SLIST2:
|
||||
VFO = 1;
|
||||
|
||||
// Fallthrough
|
||||
|
||||
case MENU_SLIST1:
|
||||
bCheckScanList = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
MENU_ClampSelection(Direction);
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax);
|
||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax);
|
||||
void MENU_AcceptSetting(void);
|
||||
void MENU_SelectNextCode(void);
|
||||
void MENU_ShowCurrentSetting(void);
|
||||
|
12
board.c
12
board.c
@ -568,6 +568,7 @@ void BOARD_EEPROM_LoadMoreSettings(void)
|
||||
//gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15;
|
||||
gEeprom.MIC_SENSITIVITY_TUNING = gMicGain_dB2[gEeprom.MIC_SENSITIVITY];
|
||||
|
||||
{
|
||||
struct
|
||||
{
|
||||
int16_t BK4819_XtalFreqLow;
|
||||
@ -575,18 +576,21 @@ void BOARD_EEPROM_LoadMoreSettings(void)
|
||||
uint16_t EEPROM_1F8C;
|
||||
uint8_t VOLUME_GAIN;
|
||||
uint8_t DAC_GAIN;
|
||||
} Misc;
|
||||
} __attribute__((packed)) Misc;
|
||||
|
||||
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
||||
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
||||
EEPROM_ReadBuffer(0x1F88, &Misc, 8);
|
||||
gEeprom.BK4819_XTAL_FREQ_LOW = ((Misc.BK4819_XtalFreqLow + 1000) < 2000) ? Misc.BK4819_XtalFreqLow : 0;
|
||||
|
||||
gEeprom.BK4819_XTAL_FREQ_LOW = (Misc.BK4819_XtalFreqLow >= -1000 && Misc.BK4819_XtalFreqLow <= 1000) ? Misc.BK4819_XtalFreqLow : 0;
|
||||
gEEPROM_1F8A = Misc.EEPROM_1F8A & 0x01FF;
|
||||
gEEPROM_1F8C = Misc.EEPROM_1F8C & 0x01FF;
|
||||
|
||||
gEeprom.VOLUME_GAIN = (Misc.VOLUME_GAIN < 64) ? Misc.VOLUME_GAIN : 58;
|
||||
gEeprom.DAC_GAIN = (Misc.DAC_GAIN < 16) ? Misc.DAC_GAIN : 8;
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_3B, gEeprom.BK4819_XTAL_FREQ_LOW + 22656);
|
||||
BK4819_WriteRegister(BK4819_REG_3B, 22656 + gEeprom.BK4819_XTAL_FREQ_LOW);
|
||||
// BK4819_WriteRegister(BK4819_REG_3C, gEeprom.BK4819_XTAL_FREQ_HIGH);
|
||||
}
|
||||
}
|
||||
|
||||
void BOARD_FactoryReset(bool bIsAll)
|
||||
|
@ -1028,12 +1028,17 @@ uint8_t BK4819_GetDTMF_5TONE_Code(void)
|
||||
|
||||
uint8_t BK4819_GetCDCSSCodeType(void)
|
||||
{
|
||||
return (BK4819_ReadRegister(BK4819_REG_0C) >> 14) & 3;
|
||||
return (BK4819_ReadRegister(BK4819_REG_0C) >> 14) & 3u;
|
||||
}
|
||||
|
||||
uint8_t BK4819_GetCTCShift(void)
|
||||
{
|
||||
return (BK4819_ReadRegister(BK4819_REG_0C) >> 12) & 3u;
|
||||
}
|
||||
|
||||
uint8_t BK4819_GetCTCType(void)
|
||||
{
|
||||
return (BK4819_ReadRegister(BK4819_REG_0C) >> 10) & 3;
|
||||
return (BK4819_ReadRegister(BK4819_REG_0C) >> 10) & 3u;
|
||||
}
|
||||
|
||||
void BK4819_SendFSKData(uint16_t *pData)
|
||||
|
@ -137,6 +137,7 @@ void BK4819_StopScan(void);
|
||||
uint8_t BK4819_GetDTMF_5TONE_Code(void);
|
||||
|
||||
uint8_t BK4819_GetCDCSSCodeType(void);
|
||||
uint8_t BK4819_GetCTCShift(void);
|
||||
uint8_t BK4819_GetCTCType(void);
|
||||
|
||||
void BK4819_SendFSKData(uint16_t *pData);
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -148,7 +148,22 @@ uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t T
|
||||
|
||||
uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower)
|
||||
{
|
||||
const uint32_t Index = (Upper - Lower) / Step;
|
||||
uint32_t Index;
|
||||
|
||||
if (Step == 833)
|
||||
{
|
||||
const uint32_t Delta = Upper - Lower;
|
||||
uint32_t Base = (Delta / 2500) * 2500;
|
||||
const uint32_t Index = ((Delta - Base) % 2500) / 833;
|
||||
|
||||
if (Index == 2)
|
||||
Base++;
|
||||
|
||||
return Lower + Base + (Index * 833);
|
||||
}
|
||||
|
||||
Index = (Upper - Lower) / Step;
|
||||
|
||||
return Lower + (Step * Index);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,8 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
||||
{
|
||||
if (Mode == BOOT_MODE_F_LOCK)
|
||||
{
|
||||
gMenuListCount += 6; // enable the last 6 menu items
|
||||
//gMenuListCount += 6; // enable the last 6 menu items
|
||||
gMenuListCount += 7; // enable the last 7 menu items
|
||||
gMenuCursor = MENU_350TX;
|
||||
gSubMenuSelection = gSetting_350TX;
|
||||
GUI_SelectNextDisplay(DISPLAY_MENU);
|
||||
|
3
main.c
3
main.c
@ -116,7 +116,8 @@ void Main(void)
|
||||
// count the number of menu list items
|
||||
while (MenuList[gMenuListCount][0] != 0)
|
||||
gMenuListCount++;
|
||||
gMenuListCount -= 6;
|
||||
//gMenuListCount -= 6;
|
||||
gMenuListCount -= 7;
|
||||
|
||||
UI_DisplayWelcome();
|
||||
BACKLIGHT_TurnOn();
|
||||
|
7
misc.c
7
misc.c
@ -216,12 +216,15 @@ void NUMBER_ToDigits(uint32_t Value, char *pDigits)
|
||||
pDigits[8] = 0;
|
||||
}
|
||||
|
||||
uint8_t NUMBER_AddWithWraparound(uint8_t Base, int8_t Add, uint8_t LowerLimit, uint8_t UpperLimit)
|
||||
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit)
|
||||
{
|
||||
Base += Add;
|
||||
if (Base == 0xFF || Base < LowerLimit)
|
||||
|
||||
if (Base == 0x7fffffff || Base < LowerLimit)
|
||||
return UpperLimit;
|
||||
|
||||
if (Base > UpperLimit)
|
||||
return LowerLimit;
|
||||
|
||||
return Base;
|
||||
}
|
||||
|
2
misc.h
2
misc.h
@ -239,7 +239,7 @@ extern uint8_t gIsLocked;
|
||||
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger);
|
||||
void NUMBER_ToDigits(uint32_t Value, char *pDigits);
|
||||
uint8_t NUMBER_AddWithWraparound(uint8_t Base, int8_t Add, uint8_t LowerLimit, uint8_t UpperLimit);
|
||||
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit);
|
||||
|
||||
#endif
|
||||
|
||||
|
56
ui/menu.c
56
ui/menu.c
@ -15,10 +15,12 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h> // abs()
|
||||
|
||||
#include "app/dtmf.h"
|
||||
#include "bitmaps.h"
|
||||
#include "dcs.h"
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/eeprom.h" // EEPROM_ReadBuffer()
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
@ -108,6 +110,8 @@ const char MenuList[][7] =
|
||||
"350-EN", // was "350EN"
|
||||
"SCR-EN", // was "SCREN"
|
||||
|
||||
"F-CALI", // reference xtal calibration
|
||||
|
||||
"" // end of list
|
||||
};
|
||||
|
||||
@ -244,7 +248,7 @@ const char gSubMenu_F_LOCK[6][4] =
|
||||
bool gIsInSubMenu;
|
||||
uint8_t gMenuCursor;
|
||||
int8_t gMenuScrollDirection;
|
||||
uint32_t gSubMenuSelection;
|
||||
int32_t gSubMenuSelection;
|
||||
|
||||
void UI_DisplayMenu(void)
|
||||
{
|
||||
@ -255,7 +259,7 @@ void UI_DisplayMenu(void)
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (gMenuCursor || i)
|
||||
if (gMenuCursor > 0 || i > 0)
|
||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||
UI_PrintString(MenuList[gMenuCursor + i - 1], 0, 0, i * 2, 8);
|
||||
|
||||
@ -274,7 +278,7 @@ void UI_DisplayMenu(void)
|
||||
gFrameBuffer[i][49] = 0xFF;
|
||||
}
|
||||
#else
|
||||
// a nicer less intense thinner dotted line
|
||||
// a less intense thinner dotted line
|
||||
for (i = 0; i < 6; i++)
|
||||
gFrameBuffer[i][49] = 0xAA;
|
||||
#endif
|
||||
@ -283,7 +287,7 @@ void UI_DisplayMenu(void)
|
||||
NUMBER_ToDigits(1 + gMenuCursor, String);
|
||||
UI_DisplaySmallDigits(2, String + 6, 33, 6, false);
|
||||
#else
|
||||
sprintf(String, "%2u.%u", 1u + gMenuCursor, gMenuListCount);
|
||||
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
|
||||
UI_PrintStringSmall(String, 8, 0, 6);
|
||||
#endif
|
||||
|
||||
@ -295,7 +299,7 @@ void UI_DisplayMenu(void)
|
||||
switch (gMenuCursor)
|
||||
{
|
||||
case MENU_SQL:
|
||||
sprintf(String, "%u", gSubMenuSelection);
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_MIC:
|
||||
@ -306,7 +310,7 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_STEP:
|
||||
sprintf(String, "%u.%02uKHz", StepFrequencyTable[gSubMenuSelection] / 100, StepFrequencyTable[gSubMenuSelection] % 100);
|
||||
sprintf(String, "%d.%02uKHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
|
||||
break;
|
||||
|
||||
case MENU_TXP:
|
||||
@ -339,7 +343,7 @@ void UI_DisplayMenu(void)
|
||||
case MENU_OFFSET:
|
||||
if (!gIsInSubMenu || gInputBoxIndex == 0)
|
||||
{
|
||||
sprintf(String, "%u.%05u", gSubMenuSelection / 100000, gSubMenuSelection % 100000);
|
||||
sprintf(String, "%d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -365,7 +369,7 @@ void UI_DisplayMenu(void)
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%u", gSubMenuSelection);
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_ABR:
|
||||
@ -374,7 +378,7 @@ void UI_DisplayMenu(void)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
if (gSubMenuSelection < 5)
|
||||
sprintf(String, "%u sec", gSubMenuSelection * 10);
|
||||
sprintf(String, "%d sec", gSubMenuSelection * 10);
|
||||
else
|
||||
strcpy(String, "ON");
|
||||
#else
|
||||
@ -423,10 +427,7 @@ void UI_DisplayMenu(void)
|
||||
case MENU_MEM_CH:
|
||||
case MENU_1_CALL:
|
||||
case MENU_DEL_CH:
|
||||
UI_GenerateChannelStringEx(
|
||||
String,
|
||||
RADIO_CheckValidChannel((uint16_t)gSubMenuSelection, false, 0),
|
||||
(uint8_t)gSubMenuSelection);
|
||||
UI_GenerateChannelStringEx(String, RADIO_CheckValidChannel(gSubMenuSelection, false, 0), gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_SAVE:
|
||||
@ -442,7 +443,7 @@ void UI_DisplayMenu(void)
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%umin", gSubMenuSelection);
|
||||
sprintf(String, "%dmin", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@ -463,7 +464,7 @@ void UI_DisplayMenu(void)
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%u*100ms", gSubMenuSelection);
|
||||
sprintf(String, "%d*100ms", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_S_LIST:
|
||||
@ -493,11 +494,11 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_D_HOLD:
|
||||
sprintf(String, "%us", gSubMenuSelection);
|
||||
sprintf(String, "%ds", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_D_PRE:
|
||||
sprintf(String, "%u*10ms", gSubMenuSelection);
|
||||
sprintf(String, "%d*10ms", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_PTT_ID:
|
||||
@ -531,6 +532,22 @@ void UI_DisplayMenu(void)
|
||||
case MENU_F_LOCK:
|
||||
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_F_CALI:
|
||||
{
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
UI_PrintString(String, 50, 127, 1, 8);
|
||||
|
||||
const uint32_t value = 22656 + gSubMenuSelection;
|
||||
//gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection;
|
||||
BK4819_WriteRegister(BK4819_REG_3B, value);
|
||||
|
||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||
sprintf(String, "%u.%06u", xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
UI_PrintString(String, 50, 127, 3, 8);
|
||||
UI_PrintString("MHz", 50, 127, 5, 8);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_AM)
|
||||
@ -565,6 +582,7 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString("MHz", 50, 127, 3, 8);
|
||||
}
|
||||
else
|
||||
if (gMenuCursor != MENU_F_CALI)
|
||||
{
|
||||
UI_PrintString(String, 50, 127, 2, 8);
|
||||
}
|
||||
@ -631,7 +649,7 @@ void UI_DisplayMenu(void)
|
||||
gMenuCursor == MENU_D_LIST)
|
||||
{
|
||||
unsigned int Offset;
|
||||
NUMBER_ToDigits((uint8_t)gSubMenuSelection, String);
|
||||
NUMBER_ToDigits(gSubMenuSelection, String);
|
||||
Offset = (gMenuCursor == MENU_D_LIST) ? 2 : 3;
|
||||
UI_DisplaySmallDigits(Offset, String + (8 - Offset), 105, 0, false);
|
||||
}
|
||||
@ -643,7 +661,7 @@ void UI_DisplayMenu(void)
|
||||
if (gSubMenuSelection == 0xFF)
|
||||
strcpy(String, "NULL");
|
||||
else
|
||||
UI_GenerateChannelStringEx(String, true, (uint8_t)gSubMenuSelection);
|
||||
UI_GenerateChannelStringEx(String, true, gSubMenuSelection);
|
||||
|
||||
if (gSubMenuSelection == 0xFF || !gEeprom.SCAN_LIST_ENABLED[i])
|
||||
{
|
||||
|
10
ui/menu.h
10
ui/menu.h
@ -82,12 +82,17 @@ enum
|
||||
#endif
|
||||
MENU_DEL_CH,
|
||||
MENU_RESET,
|
||||
|
||||
// items after here are normally hidden
|
||||
|
||||
MENU_350TX,
|
||||
MENU_F_LOCK,
|
||||
MENU_200TX,
|
||||
MENU_500TX,
|
||||
MENU_350EN,
|
||||
MENU_SCREN
|
||||
MENU_SCREN,
|
||||
|
||||
MENU_F_CALI // reference xtal calibration
|
||||
};
|
||||
|
||||
extern const char MenuList[][7];
|
||||
@ -121,9 +126,8 @@ extern bool gIsInSubMenu;
|
||||
|
||||
extern uint8_t gMenuCursor;
|
||||
extern int8_t gMenuScrollDirection;
|
||||
extern uint32_t gSubMenuSelection;
|
||||
extern int32_t gSubMenuSelection;
|
||||
|
||||
void UI_DisplayMenu(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user