0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 06:11:24 +03:00

Fixed compander setting, .bat typo and started menulist unify

This commit is contained in:
OneOfEleven 2023-09-21 08:46:24 +01:00
parent 417fe617df
commit 653a00b89d
12 changed files with 244 additions and 314 deletions

View File

@ -46,88 +46,6 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
#ifdef ENABLE_VOICE
static const VOICE_ID_t MenuVoices[] =
{
VOICE_ID_SQUELCH, // SQL
VOICE_ID_FREQUENCY_STEP, // STEP
VOICE_ID_POWER, // T-PWR
VOICE_ID_DCS, // R-DCS
VOICE_ID_CTCSS, // R-CTCS
VOICE_ID_DCS, // T-DCS
VOICE_ID_CTCSS, // T-CTCS
VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, // T-DIR
VOICE_ID_TX_OFFSET_FREQUENCY, // T-OFFS
VOICE_ID_INVALID, // T-VFO
VOICE_ID_TRANSMIT_OVER_TIME, // T-TOUT
VOICE_ID_CHANNEL_BANDWIDTH, // W/N
VOICE_ID_SCRAMBLER_ON, // SCRAM
VOICE_ID_BUSY_LOCKOUT, // BUSYCL
VOICE_ID_MEMORY_CHANNEL, // CH-SAV
VOICE_ID_DELETE_CHANNEL, // CH-DEL
VOICE_ID_INVALID, // CH-EDIT
VOICE_ID_INVALID, // CH-DIS
VOICE_ID_SAVE_MODE, // BATSAV
VOICE_ID_VOX, // VOX
VOICE_ID_INVALID, // BACKLT
VOICE_ID_DUAL_STANDBY, // DUALRX
VOICE_ID_BEEP_PROMPT, // BEEP
#ifdef ENABLE_VOICE
VOICE_ID_VOICE_PROMPT, // VOICE
#endif
VOICE_ID_INVALID, // SC-REV
VOICE_ID_INVALID, // KEYLOC
VOICE_ID_INVALID, // S-ADD1
VOICE_ID_INVALID, // S-ADD2
VOICE_ID_INVALID, // STE
VOICE_ID_INVALID, // RP-STE
VOICE_ID_INVALID, // MIC
VOICE_ID_INVALID, // MICBAR
#ifdef ENABLE_COMPANDER
VOICE_ID_INVALID, // COMPND
#endif
VOICE_ID_INVALID, // 1-CALL
VOICE_ID_INVALID, // SLIST
VOICE_ID_INVALID, // SLIST1
VOICE_ID_INVALID, // SLIST2
#ifdef ENABLE_ALARM
VOICE_ID_INVALID, // AL-MOD
#endif
VOICE_ID_ANI_CODE, // ANI-ID
VOICE_ID_INVALID, // UPCODE
VOICE_ID_INVALID, // DWCODE
VOICE_ID_INVALID, // D-ST
VOICE_ID_INVALID, // D-RSP
VOICE_ID_INVALID, // D-HOLD
VOICE_ID_INVALID, // D-PRE
VOICE_ID_INVALID, // PTT-ID
VOICE_ID_INVALID, // D-DCD
VOICE_ID_INVALID, // D-LIST
VOICE_ID_INVALID, // D-LIVE
VOICE_ID_INVALID, // PONMSG
VOICE_ID_INVALID, // ROGER
VOICE_ID_INVALID, // BATVOL
VOICE_ID_INVALID, // BATTXT
VOICE_ID_INVALID, // MODE
#ifdef ENABLE_NOAA
VOICE_ID_INVALID, // NOAA-S
#endif
VOICE_ID_INITIALISATION, // RESET
// hidden items
VOICE_ID_INVALID, // F-LOCK
VOICE_ID_INVALID, // TX-200
VOICE_ID_INVALID, // TX-350
VOICE_ID_INVALID, // TX-500
VOICE_ID_INVALID, // 350-EN
VOICE_ID_INVALID, // SCR-EN
VOICE_ID_INVALID, // TX-EN
VOICE_ID_INVALID // F-CALI
};
#endif
void MENU_StartCssScan(int8_t Direction)
{
gCssScanMode = CSS_SCAN_MODE_SCANNING;
@ -1329,7 +1247,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
{
#ifdef ENABLE_VOICE
if (gMenuCursor != MENU_SCR)
gAnotherVoiceID = MenuVoices[gMenuCursor];
gAnotherVoiceID = MenuList[gMenuCursor].voice_id;
#endif
#if 1

180
audio.h
View File

@ -37,98 +37,97 @@ extern BEEP_Type_t gBeepToPlay;
void AUDIO_PlayBeep(BEEP_Type_t Beep);
#ifdef ENABLE_VOICE
enum
{
VOICE_ID_CHI_BASE = 0x10U,
VOICE_ID_ENG_BASE = 0x60U,
};
enum
{
VOICE_ID_CHI_BASE = 0x10U,
VOICE_ID_ENG_BASE = 0x60U,
};
enum VOICE_ID_t
{
VOICE_ID_0 = 0x00U,
VOICE_ID_1 = 0x01U,
VOICE_ID_2 = 0x02U,
VOICE_ID_3 = 0x03U,
VOICE_ID_4 = 0x04U,
VOICE_ID_5 = 0x05U,
VOICE_ID_6 = 0x06U,
VOICE_ID_7 = 0x07U,
VOICE_ID_8 = 0x08U,
VOICE_ID_9 = 0x09U,
VOICE_ID_10 = 0x0AU,
VOICE_ID_100 = 0x0BU,
VOICE_ID_WELCOME = 0x0CU,
VOICE_ID_LOCK = 0x0DU,
VOICE_ID_UNLOCK = 0x0EU,
VOICE_ID_SCANNING_BEGIN = 0x0FU,
VOICE_ID_SCANNING_STOP = 0x10U,
VOICE_ID_SCRAMBLER_ON = 0x11U,
VOICE_ID_SCRAMBLER_OFF = 0x12U,
VOICE_ID_FUNCTION = 0x13U,
VOICE_ID_CTCSS = 0x14U,
VOICE_ID_DCS = 0x15U,
VOICE_ID_POWER = 0x16U,
VOICE_ID_SAVE_MODE = 0x17U,
VOICE_ID_MEMORY_CHANNEL = 0x18U,
VOICE_ID_DELETE_CHANNEL = 0x19U,
VOICE_ID_FREQUENCY_STEP = 0x1AU,
VOICE_ID_SQUELCH = 0x1BU,
VOICE_ID_TRANSMIT_OVER_TIME = 0x1CU,
VOICE_ID_BACKLIGHT_SELECTION = 0x1DU,
VOICE_ID_VOX = 0x1EU,
VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION = 0x1FU,
VOICE_ID_TX_OFFSET_FREQUENCY = 0x20U,
VOICE_ID_TRANSMITING_MEMORY = 0x21U,
VOICE_ID_RECEIVING_MEMORY = 0x22U,
VOICE_ID_EMERGENCY_CALL = 0x23U,
VOICE_ID_LOW_VOLTAGE = 0x24U,
VOICE_ID_CHANNEL_MODE = 0x25U,
VOICE_ID_FREQUENCY_MODE = 0x26U,
VOICE_ID_VOICE_PROMPT = 0x27U,
VOICE_ID_BAND_SELECTION = 0x28U,
VOICE_ID_DUAL_STANDBY = 0x29U,
VOICE_ID_CHANNEL_BANDWIDTH = 0x2AU,
VOICE_ID_OPTIONAL_SIGNAL = 0x2BU,
VOICE_ID_MUTE_MODE = 0x2CU,
VOICE_ID_BUSY_LOCKOUT = 0x2DU,
VOICE_ID_BEEP_PROMPT = 0x2EU,
VOICE_ID_ANI_CODE = 0x2FU,
VOICE_ID_INITIALISATION = 0x30U,
VOICE_ID_CONFIRM = 0x31U,
VOICE_ID_CANCEL = 0x32U,
VOICE_ID_ON = 0x33U,
VOICE_ID_OFF = 0x34U,
VOICE_ID_2_TONE = 0x35U,
VOICE_ID_5_TONE = 0x36U,
VOICE_ID_DIGITAL_SIGNAL = 0x37U,
VOICE_ID_REPEATER = 0x38U,
VOICE_ID_MENU = 0x39U,
VOICE_ID_11 = 0x3AU,
VOICE_ID_12 = 0x3BU,
VOICE_ID_13 = 0x3CU,
VOICE_ID_14 = 0x3DU,
VOICE_ID_15 = 0x3EU,
VOICE_ID_16 = 0x3FU,
VOICE_ID_17 = 0x40U,
VOICE_ID_18 = 0x41U,
VOICE_ID_19 = 0x42U,
VOICE_ID_20 = 0x43U,
VOICE_ID_30 = 0x44U,
VOICE_ID_40 = 0x45U,
VOICE_ID_50 = 0x46U,
VOICE_ID_60 = 0x47U,
VOICE_ID_70 = 0x48U,
VOICE_ID_80 = 0x49U,
VOICE_ID_90 = 0x4AU,
VOICE_ID_END = 0x4BU,
VOICE_ID_INVALID = 0xFFU,
};
typedef enum VOICE_ID_t VOICE_ID_t;
enum VOICE_ID_t
{
VOICE_ID_0 = 0x00U,
VOICE_ID_1 = 0x01U,
VOICE_ID_2 = 0x02U,
VOICE_ID_3 = 0x03U,
VOICE_ID_4 = 0x04U,
VOICE_ID_5 = 0x05U,
VOICE_ID_6 = 0x06U,
VOICE_ID_7 = 0x07U,
VOICE_ID_8 = 0x08U,
VOICE_ID_9 = 0x09U,
VOICE_ID_10 = 0x0AU,
VOICE_ID_100 = 0x0BU,
VOICE_ID_WELCOME = 0x0CU,
VOICE_ID_LOCK = 0x0DU,
VOICE_ID_UNLOCK = 0x0EU,
VOICE_ID_SCANNING_BEGIN = 0x0FU,
VOICE_ID_SCANNING_STOP = 0x10U,
VOICE_ID_SCRAMBLER_ON = 0x11U,
VOICE_ID_SCRAMBLER_OFF = 0x12U,
VOICE_ID_FUNCTION = 0x13U,
VOICE_ID_CTCSS = 0x14U,
VOICE_ID_DCS = 0x15U,
VOICE_ID_POWER = 0x16U,
VOICE_ID_SAVE_MODE = 0x17U,
VOICE_ID_MEMORY_CHANNEL = 0x18U,
VOICE_ID_DELETE_CHANNEL = 0x19U,
VOICE_ID_FREQUENCY_STEP = 0x1AU,
VOICE_ID_SQUELCH = 0x1BU,
VOICE_ID_TRANSMIT_OVER_TIME = 0x1CU,
VOICE_ID_BACKLIGHT_SELECTION = 0x1DU,
VOICE_ID_VOX = 0x1EU,
VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION = 0x1FU,
VOICE_ID_TX_OFFSET_FREQUENCY = 0x20U,
VOICE_ID_TRANSMITING_MEMORY = 0x21U,
VOICE_ID_RECEIVING_MEMORY = 0x22U,
VOICE_ID_EMERGENCY_CALL = 0x23U,
VOICE_ID_LOW_VOLTAGE = 0x24U,
VOICE_ID_CHANNEL_MODE = 0x25U,
VOICE_ID_FREQUENCY_MODE = 0x26U,
VOICE_ID_VOICE_PROMPT = 0x27U,
VOICE_ID_BAND_SELECTION = 0x28U,
VOICE_ID_DUAL_STANDBY = 0x29U,
VOICE_ID_CHANNEL_BANDWIDTH = 0x2AU,
VOICE_ID_OPTIONAL_SIGNAL = 0x2BU,
VOICE_ID_MUTE_MODE = 0x2CU,
VOICE_ID_BUSY_LOCKOUT = 0x2DU,
VOICE_ID_BEEP_PROMPT = 0x2EU,
VOICE_ID_ANI_CODE = 0x2FU,
VOICE_ID_INITIALISATION = 0x30U,
VOICE_ID_CONFIRM = 0x31U,
VOICE_ID_CANCEL = 0x32U,
VOICE_ID_ON = 0x33U,
VOICE_ID_OFF = 0x34U,
VOICE_ID_2_TONE = 0x35U,
VOICE_ID_5_TONE = 0x36U,
VOICE_ID_DIGITAL_SIGNAL = 0x37U,
VOICE_ID_REPEATER = 0x38U,
VOICE_ID_MENU = 0x39U,
VOICE_ID_11 = 0x3AU,
VOICE_ID_12 = 0x3BU,
VOICE_ID_13 = 0x3CU,
VOICE_ID_14 = 0x3DU,
VOICE_ID_15 = 0x3EU,
VOICE_ID_16 = 0x3FU,
VOICE_ID_17 = 0x40U,
VOICE_ID_18 = 0x41U,
VOICE_ID_19 = 0x42U,
VOICE_ID_20 = 0x43U,
VOICE_ID_30 = 0x44U,
VOICE_ID_40 = 0x45U,
VOICE_ID_50 = 0x46U,
VOICE_ID_60 = 0x47U,
VOICE_ID_70 = 0x48U,
VOICE_ID_80 = 0x49U,
VOICE_ID_90 = 0x4AU,
VOICE_ID_END = 0x4BU,
VOICE_ID_INVALID = 0xFFU,
};
typedef enum VOICE_ID_t VOICE_ID_t;
#ifdef ENABLE_VOICE
extern VOICE_ID_t gVoiceID[8];
extern uint8_t gVoiceReadIndex;
extern uint8_t gVoiceWriteIndex;
@ -141,7 +140,6 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep);
void AUDIO_SetVoiceID(uint8_t Index, VOICE_ID_t VoiceID);
uint8_t AUDIO_SetDigitVoice(uint8_t Index, uint16_t Value);
void AUDIO_PlayQueuedVoice(void);
#endif
#endif

View File

@ -764,8 +764,6 @@ bool BK4819_CompanderEnabled(void)
void BK4819_SetCompander(const unsigned int mode)
{
uint16_t val;
// mode 0 .. OFF
// mode 1 .. TX
// mode 2 .. RX
@ -773,14 +771,12 @@ void BK4819_SetCompander(const unsigned int mode)
if (mode == 0)
{ // disable
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
BK4819_WriteRegister(BK4819_REG_31, Value & ~(1u < 3));
BK4819_WriteRegister(BK4819_REG_31, BK4819_ReadRegister(BK4819_REG_31) & ~(1u < 3));
return;
}
// enable
val = BK4819_ReadRegister(BK4819_REG_31);
BK4819_WriteRegister(BK4819_REG_31, val | (1u < 3));
BK4819_WriteRegister(BK4819_REG_31, BK4819_ReadRegister(BK4819_REG_31) | (1u < 3));
// set the compressor ratio
//
@ -791,8 +787,7 @@ void BK4819_SetCompander(const unsigned int mode)
// 11 = 4:1
//
const uint16_t compress_ratio = (mode == 1 || mode >= 3) ? 3 : 0; // 4:1
val = BK4819_ReadRegister(BK4819_REG_29);
BK4819_WriteRegister(BK4819_REG_29, (val & ~(3u < 14)) | (compress_ratio < 14));
BK4819_WriteRegister(BK4819_REG_29, (BK4819_ReadRegister(BK4819_REG_29) & ~(3u < 14)) | (compress_ratio < 14));
// set the expander ratio
//
@ -803,8 +798,7 @@ void BK4819_SetCompander(const unsigned int mode)
// 11 = 1:4
//
const uint16_t expand_ratio = (mode >= 2) ? 3 : 0; // 1:4
val = BK4819_ReadRegister(BK4819_REG_28);
BK4819_WriteRegister(BK4819_REG_28, (val & ~(3u < 14)) | (expand_ratio < 14));
BK4819_WriteRegister(BK4819_REG_28, (BK4819_ReadRegister(BK4819_REG_28) & ~(3u < 14)) | (expand_ratio < 14));
}
void BK4819_DisableVox(void)

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -68,8 +68,8 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
{
// enable all the menu items
gMenuListCount = 0;
//while (MenuList[gMenuListCount][0] != 0)
while (MenuList[gMenuListCount] != NULL)
// while (MenuList[gMenuListCount].name != NULL)
while (MenuList[gMenuListCount].name[0] != '\0')
gMenuListCount++;
gMenuCursor = MENU_350TX;

21
main.c
View File

@ -96,13 +96,20 @@ void Main(void)
BATTERY_GetReadings(false);
// count the number of menu list items
gMenuListCount = 0;
// while (MenuList[gMenuListCount][0] != 0)
while (MenuList[gMenuListCount] != NULL)
gMenuListCount++;
gMenuListCount -= 8; // disable the last few menu items .. they are the normally 'hidden' menu items
{ // count the number of menu list items
unsigned int hidden = 0;
gMenuListCount = 0;
// while (MenuList[gMenuListCount].name != NULL)
while (MenuList[gMenuListCount].name[0] != '\0')
{
if (MenuList[++gMenuListCount].hidden != 0)
hidden++;
}
// disable the items marked hidden
//gMenuListCount -= 8;
gMenuListCount -= hidden;
}
boot_counter_10ms = 250; // 2.5 sec
if (!gChargingWithTypeC && !gBatteryDisplayLevel)

View File

@ -711,7 +711,8 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_DisableVox();
#ifdef ENABLE_COMPANDER
BK4819_SetCompander(!gRxVfo->IsAM ? gRxVfo->Compander : 0);
// RX expander
BK4819_SetCompander((!gRxVfo->IsAM && gRxVfo->Compander >= 2) ? gRxVfo->Compander : 0);
#endif
#if 0
@ -811,7 +812,8 @@ void RADIO_SetTxParameters(void)
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
#ifdef ENABLE_COMPANDER
BK4819_SetCompander(!gCurrentVfo->IsAM ? gCurrentVfo->Compander : 0);
// TX compressor
BK4819_SetCompander((!gRxVfo->IsAM && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
#endif
BK4819_PrepareTransmit();

179
ui/menu.c
View File

@ -39,89 +39,89 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
const char *MenuList[] =
const t_menu_item MenuList[] =
{
"SQL",
"STEP",
"T-PWR", // was "TXP"
"R-DCS", // was "R_DCS"
"R-CTCS", // was "R_CTCS"
"T-DCS", // was "T_DCS"
"T-CTCS", // was "T_CTCS"
"T-DIR", // was "SFT_D"
"T-OFFS", // was "OFFSET"
"T-VFO", // was "WX"
"T-TOUT", // was "TOT"
"W/N",
"SCRAM", // was "SCR"
"BUSYCL", // was "BCL"
"CH-SAV", // was "MEM-CH"
"CH-DEL", // was "DEL-CH"
"CH-NAM",
"CH-DIS", // was "MDF"
"BATSAV", // was "SAVE"
"VOX",
"BACKLT", // was "ABR"
"DUALRX", // was "TDR"
"BEEP",
#ifdef ENABLE_VOICE
"VOICE",
#endif
"SC-REV",
"KEYLOC", // was "AUTOLk"
"S-ADD1",
"S-ADD2",
"STE",
"RP-STE",
"MIC",
#ifdef ENABLE_AUDIO_BAR
"MICBAR",
#endif
#ifdef ENABLE_COMPANDER
"COMPND",
#endif
"1-CALL",
"SLIST",
"SLIST1",
"SLIST2",
#ifdef ENABLE_ALARM
"AL-MOD",
#endif
"ANI-ID",
"UPCODE",
"DWCODE",
"D-ST",
"D-RSP",
"D-HOLD",
"D-PRE",
"PTT-ID",
"D-DCD",
"D-LIST",
"D-LIVE", // live DTMF decoder
"PONMSG",
"ROGER",
"BATVOL", // was "VOL"
"BATTXT",
"MODE", // was "AM"
#ifdef ENABLE_NOAA
"NOAA-S",
#endif
"RESET", // might be better to move this to the hidden menu items ?
{"SQL", 0, VOICE_ID_SQUELCH },
{"STEP", 0, VOICE_ID_FREQUENCY_STEP },
{"T-PWR", 0, VOICE_ID_POWER }, // was "TXP"
{"R-DCS", 0, VOICE_ID_DCS }, // was "R_DCS"
{"R-CTCS", 0, VOICE_ID_CTCSS }, // was "R_CTCS"
{"T-DCS", 0, VOICE_ID_DCS }, // was "T_DCS"
{"T-CTCS", 0, VOICE_ID_CTCSS }, // was "T_CTCS"
{"T-DIR", 0, VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION}, // was "SFT_D"
{"T-OFFS", 0, VOICE_ID_TX_OFFSET_FREQUENCY }, // was "OFFSET"
{"T-VFO", 0, VOICE_ID_INVALID }, // was "WX"
{"T-TOUT", 0, VOICE_ID_TRANSMIT_OVER_TIME }, // was "TOT"
{"W/N", 0, VOICE_ID_CHANNEL_BANDWIDTH },
{"SCRAM", 0, VOICE_ID_SCRAMBLER_ON }, // was "SCR"
{"BUSYCL", 0, VOICE_ID_BUSY_LOCKOUT }, // was "BCL"
{"CH-SAV", 0, VOICE_ID_MEMORY_CHANNEL }, // was "MEM-CH"
{"CH-DEL", 0, VOICE_ID_DELETE_CHANNEL }, // was "DEL-CH"
{"CH-NAM", 0, VOICE_ID_INVALID },
{"CH-DIS", 0, VOICE_ID_INVALID }, // was "MDF"
{"BATSAV", 0, VOICE_ID_SAVE_MODE }, // was "SAVE"
{"VOX", 0, VOICE_ID_VOX },
{"BACKLT", 0, VOICE_ID_INVALID }, // was "ABR"
{"DUALRX", 0, VOICE_ID_DUAL_STANDBY }, // was "TDR"
{"BEEP", 0, VOICE_ID_BEEP_PROMPT },
#ifdef ENABLE_VOICE
{"VOICE", 0, VOICE_ID_VOICE_PROMPT },
#endif
{"SC-REV", 0, VOICE_ID_INVALID },
{"KEYLOC", 0, VOICE_ID_INVALID }, // was "AUTOLk"
{"S-ADD1", 0, VOICE_ID_INVALID },
{"S-ADD2", 0, VOICE_ID_INVALID },
{"STE", 0, VOICE_ID_INVALID },
{"RP-STE", 0, VOICE_ID_INVALID },
{"MIC", 0, VOICE_ID_INVALID },
#ifdef ENABLE_AUDIO_BAR
{"MICBAR", 0, VOICE_ID_INVALID },
#endif
#ifdef ENABLE_COMPANDER
{"COMPND", 0, VOICE_ID_INVALID },
#endif
{"1-CALL", 0, VOICE_ID_INVALID },
{"SLIST", 0, VOICE_ID_INVALID },
{"SLIST1", 0, VOICE_ID_INVALID },
{"SLIST2", 0, VOICE_ID_INVALID },
#ifdef ENABLE_ALARM
"AL-MOD", 0, VOICE_ID_INVALID },
#endif
{"ANI-ID", 0, VOICE_ID_ANI_CODE },
{"UPCODE", 0, VOICE_ID_INVALID },
{"DWCODE", 0, VOICE_ID_INVALID },
{"D-ST", 0, VOICE_ID_INVALID },
{"D-RSP", 0, VOICE_ID_INVALID },
{"D-HOLD", 0, VOICE_ID_INVALID },
{"D-PRE", 0, VOICE_ID_INVALID },
{"PTT-ID", 0, VOICE_ID_INVALID },
{"D-DCD", 0, VOICE_ID_INVALID },
{"D-LIST", 0, VOICE_ID_INVALID },
{"D-LIVE", 0, VOICE_ID_INVALID }, // live DTMF decoder
{"PONMSG", 0, VOICE_ID_INVALID },
{"ROGER", 0, VOICE_ID_INVALID },
{"BATVOL", 0, VOICE_ID_INVALID }, // was "VOL"
{"BATTXT", 0, VOICE_ID_INVALID },
{"MODE", 0, VOICE_ID_INVALID }, // was "AM"
#ifdef ENABLE_NOAA
{"NOAA-S", 0, VOICE_ID_INVALID },
#endif
{"RESET", 0, VOICE_ID_INITIALISATION }, // might be better to move this to the hidden menu items ?
// hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on
"F-LOCK",
"TX-200", // was "200TX"
"TX-350", // was "350TX"
"TX-500", // was "500TX"
"350-EN", // was "350EN"
"SCR-EN", // was "SCREN"
{"F-LOCK", 1, VOICE_ID_INVALID },
{"TX-200", 1, VOICE_ID_INVALID }, // was "200TX"
{"TX-350", 1, VOICE_ID_INVALID }, // was "350TX"
{"TX-500", 1, VOICE_ID_INVALID }, // was "500TX"
{"350-EN", 1, VOICE_ID_INVALID }, // was "350EN"
{"SCR-EN", 1, VOICE_ID_INVALID }, // was "SCREN"
"TX-EN", // enable TX
"F-CALI", // reference xtal calibration
{"TX-EN", 1, VOICE_ID_INVALID }, // enable TX
{"F-CALI", 1, VOICE_ID_INVALID }, // reference xtal calibration
NULL // end of list - DO NOT delete this
{"", 0, VOICE_ID_INVALID } // end of list - DO NOT delete this
};
const char gSubMenu_TXP[3][5] =
@ -278,7 +278,7 @@ int8_t gMenuScrollDirection;
int32_t gSubMenuSelection;
// edit box
char edit_original[17]; // a copy of the text before editing
char edit_original[17]; // a copy of the text before editing so that we can easily test for changes/difference
char edit[17];
int edit_index;
@ -293,28 +293,31 @@ void UI_DisplayMenu(void)
for (i = 0; i < 3; i++)
if (gMenuCursor > 0 || i > 0)
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
UI_PrintString(MenuList[gMenuCursor + i - 1], 0, 0, i * 2, 8);
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
// invert the pixels
for (i = 0; i < 48; i++)
{
gFrameBuffer[2][i] ^= 0xFF;
gFrameBuffer[3][i] ^= 0xFF;
}
// draw vertical separating line
// draw vertical separating dotted line
for (i = 0; i < 6; i++)
gFrameBuffer[i][49] = 0xAA;
// draw the menu index number/count
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
UI_PrintStringSmall(String, 8, 0, 6);
// draw the little marker
if (gIsInSubMenu)
memmove(gFrameBuffer[0] + 50, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
memset(String, 0, sizeof(String));
bool already_printed = false;
switch (gMenuCursor)
{
case MENU_SQL:
@ -333,7 +336,7 @@ void UI_DisplayMenu(void)
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break;
#endif
case MENU_STEP:
sprintf(String, "%d.%02uKHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
break;
@ -387,7 +390,7 @@ void UI_DisplayMenu(void)
}
UI_PrintString("MHz", 50, 127, 3, 8);
already_printed = true;
break;
@ -446,7 +449,7 @@ void UI_DisplayMenu(void)
case MENU_DEL_CH:
{
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
UI_PrintString(String, 50, 127, 0, 8);
@ -467,7 +470,7 @@ void UI_DisplayMenu(void)
already_printed = true;
break;
}
case MENU_MEM_NAME:
{
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
@ -498,7 +501,7 @@ void UI_DisplayMenu(void)
UI_PrintString("^", 50 + (8 * edit_index), 0, 4, 8); // show the cursor
// UI_PrintStringSmall("^", 50 + (8 * edit_index), 0, 4);
}
if (!gAskForConfirmation)
{ // show the frequency so that the user knows the channels frequency
sprintf(String, "%03u.%05u", Info.Frequency / 100000, Info.Frequency % 100000);
@ -509,11 +512,11 @@ void UI_DisplayMenu(void)
// UI_PrintStringSmall(String, 50, 127, 5);
}
}
already_printed = true;
break;
}
case MENU_SAVE:
strcpy(String, gSubMenu_SAVE[gSubMenuSelection]);
break;
@ -659,7 +662,7 @@ void UI_DisplayMenu(void)
if (!already_printed)
UI_PrintString(String, 50, 127, 2, 8);
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)
{
i = (gMenuCursor == MENU_SLIST1) ? 0 : 1;

View File

@ -20,6 +20,14 @@
#include <stdbool.h>
#include <stdint.h>
#include "audio.h" // VOICE_ID_t
typedef struct {
const char name[7]; // menu display only has room for 6 characters
uint8_t hidden;
VOICE_ID_t voice_id;
} t_menu_item;
enum
{
MENU_SQL = 0,
@ -102,43 +110,43 @@ enum
MENU_F_CALI // reference xtal calibration
};
extern const char *MenuList[];
extern const t_menu_item MenuList[];
extern const char gSubMenu_TXP[3][5];
extern const char gSubMenu_SFT_D[3][4];
extern const char gSubMenu_W_N[2][7];
extern const char gSubMenu_OFF_ON[2][4];
extern const char gSubMenu_SAVE[5][4];
extern const char gSubMenu_CHAN[3][7];
extern const char gSubMenu_TXP[3][5];
extern const char gSubMenu_SFT_D[3][4];
extern const char gSubMenu_W_N[2][7];
extern const char gSubMenu_OFF_ON[2][4];
extern const char gSubMenu_SAVE[5][4];
extern const char gSubMenu_CHAN[3][7];
#ifdef ENABLE_VOICE
extern const char gSubMenu_VOICE[3][4];
extern const char gSubMenu_VOICE[3][4];
#endif
extern const char gSubMenu_SC_REV[3][3];
extern const char gSubMenu_MDF[4][8];
extern const char gSubMenu_SC_REV[3][3];
extern const char gSubMenu_MDF[4][8];
#ifdef ENABLE_ALARM
extern const char gSubMenu_AL_MOD[2][5];
extern const char gSubMenu_AL_MOD[2][5];
#endif
extern const char gSubMenu_D_RSP[4][6];
extern const char gSubMenu_PTT_ID[4][5];
extern const char gSubMenu_PONMSG[4][5];
extern const char gSubMenu_ROGER[3][6];
extern const char gSubMenu_RESET[2][4];
extern const char gSubMenu_F_LOCK[6][4];
extern const char gSubMenu_BACK_LIGHT[6][7];
extern const char gSubMenu_D_RSP[4][6];
extern const char gSubMenu_PTT_ID[4][5];
extern const char gSubMenu_PONMSG[4][5];
extern const char gSubMenu_ROGER[3][6];
extern const char gSubMenu_RESET[2][4];
extern const char gSubMenu_F_LOCK[6][4];
extern const char gSubMenu_BACK_LIGHT[6][7];
#ifdef ENABLE_COMPANDER
extern const char gSubMenu_Compand[4][6];
extern const char gSubMenu_Compand[4][6];
#endif
extern const char gSubMenu_BAT_TXT[3][8];
extern bool gIsInSubMenu;
extern uint8_t gMenuCursor;
extern int8_t gMenuScrollDirection;
extern int32_t gSubMenuSelection;
extern char edit_original[17];
extern char edit[17];
extern int edit_index;
extern const char gSubMenu_BAT_TXT[3][8];
extern bool gIsInSubMenu;
extern uint8_t gMenuCursor;
extern int8_t gMenuScrollDirection;
extern int32_t gSubMenuSelection;
extern char edit_original[17];
extern char edit[17];
extern int edit_index;
void UI_DisplayMenu(void);

View File

@ -13,7 +13,7 @@ del /S /Q *.o >nul 2>nul
del /S /Q *.d >nul 2>nul
:: If you have python installed, you can create a 'packed' .bin from the compiled firmware.bin file.
:: The Quangsheng windows upload-to-radio program requires a 'packed' .bin file.
:: The Quansheng windows upload-to-radio program requires a 'packed' .bin file.
::
:: if you don't have python installed, then comment out the python line(s) below, in which case you'll need
:: to upload the standard unpacked firmware.bin file another way.