forked from mirror/uv-k5-firmware
Reduction of magic numbers.
This commit is contained in:
parent
c59e1ff409
commit
3f170ed900
8
audio.c
8
audio.c
@ -174,8 +174,8 @@ void AUDIO_PlaySingleVoice(bool bFlag)
|
||||
uint8_t Delay;
|
||||
|
||||
VoiceID = gVoiceID[0];
|
||||
if (gEeprom.KEYPAD_TONE && gVoiceWriteIndex) {
|
||||
if (gEeprom.KEYPAD_TONE == 1) {
|
||||
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF && gVoiceWriteIndex) {
|
||||
if (gEeprom.VOICE_PROMPT == VOICE_PROMPT_CHINESE) {
|
||||
// Chinese
|
||||
if (VoiceID >= sizeof(VoiceClipLengthChinese)) {
|
||||
goto Bailout;
|
||||
@ -289,9 +289,9 @@ void AUDIO_PlayQueuedVoice(void)
|
||||
|
||||
Skip = false;
|
||||
gVoiceReadIndex = gVoiceReadIndex;
|
||||
if (gVoiceReadIndex != gVoiceWriteIndex && gEeprom.KEYPAD_TONE != 0) {
|
||||
if (gVoiceReadIndex != gVoiceWriteIndex && gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF) {
|
||||
VoiceID = gVoiceID[gVoiceReadIndex];
|
||||
if (gEeprom.KEYPAD_TONE == 1) {
|
||||
if (gEeprom.VOICE_PROMPT == VOICE_PROMPT_CHINESE) {
|
||||
if (VoiceID < 58) {
|
||||
Delay = VoiceClipLengthChinese[VoiceID];
|
||||
VoiceID += VOICE_ID_CHI_BASE;
|
||||
|
@ -17,7 +17,7 @@ const uint8_t BITMAP_VOX[18] = { 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x0, 0x3E,
|
||||
|
||||
const uint8_t BITMAP_WX[12] = { 0x00, 0x7F, 0x20, 0x18, 0x20, 0x7F, 0x00, 0x63, 0x14, 0x08, 0x14, 0x63 };
|
||||
const uint8_t BITMAP_TDR[12] = { 0x00, 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x7F, 0x20, 0x18, 0x20, 0x7F };
|
||||
const uint8_t BITMAP_KEYPAD_TONE[9] = { 0x00, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0xFF, 0x18 };
|
||||
const uint8_t BITMAP_VoicePrompt[9] = { 0x00, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0xFF, 0x18 };
|
||||
|
||||
const uint8_t BITMAP_FM_Mute[12] = { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F };
|
||||
const uint8_t BITMAP_NOAA[12] = { 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, 0x46, 0x49, 0x49, 0x49, 0x31 };
|
||||
|
@ -20,7 +20,7 @@ extern const uint8_t BITMAP_VOX[18];
|
||||
|
||||
extern const uint8_t BITMAP_WX[12];
|
||||
extern const uint8_t BITMAP_TDR[12];
|
||||
extern const uint8_t BITMAP_KEYPAD_TONE[9];
|
||||
extern const uint8_t BITMAP_VoicePrompt[9];
|
||||
|
||||
extern const uint8_t BITMAP_FM_Mute[12];
|
||||
extern const uint8_t BITMAP_NOAA[12];
|
||||
|
4
board.c
4
board.c
@ -547,9 +547,9 @@ void BOARD_EEPROM_Init(void)
|
||||
// 0EA0..0EA7
|
||||
EEPROM_ReadBuffer(0x0EA0, Data, 8);
|
||||
if (Data[0] < 3) {
|
||||
gEeprom.KEYPAD_TONE = Data[0];
|
||||
gEeprom.VOICE_PROMPT = Data[0];
|
||||
} else {
|
||||
gEeprom.KEYPAD_TONE = 1;
|
||||
gEeprom.VOICE_PROMPT = VOICE_PROMPT_CHINESE;
|
||||
}
|
||||
|
||||
// 0EA8..0EAF
|
||||
|
@ -138,7 +138,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
BK1080_Init(0, false);
|
||||
}
|
||||
|
||||
if (g_20000383 == 1 && gEeprom.ALARM_MODE != 1) {
|
||||
if (g_20000383 == 1 && gEeprom.ALARM_MODE != ALARM_MODE_TONE) {
|
||||
g_20000383 = 2;
|
||||
GUI_DisplayScreen();
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
4
gui.c
4
gui.c
@ -394,8 +394,8 @@ void GUI_DisplayStatusLine(void)
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
|
||||
memcpy(gStatusLine + 45, BITMAP_TDR, sizeof(BITMAP_TDR));
|
||||
}
|
||||
if (gEeprom.KEYPAD_TONE != 0) {
|
||||
memcpy(gStatusLine + 34, BITMAP_KEYPAD_TONE, sizeof(BITMAP_KEYPAD_TONE));
|
||||
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF) {
|
||||
memcpy(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||
}
|
||||
if (gSetting_KILLED) {
|
||||
memset(gStatusLine + 21, 0xFF, 10);
|
||||
|
10
radio.c
10
radio.c
@ -110,7 +110,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t Band, uint32
|
||||
pInfo->StepFrequency = 2500;
|
||||
pInfo->CHANNEL_SAVE = ChannelSave;
|
||||
pInfo->FrequencyReverse = false;
|
||||
pInfo->OUTPUT_POWER = 2;
|
||||
pInfo->OUTPUT_POWER = OUTPUT_POWER_HIGH;
|
||||
pInfo->DCS[0].Frequency = Frequency;
|
||||
pInfo->DCS[1].Frequency = Frequency;
|
||||
pInfo->pDCS_Current = &pInfo->DCS[0];
|
||||
@ -311,7 +311,7 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
|
||||
pRadio->DCS[0].Frequency = Frequency;
|
||||
|
||||
if (Frequency - 10800000 < 2799991) {
|
||||
gEeprom.VfoInfo[VFO].FREQUENCY_DEVIATION_SETTING = 0;
|
||||
gEeprom.VfoInfo[VFO].FREQUENCY_DEVIATION_SETTING = FREQUENCY_DEVIATION_OFF;
|
||||
} else if (ChNum >= 200) {
|
||||
Frequency = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].FREQUENCY_OF_DEVIATION, gEeprom.VfoInfo[VFO].StepFrequency, 0);
|
||||
gEeprom.VfoInfo[VFO].FREQUENCY_OF_DEVIATION = Frequency;
|
||||
@ -407,12 +407,12 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||
|
||||
Frequency = pInfo->DCS[0].Frequency;
|
||||
switch (pInfo->FREQUENCY_DEVIATION_SETTING) {
|
||||
case 0:
|
||||
case FREQUENCY_DEVIATION_OFF:
|
||||
break;
|
||||
case 1:
|
||||
case FREQUENCY_DEVIATION_ADD:
|
||||
Frequency += pInfo->FREQUENCY_OF_DEVIATION;
|
||||
break;
|
||||
case 2:
|
||||
case FREQUENCY_DEVIATION_SUB:
|
||||
Frequency -= pInfo->FREQUENCY_OF_DEVIATION;
|
||||
break;
|
||||
}
|
||||
|
37
settings.h
37
settings.h
@ -21,11 +21,13 @@
|
||||
#include <stdint.h>
|
||||
#include "radio.h"
|
||||
|
||||
enum {
|
||||
enum POWER_OnDisplayMode_t {
|
||||
POWER_ON_DISPLAY_MODE_FULL_SCREEN = 0U,
|
||||
POWER_ON_DISPLAY_MODE_VOLTAGE = 2U,
|
||||
};
|
||||
|
||||
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
|
||||
|
||||
enum {
|
||||
F_LOCK_OFF = 0U,
|
||||
F_LOCK_FCC = 1U,
|
||||
@ -53,6 +55,33 @@ enum {
|
||||
DUAL_WATCH_CHAN_B = 2U,
|
||||
};
|
||||
|
||||
enum {
|
||||
FREQUENCY_DEVIATION_OFF = 0U,
|
||||
FREQUENCY_DEVIATION_ADD = 1U,
|
||||
FREQUENCY_DEVIATION_SUB = 2U,
|
||||
};
|
||||
|
||||
enum {
|
||||
OUTPUT_POWER_LOW = 0U,
|
||||
OUTPUT_POWER_MID = 1U,
|
||||
OUTPUT_POWER_HIGH = 2U,
|
||||
};
|
||||
|
||||
enum VOICE_Prompt_t {
|
||||
VOICE_PROMPT_OFF = 0U,
|
||||
VOICE_PROMPT_CHINESE = 1U,
|
||||
VOICE_PROMPT_ENGLISH = 2U,
|
||||
};
|
||||
|
||||
typedef enum VOICE_Prompt_t VOICE_Prompt_t;
|
||||
|
||||
enum ALARM_Mode_t {
|
||||
ALARM_MODE_SITE = 0U,
|
||||
ALARM_MODE_TONE = 1U,
|
||||
};
|
||||
|
||||
typedef enum ALARM_Mode_t ALARM_Mode_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t EEPROM_0E80_0E83[2];
|
||||
uint8_t EEPROM_0E82_0E85[2];
|
||||
@ -69,7 +98,7 @@ typedef struct {
|
||||
bool KEY_LOCK;
|
||||
bool VOX_SWITCH;
|
||||
uint8_t VOX_LEVEL;
|
||||
uint8_t KEYPAD_TONE;
|
||||
VOICE_Prompt_t VOICE_PROMPT;
|
||||
bool BEEP_CONTROL;
|
||||
uint8_t CHANNEL_DISPLAY_MODE;
|
||||
bool TAIL_NOTE_ELIMINATION;
|
||||
@ -96,8 +125,8 @@ typedef struct {
|
||||
uint16_t FM_LowerLimit;
|
||||
uint16_t FM_UpperLimit;
|
||||
bool AUTO_KEYPAD_LOCK;
|
||||
uint8_t ALARM_MODE;
|
||||
uint8_t POWER_ON_DISPLAY_MODE;
|
||||
ALARM_Mode_t ALARM_MODE;
|
||||
POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE;
|
||||
uint8_t ROGER;
|
||||
uint8_t REPEATER_TAIL_TONE_ELIMINATION;
|
||||
uint8_t KEY_1_SHORT_PRESS_ACTION;
|
||||
|
Loading…
Reference in New Issue
Block a user