Commit 3e0c01f8 authored by 郑萍's avatar 郑萍

feat:删除里程全部内容

parent a085e505
......@@ -513,21 +513,6 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\BU98R10\BU98R10.h</FilePath>
</File>
<File>
<FileName>Services_Mileage.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Mileage\Services_Mileage.h</FilePath>
</File>
<File>
<FileName>Services_Mileage_User.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Component\Mileage\Services_Mileage_User.c</FilePath>
</File>
<File>
<FileName>Services_Mileage_User.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Mileage\Services_Mileage_User.h</FilePath>
</File>
<File>
<FileName>eeManager_Interface.c</FileName>
<FileType>1</FileType>
......@@ -658,11 +643,6 @@
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Component\Telltales\Telltales_user.c</FilePath>
</File>
<File>
<FileName>libMileage_BAT32_V1.07.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Mileage\libMileage_BAT32_V1.07.lib</FilePath>
</File>
<File>
<FileName>PowerManagement.lib</FileName>
<FileType>4</FileType>
......
......@@ -161,25 +161,3 @@ uint32_t Common_GetSocTime(void)
return PowerSocTimeLine;
}
/**
* @brief 公里转换英里
* @return 公里
*/
uint32_t Data_Km_To_Mile(uint32_t Km)
{
// Km *= 621;
// Km /= 1000;
Km *= 100;
Km /= 161;
return Km;
}
/**
* @brief 英里转换公里
* @return 英里
*/
uint32_t Data_Mile_To_Km(uint32_t Mile)
{
Mile *= 161;
Mile /= 100;
return Mile;
}
......@@ -74,8 +74,5 @@ extern uint32_t Common_GetIgnOnTime(void); /*ms*/
extern uint32_t Common_GetIgnOffTime(void); /*ms*/
extern uint32_t Data_Km_To_Mile(uint32_t Km);
extern uint32_t Data_Mile_To_Km(uint32_t Mile);
#endif
......@@ -11,8 +11,6 @@
#include "System_Monitor\System_Monitor.h"
#include "Telltales\Telltales_Lib.h"
#include "Telltales\Telltales_user.h"
#include "Mileage\Services_Mileage.h"
#include "Mileage\Services_Mileage_User.h"
#include "Eeprom\eeManager_Interface.h"
#include "Eeprom\eepromManage.h"
#include "BU98R10\BU98R10.h"
......
This diff is collapsed.
#include "Components.h"
__align(4)
uint8_t DataMilleageBuf[Data_MEM_Block_Mileage];
uint8_t DataODOBuf[Data_MEM_Block_ODO];
uint8_t DataTripBuf[Data_MEM_Block_Trip * EM_TRIP_MAX];
Mileage_t g_WriteMileage;
Mileage_t g_ReadMileage;
uint8_t odo_writeState;
uint8_t odo_readState;
static uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len);
static void Data_User_EEPROM_Write(Data_EEPROM_Enum_t BlockID, uint32_t u32Data[], uint16_t u16Len);
#define EEPROM_BLOCK_00 0X00
#define EEPROM_BLOCK_01 0X16
#define EEPROM_BLOCK_02 0X32
#define EEPROM_BLOCK_03 0X48
#define EEPROM_BLOCK_04 0X64
#define EEPROM_BLOCK_05 0X80
#define EEPROM_BLOCK_06 0X90
uint32_t Milleage_InitFlag = 0U;
/******************************************************************************
Function:Data_ODO_KL30Init
Description:
Input:
Output:
******************************************************************************/
void Data_User_Mileage_KL30Init(void)
{
uint32_t TempBuf[20] = {0};
Mileage_Init_t MileInit = {0};
Mileage_Func_t Func = {0};
ODO_Init_t ODOInit = {0};
// EngODO_Init_t EngODOInit = {0};
Trip_Init_t TripInit[4] = {0};
Milleage_InitFlag = 0U;
// �������ݴ�EEPROM�ж�ȡ
(void)Data_User_EEPROM_Read(EM_MILEAGE_BLOCK, TempBuf, 1);
if (TempBuf[0] == 0xFFFFFFFF)
{
MileInit.Mileage = 0u;
}
else
{
MileInit.Mileage = TempBuf[0];
}
Func.Get_Sys_IG_Sts = Common_Get_IG_Sts;
Func.Get_Act_V_Speed_Valid = Common_Get_Act_V_Speed_Valid;
Func.Get_Act_V_Speed = Common_Get_Act_V_Speed_ODO;
Func.Get_TireSize = (void *)0;
Func.EEPromWrite_Cbk = Data_User_EEPROM_Write; // ��ʱδ����
Data_Mileage_KL30_Init(DataMilleageBuf, &MileInit, &Func);
(void)Data_User_EEPROM_Read(EM_ODO_BLOCK, TempBuf + 1, 2);
if (TempBuf[1] == 0xFFFFFFFF)
{
ODOInit.Stamp = 0;
}
else
{
ODOInit.Stamp = TempBuf[1];
}
if (TempBuf[1] == 0xFFFFFFFF)
{
ODOInit.Offset = 0;
}
else
{
ODOInit.Offset = TempBuf[2];
}
ODOInit.MaxValue = 16103058;
Data_ODO_KL30_Init(DataODOBuf, &ODOInit, Func.EEPromWrite_Cbk);
(void)Data_User_EEPROM_Read(EM_TRIP_BLOCK, TempBuf + 3, 8);
if (TempBuf[3] == 0XFFFFFFFF)
{
TripInit[EM_TRIP_A].Stamp = 0;
}
else
{
TripInit[EM_TRIP_A].Stamp = TempBuf[3];
}
TripInit[EM_TRIP_A].Offset = TempBuf[4];
TripInit[EM_TRIP_A].MaxValue = 16092; /* 最大999.9Mile 进行复位 */
TripInit[EM_TRIP_A].IsRestart = 1u;
TripInit[EM_TRIP_B].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_B].MaxValue = 99999;
TripInit[EM_TRIP_B].IsRestart = 1u;
TripInit[EM_TRIP_C].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_C].MaxValue = 99999;
TripInit[EM_TRIP_C].IsRestart = 1u;
TripInit[EM_TRIP_D].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_D].MaxValue = 99999;
TripInit[EM_TRIP_D].IsRestart = 1u;
Data_Trip_KL30_Init(DataTripBuf, TripInit, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
Milleage_InitFlag = 0X5AA53AA3UL;
}
void Data_User_Mileage_WakeupInit(void)
{
Mileage_Func_t Func = {0};
Milleage_InitFlag = 0U;
Func.Get_Sys_IG_Sts = Common_Get_IG_Sts;
Func.Get_Act_V_Speed_Valid = Common_Get_Act_V_Speed_Valid;
Func.Get_Act_V_Speed = Common_Get_Act_V_Speed_ODO;
Func.Get_TireSize = (void *)0;
Func.EEPromWrite_Cbk = Data_User_EEPROM_Write; // ��ʱδ����
Data_Mileage_Wakeup_Init(DataMilleageBuf, &Func);
Data_ODO_Wakeup_Init(DataODOBuf, Func.EEPromWrite_Cbk);
Data_Trip_Wakeup_Init(DataTripBuf, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
Milleage_InitFlag = 0X5AA53AA3UL;
}
uint32_t Get_MileageInit_Status(void)
{
return Milleage_InitFlag;
}
static uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len)
{
switch (u16BlockID)
{
case EM_MILEAGE_BLOCK:
odo_readState = eeprom_ReadODO(&g_ReadMileage);
u32Data[0] = g_ReadMileage.Odo / 100;
break;
case EM_ODO_BLOCK:
eeprom_ReadRecord(EEPROM_BLOCK_01, (uint8_t *)u32Data, u16Len * 4);
break;
case EM_TRIP_BLOCK:
eeprom_ReadRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
break;
default:
break;
}
return 0;
}
static void Data_User_EEPROM_Write(Data_EEPROM_Enum_t BlockID, uint32_t u32Data[], uint16_t u16Len)
{
// uint8_t i = 0u;
switch (BlockID)
{
case EM_MILEAGE_BLOCK:
if (u32Data[0] == 0)
{
eeprom_ClearOdoSection();
}
else
{
g_WriteMileage.Odo = u32Data[0] * 100;
odo_writeState = WRITE_FAIL;
odo_writeState = eeprom_WriteODO(&g_WriteMileage, distance_100m, 1);
}
break;
case EM_ODO_BLOCK:
eeprom_WriteRecord(EEPROM_BLOCK_01, (uint8_t *)u32Data, u16Len * 4);
break;
case EM_TRIP_BLOCK:
eeprom_WriteRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
break;
default:
break;
}
}
void Services_Mileage_Callback(void)
{
Data_Mileage_ISR();
Data_ODO_Processing();
Data_Trip_Processing();
Trip_Clear_Km_Service();
}
/**
* @brief 获取大计里程值
* @return 根据当前单位输出对应大计里程值
*/
uint32_t Get_ODO_Value(void)
{
uint32_t ODO = 0;
// if (Get_Dis_Unit() == 0) /* 公制 */
// {
// ODO = Data_ODO_Read();
// }
// else if (Get_Dis_Unit() == 1) /* 英制 */
// {
// ODO = Data_Km_To_Mile(Data_ODO_Read());
// }
// else /* 无效值,按照公里处理,理论上不会执行到这 */
// {
// ODO = Data_ODO_Read();
// }
return ODO;
}
/**
* @brief 获取小计里程值
* @return 根据当前单位输出对应小计里程值
*/
uint32_t Get_Trip_Value(void)
{
uint32_t Trip = 0;
// if (Get_Dis_Unit() == 0) /* 公制 */
// {
// Trip = Data_Read_Trip(EM_TRIP_A);
// }
// else if (Get_Dis_Unit() == 1) /* 英制 */
// {
// Trip = Data_Km_To_Mile(Data_Read_Trip(EM_TRIP_A));
// }
// else /* 无效值,按照公里处理,理论上不会执行到这 */
// {
// Trip = Data_Read_Trip(EM_TRIP_A);
// }
return Trip;
}
uint32_t testtrip = 0;
/**
* @brief 当前单位在KM时,小计里程大于999.9KM,主动触发小计清零
*
*/
void Trip_Clear_Km_Service(void)
{
// if (Get_Dis_Unit() == 0) /* 公制 */
// {
// if (Data_Read_Trip(EM_TRIP_A) > 9999) /* 当前单位在KM时,里程大于999.9KM进行清零 */
// {
// Data_Clear_Trip_All();
// }
// }
}
/**
* @brief 触发单位转换时调用,如当前单位英里且里程大于621Mile时,单位转换为公里后需主动写入小计里程为999.9KM;
* 需要单位转换标志位赋值后进行调用!!!
*
*/
void Unit_Convert_Service(void)
{
// if (Get_Dis_Unit() == 0) /* 公制 */
// {
// if (Data_Read_Trip(EM_TRIP_A) > 9999) /* 当前单位在KM时,里程大于999.9KM进行清零 */
// {
// Data_Write_Trip(EM_TRIP_A, 9999);
// }
// }
}
#ifndef __SERVICE_ODO_USER_H__
#define __SERVICE_ODO_USER_H__
//#define ONLY_CLEAR_ODO_MIL 0x01u /*仅根据距离信息进行ODO清除*/
//#define ONLY_CLEAR_ODO_NUM 0x01u /*仅根据次数信息进行ODO清除*/
#define CLEAR_ODO_NUM_MIL 0x01u /*以距离信息以及次数信息进行ODO清除*/
#define ODO_CLEAR_NUM 5u /*清除次数上限值 */
#define ODO_CLEAR_MIL 50000u /*清除距离上限值 单位0.1KM*/
extern uint8_t ODO_Clear_Num_Value;
void Data_User_Mileage_KL30Init(void);
void Data_User_Mileage_WakeupInit(void);
void Services_Mileage_Callback(void);
void Data_ODO_KM_TO_MILE(void);
void Data_TRIP_KM_TO_MILE(void);
uint32_t Get_MileageInit_Status(void);
extern uint32_t Get_ODO_Value(void);
extern uint32_t Get_Trip_Value(void);
extern void Trip_Clear_Km_Service(void);
extern void Unit_Convert_Service(void);
#endif
......@@ -54,7 +54,6 @@ static void Power_KL30_Init(void)
LINE_IN_Init();
LED_Driver_Init_Example();//注意顺序2
LED_Driver_Service_Immediate();
Data_User_Mileage_KL30Init();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHB, ActiveLevel_High);
......@@ -81,7 +80,6 @@ static void Power_Wakeup_Init(void)
Can_Init();
eeprom_StoreInfo_Init();
Analog_Signal_Conv_Init();
Data_User_Mileage_WakeupInit();
BU98R10_Init();
Sys_WakeUp_Init();
LINE_IN_Init();
......
......@@ -32,7 +32,6 @@ void Sys_5ms_Tasks(void)
void Sys_10ms_Tasks(void)
{
Line_In_Debounce_Service(10u);
Data_Mileage_Write_EEPROM();
Can_BusOff_Recover(10u);
TYW_Check_Count();
}
......
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