mirror of
https://github.com/kamilsss655/uv-k5-firmware-custom
synced 2024-11-22 02:08:48 +00:00
Fixed RSSI calibration
This commit is contained in:
parent
ec4bec5b1f
commit
d817ff7e6a
@ -505,7 +505,7 @@ void MENU_AcceptSetting(void)
|
||||
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
@ -579,7 +579,7 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_MIC:
|
||||
gEeprom.MIC_SENSITIVITY = gSubMenuSelection;
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
gFlagReconfigureVfos = true;
|
||||
break;
|
||||
|
||||
|
10
board.c
10
board.c
@ -739,14 +739,14 @@ void BOARD_EEPROM_Init(void)
|
||||
}
|
||||
}
|
||||
|
||||
void BOARD_EEPROM_LoadMoreSettings(void)
|
||||
void BOARD_EEPROM_LoadCalibration(void)
|
||||
{
|
||||
// uint8_t Mic;
|
||||
|
||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_1EC0_0, 8);
|
||||
memmove(gEEPROM_1EC0_1, gEEPROM_1EC0_0, 8);
|
||||
memmove(gEEPROM_1EC0_2, gEEPROM_1EC0_0, 8);
|
||||
memmove(gEEPROM_1EC0_3, gEEPROM_1EC0_0, 8);
|
||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[3], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[4], gEEPROM_RSSI_CALIB[3], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[5], gEEPROM_RSSI_CALIB[3], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[6], gEEPROM_RSSI_CALIB[3], 8);
|
||||
|
||||
// 8 * 16-bit values
|
||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[0], 8);
|
||||
|
2
board.h
2
board.h
@ -27,7 +27,7 @@ void BOARD_ADC_Init(void);
|
||||
void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
|
||||
void BOARD_Init(void);
|
||||
void BOARD_EEPROM_Init(void);
|
||||
void BOARD_EEPROM_LoadMoreSettings(void);
|
||||
void BOARD_EEPROM_LoadCalibration(void);
|
||||
uint32_t BOARD_fetchChannelFrequency(const int channel);
|
||||
void BOARD_fetchChannelName(char *s, const int channel);
|
||||
void BOARD_FactoryReset(bool bIsAll);
|
||||
|
2
main.c
2
main.c
@ -84,7 +84,7 @@ void Main(void)
|
||||
|
||||
BOARD_EEPROM_Init();
|
||||
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
|
||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||
|
7
misc.c
7
misc.c
@ -110,12 +110,7 @@ bool bHasCustomAesKey;
|
||||
uint32_t gChallenge[4];
|
||||
uint8_t gTryCount;
|
||||
|
||||
uint8_t gEEPROM_1EC0_0[8];
|
||||
uint8_t gEEPROM_1EC0_1[8];
|
||||
uint8_t gEEPROM_1EC0_2[8];
|
||||
uint8_t gEEPROM_1EC0_3[8];
|
||||
|
||||
uint16_t gEEPROM_RSSI_CALIB[2][4];
|
||||
uint16_t gEEPROM_RSSI_CALIB[7][4];
|
||||
|
||||
uint16_t gEEPROM_1F8A;
|
||||
uint16_t gEEPROM_1F8C;
|
||||
|
7
misc.h
7
misc.h
@ -184,12 +184,7 @@ extern bool bHasCustomAesKey;
|
||||
extern uint32_t gChallenge[4];
|
||||
extern uint8_t gTryCount;
|
||||
|
||||
extern uint8_t gEEPROM_1EC0_0[8];
|
||||
extern uint8_t gEEPROM_1EC0_1[8];
|
||||
extern uint8_t gEEPROM_1EC0_2[8];
|
||||
extern uint8_t gEEPROM_1EC0_3[8];
|
||||
|
||||
extern uint16_t gEEPROM_RSSI_CALIB[2][4];
|
||||
extern uint16_t gEEPROM_RSSI_CALIB[7][4];
|
||||
|
||||
extern uint16_t gEEPROM_1F8A;
|
||||
extern uint16_t gEEPROM_1F8C;
|
||||
|
27
ui/main.c
27
ui/main.c
@ -58,8 +58,8 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||
case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||
case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
||||
case 0: break;
|
||||
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); break;
|
||||
case 0: memset( p + 0, 0, sizeof(BITMAP_Antenna)); break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
@ -218,24 +218,13 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
const uint8_t Line = (vfo == 0) ? 3 : 7;
|
||||
uint8_t *p_line = gFrameBuffer[Line - 1];
|
||||
|
||||
// TODO: sort out all 8 values from the eeprom
|
||||
|
||||
#if 0
|
||||
// dBm -105 -100 -95 -90 -70 -65 -60 -55
|
||||
// RSSI 110 120 130 140 180 190 200 210
|
||||
// 0000C0 6E 00 78 00 82 00 8C 00 B4 00 BE 00 C8 00 D2 00
|
||||
//
|
||||
const unsigned int band = 1;
|
||||
const int16_t level0 = gEEPROM_RSSI_CALIB[band][0];
|
||||
const int16_t level1 = gEEPROM_RSSI_CALIB[band][1];
|
||||
const int16_t level2 = gEEPROM_RSSI_CALIB[band][2];
|
||||
const int16_t level3 = gEEPROM_RSSI_CALIB[band][3];
|
||||
#else
|
||||
const int16_t level0 = (-115 + 160) * 2; // dB
|
||||
const int16_t level1 = ( -89 + 160) * 2; // dB
|
||||
const int16_t level2 = ( -64 + 160) * 2; // dB
|
||||
const int16_t level3 = ( -39 + 160) * 2; // dB
|
||||
#endif
|
||||
const unsigned int band = gRxVfo->Band;
|
||||
const int16_t level0 = gEEPROM_RSSI_CALIB[band][0];
|
||||
const int16_t level1 = gEEPROM_RSSI_CALIB[band][1];
|
||||
const int16_t level2 = gEEPROM_RSSI_CALIB[band][2];
|
||||
const int16_t level3 = gEEPROM_RSSI_CALIB[band][3];
|
||||
|
||||
const int16_t level01 = (level0 + level1) / 2;
|
||||
const int16_t level12 = (level1 + level2) / 2;
|
||||
const int16_t level23 = (level2 + level3) / 2;
|
||||
|
Loading…
Reference in New Issue
Block a user