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

🐞 fix:代码审核问题:小计读取4字节,数组第四个元素判断是否是EE第一次上电

parent a3c64709
...@@ -58,12 +58,12 @@ void Data_User_Mileage_KL30Init(void) ...@@ -58,12 +58,12 @@ void Data_User_Mileage_KL30Init(void)
} }
else else
{ {
ODOInit.Offset = TempBuf[2]; ODOInit.Offset = TempBuf[1];
} }
ODOInit.MaxValue = 1999990; ODOInit.MaxValue = 1999990;
Data_ODO_KL30_Init(DataODOBuf, &ODOInit, Func.EEPromWrite_Cbk); Data_ODO_KL30_Init(DataODOBuf, &ODOInit, Func.EEPromWrite_Cbk);
(void)Data_User_EEPROM_Read(EM_TRIP_BLOCK, TempBuf + 3, 8); (void)Data_User_EEPROM_Read(EM_TRIP_BLOCK, TempBuf + 3, 4);
if (TempBuf[3] == 0XFFFFFFFF) if (TempBuf[3] == 0XFFFFFFFF)
{ {
TripInit[EM_TRIP_A].Stamp = 0; TripInit[EM_TRIP_A].Stamp = 0;
...@@ -72,7 +72,15 @@ void Data_User_Mileage_KL30Init(void) ...@@ -72,7 +72,15 @@ void Data_User_Mileage_KL30Init(void)
{ {
TripInit[EM_TRIP_A].Stamp = TempBuf[3]; TripInit[EM_TRIP_A].Stamp = TempBuf[3];
} }
if (TempBuf[4] == 0XFFFFFFFF)
{
TripInit[EM_TRIP_A].Offset = 0;
}
else
{
TripInit[EM_TRIP_A].Offset = TempBuf[4]; TripInit[EM_TRIP_A].Offset = TempBuf[4];
}
//TripInit[EM_TRIP_A].Offset = TempBuf[4];
TripInit[EM_TRIP_A].MaxValue = 9999; /* 最大999.9km 进行复位 */ TripInit[EM_TRIP_A].MaxValue = 9999; /* 最大999.9km 进行复位 */
TripInit[EM_TRIP_A].IsRestart = 1u; TripInit[EM_TRIP_A].IsRestart = 1u;
......
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