Fixed RSSI calibration.

This commit is contained in:
Dual Tachyon 2023-10-14 01:22:26 +01:00
parent c79781ae47
commit 553200397e
6 changed files with 11 additions and 21 deletions

View File

@ -324,7 +324,7 @@ void MENU_AcceptSetting(void)
if (gEeprom.VOX_SWITCH) {
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
}
BOARD_EEPROM_LoadMoreSettings();
BOARD_EEPROM_LoadCalibration();
gFlagReconfigureVfos = true;
gRequestSaveSettings = true;
gUpdateStatus = true;
@ -412,7 +412,7 @@ void MENU_AcceptSetting(void)
case MENU_MIC:
gEeprom.MIC_SENSITIVITY = gSubMenuSelection;
BOARD_EEPROM_LoadMoreSettings();
BOARD_EEPROM_LoadCalibration();
gRequestSaveSettings = true;
gFlagReconfigureVfos = true;
return;

10
board.c
View File

@ -706,14 +706,14 @@ void BOARD_EEPROM_Init(void)
bHasCustomAesKey = false;
}
void BOARD_EEPROM_LoadMoreSettings(void)
void BOARD_EEPROM_LoadCalibration(void)
{
uint8_t Mic;
EEPROM_ReadBuffer(0x1EC0, gEEPROM_1EC0_0, 8);
memcpy(gEEPROM_1EC0_1, gEEPROM_1EC0_0, 8);
memcpy(gEEPROM_1EC0_2, gEEPROM_1EC0_0, 8);
memcpy(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);
EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[0], 8);
memcpy(gEEPROM_RSSI_CALIB[1], gEEPROM_RSSI_CALIB[0], 8);

View File

@ -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);
void BOARD_FactoryReset(bool bIsAll);
#endif

2
main.c
View File

@ -81,7 +81,7 @@ void Main(void)
BK4819_Init();
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);
BOARD_EEPROM_Init();
BOARD_EEPROM_LoadMoreSettings();
BOARD_EEPROM_LoadCalibration();
RADIO_ConfigureChannel(0, 2);
RADIO_ConfigureChannel(1, 2);

7
misc.c
View File

@ -40,12 +40,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[3][4];
uint16_t gEEPROM_RSSI_CALIB[7][4];
uint16_t gEEPROM_1F8A;
uint16_t gEEPROM_1F8C;

7
misc.h
View File

@ -97,12 +97,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[3][4];
extern uint16_t gEEPROM_RSSI_CALIB[7][4];
extern uint16_t gEEPROM_1F8A;
extern uint16_t gEEPROM_1F8C;