mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-21 17:19:57 +00:00
Compander update
This commit is contained in:
parent
863d9c55a7
commit
00fe1de467
10
app/menu.c
10
app/menu.c
@ -235,13 +235,17 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
#endif
|
||||
|
||||
case MENU_RESET:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
|
||||
break;
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_Compand) - 1;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_BCL:
|
||||
case MENU_BEEP:
|
||||
case MENU_AUTOLK:
|
||||
|
@ -523,16 +523,20 @@ bool BK4819_CompanderEnabled(void)
|
||||
{
|
||||
return (BK4819_ReadRegister(BK4819_REG_31) & (1u < 3)) ? true : false;
|
||||
}
|
||||
void BK4819_DisableCompander(void)
|
||||
{
|
||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
||||
BK4819_WriteRegister(BK4819_REG_31, Value & ~(1u < 3));
|
||||
}
|
||||
|
||||
void BK4819_EnableCompander(void)
|
||||
void BK4819_SetCompander(const unsigned int mode)
|
||||
{
|
||||
uint16_t val;
|
||||
|
||||
if (mode == 0)
|
||||
{ // disable
|
||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
||||
BK4819_WriteRegister(BK4819_REG_31, Value & ~(1u < 3));
|
||||
return;
|
||||
}
|
||||
|
||||
// enable
|
||||
|
||||
val = BK4819_ReadRegister(BK4819_REG_31);
|
||||
BK4819_WriteRegister(BK4819_REG_31, val | (1u < 3));
|
||||
|
||||
@ -544,7 +548,8 @@ void BK4819_EnableCompander(void)
|
||||
// 10 = 2:1
|
||||
// 11 = 4:1
|
||||
//
|
||||
const uint16_t compress_ratio = 2; // 2:1
|
||||
// const uint16_t compress_ratio = (mode >= 1) ? 2 : 0; // 2:1
|
||||
const uint16_t compress_ratio = (mode >= 1) ? 3 : 0; // 4:1
|
||||
val = BK4819_ReadRegister(BK4819_REG_29);
|
||||
BK4819_WriteRegister(BK4819_REG_29, (val & ~(3u < 14)) | (compress_ratio < 14));
|
||||
|
||||
@ -556,7 +561,8 @@ void BK4819_EnableCompander(void)
|
||||
// 10 = 1:3
|
||||
// 11 = 1:4
|
||||
//
|
||||
const uint16_t expand_ratio = 1; // 2:1
|
||||
// const uint16_t expand_ratio = (mode >= 2) ? 1 : 0; // 1:2
|
||||
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));
|
||||
}
|
||||
|
@ -86,8 +86,7 @@ void BK4819_DisableScramble(void);
|
||||
void BK4819_EnableScramble(uint8_t Type);
|
||||
|
||||
bool BK4819_CompanderEnabled(void);
|
||||
void BK4819_DisableCompander(void);
|
||||
void BK4819_EnableCompander(void);
|
||||
void BK4819_SetCompander(const unsigned int mode);
|
||||
|
||||
void BK4819_DisableVox(void);
|
||||
void BK4819_DisableDTMF(void);
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
14
radio.c
14
radio.c
@ -134,7 +134,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t Band, uint32
|
||||
pInfo->pTX = &pInfo->ConfigTX;
|
||||
pInfo->TX_OFFSET_FREQUENCY = 1000000;
|
||||
#ifdef ENABLE_COMPANDER
|
||||
pInfo->Compander = false;
|
||||
pInfo->Compander = 0; // off
|
||||
#endif
|
||||
|
||||
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
||||
@ -413,7 +413,7 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
|
||||
gEeprom.VfoInfo[VFO].IsAM = false;
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
gEeprom.VfoInfo[VFO].Compander = false;
|
||||
gEeprom.VfoInfo[VFO].Compander = 0; // off
|
||||
#endif
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(pRadio);
|
||||
@ -684,10 +684,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
BK4819_DisableVox();
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
if (gRxVfo->Compander && !gRxVfo->IsAM)
|
||||
BK4819_EnableCompander();
|
||||
else
|
||||
BK4819_DisableCompander();
|
||||
BK4819_SetCompander(!gRxVfo->IsAM ? gRxVfo->Compander : 0);
|
||||
#endif
|
||||
|
||||
if (gRxVfo->IsAM || (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED))
|
||||
@ -772,10 +769,7 @@ void RADIO_SetTxParameters(void)
|
||||
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
if (gCurrentVfo->Compander && !gCurrentVfo->IsAM)
|
||||
BK4819_EnableCompander();
|
||||
else
|
||||
BK4819_DisableCompander();
|
||||
BK4819_SetCompander(!gCurrentVfo->IsAM ? gCurrentVfo->Compander : 0);
|
||||
#endif
|
||||
|
||||
BK4819_PrepareTransmit();
|
||||
|
2
radio.h
2
radio.h
@ -125,7 +125,7 @@ typedef struct VFO_Info_t
|
||||
uint8_t AM_CHANNEL_MODE;
|
||||
bool IsAM;
|
||||
#ifdef ENABLE_COMPANDER
|
||||
bool Compander;
|
||||
uint8_t Compander;
|
||||
#endif
|
||||
char Name[16];
|
||||
} VFO_Info_t;
|
||||
|
12
ui/menu.c
12
ui/menu.c
@ -245,6 +245,15 @@ const char gSubMenu_F_LOCK[6][4] =
|
||||
"438"
|
||||
};
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
const char gSubMenu_Compand[3][6] =
|
||||
{
|
||||
"OFF",
|
||||
"TX",
|
||||
"TX/RX"
|
||||
};
|
||||
#endif
|
||||
|
||||
bool gIsInSubMenu;
|
||||
uint8_t gMenuCursor;
|
||||
int8_t gMenuScrollDirection;
|
||||
@ -405,7 +414,10 @@ void UI_DisplayMenu(void)
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
strcpy(String, gSubMenu_Compand[gSubMenuSelection]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_BCL:
|
||||
case MENU_BEEP:
|
||||
case MENU_S_ADD1:
|
||||
|
@ -121,6 +121,9 @@ 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];
|
||||
#ifdef ENABLE_COMPANDER
|
||||
extern const char gSubMenu_Compand[3][6];
|
||||
#endif
|
||||
|
||||
extern bool gIsInSubMenu;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user