Commit a3c64709 authored by 李俭双's avatar 李俭双

🐞 fix:代码评审问题:更改ee存储和读取的方式,使用ee库的接口函数,而非里程库里的接口

parent 9addd6e8
......@@ -10,7 +10,8 @@ uint8_t Can_341_Flg = 0;
void Data_TPMS_KL30_Init ( void )
{
uint8_t TPMS_L[2] = {0,0};
Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
//Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_09, TPMS_L , 2);
MenuData.TPMS_Front_Learn = TPMS_L[0];
MenuData.TPMS_Rear_Learn = TPMS_L[1];
//MenuData.TPMS_Front_FirstLearn_Flag = TPMS_L[2];
......@@ -38,7 +39,8 @@ void Data_TPMS_KL30_Init ( void )
void Data_TPMS_KL15_WAKE_UP_Init ( void )
{
uint8_t TPMS_L[2] = {0,0};
Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1);
//Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1);
eeprom_ReadRecord(EEPROM_BLOCK_09, TPMS_L , 2);
MenuData.TPMS_Front_Learn = TPMS_L[0];
MenuData.TPMS_Rear_Learn = TPMS_L[1];
//MenuData.TPMS_Front_FirstLearn_Flag = TPMS_L[2];
......@@ -338,7 +340,8 @@ void Data_TPMS_Processing_Service ( void )
MenuData.TPMS_Front_Learn = TPMS.TPMS_Front_Learn;
TPMS_L[0] = MenuData.TPMS_Front_Learn;
TPMS_L[1] = MenuData.TPMS_Rear_Learn;
Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
//Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
eeprom_WriteRecord(EEPROM_BLOCK_09, TPMS_L, 2);
}
......@@ -347,7 +350,8 @@ void Data_TPMS_Processing_Service ( void )
MenuData.TPMS_Rear_Learn = TPMS.TPMS_Rear_Learn;
TPMS_L[0] = MenuData.TPMS_Front_Learn;
TPMS_L[1] = MenuData.TPMS_Rear_Learn;
Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
//Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
eeprom_WriteRecord(EEPROM_BLOCK_09, TPMS_L, 2);
}
......
......@@ -16,11 +16,11 @@ uint8_t Tpms_TX_Flag = 0;
//RTC_DateTypeDef RTC_DateStruct;
RTC_CounterTypeDef counter_val;
void Data_TCS_Set_OnOff(uint32_t u32Data)
void Data_TCS_Set_OnOff(uint8_t u8Data)
{
uint32_t u32Data1[1u] = {0};
u32Data1[0u] = u32Data;
Data_User_EEPROM_Write(EM_MenuData_Tcs_Val, u32Data1, 1u);
uint8_t u8Data1[1u] = {0};
u8Data1[0u] = u8Data;
eeprom_WriteRecord(EEPROM_BLOCK_08, (uint8_t *)u8Data, 1);
}
void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
......@@ -485,8 +485,9 @@ void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datM
void MenuData_Unit_Init(void)
{
uint32_t TCS[1] = {0};
Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TCS, 1u);
uint8_t TCS[1] = {0};
//Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TCS, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_08, TCS, 1);
MenuData.KM_Unit = 0;
//MenuData.Tpms_Unit = 0;
MenuData.Tcs_Val = TCS[0];
......@@ -494,8 +495,9 @@ void MenuData_Unit_Init(void)
}
void MenuData_TCS_Init(void)
{
uint32_t TCS[1] = {0};
Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TCS, 1u);
uint8_t TCS[1] = {0};
//Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TCS, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_08, TCS, 1);
MenuData.Tcs_Val = TCS[0];
PageType = Page_Menu;
Hour_Set = 0;
......
......@@ -19,7 +19,7 @@ typedef struct __attribute__((aligned(4)))
uint8_t Dis_Minute;
uint8_t KM_Unit; // 0 km, 1 mile
uint8_t Tpms_Unit;// 0 bar, 1 psi
uint32_t Tcs_Val; // 0 off, 1 on
uint8_t Tcs_Val; // 0 off, 1 on
uint8_t TPMS_Front_Learn;
uint8_t TPMS_Rear_Learn;
uint8_t TPMS_Front_FirstLearn_Flag;
......@@ -77,6 +77,6 @@ void Key_Check_Service(void);
void MenuData_Unit_Init(void);
void Maintain_Reset_Service(void);
void MenuData_TCS_Init(void);
void Data_TCS_Set_OnOff(uint32_t u32Data);
void Data_TCS_Set_OnOff(uint8_t u8Data);
uint8_t Get_Tpms_TX_Flag(void);
#endif
......@@ -51,10 +51,10 @@ typedef enum
EM_MILEAGE_BLOCK = 0u, /**< 累计里程 */
EM_ODO_BLOCK, /**< 总计里程 */
EM_TRIP_BLOCK, /**< 小计里程 */
EM_Maintenance_BLOCK, /**< 保养里程 */
EM_Maintenance_Firstflg, /**< 保养标志 */
EM_MenuData_Tcs_Val, /**< TCS开关标志 */
EM_MenuData_TPMS_LEARN, /**< TPMS学习结果 */
// EM_Maintenance_BLOCK, /**< 保养里程 */
// EM_Maintenance_Firstflg, /**< 保养标志 */
// EM_MenuData_Tcs_Val, /**< TCS开关标志 */
// EM_MenuData_TPMS_LEARN, /**< TPMS学习结果 */
} Data_EEPROM_Enum_t;
typedef void (*EEPromWrite)(Data_EEPROM_Enum_t BlockID, Millib_uint32_t u32Data[], Millib_uint16_t u16Len);
......
......@@ -89,21 +89,23 @@ void Data_User_Mileage_KL30Init(void)
TripInit[EM_TRIP_D].IsRestart = 1u;
Data_Trip_KL30_Init(DataTripBuf, TripInit, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TempBuf, 1u);
//Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TempBuf, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)TempBuf, 1);
if (TempBuf[0u] == 0xFFFFFFFF)
{
MenuData.Tcs_Val = 1;
Data_User_EEPROM_Write(EM_MenuData_Tcs_Val, &MenuData.Tcs_Val, 1u);
//Data_User_EEPROM_Write(EM_MenuData_Tcs_Val, &MenuData.Tcs_Val, 1u);
eeprom_WriteRecord(EEPROM_BLOCK_08, &MenuData.Tcs_Val, 1);
}
Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, TempBuf, 1u);
//Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, TempBuf, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)TempBuf, 2);
if (TempBuf[0u] == 0xFFFFFFFF)
{
TPMSLearn[0] = 0;//MenuData.TPMS_Front_Learn;
TPMSLearn[1] = 0;//MenuData.TPMS_Rear_Learn;
//TPMSLearn[2] = 0;//MenuData.TPMS_Front_FirstLearn_Flag;
//TPMSLearn[3] = 0;//MenuData.TPMS_Rear_FirstLearn_Flag;
Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t *)TPMSLearn, 1u);
TPMSLearn[1] = 0;//MenuData.TPMS_Rear_Learn;
//Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t *)TPMSLearn, 1u);
eeprom_WriteRecord(EEPROM_BLOCK_09, TPMSLearn, 2);
}
Milleage_InitFlag = 0X5AA53AA3UL;
......@@ -158,12 +160,12 @@ uint32_t Get_MileageInit_Status(void)
// case EM_Maintenance_Firstflg:
// eeprom_ReadRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
// break;
case EM_MenuData_Tcs_Val:
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 4);
break;
case EM_MenuData_TPMS_LEARN:
eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 2);
break;
// case EM_MenuData_Tcs_Val:
// eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 4);
// break;
// case EM_MenuData_TPMS_LEARN:
// eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 2);
// break;
default:
......@@ -207,12 +209,12 @@ uint32_t Get_MileageInit_Status(void)
// case EM_Maintenance_Firstflg:
// eeprom_WriteRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
// break;
case EM_MenuData_Tcs_Val:
eeprom_WriteRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 1);
break;
case EM_MenuData_TPMS_LEARN:
eeprom_WriteRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 2);
break;
// case EM_MenuData_Tcs_Val:
// eeprom_WriteRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 1);
// break;
// case EM_MenuData_TPMS_LEARN:
// eeprom_WriteRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 2);
// break;
default:
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment