mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-29 14:51:26 +03:00
Fix DTMF decoder whoopsy
This commit is contained in:
parent
630a17a7ed
commit
787a705b45
76
app/app.c
76
app/app.c
@ -460,7 +460,7 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t rx_frequency = gRxVfo->pRX->Frequency;
|
const uint32_t rx_frequency = gRxVfo->pRX->Frequency;
|
||||||
|
/*
|
||||||
if (gRxVfo->IsAM)
|
if (gRxVfo->IsAM)
|
||||||
{ // AM
|
{ // AM
|
||||||
|
|
||||||
@ -476,7 +476,7 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
|||||||
//
|
//
|
||||||
// REG_48 <9:4> 60 AF Rx Gain-2 -26dB ~ 5.5dB 0.5dB/step
|
// REG_48 <9:4> 60 AF Rx Gain-2 -26dB ~ 5.5dB 0.5dB/step
|
||||||
// 63 = max
|
// 63 = max
|
||||||
// 0 = mute
|
// 0 = min = mute
|
||||||
//
|
//
|
||||||
// REG_48 <3:0> 15 AF DAC Gain (after Gain-1 and Gain-2) approx 2dB/step
|
// REG_48 <3:0> 15 AF DAC Gain (after Gain-1 and Gain-2) approx 2dB/step
|
||||||
// 15 = max
|
// 15 = max
|
||||||
@ -484,23 +484,25 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
|||||||
//
|
//
|
||||||
BK4819_WriteRegister(BK4819_REG_48,
|
BK4819_WriteRegister(BK4819_REG_48,
|
||||||
#if 0
|
#if 0
|
||||||
|
// QS calibrated RX AF gain
|
||||||
(11u << 12) | // ???
|
(11u << 12) | // ???
|
||||||
( 0u << 10) | // AF Rx Gain-1
|
( 0u << 10) | // AF Rx Gain-1
|
||||||
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
|
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
|
||||||
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||||
#else
|
#else
|
||||||
|
// max RX AF gain
|
||||||
(11u << 12) | // ???
|
(11u << 12) | // ???
|
||||||
( 0u << 10) | // AF Rx Gain-1
|
( 0u << 10) | // AF Rx Gain-1
|
||||||
(63u << 4) | // AF Rx Gain-2
|
(63u << 4) | // AF Rx Gain-2
|
||||||
(15u << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
(15u << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BK4819_WriteRegister(0x4B, BK4819_ReadRegister(0x4B) & ~(1u << 5)); // enable RX ALC
|
// BK4819_WriteRegister(0x4B, BK4819_ReadRegister(0x4B) & ~(1u << 5)); // enable RX ALC
|
||||||
|
|
||||||
// help improve AM RX distorted audio by reducing the PGA gain (still very bad with stronge signals)
|
// help improve AM RX distorted audio by reducing the PGA gain (still very bad with stronge signals)
|
||||||
//
|
//
|
||||||
// I think a solution is to dynamically change these values as the RSSI moves up/down ?
|
// I think a solution is to dynamically change these values as the RSSI moves up/down ?
|
||||||
// without a detailed datasheet on the chip it's very difficult to fix things
|
// without a detailed datasheet on the chip it's difficult/impossible to fix things
|
||||||
//
|
//
|
||||||
// REG_10 <15:0> 0x0038 Rx AGC Gain Table[0]. (Index Max->Min is 3,2,1,0,-1)
|
// REG_10 <15:0> 0x0038 Rx AGC Gain Table[0]. (Index Max->Min is 3,2,1,0,-1)
|
||||||
//
|
//
|
||||||
@ -540,29 +542,32 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
|||||||
// LNA ........ 14dB
|
// LNA ........ 14dB
|
||||||
// MIXER ...... 0dB
|
// MIXER ...... 0dB
|
||||||
// PGA ........ -15dB
|
// PGA ........ -15dB
|
||||||
// LNA SHORT LNA MIXER PGA
|
//
|
||||||
{
|
{
|
||||||
uint16_t lna_short;
|
uint16_t lna_short; // whats "LNA SHORT" mean ?
|
||||||
uint16_t lna;
|
uint16_t lna;
|
||||||
uint16_t mixer;
|
uint16_t mixer;
|
||||||
uint16_t pga;
|
uint16_t pga;
|
||||||
if (rx_frequency < 22640000) // seem to need more gain above this frequency
|
// seems the RX gain abrutly reduces above this frequency, why ?
|
||||||
|
if (rx_frequency <= 22640000)
|
||||||
{
|
{
|
||||||
lna_short = 3; // original
|
lna_short = 3; // original
|
||||||
lna = 2; // original
|
lna = 2; // original
|
||||||
mixer = 3; // original
|
mixer = 3; // original
|
||||||
pga = 3; // reduced
|
pga = 3; // reduced - seems to help reduce the AM demodulation distortion
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lna_short = 3; // original
|
lna_short = 3; // original
|
||||||
lna = 3; // increased
|
lna = 4; // increased
|
||||||
mixer = 3; // original
|
mixer = 3; // original
|
||||||
// pga = 6; // original
|
// pga = 6; // original
|
||||||
pga = 7; // increased
|
pga = 7; // increased
|
||||||
}
|
}
|
||||||
|
|
||||||
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
|
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
|
||||||
|
|
||||||
|
// what do these 4 other gain tables do ???
|
||||||
//BK4819_WriteRegister(BK4819_REG_12, 0x037B); // 000000 11 011 11 011
|
//BK4819_WriteRegister(BK4819_REG_12, 0x037B); // 000000 11 011 11 011
|
||||||
//BK4819_WriteRegister(BK4819_REG_11, 0x027B); // 000000 10 011 11 011
|
//BK4819_WriteRegister(BK4819_REG_11, 0x027B); // 000000 10 011 11 011
|
||||||
//BK4819_WriteRegister(BK4819_REG_10, 0x007A); // 000000 00 011 11 010
|
//BK4819_WriteRegister(BK4819_REG_10, 0x007A); // 000000 00 011 11 010
|
||||||
@ -586,7 +591,7 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
|||||||
//
|
//
|
||||||
// REG_48 <9:4> 60 AF Rx Gain-2 -26dB ~ 5.5dB 0.5dB/step
|
// REG_48 <9:4> 60 AF Rx Gain-2 -26dB ~ 5.5dB 0.5dB/step
|
||||||
// 63 = max
|
// 63 = max
|
||||||
// 0 = mute
|
// 0 = min = mute
|
||||||
//
|
//
|
||||||
// REG_48 <3:0> 15 AF DAC Gain (after Gain-1 and Gain-2) approx 2dB/step
|
// REG_48 <3:0> 15 AF DAC Gain (after Gain-1 and Gain-2) approx 2dB/step
|
||||||
// 15 = max
|
// 15 = max
|
||||||
@ -598,7 +603,7 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
|||||||
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
|
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
|
||||||
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||||
|
|
||||||
BK4819_WriteRegister(0x4B, BK4819_ReadRegister(0x4B) | (1u << 5)); // disable RX ALC
|
// BK4819_WriteRegister(0x4B, BK4819_ReadRegister(0x4B) | (1u << 5)); // disable RX ALC
|
||||||
|
|
||||||
// REG_10 <15:0> 0x0038 Rx AGC Gain Table[0]. (Index Max->Min is 3,2,1,0,-1)
|
// REG_10 <15:0> 0x0038 Rx AGC Gain Table[0]. (Index Max->Min is 3,2,1,0,-1)
|
||||||
//
|
//
|
||||||
@ -641,6 +646,55 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
|||||||
// LNA SHORT LNA MIXER PGA
|
// LNA SHORT LNA MIXER PGA
|
||||||
BK4819_WriteRegister(BK4819_REG_13, (3u << 8) | (2u << 5) | (3u << 3) | (6u << 0));
|
BK4819_WriteRegister(BK4819_REG_13, (3u << 8) | (2u << 5) | (3u << 3) | (6u << 0));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if (gRxVfo->IsAM)
|
||||||
|
{ // AM
|
||||||
|
{
|
||||||
|
uint16_t lna_short; // whats "LNA SHORT" mean ?
|
||||||
|
uint16_t lna;
|
||||||
|
uint16_t mixer;
|
||||||
|
uint16_t pga;
|
||||||
|
// seems the RX gain abrutly reduces above this frequency, why ?
|
||||||
|
if (rx_frequency <= 22640000)
|
||||||
|
{
|
||||||
|
lna_short = 3; // original
|
||||||
|
lna = 2; // original
|
||||||
|
mixer = 3; // original
|
||||||
|
pga = 3; // reduced - seems to help reduce the AM demodulation distortion
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lna_short = 3; // original
|
||||||
|
lna = 4; // increased
|
||||||
|
mixer = 3; // original
|
||||||
|
// pga = 6; // original
|
||||||
|
pga = 7; // increased
|
||||||
|
}
|
||||||
|
|
||||||
|
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
|
||||||
|
|
||||||
|
// what do these 4 other gain tables do ???
|
||||||
|
//BK4819_WriteRegister(BK4819_REG_12, 0x037B); // 000000 11 011 11 011
|
||||||
|
//BK4819_WriteRegister(BK4819_REG_11, 0x027B); // 000000 10 011 11 011
|
||||||
|
//BK4819_WriteRegister(BK4819_REG_10, 0x007A); // 000000 00 011 11 010
|
||||||
|
//BK4819_WriteRegister(BK4819_REG_14, 0x0019); // 000000 00 000 11 001
|
||||||
|
}
|
||||||
|
BK4819_WriteRegister(BK4819_REG_48,
|
||||||
|
// max RX AF gain
|
||||||
|
(11u << 12) | // ???
|
||||||
|
( 0u << 10) | // AF Rx Gain-1
|
||||||
|
(63u << 4) | // AF Rx Gain-2
|
||||||
|
(15u << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||||
|
gNeverUsed = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // FM
|
||||||
|
BK4819_WriteRegister(BK4819_REG_48,
|
||||||
|
(11u << 12) | // ???
|
||||||
|
( 0u << 10) | // AF Rx Gain-1
|
||||||
|
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
|
||||||
|
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
if (gVoiceWriteIndex == 0)
|
if (gVoiceWriteIndex == 0)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "bitmaps.h"
|
#include "bitmaps.h"
|
||||||
|
|
||||||
// all these images are on their right sides
|
// all these images are on their right sides
|
||||||
// turn your monitor 90deg anti-clockwise to see the images
|
// turn your monitor 90-deg anti-clockwise to see the images
|
||||||
|
|
||||||
const uint8_t BITMAP_PowerSave[8] =
|
const uint8_t BITMAP_PowerSave[8] =
|
||||||
{
|
{
|
||||||
|
1
board.c
1
board.c
@ -707,7 +707,6 @@ void BOARD_EEPROM_Init(void)
|
|||||||
// 0F40..0F47
|
// 0F40..0F47
|
||||||
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
||||||
gSetting_F_LOCK = (Data[0] < 6) ? Data[0] : F_LOCK_OFF;
|
gSetting_F_LOCK = (Data[0] < 6) ? Data[0] : F_LOCK_OFF;
|
||||||
|
|
||||||
gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true
|
gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true
|
||||||
gSetting_KILLED = (Data[2] < 2) ? Data[2] : false;
|
gSetting_KILLED = (Data[2] < 2) ? Data[2] : false;
|
||||||
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
|
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
1
radio.c
1
radio.c
@ -719,7 +719,6 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (!gSetting_KILLED)
|
|
||||||
{
|
{
|
||||||
BK4819_EnableDTMF();
|
BK4819_EnableDTMF();
|
||||||
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||||
|
@ -455,7 +455,7 @@ void UI_DisplayMain(void)
|
|||||||
if (center_line_is_free)
|
if (center_line_is_free)
|
||||||
{
|
{
|
||||||
if (gDTMF_ReceivedSaved[0] >= 32)
|
if (gDTMF_ReceivedSaved[0] >= 32)
|
||||||
{ // show the on-screen live DTMF decode
|
{ // show live DTMF decode
|
||||||
UI_PrintStringSmall(gDTMF_ReceivedSaved, 8, 0, 3);
|
UI_PrintStringSmall(gDTMF_ReceivedSaved, 8, 0, 3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -54,11 +54,11 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
line += 12;
|
line += 12;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
// FM indicator
|
|
||||||
if (gSetting_KILLED)
|
if (gSetting_KILLED)
|
||||||
memset(line, 0xFF, 10);
|
memset(line, 0xFF, 10);
|
||||||
else
|
else
|
||||||
|
#ifdef ENABLE_FMRADIO
|
||||||
|
// FM indicator
|
||||||
if (gFmRadioMode || test_display)
|
if (gFmRadioMode || test_display)
|
||||||
memmove(line, BITMAP_FM, sizeof(BITMAP_FM));
|
memmove(line, BITMAP_FM, sizeof(BITMAP_FM));
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user