From 553200397ed70189ca7c29f9af6a99b65d808dea Mon Sep 17 00:00:00 2001 From: Dual Tachyon Date: Sat, 14 Oct 2023 01:22:26 +0100 Subject: [PATCH] Fixed RSSI calibration. --- app/menu.c | 4 ++-- board.c | 10 +++++----- board.h | 2 +- main.c | 2 +- misc.c | 7 +------ misc.h | 7 +------ 6 files changed, 11 insertions(+), 21 deletions(-) diff --git a/app/menu.c b/app/menu.c index d8f4ded..8f03a1a 100644 --- a/app/menu.c +++ b/app/menu.c @@ -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; diff --git a/board.c b/board.c index 3951272..053c5bc 100644 --- a/board.c +++ b/board.c @@ -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); diff --git a/board.h b/board.h index 3d28e58..6b7858a 100644 --- a/board.h +++ b/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); void BOARD_FactoryReset(bool bIsAll); #endif diff --git a/main.c b/main.c index 43afe70..d73163b 100644 --- a/main.c +++ b/main.c @@ -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); diff --git a/misc.c b/misc.c index 2e0d6f7..838878c 100644 --- a/misc.c +++ b/misc.c @@ -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; diff --git a/misc.h b/misc.h index 6fe4c32..9dc482b 100644 --- a/misc.h +++ b/misc.h @@ -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;