mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
Squelch-1 more sensitive
This commit is contained in:
parent
6e8d56c0a7
commit
3fb581760e
4
Makefile
4
Makefile
@ -22,6 +22,7 @@ ENABLE_COMPANDER := 1
|
|||||||
ENABLE_SHOW_CHARGE_LEVEL := 0
|
ENABLE_SHOW_CHARGE_LEVEL := 0
|
||||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
ENABLE_REVERSE_BAT_SYMBOL := 1
|
||||||
ENABLE_AM_FIX := 1
|
ENABLE_AM_FIX := 1
|
||||||
|
ENABLE_SQUELCH1_LOWER := 1
|
||||||
ENABLE_AUDIO_BAR := 0
|
ENABLE_AUDIO_BAR := 0
|
||||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||||
#ENABLE_BAND_SCOPE := 1
|
#ENABLE_BAND_SCOPE := 1
|
||||||
@ -200,6 +201,9 @@ endif
|
|||||||
ifeq ($(ENABLE_AM_FIX),1)
|
ifeq ($(ENABLE_AM_FIX),1)
|
||||||
CFLAGS += -DENABLE_AM_FIX
|
CFLAGS += -DENABLE_AM_FIX
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_SQUELCH1_LOWER),1)
|
||||||
|
CFLAGS += -DENABLE_SQUELCH1_LOWER
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_AUDIO_BAR),1)
|
ifeq ($(ENABLE_AUDIO_BAR),1)
|
||||||
CFLAGS += -DENABLE_AUDIO_BAR
|
CFLAGS += -DENABLE_AUDIO_BAR
|
||||||
endif
|
endif
|
||||||
|
@ -199,7 +199,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
gRequestSaveVFO = true;
|
gRequestSaveVFO = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
}
|
}
|
||||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH);
|
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, );
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
gRequestDisplayScreen = gScreenToDisplay;
|
gRequestDisplayScreen = gScreenToDisplay;
|
||||||
#else
|
#else
|
||||||
|
105
driver/bk4819.c
105
driver/bk4819.c
@ -515,7 +515,7 @@ void BK4819_EnableVox(uint16_t VoxEnableThreshold, uint16_t VoxDisableThreshold)
|
|||||||
BK4819_WriteRegister(BK4819_REG_31, REG_31_Value | (1u << 2)); // VOX Enable
|
BK4819_WriteRegister(BK4819_REG_31, REG_31_Value | (1u << 2)); // VOX Enable
|
||||||
}
|
}
|
||||||
|
|
||||||
void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth, const bool weak_no_different)
|
void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const bool weak_no_different)
|
||||||
{
|
{
|
||||||
// REG_43 <14:12> 4 RF filter bandwidth
|
// REG_43 <14:12> 4 RF filter bandwidth
|
||||||
// 0 = 1.7 kHz
|
// 0 = 1.7 kHz
|
||||||
@ -557,11 +557,12 @@ void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth, const bool we
|
|||||||
// REG_43 <2> 0 Gain after FM Demodulation
|
// REG_43 <2> 0 Gain after FM Demodulation
|
||||||
// 0 = 0dB
|
// 0 = 0dB
|
||||||
// 1 = 6dB
|
// 1 = 6dB
|
||||||
//
|
|
||||||
if (Bandwidth == BK4819_FILTER_BW_WIDE)
|
if (Bandwidth == BK4819_FILTER_BW_WIDE)
|
||||||
{
|
{
|
||||||
if (weak_no_different)
|
if (weak_no_different)
|
||||||
{
|
{ // make the bandwidth the same with weak signals (sounds much better)
|
||||||
|
|
||||||
BK4819_WriteRegister(BK4819_REG_43,
|
BK4819_WriteRegister(BK4819_REG_43,
|
||||||
(0u << 15) | // 0
|
(0u << 15) | // 0
|
||||||
(3u << 12) | // 3 RF filter bandwidth
|
(3u << 12) | // 3 RF filter bandwidth
|
||||||
@ -618,10 +619,10 @@ void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth, const bool we
|
|||||||
{
|
{
|
||||||
if (weak_no_different)
|
if (weak_no_different)
|
||||||
{
|
{
|
||||||
BK4819_WriteRegister(BK4819_REG_43, // 0 100 000 001 01 1 0 00
|
BK4819_WriteRegister(BK4819_REG_43,
|
||||||
(0u << 15) | // 0
|
(0u << 15) | // 0
|
||||||
(4u << 12) | // 4 RF filter bandwidth
|
(2u << 12) | // 4 RF filter bandwidth
|
||||||
(4u << 9) | // 0 RF filter bandwidth when signal is weak
|
(2u << 9) | // 0 RF filter bandwidth when signal is weak
|
||||||
(1u << 6) | // 1 AFTxLPF2 filter Band Width
|
(1u << 6) | // 1 AFTxLPF2 filter Band Width
|
||||||
(1u << 4) | // 1 BW Mode Selection
|
(1u << 4) | // 1 BW Mode Selection
|
||||||
(1u << 3) | // 1
|
(1u << 3) | // 1
|
||||||
@ -630,9 +631,9 @@ void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth, const bool we
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BK4819_WriteRegister(BK4819_REG_43, // 0 100 000 001 01 1 0 00
|
BK4819_WriteRegister(BK4819_REG_43,
|
||||||
(0u << 15) | // 0
|
(0u << 15) | // 0
|
||||||
(4u << 12) | // 4 RF filter bandwidth
|
(2u << 12) | // 4 RF filter bandwidth
|
||||||
(0u << 9) | // 0 RF filter bandwidth when signal is weak
|
(0u << 9) | // 0 RF filter bandwidth when signal is weak
|
||||||
(1u << 6) | // 1 AFTxLPF2 filter Band Width
|
(1u << 6) | // 1 AFTxLPF2 filter Band Width
|
||||||
(1u << 4) | // 1 BW Mode Selection
|
(1u << 4) | // 1 BW Mode Selection
|
||||||
@ -643,28 +644,28 @@ void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth, const bool we
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BK4819_SetupPowerAmplifier(uint16_t Bias, uint32_t Frequency)
|
void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency)
|
||||||
{
|
{
|
||||||
uint8_t Gain;
|
// REG_36 <15:8> 0 PA Bias output 0 ~ 3.2V
|
||||||
|
// 255 = 3.2V
|
||||||
if (Bias > 255)
|
// 0 = 0V
|
||||||
Bias = 255;
|
//
|
||||||
|
// REG_36 <7> 0
|
||||||
if (Frequency < 28000000)
|
// 1 = Enable PA-CTL output
|
||||||
{
|
// 0 = Disable (Output 0 V)
|
||||||
// Gain 1 = 1
|
//
|
||||||
// Gain 2 = 0
|
// REG_36 <5:3> 7 PA gain 1 tuning
|
||||||
Gain = 0x08U;
|
// 7 = max
|
||||||
}
|
// 0 = min
|
||||||
else
|
//
|
||||||
{
|
// REG_36 <2:0> 7 PA gain 2 tuning
|
||||||
// Gain 1 = 4
|
// 7 = max
|
||||||
// Gain 2 = 2
|
// 0 = min
|
||||||
Gain = 0x22U;
|
//
|
||||||
}
|
// 280MHz gain 1 = 1 gain 2 = 0 gain 1 = 4 gain 2 = 2
|
||||||
|
const uint8_t gain = (frequency < 28000000) ? (1u << 3) | (0u << 0) : (4u << 3) | (2u << 0);
|
||||||
// Enable PACTLoutput
|
const uint8_t enable = 1;
|
||||||
BK4819_WriteRegister(BK4819_REG_36, (Bias << 8) | 0x80U | Gain);
|
BK4819_WriteRegister(BK4819_REG_36, (bias << 8) | (enable << 7) | (gain << 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BK4819_SetFrequency(uint32_t Frequency)
|
void BK4819_SetFrequency(uint32_t Frequency)
|
||||||
@ -684,35 +685,63 @@ void BK4819_SetupSquelch(
|
|||||||
// REG_70 <15> 0 Enable TONE1
|
// REG_70 <15> 0 Enable TONE1
|
||||||
// 1 = Enable
|
// 1 = Enable
|
||||||
// 0 = Disable
|
// 0 = Disable
|
||||||
|
//
|
||||||
// REG_70 <14:8> 0 TONE1 tuning gain
|
// REG_70 <14:8> 0 TONE1 tuning gain
|
||||||
|
// 0 ~ 127
|
||||||
|
//
|
||||||
// REG_70 <7> 0 Enable TONE2
|
// REG_70 <7> 0 Enable TONE2
|
||||||
// 1 = Enable
|
// 1 = Enable
|
||||||
// 0 = Disable
|
// 0 = Disable
|
||||||
|
//
|
||||||
// REG_70 <6:0> 0 TONE2/FSK tuning gain
|
// REG_70 <6:0> 0 TONE2/FSK tuning gain
|
||||||
|
// 0 ~ 127
|
||||||
//
|
//
|
||||||
BK4819_WriteRegister(BK4819_REG_70, 0);
|
BK4819_WriteRegister(BK4819_REG_70, 0);
|
||||||
|
|
||||||
// Glitch threshold for Squelch
|
// Glitch threshold for Squelch
|
||||||
//
|
//
|
||||||
|
// 0 ~ 255
|
||||||
|
//
|
||||||
BK4819_WriteRegister(BK4819_REG_4D, 0xA000 | SquelchCloseGlitchThresh);
|
BK4819_WriteRegister(BK4819_REG_4D, 0xA000 | SquelchCloseGlitchThresh);
|
||||||
|
|
||||||
// REG_4E <13:11> 5 Squelch = 1 Delay Setting
|
// REG_4E <15:14> 1 ???
|
||||||
// REG_4E <10: 9> 7 Squelch = 0 Delay Setting
|
|
||||||
// REG_4E < 7: 0> 8 Glitch threshold for Squelch = 1
|
|
||||||
//
|
//
|
||||||
#if 1
|
// REG_4E <13:11> 5 Squelch = 1 Delay Setting
|
||||||
BK4819_WriteRegister(BK4819_REG_4E, 0x6F00 | SquelchOpenGlitchThresh);
|
// 0 ~ 7
|
||||||
|
//
|
||||||
|
// REG_4E <10: 9> 7 Squelch = 0 Delay Setting
|
||||||
|
// 0 ~ 3
|
||||||
|
//
|
||||||
|
// REG_4E < 8> 0 ???
|
||||||
|
//
|
||||||
|
// REG_4E < 7: 0> 8 Glitch threshold for Squelch = 1
|
||||||
|
// 0 ~ 255
|
||||||
|
//
|
||||||
|
BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000
|
||||||
|
#if 0
|
||||||
|
(1u << 14) // 1 ???
|
||||||
|
| (5u << 11) // 5 squelch = 1 delay .. 0 ~ 7
|
||||||
|
| (3u << 9) // 3 squelch = 0 delay .. 0 ~ 3
|
||||||
|
| SquelchOpenGlitchThresh); // 0 ~ 255
|
||||||
#else
|
#else
|
||||||
// https://github.com/fagci/uv-k5-firmware-fagci-mod
|
(1u << 14) // 1 ???
|
||||||
BK4819_WriteRegister(BK4819_REG_4E, 0x0040 | SquelchOpenGlitchThresh);
|
| (2u << 11) // squelch = 1 delay .. 0 ~ 7
|
||||||
|
| (1u << 9) // squelch = 0 delay .. 0 ~ 3
|
||||||
|
| SquelchOpenGlitchThresh); // 0 ~ 255
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// REG_4F <14:8> 47 Ex-noise threshold for Squelch = 0
|
// REG_4F <14:8> 47 Ex-noise threshold for Squelch = 0
|
||||||
|
// 0 ~ 127
|
||||||
|
//
|
||||||
|
// REG_4F < 7> ???
|
||||||
|
//
|
||||||
// REG_4F < 6:0> 46 Ex-noise threshold for Squelch = 1
|
// REG_4F < 6:0> 46 Ex-noise threshold for Squelch = 1
|
||||||
|
// 0 ~ 127
|
||||||
BK4819_WriteRegister(BK4819_REG_4F, ((uint16_t)SquelchCloseNoiseThresh << 8) | SquelchOpenNoiseThresh);
|
BK4819_WriteRegister(BK4819_REG_4F, ((uint16_t)SquelchCloseNoiseThresh << 8) | SquelchOpenNoiseThresh);
|
||||||
|
|
||||||
// REG_78 <15:8> 72 RSSI threshold for Squelch = 1 0.5dB/step
|
// REG_78 <15:8> 72 RSSI threshold for Squelch = 1 0.5dB/step
|
||||||
// REG_78 < 7:0> 70 RSSI threshold for Squelch = 0 0.5dB/step
|
// REG_78 < 7:0> 70 RSSI threshold for Squelch = 0 0.5dB/step
|
||||||
|
//
|
||||||
BK4819_WriteRegister(BK4819_REG_78, ((uint16_t)SquelchOpenRSSIThresh << 8) | SquelchCloseRSSIThresh);
|
BK4819_WriteRegister(BK4819_REG_78, ((uint16_t)SquelchOpenRSSIThresh << 8) | SquelchCloseRSSIThresh);
|
||||||
|
|
||||||
BK4819_SetAF(BK4819_AF_MUTE);
|
BK4819_SetAF(BK4819_AF_MUTE);
|
||||||
@ -881,9 +910,9 @@ void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch)
|
|||||||
BK4819_SetAF(BK4819_AF_BEEP);
|
BK4819_SetAF(BK4819_AF_BEEP);
|
||||||
|
|
||||||
if (bTuningGainSwitch == 0)
|
if (bTuningGainSwitch == 0)
|
||||||
ToneConfig = BK4819_REG_70_ENABLE_TONE1 | (96U << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN);
|
ToneConfig = BK4819_REG_70_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN);
|
||||||
else
|
else
|
||||||
ToneConfig = BK4819_REG_70_ENABLE_TONE1 | (28U << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN);
|
ToneConfig = BK4819_REG_70_ENABLE_TONE1 | (28u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN);
|
||||||
BK4819_WriteRegister(BK4819_REG_70, ToneConfig);
|
BK4819_WriteRegister(BK4819_REG_70, ToneConfig);
|
||||||
|
|
||||||
BK4819_WriteRegister(BK4819_REG_30, 0);
|
BK4819_WriteRegister(BK4819_REG_30, 0);
|
||||||
|
@ -78,8 +78,8 @@ void BK4819_SetCDCSSCodeWord(uint32_t CodeWord);
|
|||||||
void BK4819_SetCTCSSFrequency(uint32_t BaudRate);
|
void BK4819_SetCTCSSFrequency(uint32_t BaudRate);
|
||||||
void BK4819_SetTailDetection(const uint32_t freq_10Hz);
|
void BK4819_SetTailDetection(const uint32_t freq_10Hz);
|
||||||
void BK4819_EnableVox(uint16_t Vox1Threshold, uint16_t Vox0Threshold);
|
void BK4819_EnableVox(uint16_t Vox1Threshold, uint16_t Vox0Threshold);
|
||||||
void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth, const bool weak_no_different);
|
void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const bool weak_no_different);
|
||||||
void BK4819_SetupPowerAmplifier(uint16_t Bias, uint32_t Frequency);
|
void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency);
|
||||||
void BK4819_SetFrequency(uint32_t Frequency);
|
void BK4819_SetFrequency(uint32_t Frequency);
|
||||||
void BK4819_SetupSquelch(
|
void BK4819_SetupSquelch(
|
||||||
uint8_t SquelchOpenRSSIThresh,
|
uint8_t SquelchOpenRSSIThresh,
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
55
radio.c
55
radio.c
@ -440,30 +440,59 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
|||||||
|
|
||||||
if (gEeprom.SQUELCH_LEVEL == 0)
|
if (gEeprom.SQUELCH_LEVEL == 0)
|
||||||
{
|
{
|
||||||
pInfo->SquelchOpenRSSIThresh = 0x00;
|
pInfo->SquelchOpenRSSIThresh = 0;
|
||||||
pInfo->SquelchOpenNoiseThresh = 0x7F;
|
pInfo->SquelchOpenNoiseThresh = 127;
|
||||||
pInfo->SquelchCloseGlitchThresh = 0xFF;
|
pInfo->SquelchCloseGlitchThresh = 255;
|
||||||
|
|
||||||
pInfo->SquelchCloseRSSIThresh = 0x00;
|
pInfo->SquelchCloseRSSIThresh = 0;
|
||||||
pInfo->SquelchCloseNoiseThresh = 0x7F;
|
pInfo->SquelchCloseNoiseThresh = 127;
|
||||||
pInfo->SquelchOpenGlitchThresh = 0xFF;
|
pInfo->SquelchOpenGlitchThresh = 255;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Base += gEeprom.SQUELCH_LEVEL;
|
Base += gEeprom.SQUELCH_LEVEL;
|
||||||
|
// my squelch-1
|
||||||
|
// VHF UHF
|
||||||
|
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
|
||||||
|
EEPROM_ReadBuffer(Base + 0x10, &pInfo->SquelchCloseRSSIThresh, 1); // 40 5
|
||||||
|
|
||||||
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1);
|
EEPROM_ReadBuffer(Base + 0x20, &pInfo->SquelchOpenNoiseThresh, 1); // 65 90
|
||||||
EEPROM_ReadBuffer(Base + 0x10, &pInfo->SquelchCloseRSSIThresh, 1);
|
EEPROM_ReadBuffer(Base + 0x30, &pInfo->SquelchCloseNoiseThresh, 1); // 70 100
|
||||||
|
|
||||||
EEPROM_ReadBuffer(Base + 0x20, &pInfo->SquelchOpenNoiseThresh, 1);
|
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
|
||||||
EEPROM_ReadBuffer(Base + 0x30, &pInfo->SquelchCloseNoiseThresh, 1);
|
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
|
||||||
|
|
||||||
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1);
|
#if ENABLE_SQUELCH1_LOWER
|
||||||
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1);
|
// make squelch-1 more sensitive
|
||||||
|
if (gEeprom.SQUELCH_LEVEL == 1)
|
||||||
|
{
|
||||||
|
if (Band < BAND4_174MHz)
|
||||||
|
{
|
||||||
|
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 11) / 12;
|
||||||
|
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 9) / 10;
|
||||||
|
|
||||||
|
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
|
||||||
|
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 10) / 9;
|
||||||
|
|
||||||
|
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
|
||||||
|
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 10) / 9;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 3) / 4;
|
||||||
|
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 9) / 10;
|
||||||
|
|
||||||
|
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 4) / 3;
|
||||||
|
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 10) / 9;
|
||||||
|
|
||||||
|
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 4) / 3;
|
||||||
|
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 10) / 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pInfo->SquelchOpenNoiseThresh > 127)
|
if (pInfo->SquelchOpenNoiseThresh > 127)
|
||||||
pInfo->SquelchOpenNoiseThresh = 127;
|
pInfo->SquelchOpenNoiseThresh = 127;
|
||||||
|
|
||||||
if (pInfo->SquelchCloseNoiseThresh > 127)
|
if (pInfo->SquelchCloseNoiseThresh > 127)
|
||||||
pInfo->SquelchCloseNoiseThresh = 127;
|
pInfo->SquelchCloseNoiseThresh = 127;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user