#include "Maintenance.h"
#include "Maintenance_user.h"
#include "Non_volatile_Memorys.h"
/*-------------------------------------------------------*/
#pragma location="BACKUP_RAM_CONTENT"
Maint_uint8_t u8MaintData[16];
/*-------------------------------------------------------*/
/**触发保养相关参数存储动作时执行，目前存储长度固定为16个字节**/
void Maintenance_Handle_Parameter_Save(Maint_uint8_t *pu8MaintData, Maint_uint8_t u8MaintLen)
{
	Maint_uint8_t i = 0;
	for (i = 0; i < u8MaintLen; i++)
	{
		u8MaintData[i] = pu8MaintData[i];
	}
	NVM_Data_Update(NVM_MAINTENANCE);
}

void Maintenance_Init_Example(void)
{
	Maint_Init_st_t stMaintInit;
	stMaintInit.u32ODOCurrent = NVM_ODO_VALUE;				/**获取当前里程然后赋值***/
	stMaintInit.u32DefaultFirstIntervalMileage = 30000UL;	/**默认首保5000KM*/
	stMaintInit.u32DefaultSecondIntervalMileage = 100000UL; /**默认首保10000KM*/
	stMaintInit.pfnMaintSaveCallBack = Maintenance_Handle_Parameter_Save;
	Maintenance_Init(&stMaintInit, &u8MaintData[0]);
}
/*
Maintenance_Current_ODO_Set(NVM_ODO_VALUE );
Maintenance_Service();
*/
