0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

Fix frequency band error from yesterday

This commit is contained in:
OneOfEleven 2023-10-03 11:48:00 +01:00
parent 010ea0308a
commit c5c86d0ad0
7 changed files with 32 additions and 48 deletions

View File

@ -443,7 +443,7 @@
#if 0 #if 0
if (gain_table_index[vfo] == gain_table_index_prev[vfo]) if (gain_table_index[vfo] == gain_table_index_prev[vfo])
return; // no gain change return; // no gain change - this is to reduce writing to the BK chip on ever call
#endif #endif
#endif #endif

View File

@ -543,48 +543,34 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
// ****************************************** // ******************************************
// original setting {
uint16_t lna_short = orig_lna_short; // original setting
uint16_t lna = orig_lna; uint16_t lna_short = orig_lna_short;
uint16_t mixer = orig_mixer; uint16_t lna = orig_lna;
uint16_t pga = orig_pga; uint16_t mixer = orig_mixer;
uint16_t pga = orig_pga;
if (gRxVfo->AM_mode) #ifdef ENABLE_AM_FIX
{ // AM
/*
#ifndef ENABLE_AM_FIX
const uint32_t rx_frequency = gRxVfo->pRX->Frequency;
// the RX gain abrutly reduces above this frequency
// I guess this is (one of) the freq the hardware switches the front ends over ? // TODO:
if (rx_frequency <= 22640000)
{ // decrease front end gain - AM demodulator saturates at a slightly higher signal level
lna_short = 3; // 3 original // if (gRxVfo->AM_mode)
lna = 2; // 2 original // { // AM RX
mixer = 3; // 3 original // if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
pga = 3; // 6 original, 3 reduced // {
} // AM_fix_10ms(gEeprom.RX_CHANNEL);
else // }
{ // increase the front end to compensate the reduced gain, but more gain decreases dynamic range :( // }
lna_short = 3; // 3 original // else
lna = 4; // 2 original, 4 increased BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
mixer = 3; // 3 original #else
pga = 7; // 6 original, 7 increased // apply the front end gain settings
} BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
#endif #endif
*/
// what do these 4 other gain settings 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
gNeverUsed = 0;
} }
// apply the front end gain settings
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
// ****************************************** // ******************************************
// AF gain - original // AF gain - original

Binary file not shown.

Binary file not shown.

1
misc.c
View File

@ -217,7 +217,6 @@ uint8_t gScanDelay_10ms;
uint8_t gAircopySendCountdown; uint8_t gAircopySendCountdown;
#endif #endif
uint8_t gFSKWriteIndex; uint8_t gFSKWriteIndex;
uint8_t gNeverUsed;
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
bool gIsNoaaMode; bool gIsNoaaMode;

1
misc.h
View File

@ -285,7 +285,6 @@ extern uint8_t gScanDelay_10ms;
extern uint8_t gAircopySendCountdown; extern uint8_t gAircopySendCountdown;
#endif #endif
extern uint8_t gFSKWriteIndex; extern uint8_t gFSKWriteIndex;
extern uint8_t gNeverUsed;
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
extern bool gIsNoaaMode; extern bool gIsNoaaMode;
extern uint8_t gNoaaChannel; extern uint8_t gNoaaChannel;

View File

@ -371,8 +371,8 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (Frequency < frequencyBandTable[Band].lower) if (Frequency < frequencyBandTable[Band].lower)
Frequency = frequencyBandTable[Band].lower; Frequency = frequencyBandTable[Band].lower;
else else
if (Frequency > frequencyBandTable[Band + 1].upper) if (Frequency > frequencyBandTable[Band].upper)
Frequency = frequencyBandTable[Band + 1].upper; Frequency = frequencyBandTable[Band].upper;
else else
if (Channel >= FREQ_CHANNEL_FIRST) if (Channel >= FREQ_CHANNEL_FIRST)
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, frequencyBandTable[Band].lower); Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, frequencyBandTable[Band].lower);