Commit 7b6e711e authored by hu's avatar hu

修改车速,转速相关函数

parent 4788817e
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
.\APP\BackLight\BackLight_APP.h .\APP\BackLight\BackLight_APP.h
.\APP\Data_CoolantTemperature\Data_CoolantTemperature.c .\APP\Data_CoolantTemperature\Data_CoolantTemperature.c
.\APP\Data_CoolantTemperature\Data_CoolantTemperature.h .\APP\Data_CoolantTemperature\Data_CoolantTemperature.h
.\APP\Data_CoolantTemperature\Data_CoolantTemperature_Filter.c
.\APP\Data_EngineSpeed\Data_EngineSpeed.c .\APP\Data_EngineSpeed\Data_EngineSpeed.c
.\APP\Data_EngineSpeed\Data_EngineSpeed.h .\APP\Data_EngineSpeed\Data_EngineSpeed.h
.\APP\Data_Gear\Data_Gear.c .\APP\Data_Gear\Data_Gear.c
......
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
project .intvect 1536 project .intvect 1536
project .text 299212 project .text 297564
project .rodata 412367 project .rodata 412311
project .secinfo 120 project .secinfo 120
project .syscall 6 project .syscall 6
project .romdata 7853 project .romdata 7765
project .ROM.ramfunc 208 project .ROM.ramfunc 208
project .ramfunc 208 project .ramfunc 208
...@@ -62,7 +62,7 @@ void BL_Management_service ( void ) ...@@ -62,7 +62,7 @@ void BL_Management_service ( void )
uint8_t ILL = 0 ; uint8_t ILL = 0 ;
if(Line_In_Get_Status(LINE_IN_ILLUMINATION) ) if (Line_In_Get_Status(LINE_IN_ILLUMINATION) )
{ {
ILL = 2 ; ILL = 2 ;
} }
...@@ -163,7 +163,7 @@ void BL_Management_service ( void ) ...@@ -163,7 +163,7 @@ void BL_Management_service ( void )
/*得到主题模式可自己在枚举中定义 在BackGroundLight.c里填表*/ /*得到主题模式可自己在枚举中定义 在BackGroundLight.c里填表*/
GetBGLTheme(0); GetBGLTheme(0);
/*得到工作模式 白天 傍晚 夜晚 在枚举中已定义*/ /*得到工作模式 白天 傍晚 夜晚 在枚举中已定义*/
GetBGLType(ILL); GetBGLType(ILL);
//GetBGLType(0); //GetBGLType(0);
/*得到背光等级 可自己在枚举中定义 在BackGroundLight.c里填表*/ /*得到背光等级 可自己在枚举中定义 在BackGroundLight.c里填表*/
...@@ -173,42 +173,14 @@ void BL_Management_service ( void ) ...@@ -173,42 +173,14 @@ void BL_Management_service ( void )
GetBGLNTCVol(0); GetBGLNTCVol(0);
/*主函数中调用第一个参数电源状态 1是 ON档 2 off 第二个参数 唤醒条件 1是TTF唤醒 2 是表盘唤醒 3 是表盘和屏都有唤醒,0无唤醒*/ /*主函数中调用第一个参数电源状态 1是 ON档 2 off 第二个参数 唤醒条件 1是TTF唤醒 2 是表盘唤醒 3 是表盘和屏都有唤醒,0无唤醒*/
BackLightSchedu(Common_Get_IG_Sts(), BackLightWakeFlag); BackLightSchedu(Common_Get_IG_Sts(), BackLightWakeFlag);
//BL_PWM_OUT = 1 ;
//水温灯
TimerB_PWM_Channel_Duty_Set(TIMERB_2_CH7 , testBG );//水温格白色
TEMP_W_LED_OUT = 1 ;//水温字符白色指示灯
//燃油灯
if(Fuel_Get_LowAlarm())
{
FUEL_LED_Y_MCU = 1U ;
FUEL_W_LED_OUT = 0U ;
}
else
{
FUEL_LED_Y_MCU = 0U ;
FUEL_W_LED_OUT = 1U ;
}
} }
void BL_PWM_Duty_Cycle_Capture_ISR ( void ) void BL_PWM_Duty_Cycle_Capture_ISR ( void )
{ {
} }
void SEG_LCD_Init ( void ) void SEG_LCD_Init ( void )
{ {
SEGLCDBackup.Brightness = 0xFF; SEGLCDBackup.Brightness = 0xFF;
......
...@@ -17,7 +17,6 @@ static struct ...@@ -17,7 +17,6 @@ static struct
} CoolantVariable ; } CoolantVariable ;
static uint8_t CalCoolant_CurSeg(uint8_t Valid, uint8_t Temp); static uint8_t CalCoolant_CurSeg(uint8_t Valid, uint8_t Temp);
static uint8_t CalCoolant_TarSeg(uint16_t CanMsg);
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function Name : Coolant_KL30_Init * Function Name : Coolant_KL30_Init
* Description : 水温KL30初始化 * Description : 水温KL30初始化
...@@ -65,19 +64,19 @@ void Coolant_Sleep_Init(void) ...@@ -65,19 +64,19 @@ void Coolant_Sleep_Init(void)
* Return : None * Return : None
* onther : None * onther : None
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
static uint8_t wbyTestSeg = 0 ;
void Coolant_Processing_Service(void) void Coolant_Processing_Service(void)
{ {
static uint8_t Timer2s = 0 ; static uint8_t Timer2s = 0 ;
uint8_t TargetSeg = 0 ; uint8_t TargetSeg = 0 ;
uint8_t Msg_CoolTemp = 0u ;
uint8_t CanStatus = 0u;
uint8_t Msg_CoolTemp = 0 ; CanStatus = CAN_MSG_Status(ID_CanMsg18FEEE00_Msg_Count);
if (CAN_MSG_Status(ID_CanMsg18FEEE00_Msg_Count) == 0x55u) if (CanStatus == CAN_SIG_LOST)
{ {
//timeout
CoolantVariable.Valid = 0 ; CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0u;
Timer2s = 0 ; Timer2s = 0 ;
} }
else else
...@@ -92,93 +91,20 @@ void Coolant_Processing_Service(void) ...@@ -92,93 +91,20 @@ void Coolant_Processing_Service(void)
else else
{ {
Timer2s = 0 ; Timer2s = 0 ;
CoolantVariable.Valid = 1 ; CoolantVariable.Valid = 1u;
CoolantVariable.Value = Msg_CoolTemp ;
TargetSeg = CalCoolant_TarSeg(Msg_CoolTemp); if (Msg_CoolTemp >= 40)
{
CoolantVariable.Value = Msg_CoolTemp - 40u;
}
else
{
CoolantVariable.Value = 0u;
}
} }
} }
if (Msg_CoolTemp < 40) CoolantVariable.CurSeg = CalCoolant_CurSeg(CoolantVariable.Valid, CoolantVariable.Value);
{
Msg_CoolTemp = 0 ;
}
else
{
Msg_CoolTemp -= 40 ;
}
//CoolantVariable.CurSeg = CalCoolant_CurSeg(CoolantVariable.Valid,Msg_CoolTemp);
//TargetSeg - 目标段
//CoolantVariable.Valid - 有效值
//CoolantVariable.CurSeg - 当前段
CoolantVariable.CurSeg = Coolant_Temp_Filter(TargetSeg, CoolantVariable.Valid);
}
/*-------------------------------------------------------------------------
* Function Name : CalCoolant_TarSeg
* Description : 根据有效报文 得到 目标格
* Input : None
* Output : None
* Return : None
* onther : None
--------------------------------------------------------------------------*/
static uint8_t CalCoolant_TarSeg(uint16_t CanMsg)
{
uint8_t TargetSeg = 0 ;
if (CanMsg >= 0x00 && CanMsg <= 0x59)
{
TargetSeg = 0 ;
}
if (CanMsg >= 0x5A && CanMsg <= 0x5E)
{
TargetSeg = 1 ;
}
if (CanMsg >= 0x5F && CanMsg <= 0x64)
{
TargetSeg = 2 ;
}
if (CanMsg >= 0x65 && CanMsg <= 0x69)
{
TargetSeg = 3 ;
}
if (CanMsg >= 0x6A && CanMsg <= 0x6F)
{
TargetSeg = 4 ;
}
if (CanMsg >= 0x70 && CanMsg <= 0x74)
{
TargetSeg = 5 ;
}
if (CanMsg >= 0x75 && CanMsg <= 0x8D)
{
TargetSeg = 6 ;
}
if (CanMsg >= 0x8E && CanMsg <= 0x8F)
{
TargetSeg = 7 ;
}
if (CanMsg >= 0x90 && CanMsg <= 0x91)
{
TargetSeg = 8 ;
}
if (CanMsg >= 0x92 && CanMsg <= 0x93)
{
TargetSeg = 9 ;
}
if (CanMsg >= 0x94 && CanMsg <= 0x95)
{
TargetSeg = 10 ;
}
if (CanMsg == 0x96)
{
TargetSeg = 11 ;
}
if (CanMsg >= 0x97)
{
TargetSeg = 12 ;
}
return TargetSeg ;
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function Name : CalCoolant_CurSeg * Function Name : CalCoolant_CurSeg
......
#include "Data_CoolantTemperature.h"
//-------------------------------------------
//水温滤波 zhouhang
//-------------------------------------------
#define COOLANT_FILTER_SLOW 200
#define COOLANT_FILTER_FAST 25
uint8_t Coolant_Temp_Filter(uint8_t ObjSeg, uint8_t Valid)
{
static uint8_t Timer = 0u;
static uint8_t Timer_group= 0u;//Timer_group == 1 代表格数上行计时,2代表下行计时
static uint8_t CurSeg = 0u;
if (Valid == 0u)
{
CurSeg = 0u;
Timer = 0u;
Timer_group = 0u;
}
else
{
if (ObjSeg > CurSeg)//上行
{
if (Timer_group != 1u)
{
Timer_group = 1u;
Timer = 0u;
}
else
{
Timer++;
}
if ((ObjSeg - CurSeg) == 1u)
{
if (Timer > COOLANT_FILTER_SLOW)
{
CurSeg++;
Timer = 0u;
}
}
else
{
if (Timer > COOLANT_FILTER_FAST)
{
CurSeg++;
Timer = 0u;
}
}
}
else if (ObjSeg == CurSeg)//保持
{
Timer = 0u;
}
else//下行
{
if (Timer_group != 2u)
{
Timer_group = 2u;
Timer = 0u;
}
else
{
Timer++;
}
if (Timer > COOLANT_FILTER_FAST)
{
CurSeg--;
Timer = 0u;
}
}
}
return CurSeg;
}
...@@ -24,14 +24,8 @@ step 0 17 27 38 47 55 64 70 76 81 84 88 ...@@ -24,14 +24,8 @@ step 0 17 27 38 47 55 64 70 76 81 84 88
*-----------------------------------------------------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------------------------------------------------*/
static const UP_TABLE[13U] = {10U , 13U , 23U , 33U , 43U , 52U , 61U , 68U , 73U , 79U , 83U , 86U , 90U};
static const DOWN_TABLE[13U] = {10U , 17U , 27U , 38U , 47U , 55U , 64U , 70U , 76U , 81U , 84U , 88U , 90U};
static uint8_t Fuel_CurSeg = 0 ; static uint8_t Fuel_CurSeg = 0 ;
static uint8_t CalFuel_CurSeg(uint8_t Step);
#define BASEFUELVAL 3500 //3.0L底油
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function Name : Fuel_User_KL30_Init * Function Name : Fuel_User_KL30_Init
* Description : * Description :
...@@ -187,7 +181,7 @@ void Fuel_User_KL15_ON_Processing_Service(void) ...@@ -187,7 +181,7 @@ void Fuel_User_KL15_ON_Processing_Service(void)
if (FuelMode == FuelSensorNormal) if (FuelMode == FuelSensorNormal)
{ {
Fuel_CurSeg = CalFuel_CurSeg(Step) ; Fuel_CurSeg = Step ;
} }
else else
{ {
...@@ -226,149 +220,7 @@ void Fuel_User_KL15_OFF_Processing_Service(void) ...@@ -226,149 +220,7 @@ void Fuel_User_KL15_OFF_Processing_Service(void)
} }
/*-------------------------------------------------------------------------
* Function Name : Fuel_Display
* Description : Step - 步数
* Input : None
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
static uint8_t CalFuel_CurSeg(uint8_t Step)
{
static uint8_t Seg = 0 ;
switch (Seg)
{
case 0 :
if (Step >= UP_TABLE[1])
{
Seg = 1 ;
}
break ;
case 1 :
if (Step >= UP_TABLE[2])
{
Seg = 2 ;
}
else if (Step < DOWN_TABLE[0])
{
Seg = 0 ;
}
break ;
case 2 :
if (Step >= UP_TABLE[3])
{
Seg = 3 ;
}
else if (Step < DOWN_TABLE[1])
{
Seg = 1 ;
}
break ;
case 3 :
if (Step >= UP_TABLE[4])
{
Seg = 4 ;
}
else if (Step < DOWN_TABLE[2])
{
Seg = 2 ;
}
break ;
case 4 :
if (Step >= UP_TABLE[5])
{
Seg = 5 ;
}
else if (Step < DOWN_TABLE[3])
{
Seg = 3 ;
}
break ;
case 5 :
if (Step >= UP_TABLE[6])
{
Seg = 6 ;
}
else if (Step < DOWN_TABLE[4])
{
Seg = 4 ;
}
break ;
case 6 :
if (Step >= UP_TABLE[7])
{
Seg = 7 ;
}
else if (Step < DOWN_TABLE[5])
{
Seg = 5 ;
}
break ;
case 7 :
if (Step >= UP_TABLE[8])
{
Seg = 8 ;
}
else if (Step < DOWN_TABLE[6])
{
Seg = 6 ;
}
break ;
case 8 :
if (Step >= UP_TABLE[9])
{
Seg = 9 ;
}
else if (Step < DOWN_TABLE[7])
{
Seg = 7 ;
}
break ;
case 9 :
if (Step >= UP_TABLE[10])
{
Seg = 10 ;
}
else if (Step < DOWN_TABLE[8])
{
Seg = 8 ;
}
break ;
case 10 :
if (Step >= UP_TABLE[11])
{
Seg = 11 ;
}
else if (Step < DOWN_TABLE[9])
{
Seg = 9 ;
}
break ;
case 11 :
if (Step >= UP_TABLE[12])
{
Seg = 12 ;
}
else if (Step < DOWN_TABLE[10])
{
Seg = 10 ;
}
break ;
case 12 :
if (Step < DOWN_TABLE[11])
{
Seg = 11 ;
}
break ;
default :
Seg = 0 ;
break ;
}
return Seg ;
}
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function Name : Fuel_Get_CurSeg * Function Name : Fuel_Get_CurSeg
* Description : 燃油当前格 * Description : 燃油当前格
......
...@@ -4,585 +4,4 @@ ...@@ -4,585 +4,4 @@
#include "Services_Mileage.h" #include "Services_Mileage.h"
#include "Common_Interface.h" #include "Common_Interface.h"
#include "CAN_Lib.h" #include "CAN_Lib.h"
#pragma ghs section sbss=".mysbss"
uint32_t OldTotalFuel_Trip = 0u;
uint32_t OldTotalFuel_ThisTime = 0u;
uint32_t OldTotalFuel_Comprehensive = 0u;
uint32_t OldTotalRunTime_Comprehensive = 0u;
uint32_t OldOdo_ThisTime = 0u;
uint8_t EngineType = 0u;
uint32_t TotalFuleLitre = 0U;
/*综合油耗信息*/
uint16_t FuelCounsComprehensiveRestFlag = 0u;
uint32_t FuelCounsComprehensiveODO = 0U;
uint32_t FuelCounsComprehensiveTotalFuleLitre = 0U;
uint16_t FuelCounsComprehensiveVale = 0U;
/*小计油耗信息*/
uint16_t FuelCounsumpTripRestFlag = 0u;
uint32_t FuelCounsumpTripODO = 0U;
uint32_t FuelCounsumpTripTotalFuleLitre = 0U;
uint16_t FuelCounsumpTripVale = 0U;
uint32_t TripTotalFuleLitre =0u;
/*本次油耗信息*/
uint16_t FuelCounsumpThisTimeRestFlag = 0u;
uint32_t FuelCounsumpThisTimeODO = 0U;
uint32_t FuelCounsumpThisTimeTotalFuleLitre = 0U;
uint16_t FuelCounsumpThisTimeVale = 0U;
uint32_t ThisTimeTotalFuleLitre =0u;
/*加油后油耗信息*/
uint32_t AVFTotalFuleLitre = 0U;
uint32_t AVFODO = 0U;
uint16_t AVFVale = 0U;
uint16_t RefuelingRestFlag = 0U;
uint32_t RefuelingTotalFuleLitre = 0U;
uint32_t RefuelingTrip = 0U;
#pragma ghs section sbss=default
/******************************************************************************
Function:Data_FuelCounsComprehensive
Description:综合油耗行车信息
Input:
Output:
******************************************************************************/
void Data_FuelCounsComprehensive(void)
{
uint32_t TmpTotalFuleLitre = 0u;
uint32_t CurOdo = 0u;
uint16_t TmpFuelCounsComprehensive = 0u;
CAN_MSG_Status_t TmpCanStatus;
//TmpCanStatus = CAN_MSG_Status(ID_Fcosm_0x18FEE900x_Msg_Count);
if (TmpCanStatus == CAN_SIG_NORMAL)
{
//TotalFuleLitre = Get_ID_18FEE900_Sig_EngineTotalFuelUsed();
}
else
{
;
}
if (Common_GetIgnOnTime() > 2000u)
{
if ((FuelCounsComprehensiveRestFlag == 0xaabbu))
{
if (TmpCanStatus == CAN_SIG_NORMAL)
{
FuelCounsComprehensiveTotalFuleLitre = TotalFuleLitre;
FuelCounsComprehensiveTotalFuleLitre = FuelCounsComprehensiveTotalFuleLitre * 50u;
FuelCounsComprehensiveODO = Data_ODO_Read();
FuelCounsComprehensiveRestFlag = 0xbbaau;
}
else
{
}
}
else
{
;
}
TmpTotalFuleLitre = TotalFuleLitre;
TmpTotalFuleLitre = TmpTotalFuleLitre * 50u;
CurOdo = Data_ODO_Read();
if (TmpTotalFuleLitre > FuelCounsComprehensiveTotalFuleLitre)
{
if (CurOdo >FuelCounsComprehensiveODO)
{
if ((CurOdo - FuelCounsComprehensiveODO) >= 20u)
{
TmpFuelCounsComprehensive = ((TmpTotalFuleLitre - FuelCounsComprehensiveTotalFuleLitre) * 100u) / (CurOdo - FuelCounsComprehensiveODO) ;
}
else
{
TmpFuelCounsComprehensive = 0xffffu;
}
}
else
{
TmpFuelCounsComprehensive = 0xffffu;
}
}
else
{
TmpFuelCounsComprehensive = 0xffffu;
}
}
else
{
;
}
FuelCounsComprehensiveVale = TmpFuelCounsComprehensive;
}
/******************************************************************************
Function:Rest_Refueling_Data
Description:复位综合油耗行车信息
Input:
Output:
******************************************************************************/
void Rest_FuelCounsComprehensive_Data(void)
{
FuelCounsComprehensiveRestFlag = 0xaabbu;
}
/******************************************************************************
Function:Get_FuelCounsComprehensive_ODO
Description:得到综合油耗燃油消耗
Input:
Output:
******************************************************************************/
uint32_t Get_FuelCounsComprehensive_ToalFuelLitre(void)
{
uint32_t TmpTotalFuleLitre;
if (FuelCounsComprehensiveRestFlag == 0xbbaau)
{
//TmpTotalFuleLitre = Get_ID_18FEE900_Sig_EngineTotalFuelUsed();
TmpTotalFuleLitre = TmpTotalFuleLitre / 2u;
}
else
{
TmpTotalFuleLitre = 0xffffffffu;
}
return TmpTotalFuleLitre;
}
/******************************************************************************
Function:Get_FuelCounsComprehensive_ODO
Description:得到综合油耗行驶里程
Input:
Output:
******************************************************************************/
uint32_t Get_FuelCounsComprehensive_ODO(void)
{
uint32_t TmpFuelCounsComprehensiveODO;
TmpFuelCounsComprehensiveODO = Data_ODO_Read();
return TmpFuelCounsComprehensiveODO / 10u;
}
/******************************************************************************
Function:Get_FuelCounsComprehensive_Value
Description:得到综合油耗
Input:
Output:
******************************************************************************/
uint16_t Get_FuelCounsComprehensive_Value(void)
{
return FuelCounsComprehensiveVale;
}
/******************************************************************************
Function:Get_Refueling_ToalFuelLitre
Description:得到综合油耗行驶时间
Input:
Output:
******************************************************************************/
uint32_t Get_FuelCounsComprehensive_RunTime(void)
{
uint32_t TmpFuelCounsComprehensiveRunTime;
//TmpFuelCounsComprehensiveRunTime = Get_ID_18FEE500_Sig_Total_engine_hours ();
return TmpFuelCounsComprehensiveRunTime / 2u;
}
/******************************************************************************
Function:Data_FuelCounsumpTrip
Description:小计油耗
Input:
Output:
******************************************************************************/
void Data_FuelCounsumpTrip(void)
{
uint32_t TmpTotalFuleLitre = 0u;
uint16_t TmpFuelCounsumpTrip = 0u;
CAN_MSG_Status_t TmpCanStatus;
//TmpCanStatus = CAN_MSG_Status(ID_Fcosm_0x18FEE900x_Msg_Count);
if (Common_GetIgnOnTime() > 2000u)
{
if ((FuelCounsumpTripRestFlag == 0xaabbu))
{
if (TmpCanStatus == CAN_SIG_NORMAL)
{
FuelCounsumpTripTotalFuleLitre = TotalFuleLitre;
FuelCounsumpTripTotalFuleLitre = FuelCounsumpTripTotalFuleLitre * 50u;
TripTotalFuleLitre=0u;
FuelCounsumpTripRestFlag = 0xbbaau;
}
else
{
}
}
else
{
;
}
TmpTotalFuleLitre = TotalFuleLitre;
TmpTotalFuleLitre = TmpTotalFuleLitre * 50u;
FuelCounsumpTripODO = Data_Read_Trip(EM_TRIP_B);
if (TmpTotalFuleLitre > FuelCounsumpTripTotalFuleLitre)
{
TripTotalFuleLitre = TmpTotalFuleLitre - FuelCounsumpTripTotalFuleLitre;
if (FuelCounsumpTripODO >= 20u)
{
TmpFuelCounsumpTrip = (TripTotalFuleLitre* 100u) / FuelCounsumpTripODO;
}
else
{
TmpFuelCounsumpTrip = 0xffffu;
}
}
else
{
TmpFuelCounsumpTrip = 0xffffu;
}
}
else
{
;
}
FuelCounsumpTripVale = TmpFuelCounsumpTrip;
}
/******************************************************************************
Function:Rest_Refueling_Data
Description:复位小计油耗行车信息
Input:
Output:
******************************************************************************/
void Rest_FuelCounsumpTrip_Data(void)
{
FuelCounsumpTripRestFlag = 0xaabbu;
Data_Clear_Trip ( EM_TRIP_B);
}
/******************************************************************************
Function:Get_FuelCounsComprehensive_ODO
Description:得到小计燃油消耗
Input:
Output:
******************************************************************************/
uint32_t Get_FuelCounsumpTrip_ToalFuelLitre(void)
{
uint32_t TmpTotalFuleLitre;
if (FuelCounsumpTripRestFlag == 0xbbaau)
{
TmpTotalFuleLitre = TripTotalFuleLitre;
TmpTotalFuleLitre = TmpTotalFuleLitre / 100u;
}
else
{
TmpTotalFuleLitre = 0xffffffffu;
}
return TmpTotalFuleLitre;
}
/******************************************************************************
Function:Get_FuelCounsComprehensive_ODO
Description:得到小计油耗行驶里程
Input:
Output:
******************************************************************************/
uint32_t Get_FuelCounsumpTrip_ODO(void)
{
uint32_t TmpFuelCounsumpTripODO;
TmpFuelCounsumpTripODO = Data_Read_Trip(EM_TRIP_A);
return TmpFuelCounsumpTripODO /10u;
}
/******************************************************************************
Function:Get_FuelCounsComprehensive_Value
Description:得到小计油耗
Input:
Output:
******************************************************************************/
uint16_t Get_FuelCounsumpTrip_Value(void)
{
return FuelCounsumpTripVale;
}
/*****/
/******************************************************************************
Function:Data_FuelCounsumpTrip
Description:本次油耗
Input:
Output:
******************************************************************************/
void Data_FuelCounsumpThisTime(void)
{
uint32_t TmpTotalFuleLitre = 0u;
uint16_t TmpFuelCounsumpThisTime = 0u;
CAN_MSG_Status_t TmpCanStatus;
//TmpCanStatus = CAN_MSG_Status(ID_Fcosm_0x18FEE900x_Msg_Count);
if (Common_GetIgnOnTime() > 3000u)
{
if ((FuelCounsumpThisTimeRestFlag == 0xaabbu))
{
if (TmpCanStatus == CAN_SIG_NORMAL)
{
FuelCounsumpThisTimeTotalFuleLitre = TotalFuleLitre;
FuelCounsumpThisTimeTotalFuleLitre = FuelCounsumpThisTimeTotalFuleLitre * 50u;
ThisTimeTotalFuleLitre=0u;
FuelCounsumpThisTimeRestFlag = 0xbbaau;
}
else
{
}
}
else
{
;
}
TmpTotalFuleLitre = TotalFuleLitre;
TmpTotalFuleLitre = TmpTotalFuleLitre * 50u;
FuelCounsumpThisTimeODO = Data_Read_Trip(EM_TRIP_C);
if (TmpTotalFuleLitre > FuelCounsumpThisTimeTotalFuleLitre)
{
ThisTimeTotalFuleLitre = TmpTotalFuleLitre - FuelCounsumpThisTimeTotalFuleLitre;
if (FuelCounsumpThisTimeODO >= 50u)
{
TmpFuelCounsumpThisTime = (ThisTimeTotalFuleLitre* 100u) / FuelCounsumpThisTimeODO;
}
else
{
TmpFuelCounsumpThisTime = 0xffffu;
}
}
else
{
TmpFuelCounsumpThisTime= 0xffffu;
}
}
else
{
;
}
FuelCounsumpThisTimeVale = TmpFuelCounsumpThisTime;
}
/******************************************************************************
Function:Rest_FuelCounsumpThisTime_Data
Description:复位本次油耗行车信息
Input:
Output:
******************************************************************************/
void Rest_FuelCounsumpThisTime_Data(void)
{
FuelCounsumpThisTimeRestFlag = 0xaabbu;
Data_Clear_Trip ( EM_TRIP_C);
}
/******************************************************************************
Function:Get_FuelCounsumpThisTime_ToalFuelLitre
Description:得到本次燃油消耗
Input:
Output:
******************************************************************************/
uint32_t Get_FuelCounsumpThisTime_ToalFuelLitre(void)
{
uint32_t TmpTotalFuleLitre;
if (FuelCounsumpThisTimeRestFlag == 0xbbaau)
{
TmpTotalFuleLitre = ThisTimeTotalFuleLitre;
TmpTotalFuleLitre = TmpTotalFuleLitre / 100u;
}
else
{
TmpTotalFuleLitre = 0xffffffffu;
}
return TmpTotalFuleLitre;
}
/******************************************************************************
Function:Get_FuelCounsumpThisTime_ODO
Description:得到本次油耗行驶里程
Input:
Output:
******************************************************************************/
uint32_t Get_FuelCounsumpThisTime_ODO(void)
{
uint32_t TmpFuelCounsumpThisTimeODO;
TmpFuelCounsumpThisTimeODO = Data_Read_Trip(EM_TRIP_C);
return TmpFuelCounsumpThisTimeODO / 10u;
}
/******************************************************************************
Function:Get_FuelCounsumpThisTime_Value
Description:得到本次油耗
Input:
Output:
******************************************************************************/
uint16_t Get_FuelCounsumpThisTime_Value(void)
{
return FuelCounsumpThisTimeVale;
}
/*****/
/******************************************************************************
Function:Get_Info_Last_Refueling
Description:上次加油后的行车信息
Input:
Output:
******************************************************************************/
void Data_Info_Last_Refueling(void)
{
uint32_t TmpTotalFuleLitre = 0u;
uint32_t CurOdo = 0u;
uint16_t TmpAVF = 0u;
CAN_MSG_Status_t TmpCanStatus;
//TmpCanStatus = CAN_MSG_Status(ID_Fcosm_0x18FEE900x_Msg_Count);
if (Common_GetIgnOnTime() > 2000u)
{
if ((RefuelingRestFlag == 0xaabbu))
{
if (TmpCanStatus == CAN_SIG_NORMAL)
{
AVFTotalFuleLitre = TotalFuleLitre;
AVFTotalFuleLitre = AVFTotalFuleLitre * 50u;
AVFODO = Data_ODO_Read();
RefuelingTotalFuleLitre = 0u;
RefuelingTrip = 0u;
RefuelingRestFlag = 0xbbaau;
}
else
{
}
}
else
{
;
}
TmpTotalFuleLitre = TotalFuleLitre;
TmpTotalFuleLitre = TmpTotalFuleLitre * 50u;
CurOdo = Data_ODO_Read();
if (TmpTotalFuleLitre > AVFTotalFuleLitre)
{
RefuelingTotalFuleLitre = TmpTotalFuleLitre - AVFTotalFuleLitre;
if (CurOdo > AVFODO)
{
RefuelingTrip = CurOdo - AVFODO;
if ((CurOdo - AVFODO) >= 50u)
{
TmpAVF = RefuelingTotalFuleLitre * 100u / RefuelingTrip;
}
else
{
TmpAVF = 0xffffu;
}
}
else
{
TmpAVF = 0xffffu;
}
}
else
{
TmpAVF = 0xffffu;
}
}
else
{
;
}
AVFVale = TmpAVF;
}
/******************************************************************************
Function:Rest_Refueling_Data
Description:复位加油后行车信息
Input:
Output:
******************************************************************************/
void Rest_Refueling_Data(void)
{
RefuelingRestFlag = 0xaabbu;
}
/******************************************************************************
Function:Get_Refueling_AVF
Description:得到平均油耗
Input:
Output:
******************************************************************************/
uint16_t Get_Refueling_AVF(void)
{
return AVFVale;
}
/******************************************************************************
Function:Get_Refueling_Trip
Description:得到加油后行驶里程
Input:
Output:
******************************************************************************/
uint32_t Get_Refueling_Trip(void)
{
return RefuelingTrip/10u;
}
/******************************************************************************
Function:Get_Refueling_ToalFuelLitre
Description:得到加油后总油耗
Input:
Output:
******************************************************************************/
uint32_t Get_Refueling_ToalFuelLitre(void)
{
uint32_t TmpTotalFuleLitre;
if (RefuelingRestFlag == 0xbbaau)
{
TmpTotalFuleLitre = RefuelingTotalFuleLitre;
TmpTotalFuleLitre = TmpTotalFuleLitre / 100u;
}
else
{
TmpTotalFuleLitre = 0xffffffffu;
}
return TmpTotalFuleLitre;
}
/******************************************************************************
Function:Fuel_Consump_K30_Init
Description:所有油耗燃油初始化
Input:
Output:
******************************************************************************/
void Fuel_Consump_K30_Init(void)
{
Rest_FuelCounsComprehensive_Data();
Rest_Refueling_Data();
Rest_FuelCounsumpTrip_Data();
Rest_FuelCounsumpThisTime_Data();
}
/******************************************************************************
Function:Fuel_Consump_K15_Init
Description:所有油耗燃油初始化
Input:
Output:
******************************************************************************/
void Fuel_Consump_K15_Init(void)
{
Rest_FuelCounsumpThisTime_Data();
}
...@@ -16,33 +16,4 @@ extern uint32_t OldTotalFuel_Comprehensive; ...@@ -16,33 +16,4 @@ extern uint32_t OldTotalFuel_Comprehensive;
extern uint32_t OldTotalFuel_ThisTime; extern uint32_t OldTotalFuel_ThisTime;
extern uint32_t OldOdo_ThisTime; extern uint32_t OldOdo_ThisTime;
extern void Fuel_Consump_K15_Init(void);
extern void Fuel_Consump_K30_Init(void);
/*综合油耗*/
extern void Data_FuelCounsComprehensive(void);
extern uint32_t Get_FuelCounsComprehensive_ToalFuelLitre(void);
extern uint32_t Get_FuelCounsComprehensive_ODO(void);
extern uint16_t Get_FuelCounsComprehensive_Value(void);
extern uint32_t Get_FuelCounsComprehensive_RunTime(void);
/*小计油耗*/
extern void Data_FuelCounsumpTrip(void);
extern void Rest_FuelCounsumpTrip_Data(void);
extern uint32_t Get_FuelCounsumpTrip_ToalFuelLitre(void);
extern uint32_t Get_FuelCounsumpTrip_ODO(void);
extern uint16_t Get_FuelCounsumpTrip_Value(void);
/*本次油耗*/
extern void Data_FuelCounsumpThisTime(void);
extern void Rest_FuelCounsumpThisTime_Data(void);
extern uint32_t Get_FuelCounsumpThisTime_ToalFuelLitre(void);
extern uint32_t Get_FuelCounsumpThisTime_ODO(void);
extern uint16_t Get_FuelCounsumpThisTime_Value(void);
/*加油油行车信息*/
extern void Data_Info_Last_Refueling(void);
extern void Rest_Refueling_Data(void);
extern uint16_t Get_Refueling_AVF(void);
extern uint32_t Get_Refueling_Trip(void);
extern uint32_t Get_Refueling_ToalFuelLitre(void);
#endif #endif
\ No newline at end of file
...@@ -135,8 +135,6 @@ void TYW_Data_ODO_Clear(void) ...@@ -135,8 +135,6 @@ void TYW_Data_ODO_Clear(void)
if (( Get_Data_Veh_value >= Get_Data_Veh_valueMax ) && ( Get_Data_Rev_value >= Get_Data_Rev_valueMax )) if (( Get_Data_Veh_value >= Get_Data_Veh_valueMax ) && ( Get_Data_Rev_value >= Get_Data_Rev_valueMax ))
{ {
Data_Mileage_Clear(); Data_Mileage_Clear();
Rest_FuelCounsumpTrip_Data();
Rest_FuelCounsumpThisTime_Data();
} }
} }
......
#include "Data_VehicleSpeed.h" #include "Data_VehicleSpeed.h"
#include "TimerB.h"
#include "Gauges.h" #include "Gauges.h"
#include "GaugesInterface.h" #include "GaugesInterface.h"
#include "TimerB.h" #include "Common_Interface.h"
#define VEH_FILTER_LEN 7
static struct
{
uint8_t Count;
uint16_t Data[VEH_FILTER_LEN];
} VehcleFilter;
static uint32_t SPEED_PPK = 15925u;
static uint32_t SPEED_RADIO = 637u; static uint32_t SPEED_RADIO = 637u;
uint16_t Vehicle_ACT_Speed; uint16_t Vehicle_ACT_Speed;
uint16_t Vehicle_DISP_Speed; uint16_t Vehicle_DISP_Speed;
uint8_t VehicleSpeedValid; uint8_t VehicleSpeedValid;
uint8_t Vehicle_CurSeg; uint8_t Vehicle_CurSeg;
uint8_t DataOverSpeed;
static uint16_t Cal_VehSpeed(uint16_t Fre, uint8_t Len); uint8_t DataOverSpeedK_Line;
uint32_t SPEED_PPK;
volatile uint32_t VehFreBuf[VehFreNum];
void Speed_KL30_Init(void) void Speed_KL30_Init(void)
{ {
uint8_t i; uint8_t i = 0u;
Vehicle_ACT_Speed = 0u; Vehicle_ACT_Speed = 0u;
Vehicle_DISP_Speed = 0u; Vehicle_DISP_Speed = 0u;
VehicleSpeedValid = 0u; VehicleSpeedValid = 0u;
Vehicle_CurSeg = 0u; DataOverSpeedK_Line = 0u;
VehcleFilter.Count = 0;
for (i = 0; i < VEH_FILTER_LEN; i++) for (i = 0; i < VehFreNum; i++)
{ {
VehcleFilter.Data[i] = 0; VehFreBuf[i] = 0u;
} }
Set_Speed_PPK(SPEED_RADIO);
} }
void Speed_KL15_ON_Init(void) void Speed_KL15_ON_Init(void)
{ {
uint8_t i; uint8_t i = 0u;
Vehicle_ACT_Speed = 0u; Vehicle_ACT_Speed = 0u;
Vehicle_DISP_Speed = 0u; Vehicle_DISP_Speed = 0u;
VehicleSpeedValid = 0u; VehicleSpeedValid = 0u;
Vehicle_CurSeg = 0u; Vehicle_CurSeg = 0u;
VehcleFilter.Count = 0; DataOverSpeedK_Line = 0u;
for (i = 0; i < VEH_FILTER_LEN; i++)
SPEED_PPK = 15925u;
Veh_Fre_Init(SPEED_PPK);
for (i = 0; i < VehFreNum; i++)
{ {
VehcleFilter.Data[i] = 0; VehFreBuf[i] = 0u;
} }
Veh_Fre_Init(Get_Speed_PPK());
} }
void Speed_KL15_OFF_Init(void) void Speed_KL15_OFF_Init(void)
{ {
uint8_t i;
Vehicle_ACT_Speed = 0u; Vehicle_ACT_Speed = 0u;
Vehicle_DISP_Speed = 0u; Vehicle_DISP_Speed = 0u;
VehicleSpeedValid = 0u; VehicleSpeedValid = 0u;
Vehicle_CurSeg = 0u; Vehicle_CurSeg = 0u;
VehcleFilter.Count = 0;
for (i = 0; i < VEH_FILTER_LEN; i++)
{
VehcleFilter.Data[i] = 0;
}
} }
void Speed_Wakeup_Init(void) void Speed_Wakeup_Init(void)
{ {
uint8_t i;
Vehicle_ACT_Speed = 0u; Vehicle_ACT_Speed = 0u;
Vehicle_DISP_Speed = 0u; Vehicle_DISP_Speed = 0u;
VehicleSpeedValid = 0u; VehicleSpeedValid = 0u;
Vehicle_CurSeg = 0u; Vehicle_CurSeg = 0u;
for (i = 0; i < VEH_FILTER_LEN; i++)
{
VehcleFilter.Data[i] = 0;
}
} }
void Speed_Sleep_Init(void) void Speed_Sleep_Init(void)
{ {
uint8_t i;
Vehicle_ACT_Speed = 0u; Vehicle_ACT_Speed = 0u;
Vehicle_DISP_Speed = 0u; Vehicle_DISP_Speed = 0u;
VehicleSpeedValid = 0u; VehicleSpeedValid = 0u;
Vehicle_CurSeg = 0u; Vehicle_CurSeg = 0u;
for (i = 0; i < VEH_FILTER_LEN; i++)
{
VehcleFilter.Data[i] = 0;
}
} }
void Speed_Processing_Service(void) void Speed_Processing_Service(void)
{ {
static uint8_t i = 0u;
uint32_t VehValTmp = 0u; uint32_t VehValTmp = 0u;
uint32_t VehValDisp = 0u; uint32_t VehValDisp = 0u;
uint16_t VehValCup = 0u;
uint32_t PPK = 0u; uint32_t PPK = 0u;
uint16_t DataOverSpeedValue ;
PPK = Get_Speed_PPK(); COMMON_PowerStatus_t IG_Sta;
VehValTmp = Cal_Veh_Frequency();
VehValTmp *= 36000u; IG_Sta = Common_Get_IG_Sts_Valid();
VehValTmp /= PPK;
if (VehValTmp > 2250) if ( IG_Sta == COMMON_POWER_ON)
{ {
VehicleSpeedValid = 0; /**/
DataOverSpeedValue = K_Line_Set.K_Line_LID44;
DataOverSpeedValue *= 10u;
Vehicle_ACT_Speed = 0; PPK = Get_Speed_PPK();
}
else VehValTmp = Cal_Veh_Frequency();
{ VehValTmp *= 36000u;
VehicleSpeedValid = 1; VehValTmp /= PPK;
VehFreBuf[i] = VehValTmp;
if (VehValTmp >= 1400u) i++;
if (i > VehFreNum)
{ {
Vehicle_ACT_Speed = 1400u; Fre_SortShort(VehFreBuf, VehFreNum);
i = 0u;
} }
else if (VehValTmp <= 40u) VehValCup = (uint16_t) VehFreBuf[1u];
if (VehValCup > 2250)
{ {
VehicleSpeedValid = 0u;
Vehicle_ACT_Speed = 0u; Vehicle_ACT_Speed = 0u;
} }
else else
{ {
Vehicle_ACT_Speed = VehValTmp; VehicleSpeedValid = 1u;
if (VehValCup >= 1400u)
{
Vehicle_ACT_Speed = 1400u;
}
else if (VehValCup <= 40u)
{
Vehicle_ACT_Speed = 0u;
}
else
{
Vehicle_ACT_Speed = VehValCup;
}
} }
}
//传入表头 计算放大系数 //传入表头 计算放大系数
VehValDisp = VehSpeedAmplification((uint16_t)Vehicle_ACT_Speed); VehValDisp = VehSpeedAmplification((uint16_t)Vehicle_ACT_Speed);
SetGaugesPara(VehGauges, (uint16_t)VehValDisp); SetGaugesPara(VehGauges, (uint16_t)VehValDisp);
//获得显示格和显示车速 //获得显示格和显示车速
Vehicle_CurSeg = GetGaugesCurrentPos(VehGauges); Vehicle_CurSeg = GetGaugesCurrentPos(VehGauges);
Vehicle_DISP_Speed = VehValDisp;//GetVehDisVal(Vehicle_CurSeg, &GaugesInfo_Init_Table[VehGauges]); Vehicle_DISP_Speed = VehValDisp;//GetVehDisVal(Vehicle_CurSeg, &GaugesInfo_Init_Table[VehGauges]);
}
static uint16_t Cal_VehSpeed(uint16_t Fre, uint8_t Len)
{ if (K_Line_Set.K_Line_LID44 != 0xFF)
static uint16_t u16Result = 0; {
if (Fre > 2000) if (DataOverSpeedK_Line)
{ {
// do nothing if (Vehicle_DISP_Speed <= DataOverSpeedValue)
DataOverSpeedK_Line = 0;
}
else
{
if (Vehicle_DISP_Speed >= (DataOverSpeedValue + 20))
DataOverSpeedK_Line = 1;
}
}
} }
else else
{ {
if (VehcleFilter.Count < Len) i = 0u;
{
VehcleFilter.Data[VehcleFilter.Count] = Fre;
VehcleFilter.Count++;
}
else
{
VehcleFilter.Count = 0;
App_SortNByte(VehcleFilter.Data, Len);
u16Result = VehcleFilter.Data[2];
u16Result += VehcleFilter.Data[3];
u16Result += VehcleFilter.Data[3];
u16Result += VehcleFilter.Data[4];
u16Result /= 4;
}
} }
return u16Result;
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function Name : Set_Speed_PPK * Function Name : Set_Speed_PPK
* Description : 设置PPK值,初始化 或需要改变时调用 * Description : 设置PPK值,初始化 或需要改变时调用
* Input : 10倍的PPK * Input :
* Output : None * Output : None
* Return : None * Return : None
* onther : PPK = 频率 * 3600 / 车速 * onther : PPK = 频率 * 3600 / 车速
...@@ -239,3 +233,111 @@ uint8_t Speed_Get_Valid(void) ...@@ -239,3 +233,111 @@ uint8_t Speed_Get_Valid(void)
{ {
return VehicleSpeedValid; return VehicleSpeedValid;
} }
/******************************************************************************
函数名:Data_Acc_Speed_Processing
功 能: 加速度计算
参 数: 无
返回值:无
******************************************************************************/
void Data_Acc_Speed_Processing(void)
{
#if 0
uint16_t Speed_New = 0;
uint16_t AccSpeed = 0;
Speed_New = DATA_VEHICLE_SPEED_DISPLAYING;
AccSubSpeed.Sig.ACCSpeed_Time++;
if (AccSubSpeed.Sig.ACCSpeed_Time >= 10)
{
AccSubSpeed.Sig.ACCSpeed_Time = 0;
if (Speed_Old <= Speed_New)
{
AccSpeed = Speed_New - Speed_Old;
Speed_Old = Speed_New ;
if (AccSpeed > User_App.User_JADD)
{
AccSubSpeed.Sig.AccSpeed_Flag = 1 ;
}
else
{
AccSubSpeed.Sig.AccSpeed_Flag = 0 ;
}
AccSubSpeed.Sig.SubSpeed_Flag = 0 ;
}
else
{
AccSpeed = Speed_Old - Speed_New;
Speed_Old = Speed_New ;
if (AccSpeed > User_App.User_JSUB)
{
AccSubSpeed.Sig.SubSpeed_Flag = 1 ;
}
else
{
AccSubSpeed.Sig.SubSpeed_Flag = 0 ;
}
AccSubSpeed.Sig.AccSpeed_Flag = 0 ;
}
}
#endif
}
/******************************************************************************
函数名:Data_GsLYbL_Speed_Processing
功 能: 高速路, 一般路判断
参 数: 无
返回值:无
******************************************************************************/
void Data_GsLYbL_Speed_Processing(void)
{
#if 0
uint16_t User_Gsl = 0;
uint16_t User_Ybl = 0;
User_Gsl = (uint16_t)User_App.User_Gsl * 10 ;
User_Ybl = (uint16_t)User_App.User_Ybl * 10 ;
if ( DATA_VEHICLE_SPEED_DISPLAYING >= 600 )
{
if (GslYblSpeedTime <= 6000 )
GslYblSpeedTime++;
}
else if ( DATA_VEHICLE_SPEED_DISPLAYING <= 590 )
{
GslYblSpeedTime = 0;
}
if (GslYblSpeedTime >= 6000)
{
AccSubSpeed.Sig.GslYbl_Flag = 1;
}
else
{
AccSubSpeed.Sig.GslYbl_Flag = 0;
}
if (AccSubSpeed.Sig.GslYbl_Flag == 1)
{
if (DATA_VEHICLE_SPEED_DISPLAYING > User_Gsl)
{
AccSubSpeed.Sig.GslSpeed_Flag = 1;
}
else if (DATA_VEHICLE_SPEED_DISPLAYING <= (User_Gsl - 10))
{
AccSubSpeed.Sig.GslSpeed_Flag = 0;
}
}
else
{
if (DATA_VEHICLE_SPEED_DISPLAYING > User_Ybl)
{
AccSubSpeed.Sig.GslSpeed_Flag = 1;
}
else if (DATA_VEHICLE_SPEED_DISPLAYING <= (User_Ybl - 10))
{
AccSubSpeed.Sig.GslSpeed_Flag = 0;
}
}
#endif
}
\ No newline at end of file
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#include "TYW_stdint.h" #include "TYW_stdint.h"
/*对频率计算车速做平均的个数*/
#define VehFreNum 3u
extern void Speed_KL30_Init(void); extern void Speed_KL30_Init(void);
extern void Speed_KL15_ON_Init(void); extern void Speed_KL15_ON_Init(void);
extern void Speed_KL15_OFF_Init(void); extern void Speed_KL15_OFF_Init(void);
...@@ -19,5 +22,7 @@ extern uint16_t Speed_Get_ActualValue(void); ...@@ -19,5 +22,7 @@ extern uint16_t Speed_Get_ActualValue(void);
extern uint16_t Speed_Get_Display_Value(void); extern uint16_t Speed_Get_Display_Value(void);
extern uint8_t Speed_Get_Valid(void); extern uint8_t Speed_Get_Valid(void);
extern uint8_t Speed_Get_CurSeg(void); extern uint8_t Speed_Get_CurSeg(void);
extern void Data_Acc_Speed_Processing(void);
extern void Data_GsLYbL_Speed_Processing(void);
#endif #endif
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
* version: author, date, desc\n * version: author, date, desc\n
*/ */
#include "Gauges.h" #include "Gauges.h"
#include "GaugesInterface.h" #define GAUGES_TOTAL_NUM 9u
#define GAUGES_TOTAL_NUM 8u
#define GAUGES_INIT_TIME_MAX 3000u #define GAUGES_INIT_TIME_MAX 3000u
uint16_t GaugesCurrentPos[GAUGES_TOTAL_NUM] ; uint16_t GaugesCurrentPos[GAUGES_TOTAL_NUM] ;
uint16_t BackupDestPostion[GAUGES_TOTAL_NUM]; uint16_t BackupDestPostion[GAUGES_TOTAL_NUM];
...@@ -26,12 +25,12 @@ uint8_t DisplayModeTmp[GAUGES_TOTAL_NUM]; ...@@ -26,12 +25,12 @@ uint8_t DisplayModeTmp[GAUGES_TOTAL_NUM];
uint16_t GaugesInitTimes; uint16_t GaugesInitTimes;
uint8_t GaugesPowerState = 0u; uint8_t GaugesPowerState = 0u;
uint16_t GaugesFreeSetTimes = 0u; uint16_t GaugesFreeSetTimes = 0u;
uint16_t GaugesLibDataIn;
const uint16_t Gauages_Init_Time_Max[2] = {3000, 6000}; const uint16_t Gauages_Init_Time_Max[2] = {3000, 6000};
uint8_t ModeGaugesTestFlag[GAUGES_TOTAL_NUM] = {0u}; uint8_t ModeGaugesTestFlag[GAUGES_TOTAL_NUM] = {0u};
/*两套参数第一个是正常走行速度,第二个为快速走动8*/ /*两套参数第一个是正常走行速度,第二个为快速走动8*/
const uint16_t GaugesDisDelayMax[2u][IndicatTypeTOtal] = const uint16_t GaugesDisDelayMax[2u][IndicatTypeTOtal] =
{ {
/*StepperMotor MotorGasType MotorTempType LCDGasType LEDOtherType GasType TempType 不同类型表头走行速度不同*/ /*StepperMotor MotorGasType MotorTempType LCDGasType LEDOtherType GasType TempType 不同类型表头走行速度不同*/
{0u, 20u, 20u, 40u, 2u, 20u, 200u}, {0u, 20u, 20u, 40u, 2u, 20u, 200u},
{0u, 0u, 0u, 2u, 2u, 2u, 5u}, {0u, 0u, 0u, 2u, 2u, 2u, 5u},
...@@ -42,7 +41,7 @@ const uint16_t GaugesDisDelayMax[2u][IndicatTypeTOtal] = ...@@ -42,7 +41,7 @@ const uint16_t GaugesDisDelayMax[2u][IndicatTypeTOtal] =
* @param[in] GParam Gauge Struct * @param[in] GParam Gauge Struct
* @since 1.0.0.0 * @since 1.0.0.0
*/ */
uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t SubAscf) uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t SubAscf, uint16_t FunGaugesDataIn)
{ {
uint8_t i = 0u; uint8_t i = 0u;
...@@ -54,7 +53,7 @@ uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t Sub ...@@ -54,7 +53,7 @@ uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t Sub
{ {
if (DirecSignPara == 1u) if (DirecSignPara == 1u)
{ {
if (*GParam->GaugesDataIn >= GParam->ReferenceDataInUp[i]) if (FunGaugesDataIn >= GParam->ReferenceDataInUp[i])
{ {
SectorID++; SectorID++;
} }
...@@ -65,7 +64,7 @@ uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t Sub ...@@ -65,7 +64,7 @@ uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t Sub
} }
else else
{ {
if (*GParam->GaugesDataIn >= GParam->ReferenceDataInDown[i]) if (FunGaugesDataIn >= GParam->ReferenceDataInDown[i])
{ {
SectorID++; SectorID++;
} }
...@@ -81,7 +80,7 @@ uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t Sub ...@@ -81,7 +80,7 @@ uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t Sub
{ {
if (DirecSignPara == 1u) if (DirecSignPara == 1u)
{ {
if (*GParam->GaugesDataIn <= GParam->ReferenceDataInUp[i]) if (FunGaugesDataIn <= GParam->ReferenceDataInUp[i])
{ {
SectorID++; SectorID++;
} }
...@@ -92,7 +91,7 @@ uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t Sub ...@@ -92,7 +91,7 @@ uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t Sub
} }
else else
{ {
if (*GParam->GaugesDataIn <= GParam->ReferenceDataInDown[i]) if (FunGaugesDataIn <= GParam->ReferenceDataInDown[i])
{ {
SectorID++; SectorID++;
} }
...@@ -119,7 +118,7 @@ uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t Sub ...@@ -119,7 +118,7 @@ uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t Sub
* @since 1.0.0.0 * @since 1.0.0.0
*/ */
uint16_t GetGaugestargetPosSub( _GaugesInfoInit *GParam, uint8_t SubAscf, uint8_t SectorID, uint8_t DirecSignPara ) uint16_t GetGaugestargetPosSub( _GaugesInfoInit *GParam, uint8_t SubAscf, uint8_t SectorID, uint8_t DirecSignPara, uint16_t FunGaugesDataIn )
{ {
...@@ -136,14 +135,14 @@ uint16_t GetGaugestargetPosSub( _GaugesInfoInit *GParam, uint8_t SubAscf, uint8_ ...@@ -136,14 +135,14 @@ uint16_t GetGaugestargetPosSub( _GaugesInfoInit *GParam, uint8_t SubAscf, uint8_
{ {
PerCentum = ((*GParam->GaugesDataIn - GParam->ReferenceDataInUp[SectorID - 1u])); PerCentum = ((FunGaugesDataIn - GParam->ReferenceDataInUp[SectorID - 1u]));
PerCentum = PerCentum * 100u; PerCentum = PerCentum * 100u;
PerCentum = PerCentum / (GParam->ReferenceDataInUp[SectorID] - GParam->ReferenceDataInUp[SectorID - 1u]); PerCentum = PerCentum / (GParam->ReferenceDataInUp[SectorID] - GParam->ReferenceDataInUp[SectorID - 1u]);
} }
else if (DirecSignPara == 2u) else if (DirecSignPara == 2u)
{ {
PerCentum = ((*GParam->GaugesDataIn - GParam->ReferenceDataInDown[SectorID - 1u])); PerCentum = ((FunGaugesDataIn - GParam->ReferenceDataInDown[SectorID - 1u]));
PerCentum = PerCentum * 100u; PerCentum = PerCentum * 100u;
PerCentum = PerCentum / (GParam->ReferenceDataInDown[SectorID] - GParam->ReferenceDataInDown[SectorID - 1u]); PerCentum = PerCentum / (GParam->ReferenceDataInDown[SectorID] - GParam->ReferenceDataInDown[SectorID - 1u]);
...@@ -157,13 +156,13 @@ uint16_t GetGaugestargetPosSub( _GaugesInfoInit *GParam, uint8_t SubAscf, uint8_ ...@@ -157,13 +156,13 @@ uint16_t GetGaugestargetPosSub( _GaugesInfoInit *GParam, uint8_t SubAscf, uint8_
{ {
if (DirecSignPara == 1u) if (DirecSignPara == 1u)
{ {
PerCentum = ((GParam->ReferenceDataInUp[SectorID - 1u] - *GParam->GaugesDataIn) ); PerCentum = ((GParam->ReferenceDataInUp[SectorID - 1u] - FunGaugesDataIn) );
PerCentum = PerCentum * 100u; PerCentum = PerCentum * 100u;
PerCentum = PerCentum / (GParam->ReferenceDataInUp[SectorID - 1u] - GParam->ReferenceDataInUp[SectorID]); PerCentum = PerCentum / (GParam->ReferenceDataInUp[SectorID - 1u] - GParam->ReferenceDataInUp[SectorID]);
} }
else if (DirecSignPara == 2u) else if (DirecSignPara == 2u)
{ {
PerCentum = ((GParam->ReferenceDataInDown[SectorID - 1u] - *GParam->GaugesDataIn)); PerCentum = ((GParam->ReferenceDataInDown[SectorID - 1u] - FunGaugesDataIn));
PerCentum = PerCentum * 100u; PerCentum = PerCentum * 100u;
PerCentum = PerCentum / (GParam->ReferenceDataInDown[SectorID - 1u] - GParam->ReferenceDataInDown[SectorID]); PerCentum = PerCentum / (GParam->ReferenceDataInDown[SectorID - 1u] - GParam->ReferenceDataInDown[SectorID]);
} }
...@@ -182,15 +181,15 @@ uint16_t GetGaugestargetPosSub( _GaugesInfoInit *GParam, uint8_t SubAscf, uint8_ ...@@ -182,15 +181,15 @@ uint16_t GetGaugestargetPosSub( _GaugesInfoInit *GParam, uint8_t SubAscf, uint8_
{ {
StepCnTmp = (uint16_t)((PerCentum * (GParam->ReferenceDataInOut[SectorID] - GParam->ReferenceDataInOut[SectorID - 1u])) / 10u + (GParam->ReferenceDataInOut[SectorID - 1u] * 10u)); StepCnTmp = (uint16_t)((PerCentum * (GParam->ReferenceDataInOut[SectorID] - GParam->ReferenceDataInOut[SectorID - 1u])) / 10u + (GParam->ReferenceDataInOut[SectorID - 1u] * 10u));
if((PerCentum>0u)&&(PerCentum<10u)) if ((PerCentum > 0u) && (PerCentum < 10u))
{ {
StepCnTmp=StepCnTmp+1u; StepCnTmp = StepCnTmp + 1u;
} }
else else
{ {
; ;
} }
} }
else else
{ {
...@@ -220,38 +219,36 @@ void GaugesForwardParaManage( _GaugesInfoInit *GParam, uint8_t DirecSignPara ) ...@@ -220,38 +219,36 @@ void GaugesForwardParaManage( _GaugesInfoInit *GParam, uint8_t DirecSignPara )
if (*GParam->GaugesDataIn >= GParam->ReferenceDataInUp[GParam->SectorNum - 1u]) if (*GParam->GaugesDataIn >= GParam->ReferenceDataInUp[GParam->SectorNum - 1u])
{ {
*GParam->GaugesDataIn = GParam->ReferenceDataInUp[GParam->SectorNum - 1u];
} GaugesLibDataIn = GParam->ReferenceDataInUp[GParam->SectorNum - 1u];
else
{
;
} }
if (*GParam->GaugesDataIn <= GParam->ReferenceDataInUp[0u])
else if (*GParam->GaugesDataIn <= GParam->ReferenceDataInUp[0u])
{ {
*GParam->GaugesDataIn = GParam->ReferenceDataInUp[0u];
GaugesLibDataIn = GParam->ReferenceDataInUp[0u];
} }
else else
{ {
; GaugesLibDataIn = *GParam->GaugesDataIn;
} }
} }
else if (DirecSignPara == 2u) else if (DirecSignPara == 2u)
{ {
if (*GParam->GaugesDataIn >= GParam->ReferenceDataInDown[GParam->SectorNum - 1u]) if (*GParam->GaugesDataIn >= GParam->ReferenceDataInDown[GParam->SectorNum - 1u])
{ {
*GParam->GaugesDataIn = GParam->ReferenceDataInDown[GParam->SectorNum - 1u];
} GaugesLibDataIn = GParam->ReferenceDataInDown[GParam->SectorNum - 1u];
else
{
;
} }
if (*GParam->GaugesDataIn <= GParam->ReferenceDataInDown[0u])
else if (*GParam->GaugesDataIn <= GParam->ReferenceDataInDown[0u])
{ {
*GParam->GaugesDataIn = GParam->ReferenceDataInDown[0u];
GaugesLibDataIn = GParam->ReferenceDataInDown[0u];
} }
else else
{ {
; GaugesLibDataIn = *GParam->GaugesDataIn;
} }
} }
else else
...@@ -273,22 +270,35 @@ void GaugesInversionParaManage( _GaugesInfoInit *GParam, uint8_t DirecSignPara ) ...@@ -273,22 +270,35 @@ void GaugesInversionParaManage( _GaugesInfoInit *GParam, uint8_t DirecSignPara )
{ {
if (*GParam->GaugesDataIn <= GParam->ReferenceDataInUp[GParam->SectorNum - 1u]) if (*GParam->GaugesDataIn <= GParam->ReferenceDataInUp[GParam->SectorNum - 1u])
{ {
*GParam->GaugesDataIn = GParam->ReferenceDataInUp[GParam->SectorNum - 1u];
GaugesLibDataIn = GParam->ReferenceDataInUp[GParam->SectorNum - 1u];
}
else if (*GParam->GaugesDataIn >= GParam->ReferenceDataInUp[0u])
{
GaugesLibDataIn = GParam->ReferenceDataInUp[0u];
} }
if (*GParam->GaugesDataIn >= GParam->ReferenceDataInUp[0u]) else
{ {
*GParam->GaugesDataIn = GParam->ReferenceDataInUp[0u]; GaugesLibDataIn = *GParam->GaugesDataIn;
} }
} }
else if (DirecSignPara == 2u) else if (DirecSignPara == 2u)
{ {
if (*GParam->GaugesDataIn <= GParam->ReferenceDataInDown[GParam->SectorNum - 1u]) if (*GParam->GaugesDataIn <= GParam->ReferenceDataInDown[GParam->SectorNum - 1u])
{ {
*GParam->GaugesDataIn = GParam->ReferenceDataInDown[GParam->SectorNum - 1u];
GaugesLibDataIn = GParam->ReferenceDataInDown[GParam->SectorNum - 1u];
} }
if (*GParam->GaugesDataIn >= GParam->ReferenceDataInDown[0u]) else if (*GParam->GaugesDataIn >= GParam->ReferenceDataInDown[0u])
{ {
*GParam->GaugesDataIn = GParam->ReferenceDataInDown[0u];
GaugesLibDataIn = GParam->ReferenceDataInDown[0u];
}
else
{
GaugesLibDataIn = *GParam->GaugesDataIn ;
} }
} }
else else
...@@ -321,8 +331,8 @@ uint16_t GetGaugestargetPos( _GaugesInfoInit *GParam, uint8_t DirecSignPara) ...@@ -321,8 +331,8 @@ uint16_t GetGaugestargetPos( _GaugesInfoInit *GParam, uint8_t DirecSignPara)
if (DirecSignPara != 0u) if (DirecSignPara != 0u)
{ {
SectorID = QuerySector(GParam, DirecSignPara, ParaDirection); SectorID = QuerySector(GParam, DirecSignPara, ParaDirection, GaugesLibDataIn);
StepCn = GetGaugestargetPosSub(GParam, ParaDirection, SectorID, DirecSignPara) ; StepCn = GetGaugestargetPosSub(GParam, ParaDirection, SectorID, DirecSignPara, GaugesLibDataIn) ;
} }
else else
{ {
...@@ -397,7 +407,14 @@ void GaugeMoveing(uint8_t GaugesNum) ...@@ -397,7 +407,14 @@ void GaugeMoveing(uint8_t GaugesNum)
{ {
if (ModeGaugesTestFlag[GaugesNum] && tmp) if (ModeGaugesTestFlag[GaugesNum] && tmp)
{ {
GaugesMoveTimesTmp = 5u; if (GaugesModuleType [GaugesNum] == FreeMoveType)
{
GaugesMoveTimesTmp = 2u;
}
else
{
GaugesMoveTimesTmp = 5u;
}
} }
else else
{ {
...@@ -407,10 +424,12 @@ void GaugeMoveing(uint8_t GaugesNum) ...@@ -407,10 +424,12 @@ void GaugeMoveing(uint8_t GaugesNum)
} }
else else
{ {
GaugesMoveTimesTmp = GaugesDisDelayMax[DisplayModeTmp[GaugesNum]][GaugesModuleType [GaugesNum]]; GaugesMoveTimesTmp = GaugesDisDelayMax[DisplayModeTmp[GaugesNum]][GaugesModuleType [GaugesNum]];
} }
} }
MoveTypePara = 10u; MoveTypePara = 10u;
} }
else else
{ {
...@@ -434,11 +453,48 @@ void GaugeMoveing(uint8_t GaugesNum) ...@@ -434,11 +453,48 @@ void GaugeMoveing(uint8_t GaugesNum)
{ {
if (GaugesCurrentPos[GaugesNum] < DestPostion[GaugesNum]) if (GaugesCurrentPos[GaugesNum] < DestPostion[GaugesNum])
{ {
GaugesCurrentPos[GaugesNum]++;
if (ModeGaugesTestFlag[GaugesNum] && tmp)
{
if ((GaugesModuleType [GaugesNum] == FreeMoveType))
{
GaugesCurrentPos[GaugesNum] += 5u;
}
else
{
GaugesCurrentPos[GaugesNum]++;
}
}
else
{
GaugesCurrentPos[GaugesNum]++;
}
} }
else if (GaugesCurrentPos[GaugesNum] > DestPostion[GaugesNum]) else if (GaugesCurrentPos[GaugesNum] > DestPostion[GaugesNum])
{ {
GaugesCurrentPos[GaugesNum]--; if (ModeGaugesTestFlag[GaugesNum] && tmp)
{
if ((GaugesModuleType [GaugesNum] == FreeMoveType))
{
if (GaugesCurrentPos[GaugesNum] >= 5u)
{
GaugesCurrentPos[GaugesNum] -= 5u;
}
else
{
GaugesCurrentPos[GaugesNum] = 0u;
}
}
else
{
GaugesCurrentPos[GaugesNum]--;
}
}
else
{
GaugesCurrentPos[GaugesNum]--;
}
} }
else else
{ {
...@@ -457,13 +513,21 @@ void GaugeMoveing(uint8_t GaugesNum) ...@@ -457,13 +513,21 @@ void GaugeMoveing(uint8_t GaugesNum)
} }
if (GaugesModuleType [GaugesNum] >= LEDOtherType) if (GaugesModuleType [GaugesNum] >= LEDOtherType)
{ {
if (GaugesCurrentPos[GaugesNum] % MoveTypePara == 0u) if (ModeGaugesTestFlag[GaugesNum] && tmp)
{ {
GaugesDisPos[GaugesNum] = GaugesCurrentPos[GaugesNum] / MoveTypePara; GaugesDisPos[GaugesNum] = GaugesCurrentPos[GaugesNum] / MoveTypePara;
} }
else else
{ {
;
if (GaugesCurrentPos[GaugesNum] % MoveTypePara == 0u)
{
GaugesDisPos[GaugesNum] = GaugesCurrentPos[GaugesNum] / MoveTypePara;
}
else
{
;
}
} }
} }
else else
...@@ -482,74 +546,12 @@ void GaugeMoveing(uint8_t GaugesNum) ...@@ -482,74 +546,12 @@ void GaugeMoveing(uint8_t GaugesNum)
GaugesDisPos[GaugesNum] = DestPostion[GaugesNum]; GaugesDisPos[GaugesNum] = DestPostion[GaugesNum];
} }
} }
void SeftTest_GaugeMoveing(uint8_t GaugesNum)
{
uint16_t MoveTypePara;
MoveTypePara = 100u;
if ((GaugesModuleType [GaugesNum] == FreeMoveType) || (GaugesModuleType [GaugesNum] == LEDTempType))
{
MoveTypePara = 10u;
}
else
{
MoveTypePara = 100u;
}
if (GaugesDisDelay[GaugesNum] >= SeftTest_Gauges_Times[GaugesNum])
{
if (GaugesInitTimes > GaugesStarMoveTimeMax[GaugesNum])
{
if ((GaugesCurrentPos[GaugesNum] + MoveTypePara) < DestPostion[GaugesNum])
{
GaugesCurrentPos[GaugesNum] += MoveTypePara;
}
else if ((GaugesCurrentPos[GaugesNum] - MoveTypePara) > DestPostion[GaugesNum])
{
GaugesCurrentPos[GaugesNum] -= MoveTypePara;
}
else
{
GaugesCurrentPos[GaugesNum] = DestPostion[GaugesNum];
}
}
else
{
;
}
GaugesDisDelay[GaugesNum] = 0u;
}
else
{
;
}
if (GaugesModuleType [GaugesNum] >= LEDOtherType)
{
if (GaugesCurrentPos[GaugesNum] % MoveTypePara == 0u)
{
GaugesDisPos[GaugesNum] = GaugesCurrentPos[GaugesNum] / MoveTypePara;
}
else
{
;
}
}
else
{
GaugesDisPos[GaugesNum] = GaugesCurrentPos[GaugesNum] ;
}
}
/**@brief Gauge Schedule function /**@brief Gauge Schedule function
* @author TYW * @author TYW
* @param[in] GaugeNum Gauge Postion * @param[in] GaugeNum Gauge Postion
* @param[in] GParam Gauge Struct * @param[in] GParam Gauge Struct
* @since 1.0.0.0 * @since 1.0.0.0
*/ */
static uint8_t wbyTest = 0 ;
void GaugeSchedule(uint8_t GaugesNum, _GaugesInfoInit *GParam) void GaugeSchedule(uint8_t GaugesNum, _GaugesInfoInit *GParam)
{ {
uint8_t tmp; uint8_t tmp;
...@@ -563,21 +565,13 @@ void GaugeSchedule(uint8_t GaugesNum, _GaugesInfoInit *GParam) ...@@ -563,21 +565,13 @@ void GaugeSchedule(uint8_t GaugesNum, _GaugesInfoInit *GParam)
if (GParam->GaugesTestFlag && tmp) if (GParam->GaugesTestFlag && tmp)
{ {
if (GaugesInitTimes > 1500u) if (GaugesInitTimes > 1800u)
{ {
*GParam->GaugesDataIn = GParam->ReferenceDataInUp[0u]; *GParam->GaugesDataIn = GParam->ReferenceDataInUp[0u];
} }
else if (GaugesInitTimes > 0u) else if (GaugesInitTimes > 0u)
{ {
if(GaugesNum == VehGauges) *GParam->GaugesDataIn = GParam->ReferenceDataInUp[GParam->SectorNum - 1u];
{
*GParam->GaugesDataIn = GParam->ReferenceDataInUp[7u];
}
else
{
*GParam->GaugesDataIn = GParam->ReferenceDataInUp[GParam->SectorNum - 1u];
}
} }
else else
{ {
...@@ -586,11 +580,7 @@ void GaugeSchedule(uint8_t GaugesNum, _GaugesInfoInit *GParam) ...@@ -586,11 +580,7 @@ void GaugeSchedule(uint8_t GaugesNum, _GaugesInfoInit *GParam)
} }
else else
{ {
if(GaugesNum == VehGauges) ;
{
wbyTest ++ ;
}
} }
} }
if ( BackupDestPostion[GaugesNum] < *GParam->GaugesDataIn) if ( BackupDestPostion[GaugesNum] < *GParam->GaugesDataIn)
...@@ -623,7 +613,6 @@ void GaugeSchedule(uint8_t GaugesNum, _GaugesInfoInit *GParam) ...@@ -623,7 +613,6 @@ void GaugeSchedule(uint8_t GaugesNum, _GaugesInfoInit *GParam)
uint16_t GetGaugesCurrentPos(uint8_t GaugesNum) uint16_t GetGaugesCurrentPos(uint8_t GaugesNum)
{ {
return GaugesDisPos[GaugesNum]; return GaugesDisPos[GaugesNum];
} }
/**@brief Get Current Step function /**@brief Get Current Step function
...@@ -690,7 +679,6 @@ void GaugesK15Init_OFF(void) ...@@ -690,7 +679,6 @@ void GaugesK15Init_OFF(void)
void Gauges_Time_Xms_Count(uint8_t Xms) void Gauges_Time_Xms_Count(uint8_t Xms)
{ {
uint8_t i = 0u; uint8_t i = 0u;
uint8_t tmp = 0u ;
for (i = 0u; i < GAUGES_TOTAL_NUM; i++) for (i = 0u; i < GAUGES_TOTAL_NUM; i++)
{ {
if (GaugesCurrentPos[i] != DestPostion[i]) if (GaugesCurrentPos[i] != DestPostion[i])
...@@ -708,17 +696,7 @@ void Gauges_Time_Xms_Count(uint8_t Xms) ...@@ -708,17 +696,7 @@ void Gauges_Time_Xms_Count(uint8_t Xms)
{ {
GaugesDisDelay[i] = 0u; GaugesDisDelay[i] = 0u;
} }
GaugeMoveing(i) ;
tmp = (GaugesInitTimes < (GaugesStarMoveTimeMax[i] + Gauages_Init_Time_Max[ModeGaugesTestFlag[i]]));
if(tmp)
{
SeftTest_GaugeMoveing(i);
}
else
{
GaugeMoveing(i) ;
}
} }
if (GaugesPowerState == 1u) if (GaugesPowerState == 1u)
{ {
...@@ -775,4 +753,10 @@ uint16_t GetVehDisVal(uint16_t VehCurPos, _GaugesInfoInit *GParam) ...@@ -775,4 +753,10 @@ uint16_t GetVehDisVal(uint16_t VehCurPos, _GaugesInfoInit *GParam)
void SetFreeMoveTimes(uint16_t GaugesMoveTimes) void SetFreeMoveTimes(uint16_t GaugesMoveTimes)
{ {
GaugesFreeSetTimes = GaugesMoveTimes; GaugesFreeSetTimes = GaugesMoveTimes;
} }
\ No newline at end of file
/*返回上下行状态*/
uint8_t GetGaugesDirec(uint8_t GaugesNum)
{
return DirecSign[GaugesNum] ;
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* @date 2021-2-22 * @date 2021-2-22
* @version A001 * @version A001
* @par Copyright (c): * @par Copyright (c):
* TIANYOUWEI * TIANYOUWEI
* @par History: * @par History:
* version: author, date, desc\n * version: author, date, desc\n
...@@ -33,6 +33,7 @@ typedef enum ...@@ -33,6 +33,7 @@ typedef enum
LEDTempType, LEDTempType,
IndicatTypeTOtal, IndicatTypeTOtal,
FreeMoveType, FreeMoveType,
} _GaugesType; } _GaugesType;
/**@struct _GaugesInfoInit /**@struct _GaugesInfoInit
*this is _GaugesInfoInit *this is _GaugesInfoInit
...@@ -51,8 +52,9 @@ typedef struct ...@@ -51,8 +52,9 @@ typedef struct
uint8_t GaugesTestFlag; uint8_t GaugesTestFlag;
} _GaugesInfoInit; } _GaugesInfoInit;
extern uint8_t QuerySector( _GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t SubAscf);
extern uint16_t GetGaugestargetPosSub( _GaugesInfoInit *GParam, uint8_t SubAscf, uint8_t SectorID, uint8_t DirecSignPara ); extern uint8_t QuerySector(_GaugesInfoInit *GParam, uint8_t DirecSignPara, uint8_t SubAscf, uint16_t FunGaugesDataIn);
extern uint16_t GetGaugestargetPosSub( _GaugesInfoInit *GParam, uint8_t SubAscf, uint8_t SectorID, uint8_t DirecSignPara, uint16_t FunGaugesDataIn );
extern uint16_t GetGaugestargetPos( _GaugesInfoInit *GParam, uint8_t DirecSignPara); extern uint16_t GetGaugestargetPos( _GaugesInfoInit *GParam, uint8_t DirecSignPara);
extern void GaugesForwardParaManage( _GaugesInfoInit *GParam, uint8_t DirecSignPara ); extern void GaugesForwardParaManage( _GaugesInfoInit *GParam, uint8_t DirecSignPara );
extern void GaugesInversionParaManage( _GaugesInfoInit *GParam, uint8_t DirecSignPara ); extern void GaugesInversionParaManage( _GaugesInfoInit *GParam, uint8_t DirecSignPara );
...@@ -68,13 +70,13 @@ extern uint16_t GetGaugesCurrentPos(uint8_t GaugesNum) ; ...@@ -68,13 +70,13 @@ extern uint16_t GetGaugesCurrentPos(uint8_t GaugesNum) ;
/*表头处理函数*/ /*表头处理函数*/
extern void GaugeSchedule(uint8_t GaugesNum, _GaugesInfoInit *GParam); extern void GaugeSchedule(uint8_t GaugesNum, _GaugesInfoInit *GParam);
/*表头时间函数放在ms定时中*/ /*表头时间函数放在ms定时中*/
extern void Gauges_Time_Xms_Count(uint8_t Xms); extern void Gauges_Time_Xms_Count(uint8_t Xms);
/*得到格的内部小步*/ /*得到格的内部小步*/
extern uint16_t GetGaugesCurrentStep(uint8_t GaugesNum); extern uint16_t GetGaugesCurrentStep(uint8_t GaugesNum);
/*通过车速目标步得到实际车速*/ /*通过车速目标步得到实际车速*/
extern uint16_t GetVehDisVal(uint16_t VehCurPos, _GaugesInfoInit *GParam); extern uint16_t GetVehDisVal(uint16_t VehCurPos, _GaugesInfoInit *GParam);
/*设置FreeMoveType模式仪表走动时间*/ /*设置FreeMoveType模式仪表走动时间*/
extern void SetFreeMoveTimes(uint16_t GaugesMoveTimes); extern void SetFreeMoveTimes(uint16_t GaugesMoveTimes);
/*得到上下行方向 返回值:1 2*/
extern void SeftTest_GaugeMoveing(uint8_t GaugesNum) ; extern uint8_t GetGaugesDirec(uint8_t GaugesNum) ;
#endif #endif
\ No newline at end of file
...@@ -265,7 +265,7 @@ uint16_t RevSpeedManage(uint16_t Speed) ...@@ -265,7 +265,7 @@ uint16_t RevSpeedManage(uint16_t Speed)
void Fre_SwapShort(volatile uint32_t *pData1, volatile uint32_t *pData2); void Fre_SwapShort(volatile uint32_t *pData1, volatile uint32_t *pData2);
void Fre_SortShort(volatile uint32_t SortData[], uint8_t len);
//uint16_t Cal_Veh_Frequency(void); //uint16_t Cal_Veh_Frequency(void);
...@@ -457,6 +457,7 @@ uint16_t Cal_Veh_Frequency(void) ...@@ -457,6 +457,7 @@ uint16_t Cal_Veh_Frequency(void)
{ {
; ;
} }
return VehFre.Frequency; return VehFre.Frequency;
} }
/**@brief Cal Veh Val function计算车速 /**@brief Cal Veh Val function计算车速
......
...@@ -15,31 +15,31 @@ static const uint16_t GaugesDataInInit[GaugesTotal][3][25] = ...@@ -15,31 +15,31 @@ static const uint16_t GaugesDataInInit[GaugesTotal][3][25] =
/*转速*/ /*转速*/
{ {0u, 1000, 1500, 2000, 2500, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { {0u, 1000, 1500, 2000, 2500, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0u, 1000, 1500, 2000, 2500, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0u, 1000, 1500, 2000, 2500, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0u, 6 , 11 , 16 , 21 , 27 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} {0u, 6 , 11 , 16 , 21 , 27 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}, },
/*水温*/ /*水温*/
{ {49 , 50, 55, 61, 66, 72, 77, 102, 104, 106, 108, 110, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { { 0 , 50, 55, 61, 66, 72, 77, 102, 104, 106, 108, 110, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{49 , 50, 55, 61, 66, 72, 77, 102, 104, 106, 108, 110, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {49 , 54, 60, 65, 71, 76, 101, 103, 105, 107, 109, 110, 210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0 , 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10 , 11 , 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} {0 , 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10 , 11 , 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}, },
/*PRI气压*/ /*PRI气压*/
{ {0 ,500, 720, 940, 1160, 1380, 1600, 1820, 2040, 2260, 2480, 2700, 2920, 3140, 3360, 3580 ,3800 ,4020, 4240, 4500, 0, 0, 0, 0, 0}, { {0 , 500, 720, 940, 1160, 1380, 1600, 1820, 2040, 2260, 2480, 2700, 2920, 3140, 3360, 3580 , 3800 , 4020, 4240, 4500, 0, 0, 0, 0, 0},
{0 ,610, 830, 1050,1270, 1490, 1710, 1930, 2150, 2370, 2590, 2810, 3030, 3250, 3470, 3690 ,3910 ,4130, 4350, 4500, 0, 0, 0, 0, 0}, {0 , 610, 830, 1050, 1270, 1490, 1710, 1930, 2150, 2370, 2590, 2810, 3030, 3250, 3470, 3690 , 3910 , 4130, 4350, 4500, 0, 0, 0, 0, 0},
{0 ,0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 17 , 0, 0, 0, 0, 0} {0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 0, 0, 0, 0, 0}
}, },
/*SEC气压*/ /*SEC气压*/
{ {0 ,500, 720, 940, 1160, 1380, 1600, 1820, 2040, 2260, 2480, 2700, 2920, 3140, 3360, 3580 ,3800 ,4020, 4240, 4500, 0, 0, 0, 0, 0}, { {0 , 500, 720, 940, 1160, 1380, 1600, 1820, 2040, 2260, 2480, 2700, 2920, 3140, 3360, 3580 , 3800 , 4020, 4240, 4500, 0, 0, 0, 0, 0},
{0 ,610, 830, 1050,1270, 1490, 1710, 1930, 2150, 2370, 2590, 2810, 3030, 3250, 3470, 3690 ,3910 ,4130, 4350, 4500, 0, 0, 0, 0, 0}, {0 , 610, 830, 1050, 1270, 1490, 1710, 1930, 2150, 2370, 2590, 2810, 3030, 3250, 3470, 3690 , 3910 , 4130, 4350, 4500, 0, 0, 0, 0, 0},
{0 ,0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 17, 0, 0, 0, 0, 0} {0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18, 0, 0, 0, 0, 0}
}, },
/*WET气压*/ /*WET气压*/
{ {500, 730, 960, 1190, 1420, 1650, 1880, 2100, 2330, 2560, 2790, 3020, 3250, 3480, 3710 ,3940 ,4170, 4400, 4500, 0, 0, 0, 0, 0, 0}, { {500, 730, 960, 1190, 1420, 1650, 1880, 2100, 2330, 2560, 2790, 3020, 3250, 3480, 3710 , 3940 , 4170, 4400, 4500, 0, 0, 0, 0, 0, 0},
{600, 830, 1060,1290, 1520, 1750, 1980, 2200, 2430, 2660, 2890, 3120, 3350, 3580, 3810 ,4040 ,4270, 4500, 4500, 0, 0, 0, 0, 0, 0}, {600, 830, 1060, 1290, 1520, 1750, 1980, 2200, 2430, 2660, 2890, 3120, 3350, 3580, 3810 , 4040 , 4270, 4500, 4500, 0, 0, 0, 0, 0, 0},
{0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 17, 0, 0, 0, 0, 0, 0} {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18, 0, 0, 0, 0, 0, 0}
}, },
/*电池电压*/ /*电池电压*/
{ {0 ,17000, 19000, 20000, 21000, 22000, 23000, 24000, 25000, 26000, 27000, 28000, 29000, 30000, 30500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { {0 , 17000, 19000, 20000, 21000, 22000, 23000, 24000, 25000, 26000, 27000, 28000, 29000, 30000, 30500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0 ,17000, 18500, 19500, 20500, 21500, 22500, 23500, 24500, 25500, 26500, 27500, 28500, 29500, 30000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0 , 17000, 18500, 19500, 20500, 21500, 22500, 23500, 24500, 25500, 26500, 27500, 28500, 29500, 30000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}, },
...@@ -49,14 +49,14 @@ static const uint16_t GaugesDataInInit[GaugesTotal][3][25] = ...@@ -49,14 +49,14 @@ static const uint16_t GaugesDataInInit[GaugesTotal][3][25] =
static const uint8_t GaugesIndicatType[GaugesTotal] = {LEDOtherType, LEDOtherType, LEDTempType, LEDGasType, LEDGasType, LEDGasType,LEDOtherType}; /*初始化表头显示类型,例如水温,气压*/ static const uint8_t GaugesIndicatType[GaugesTotal] = {LEDOtherType, LEDOtherType, LEDTempType, LEDGasType, LEDGasType, LEDGasType,LEDOtherType}; /*初始化表头显示类型,例如水温,气压*/
/*每个表头包含的参数个数*/ /*表头1 表头2 表头3 表头4*/ /*每个表头包含的参数个数*/ /*表头1 表头2 表头3 表头4*/
static const uint8_t GaugesParaNum[GaugesTotal] = {12, 6, 13, 20, 20, 19 ,14}; static const uint8_t GaugesParaNum[GaugesTotal] = {12, 6, 13, 19, 19, 19 , 14};
/*每个表头IGON后开始走动时间*/ /*表头1 表头2 表头3 表头4 表头5 表头6*/ /*每个表头IGON后开始走动时间*/ /*表头1 表头2 表头3 表头4 表头5 表头6*/
static const uint16_t GaugesStarMoveTime[GaugesTotal] = {0, 0, 0, 0, 0, 0, 0,};/*0是上电就开始走动,其他参数是ms*/ static const uint16_t GaugesStarMoveTime[GaugesTotal] = {0, 0, 0, 0, 0, 0, 0,};/*0是上电就开始走动,其他参数是ms*/
/*每个表头IGON后是否自检*/ /*表头1 表头2 表头3 表头4 表头5 表头6*/ /*每个表头IGON后是否自检*/ /*表头1 表头2 表头3 表头4 表头5 表头6*/
static const uint16_t GaugesTest[GaugesTotal] = {1, 1, 1, 1, 1, 0, 0,};/*1是自检,0不自检*/ static const uint16_t GaugesTest[GaugesTotal] = {1, 1, 1, 1, 1, 0, 0,};/*1是自检,0不自检*/
/*每个表头自检走动每格时间*/ /*每个表头自检走动每格时间*/
const uint16_t SeftTest_Gauges_Times[GaugesTotal] = {1500/(30+1),1500/(27+1) ,1500/(12+1),1500/(17+1),1500/(17+1),0,0}; const uint16_t SeftTest_Gauges_Times[GaugesTotal] = {1500 / (30 + 1), 1500 / (27 + 1) , 1500 / (12 + 1), 1500 / (18 + 1), 1500 / (18 + 1), 0, 0};
uint16_t RealDataIn[GaugesTotal]; uint16_t RealDataIn[GaugesTotal];
_GaugesInfoInit GaugesInfo_Init_Table[GaugesTotal]; _GaugesInfoInit GaugesInfo_Init_Table[GaugesTotal];
/**@brief User Gauge K30 Init function /**@brief User Gauge K30 Init function
...@@ -129,7 +129,7 @@ void UserGaugeSchedule(void) ...@@ -129,7 +129,7 @@ void UserGaugeSchedule(void)
for (i = 0u; i < GaugesTotal; i++) for (i = 0u; i < GaugesTotal; i++)
{ {
GaugeSchedule(i, &GaugesInfo_Init_Table[i]); GaugeSchedule(i, &GaugesInfo_Init_Table[i]);
} }
} }
......
...@@ -26,6 +26,7 @@ typedef struct ...@@ -26,6 +26,7 @@ typedef struct
uint16_t DataDisplay; uint16_t DataDisplay;
uint8_t Valid; uint8_t Valid;
uint16_t LostTimer; uint16_t LostTimer;
uint8_t Status;
} DataStruct; } DataStruct;
extern DataStruct DataStrGas1; extern DataStruct DataStrGas1;
...@@ -63,4 +64,6 @@ extern uint16_t Cal_Veh_Frequency(void) ; ...@@ -63,4 +64,6 @@ extern uint16_t Cal_Veh_Frequency(void) ;
extern void App_SortNByte(uint16_t *SortData, uint8_t len); extern void App_SortNByte(uint16_t *SortData, uint8_t len);
extern void Fre_SortShort(volatile uint32_t SortData[], uint8_t len);
#endif #endif
\ No newline at end of file
...@@ -130,7 +130,6 @@ Power_Status_t Power_KL30_Init ( void ) ...@@ -130,7 +130,6 @@ Power_Status_t Power_KL30_Init ( void )
BL_Init(); BL_Init();
/*****油耗类****/ /*****油耗类****/
Fuel_Consump_K30_Init();
Fuel_User_KL30_Init(); Fuel_User_KL30_Init();
u8PowerSts = m_IGN_OFF_Init; u8PowerSts = m_IGN_OFF_Init;
return u8PowerSts; return u8PowerSts;
...@@ -254,8 +253,6 @@ void Power_IG_ON_Init(void) ...@@ -254,8 +253,6 @@ void Power_IG_ON_Init(void)
//LongTimeNoKey_Operation_TimeRest(); //LongTimeNoKey_Operation_TimeRest();
CD4051B_KL15Init(); CD4051B_KL15Init();
Fuel_Consump_K15_Init();
GUI_Display_KL15_ON_Init(); GUI_Display_KL15_ON_Init();
} }
Power_Status_t Power_Stay_ON(void) Power_Status_t Power_Stay_ON(void)
......
...@@ -44,6 +44,8 @@ typedef enum ...@@ -44,6 +44,8 @@ typedef enum
em_LED_TRAILER_ABS_U, em_LED_TRAILER_ABS_U,
em_LED_WORKING_LAMP_U, em_LED_WORKING_LAMP_U,
em_LED_TRAILER_ABS_INFO_U, em_LED_TRAILER_ABS_INFO_U,
em_LED_TEMP,
em_LED_FUEL,
LED_Max, LED_Max,
} LED_Idx_t; } LED_Idx_t;
...@@ -144,6 +146,8 @@ uint8_t LED_AIR_SUS_R_Judgement(void); ...@@ -144,6 +146,8 @@ uint8_t LED_AIR_SUS_R_Judgement(void);
uint8_t LED_TRAILER_ABS_U_Judgement(void); uint8_t LED_TRAILER_ABS_U_Judgement(void);
uint8_t LED_WORKING_LAMP_U_Judgement(void); uint8_t LED_WORKING_LAMP_U_Judgement(void);
uint8_t LED_TRAILER_ABS_INFO_U_Judgement(void); uint8_t LED_TRAILER_ABS_INFO_U_Judgement(void);
uint8_t LED_Temp_Judgement(void);
uint8_t LED_Fuel_Judgement(void);
/*LED执行函数*/ /*LED执行函数*/
void LED_INTER_DIFF_LOCK_T_Execution(uint8_t led_status); void LED_INTER_DIFF_LOCK_T_Execution(uint8_t led_status);
...@@ -183,6 +187,8 @@ void LED_AIR_SUS_R_Execution(uint8_t led_status); ...@@ -183,6 +187,8 @@ void LED_AIR_SUS_R_Execution(uint8_t led_status);
void LED_TRAILER_ABS_U_Execution(uint8_t led_status); void LED_TRAILER_ABS_U_Execution(uint8_t led_status);
void LED_WORKING_LAMP_U_Execution(uint8_t led_status); void LED_WORKING_LAMP_U_Execution(uint8_t led_status);
void LED_TRAILER_ABS_INFO_U_Execution(uint8_t led_status); void LED_TRAILER_ABS_INFO_U_Execution(uint8_t led_status);
void LED_Temp_Execution(uint8_t led_status);
void LED_Fuel_Execution(uint8_t led_status);
/*:ZH*/ /*:ZH*/
#endif #endif
...@@ -57,8 +57,8 @@ const LED_Attribute_st LED_Attribute[LED_Max] = ...@@ -57,8 +57,8 @@ const LED_Attribute_st LED_Attribute[LED_Max] =
{ em_LED_TRAILER_ABS_U , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, LED_TRAILER_ABS_U_Judgement , LED_TRAILER_ABS_U_Execution }, { em_LED_TRAILER_ABS_U , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, LED_TRAILER_ABS_U_Judgement , LED_TRAILER_ABS_U_Execution },
{ em_LED_WORKING_LAMP_U , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, LED_WORKING_LAMP_U_Judgement , LED_WORKING_LAMP_U_Execution }, { em_LED_WORKING_LAMP_U , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, LED_WORKING_LAMP_U_Judgement , LED_WORKING_LAMP_U_Execution },
{ em_LED_TRAILER_ABS_INFO_U , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, LED_TRAILER_ABS_INFO_U_Judgement , LED_TRAILER_ABS_INFO_U_Execution }, { em_LED_TRAILER_ABS_INFO_U , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, LED_TRAILER_ABS_INFO_U_Judgement , LED_TRAILER_ABS_INFO_U_Execution },
{ em_LED_TEMP , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, LED_Temp_Judgement , LED_Temp_Execution },
{ em_LED_FUEL , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, LED_Fuel_Judgement , LED_Fuel_Execution },
}; };
/*must put into 10ms task*/ /*must put into 10ms task*/
...@@ -88,7 +88,7 @@ uint8_t LED_MAINTENANCE_F = 0x00u; ...@@ -88,7 +88,7 @@ uint8_t LED_MAINTENANCE_F = 0x00u;
uint8_t LED_SEATBELT_F = 0x00u; uint8_t LED_SEATBELT_F = 0x00u;
*/ */
/****************************************************************************** /******************************************************************************
T3 L1 L2 L3 R1 R2 R3 U1 U4 U5无灯 左右转向单独 水温 燃油 气压1 气压2 在显示处做逻辑 T3 L1 L2 L3 R1 R2 R3 U1 U4 U5无灯 左右转向单独 气压1 气压2 指示灯是背光
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
...@@ -1916,4 +1916,85 @@ void LED_TRAILER_ABS_INFO_U_Execution(uint8_t led_status) ...@@ -1916,4 +1916,85 @@ void LED_TRAILER_ABS_INFO_U_Execution(uint8_t led_status)
{ {
SEG_LED_TRAILER_ABS_INFO_U(0); SEG_LED_TRAILER_ABS_INFO_U(0);
} }
}
/******************************************************************************
Temp
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint8_t LED_Temp_Judgement(void)
{
uint8_t u8Result = 0u;
uint8_t m_Condition1 = 0u;
if (m_Condition1 == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_Temp_Execution(uint8_t led_status)
{
if (led_status == 1u)
{
//TimerB_PWM_Channel_Duty_Set(TIMERB_2_CH7 , testBG );//水温格白色
TEMP_R_LED_OUT = 1u ;/*水温红灯*/
Water_Temp_Led_R_MCU_OUT = 1u;
TEMP_W_LED_OUT = 0u ;//水温字符白色指示灯
Water_Temp_Led_W_MCU_OUT = 0u;
}
else
{
TEMP_R_LED_OUT = 0u ;/*水温红灯*/
Water_Temp_Led_R_MCU_OUT = 0u;
TEMP_W_LED_OUT = 1u ;//水温字符白色指示灯
Water_Temp_Led_W_MCU_OUT = 1u;
}
}
/******************************************************************************
Fuel
信号接口:
信号定义:
输出信号:
******************************************************************************/
uint8_t LED_Fuel_Judgement(void)
{
uint8_t u8Result = 0u;
uint8_t m_Condition1 = 0u;
//m_Condition1 = Fuel_Get_LowAlarm();
if (m_Condition1 == 1u)
{
u8Result = 1u;
}
else
{
u8Result = 0u;
}
return u8Result;
}
void LED_Fuel_Execution(uint8_t led_status)
{
if (led_status == 1u)
{
FUEL_LED_Y_MCU = 1U ;
FUEL_W_LED_OUT = 0U ;
}
else
{
FUEL_LED_Y_MCU = 0U ;
FUEL_W_LED_OUT = 1U ;
}
} }
\ No newline at end of file
...@@ -52,10 +52,7 @@ static uint8_t CanFirstEvent[ID_TOTAL_MAX]; ...@@ -52,10 +52,7 @@ static uint8_t CanFirstEvent[ID_TOTAL_MAX];
static void Individual_ECU_Communication(void); static void Individual_ECU_Communication(void);
// wangboyu - end // wangboyu - end
/*菜单设置项存储EEP结构*/ _EOL_K_LINE_SET K_Line_Set;
//_Menu_Configure_Value Menu_Con_EEP_Value;
extern uint8_t u8MenuItemVariateNum[MENU_ITEM_MAX];
extern uint8_t u8MenuItemVariateData[MENU_ITEM_MAX];
/*每次唤醒调用*/ /*每次唤醒调用*/
void Common_DataInit(void) void Common_DataInit(void)
...@@ -182,20 +179,6 @@ static void Common_Set_Disp_E_Speed_Valid(DataValid_t Val) ...@@ -182,20 +179,6 @@ static void Common_Set_Disp_E_Speed_Valid(DataValid_t Val)
Disp_E_Speed_Valid = Val; Disp_E_Speed_Valid = Val;
} }
uint16_t Common_Get_DispSpeed(void)
{
uint16_t m_Res;
if (Disp_V_Speed_Valid)
{
m_Res = (((Disp_V_Speed / 10u) * 16u) / 9u);
}
else
{
m_Res = 0x1fffu;
}
return m_Res;
}
/*2MS任务*/ /*2MS任务*/
static uint16_t wbyTest = 0; static uint16_t wbyTest = 0;
void Common_Input_Para(void) void Common_Input_Para(void)
...@@ -313,7 +296,8 @@ void Common_BlockDelay(uint16_t m_MS) ...@@ -313,7 +296,8 @@ void Common_BlockDelay(uint16_t m_MS)
Counter = 65535u - RocBackup + Counter + 1u; Counter = 65535u - RocBackup + Counter + 1u;
} }
} while (Counter < DIMCounter); }
while (Counter < DIMCounter);
} }
uint32_t Common_GetIgnOnTime(void) uint32_t Common_GetIgnOnTime(void)
...@@ -332,3 +316,58 @@ int32_t SEGGER_RTT_printf(uint16_t BufferIndex, const char *sFormat, ...) ...@@ -332,3 +316,58 @@ int32_t SEGGER_RTT_printf(uint16_t BufferIndex, const char *sFormat, ...)
{ {
return 0; return 0;
} }
void K_LINE_EOL_InitVal(void)
{
K_Line_Set.K_Line_LID20 = 0x00u; /* 00 应对ECE R13 //0:非应对、1:应对 */
K_Line_Set.K_Line_LID21 = 0x00u; /* 00 EBS/ABS //0:无、1:EBS、2:ABS(CAN应对) 3:ABS (CAN非应对) */
K_Line_Set.K_Line_LID22 = 0x00u; /* 00 EVSC //0:无、1:有 */
K_Line_Set.K_Line_LID23 = 0x00u; /* 00 驻车锁定 //0:无、1:有 */
K_Line_Set.K_Line_LID24 = 0x00u; /* 00 HSA //0:无、1:有 */
K_Line_Set.K_Line_LID25 = 0x00u; /* 00 AEBS //0:无、1:有 */
K_Line_Set.K_Line_LID26 = 0x00u; /* 00 ACC //0:无、1:有 */
K_Line_Set.K_Line_LID27 = 0x00u; /* 00 LDWS //0:无、1:有 */
K_Line_Set.K_Line_LID28 = 0x00u; /* 00 车辆间报警 //0:无、1:有 */
K_Line_Set.K_Line_LID29 = 0x01u; /* 01 有无巡航 //0:无、1:有 /*初值1*/
K_Line_Set.K_Line_LID2A = 0x00u; /* 00 气悬 //0:Reef、1:Rear air、2:Full air */
K_Line_Set.K_Line_LID2B = 0x00u; /* 00 ISS //0:无、1: eco stop、 2:Idle Stop */
K_Line_Set.K_Line_LID2C = 0x00u; /* 00 装货台工作警报蜂鸣 //0:无、1:有 */
K_Line_Set.K_Line_LID2D = 0x00u; /* 00 ROWS //0:无、1:ROWS有、2LOCAL警报有 */
K_Line_Set.K_Line_LID2E = 0x00u; /* 00 行车记录仪 //0:模拟记录仪、1:数字记录仪或行车记录仪 */
K_Line_Set.K_Line_LID2F = 0x00u; /* 00 车型 //0:单车、1:拖车、2:全拖车 */
K_Line_Set.K_Line_LID30 = 0x00u; /* 00 缓速器 //0:无、1:有(C&E)、2:有(F) */
K_Line_Set.K_Line_LID31 = 0x01u; /* -- 定速巡航 //0:无、1:有 */
K_Line_Set.K_Line_LID32 = 0x00u; /* 00 装货台种类 //0:一般、1:侧翼、2:倾倒 */
K_Line_Set.K_Line_LID33 = 0x01u; /* 01 SCR?DPD //0:SCR无/DPD有、1:SCR有/DPD有、2:SCR无/DPD无、3:SCR有/DPD无 /*初值1*/
K_Line_Set.K_Line_LID34 = 0x00u; /* 00 驻车种类 //0:FULL AIR、1:AOH /*初值1*/
K_Line_Set.K_Line_LID35 = 0x00u; /* -- 气压计 //0:2针式、1:1针式 */
K_Line_Set.K_Line_LID36 = 0x00u; /* -- 低压警报压 //0:一般输出(539kPa)、1:ADR(588kPa) */
K_Line_Set.K_Line_LID37 = 0x01u; /* -- 超限警报 //0:无、1:有 */
K_Line_Set.K_Line_LID38 = 0x01u; /* -- 速度警报 //0:无、1:有 */
K_Line_Set.K_Line_LID39 = 0x00u; /* 00 可变SLD //0:无、1:1车速、2:2车速 /*初值1*/
K_Line_Set.K_Line_LID3A = 0x00u; /* -- OEM //0:ISZ、1:UDT */
K_Line_Set.K_Line_LID3B = 0x00u; /* -- 预留 */
K_Line_Set.K_Line_LID3C = 0x00u; /* -- 预留 */
K_Line_Set.K_Line_LID3D = 0x00u; /* -- 预留 */
K_Line_Set.K_Line_LID3E = 0x01u; /* 01 预留 //0:胎压功能未匹配 1:匹配 */
K_Line_Set.K_Line_LID3F = 0x00u; /* -- 预留 */
K_Line_Set.K_Line_LID40 = 0x00u; /* 00 发动机种类 */
K_Line_Set.K_Line_LID41 = 0x10u; /* 10 变速器种类&控制 /*初值50*/
K_Line_Set.K_Line_LID42 = 0x00u; /* 00 驻车管道 /*初值 0*/
K_Line_Set.K_Line_LID43 = 0x82u; /* 82 车型 /*初值44*/
K_Line_Set.K_Line_LID44 = 0xFFu; /* FF 速度警报 /*初值FF*/
K_Line_Set.K_Line_LID45 = 0xFFu; /* FF 发动机转速 /*初值FF*/
K_Line_Set.K_Line_LID46 = 0xFFu; /* FF 急加速 /*初值FF*/
K_Line_Set.K_Line_LID47 = 0xFFu; /* FF 急减速 /*初值FF*/
K_Line_Set.K_Line_LID48 = 0xFFu; /* FF 长时间怠速 /*初值FF*/
K_Line_Set.K_Line_LID49 = 0xFFu; /* FF 辅助驻车 /*初值FF*/
K_Line_Set.K_Line_LID4A = 0x32u; /* 32 变速箱油 5000 */
K_Line_Set.K_Line_LID4B = 0x32u; /* 32 差速器油 5000 */
K_Line_Set.K_Line_LID4C = 0x32u; /* 32 离合器油 */
K_Line_Set.K_Line_LID4D = 0x64u; /* 64 动力转向油 10000 */
K_Line_Set.K_Line_LID4E = 0x78u; /* 78 轮胎 12000 */
K_Line_Set.K_Line_LID4F = 0x32u; /* 32 机油&滤清器 5000 */
K_Line_Set.K_Line_LID50 = 0x00u; /* -- 预留 */
K_Line_Set.K_Line_LID51 = 0x01u; /* 01 工作模式 */
K_Line_Set.K_Line_LID52 = 0x00u; /* 00 电子部件设定 */
}
\ No newline at end of file
...@@ -6,36 +6,39 @@ ...@@ -6,36 +6,39 @@
/****************************************************************************** /******************************************************************************
K-LINE下线配置 K-LINE下线配置
******************************************************************************/ ******************************************************************************/
static struct typedef struct
{ {
// HEX // HEX
uint8_t K_Line_LID20; /* 00 应对ECE R13 //0:非应对、1:应对 */ uint8_t K_Line_LID20; /* 00 应对ECE R13 //0:非应对、1:应对 */
uint8_t K_Line_LID21; /* 00 EBS/ABS //0:无、1:EBS、2:ABS(CAN应对) 3:ABS (CAN非应对) */ uint8_t K_Line_LID21; /* 00 EBS/ABS //0:无、1:EBS、2:ABS(CAN应对) 3:ABS (CAN非应对) */
uint8_t K_Line_LID22; /* 00 EVSC //0:无、1:有 */ uint8_t K_Line_LID22; /* 00 EVSC //0:无、1:有 */
uint8_t K_Line_LID23; /* 00 驻车锁定 //0:无、1:有 */ uint8_t K_Line_LID23; /* 00 驻车锁定 //0:无、1:有 */
uint8_t K_Line_LID24; /* 00 HSA //0:无、1:有 */ uint8_t K_Line_LID24; /* 00 HSA //0:无、1:有 */
uint8_t K_Line_LID25; /* 00 AEBS //0:无、1:有 */ uint8_t K_Line_LID25; /* 00 AEBS //0:无、1:有 */
uint8_t K_Line_LID26; /* 00 ACC //0:无、1:有 */ uint8_t K_Line_LID26; /* 00 ACC //0:无、1:有 */
uint8_t K_Line_LID27; /* 00 LDWS //0:无、1:有 */ uint8_t K_Line_LID27; /* 00 LDWS //0:无、1:有 */
uint8_t K_Line_LID28; /* 00 车辆间报警 //0:无、1:有 */ uint8_t K_Line_LID28; /* 00 车辆间报警 //0:无、1:有 */
uint8_t K_Line_LID29; /* 01 有无巡航 //0:无、1:有 /*初值1*/ uint8_t K_Line_LID29; /* 01 有无巡航 //0:无、1:有 /*初值1*/
uint8_t K_Line_LID2A; /* 00 气悬 //0:Reef、1:Rear air、2:Full air */ uint8_t K_Line_LID2A; /* 00 气悬 //0:Reef、1:Rear air、2:Full air */
uint8_t K_Line_LID2B; /* 00 ISS //0:无、1: eco stop、 2:Idle Stop */ uint8_t K_Line_LID2B; /* 00 ISS //0:无、1: eco stop、 2:Idle Stop */
uint8_t K_Line_LID2C; /* 00 装货台工作警报蜂鸣//0:无、1:有 */ uint8_t K_Line_LID2C; /* 00 装货台工作警报蜂鸣//0:无、1:有 */
uint8_t K_Line_LID2D; /* 00 ROWS //0:无、1:ROWS有、2LOCAL警报有 */ uint8_t K_Line_LID2D; /* 00 ROWS //0:无、1:ROWS有、2LOCAL警报有 */
uint8_t K_Line_LID2E; /* 00 行车记录仪 //0:模拟记录仪、1:数字记录仪或行车记录仪 */ uint8_t K_Line_LID2E; /* 00 行车记录仪 //0:模拟记录仪、1:数字记录仪或行车记录仪 */
uint8_t K_Line_LID2F; /* 00 车型 //0:单车、1:拖车、2:全拖车 */ uint8_t K_Line_LID2F; /* 00 车型 //0:单车、1:拖车、2:全拖车 */
uint8_t K_Line_LID30; /* 00 缓速器 //0:无、1:有(C&E)、2:有(F) */ uint8_t K_Line_LID30; /* 00 缓速器 //0:无、1:有(C&E)、2:有(F) */
uint8_t K_Line_LID31; /* -- 地图巡航 //0:无、1:有 */ uint8_t K_Line_LID31; /* -- 定速巡航 //0:无、1:有 */
uint8_t K_Line_LID32; /* 00 装货台种类 //0:一般、1:侧翼、2:倾倒 */ uint8_t K_Line_LID32; /* 00 装货台种类 //0:一般、1:侧翼、2:倾倒 */
uint8_t K_Line_LID33; /* 01 SCR?DPD //0:SCR无/DPD有、1:SCR有/DPD有、2:SCR无/DPD无、3:SCR有/DPD无 /*初值1*/ uint8_t K_Line_LID33; /* 01 SCR?DPD //0:SCR无/DPD有、1:SCR有/DPD有、2:SCR无/DPD无、3:SCR有/DPD无 /*初值1*/
uint8_t K_Line_LID34; /* 00 驻车种类 //0:FULL AIR、1:AOH /*初值1*/
uint8_t K_Line_LID34; /* 00 驻车种类 //0:FULL AIR、1:AOH /*初值1*/
uint8_t K_Line_LID35; /* -- 气压计 //0:2针式、1:1针式 */ uint8_t K_Line_LID35; /* -- 气压计 //0:2针式、1:1针式 */
uint8_t K_Line_LID36; /* -- 低压警报压 //0:一般输出(539kPa)、1:ADR(588kPa) */ uint8_t K_Line_LID36; /* -- 低压警报压 //0:一般输出(539kPa)、1:ADR(588kPa) */
uint8_t K_Line_LID37; /* -- 超限警报 //0:无、1:有 */ uint8_t K_Line_LID37; /* -- 超限警报 //0:无、1:有 */
uint8_t K_Line_LID38; /* -- 速度警报 //0:无、1:有 */ uint8_t K_Line_LID38; /* -- 速度警报 //0:无、1:有 */
uint8_t K_Line_LID39; /* 00 可变SLD //0:无、1:1车速、2:2车速 /*初值1*/ uint8_t K_Line_LID39; /* 00 可变SLD //0:无、1:1车速、2:2车速 /*初值1*/
uint8_t K_Line_LID3A; /* -- OEM //0:ISZ、1:UDT */ uint8_t K_Line_LID3A; /* -- OEM //0:ISZ、1:UDT */
...@@ -45,37 +48,49 @@ static struct ...@@ -45,37 +48,49 @@ static struct
uint8_t K_Line_LID3D; /* -- 预留 */ uint8_t K_Line_LID3D; /* -- 预留 */
uint8_t K_Line_LID3E; /* 01 预留 //0:胎压功能未匹配 1:匹配 */ uint8_t K_Line_LID3E; /* 01 预留 //0:胎压功能未匹配 1:匹配 */
uint8_t K_Line_LID3F; /* -- 预留 */ uint8_t K_Line_LID3F; /* -- 预留 */
uint8_t K_Line_LID40; /* 00 发动机种类 */ uint8_t K_Line_LID40; /* 00 发动机种类 */
uint8_t K_Line_LID41; /* 10 变速器种类&控制 /*初值50*/ uint8_t K_Line_LID41; /* 10 变速器种类&控制 /*初值50*/
uint8_t K_Line_LID42; /* 00 驻车管道 /*初值 0*/ uint8_t K_Line_LID42; /* 00 驻车管道 /*初值 0*/
uint8_t K_Line_LID43; /* 82 车型 /*初值44*/ uint8_t K_Line_LID43; /* 82 车型 /*初值44*/
uint8_t K_Line_LID44; /* FF 速度警报 /*初值FF*/ uint8_t K_Line_LID44; /* FF 速度警报 /*初值FF*/
uint8_t K_Line_LID45; /* FF 发动机转速 /*初值FF*/ uint8_t K_Line_LID45; /* FF 发动机转速 /*初值FF*/
uint8_t K_Line_LID46; /* FF 急加速 /*初值FF*/ uint8_t K_Line_LID46; /* FF 急加速 /*初值FF*/
uint8_t K_Line_LID47; /* FF 急减速 /*初值FF*/ uint8_t K_Line_LID47; /* FF 急减速 /*初值FF*/
uint8_t K_Line_LID48; /* FF 长时间怠速 /*初值FF*/ uint8_t K_Line_LID48; /* FF 长时间怠速 /*初值FF*/
uint8_t K_Line_LID49; /* FF 辅助驻车 /*初值FF*/ uint8_t K_Line_LID49; /* FF 辅助驻车 /*初值FF*/
uint8_t K_Line_LID4A; /* 32 变速箱油 5000 */ uint8_t K_Line_LID4A; /* 32 变速箱油 5000 */
uint8_t K_Line_LID4B; /* 32 差速器油 5000 */ uint8_t K_Line_LID4B; /* 32 差速器油 5000 */
uint8_t K_Line_LID4C; /* 32 离合器油 */ uint8_t K_Line_LID4C; /* 32 离合器油 */
uint8_t K_Line_LID4D; /* 64 动力转向油 10000 */ uint8_t K_Line_LID4D; /* 64 动力转向油 10000 */
uint8_t K_Line_LID4E; /* 78 轮胎 12000 */ uint8_t K_Line_LID4E; /* 78 轮胎 12000 */
uint8_t K_Line_LID4F; /* 32 机油&滤清器 5000 */ uint8_t K_Line_LID4F; /* 32 机油&滤清器 5000 */
uint8_t K_Line_LID50; /* -- 预留 */
uint8_t K_Line_LID50; /* -- 预留 */
uint8_t K_Line_LID51; /* 01 工作模式 */ uint8_t K_Line_LID51; /* 01 工作模式 */
uint8_t K_Line_LID52; /* 00 电子部件设定 */ uint8_t K_Line_LID52; /* 00 电子部件设定 */
uint8_t Reserved0; uint8_t Reserved0;
uint8_t Reserved1; uint8_t Reserved1;
uint8_t Reserved2; uint8_t Reserved2;
uint8_t Reserved3; uint8_t Reserved3;
uint8_t Reserved4; uint8_t Reserved4;
uint8_t Reserved5; uint8_t Reserved5;
uint8_t Reserved6;
uint8_t Reserved7;
uint8_t Reserved8;
uint8_t Reserved9;
uint8_t ReservedA;
uint8_t ReservedB;
uint8_t ReservedC;
} _EOL_K_LINE_SET; } _EOL_K_LINE_SET;
//extern _EOL_K_LINE_SET K_Line_Set; extern _EOL_K_LINE_SET K_Line_Set;
extern void Common_DataInit(void); extern void Common_DataInit(void);
extern void Common_Input_Para(void); extern void Common_Input_Para(void);
...@@ -98,8 +113,6 @@ extern DataValid_t Common_Get_Act_E_Speed_Valid(void); ...@@ -98,8 +113,6 @@ extern DataValid_t Common_Get_Act_E_Speed_Valid(void);
extern DataValid_t Common_Get_Disp_V_Speed_Valid(void); extern DataValid_t Common_Get_Disp_V_Speed_Valid(void);
extern DataValid_t Common_Get_Disp_E_Speed_Valid(void); extern DataValid_t Common_Get_Disp_E_Speed_Valid(void);
uint16_t Common_Get_DispSpeed(void);
uint32_t Common_GetIgnOnTime(void); /*ms*/ uint32_t Common_GetIgnOnTime(void); /*ms*/
uint32_t Common_GetIgnOffTime(void); /*ms*/ uint32_t Common_GetIgnOffTime(void); /*ms*/
......
#include "r_typedefs.h" #include "r_typedefs.h"
#include "Internal_Flash.h" #include "Internal_Flash.h"
#include "Emulated_EEPROM.h" #include "Emulated_EEPROM.h"
#include "Emulated_EEPROM_Access.h" #include "Emulated_EEPROM_Access.h"
/**************************************************************************** /****************************************************************************
* !!! The following code should be generated by configuration tool !!! * * !!! The following code should be generated by configuration tool !!! *
****************************************************************************/ ****************************************************************************/
#define EEPROM_BLOCK0_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_FLAG_SIZE) #define EEPROM_BLOCK0_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_FLAG_SIZE)
uint32_t g_u32EEPROMBlock0Buffer[EEPROM_BLOCK0_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock0Buffer[EEPROM_BLOCK0_BUFFER_SIZE / 4U];
#define EEPROM_BLOCK1_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_S27_SIZE) #define EEPROM_BLOCK1_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_S27_SIZE)
uint32_t g_u32EEPROMBlock1Buffer[EEPROM_BLOCK1_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock1Buffer[EEPROM_BLOCK1_BUFFER_SIZE / 4U];
#define EEPROM_BLOCK2_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_S2E0_SIZE) #define EEPROM_BLOCK2_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_S2E0_SIZE)
uint32_t g_u32EEPROMBlock2Buffer[EEPROM_BLOCK2_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock2Buffer[EEPROM_BLOCK2_BUFFER_SIZE / 4U];
#define EEPROM_BLOCK3_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_S2E_SIZE) #define EEPROM_BLOCK3_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_S2E_SIZE)
uint32_t g_u32EEPROMBlock3Buffer[EEPROM_BLOCK3_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock3Buffer[EEPROM_BLOCK3_BUFFER_SIZE / 4U];
#define EEPROM_BLOCK4_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_CONFIG_SIZE) #define EEPROM_BLOCK4_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_CONFIG_SIZE)
uint32_t g_u32EEPROMBlock4Buffer[EEPROM_BLOCK4_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock4Buffer[EEPROM_BLOCK4_BUFFER_SIZE / 4U];
#define EEPROM_BLOCK5_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_DTC_SIZE) #define EEPROM_BLOCK5_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UDS_DTC_SIZE)
uint32_t g_u32EEPROMBlock5Buffer[EEPROM_BLOCK5_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock5Buffer[EEPROM_BLOCK5_BUFFER_SIZE / 4U];
#define EEPROM_BLOCK6_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_ODO_SIZE) #define EEPROM_BLOCK6_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_ODO_SIZE)
uint32_t g_u32EEPROMBlock6Buffer[EEPROM_BLOCK6_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock6Buffer[EEPROM_BLOCK6_BUFFER_SIZE / 4U];
#define EEPROM_BLOCK7_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_ODO_STAMP_SIZE) #define EEPROM_BLOCK7_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_ODO_STAMP_SIZE)
uint32_t g_u32EEPROMBlock7Buffer[EEPROM_BLOCK7_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock7Buffer[EEPROM_BLOCK7_BUFFER_SIZE / 4U];
#define EEPROM_BLOCK8_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_TRIP_STAMP_SIZE) #define EEPROM_BLOCK8_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_TRIP_STAMP_SIZE)
uint32_t g_u32EEPROMBlock8Buffer[EEPROM_BLOCK8_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock8Buffer[EEPROM_BLOCK8_BUFFER_SIZE / 4U];
#define EEPROM_BLOCK9_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_SERVICE_INFO_SIZE) #define EEPROM_BLOCK9_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_SERVICE_INFO_SIZE)
uint32_t g_u32EEPROMBlock9Buffer[EEPROM_BLOCK9_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock9Buffer[EEPROM_BLOCK9_BUFFER_SIZE / 4U];
#define EEPROM_BLOCK10_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_UE_INFO_SIZE) #define EEPROM_BLOCK10_BUFFER_SIZE (EEPROM_BLOCK_CTRL_BYTE_SIZE + EEPROM_BLOCK_EOL_K_LINE_SIZE)
uint32_t g_u32EEPROMBlock10Buffer[EEPROM_BLOCK10_BUFFER_SIZE / 4U]; uint32_t g_u32EEPROMBlock10Buffer[EEPROM_BLOCK10_BUFFER_SIZE / 4U];
static const EEPROM_Block_st_t g_stEEPROMBlockTable[] = static const EEPROM_Block_st_t g_stEEPROMBlockTable[] =
{ {
/* u32StartAddr u32EndAddr u32DataSize pu32DataBuffer */ /* u32StartAddr u32EndAddr u32DataSize pu32DataBuffer */
{0xFF200000UL, 0xFF20007FUL, EEPROM_BLOCK0_BUFFER_SIZE, g_u32EEPROMBlock0Buffer,}, {0xFF200000UL, 0xFF20007FUL, EEPROM_BLOCK0_BUFFER_SIZE, g_u32EEPROMBlock0Buffer,},
{0xFF200080UL, 0xFF2000FFUL, EEPROM_BLOCK1_BUFFER_SIZE, g_u32EEPROMBlock1Buffer,}, {0xFF200080UL, 0xFF2000FFUL, EEPROM_BLOCK1_BUFFER_SIZE, g_u32EEPROMBlock1Buffer,},
{0xFF200100UL, 0xFF20027FUL, EEPROM_BLOCK2_BUFFER_SIZE, g_u32EEPROMBlock2Buffer,}, {0xFF200100UL, 0xFF2002FFUL, EEPROM_BLOCK2_BUFFER_SIZE, g_u32EEPROMBlock2Buffer,},
{0xFF200280UL, 0xFF2003FFUL, EEPROM_BLOCK3_BUFFER_SIZE, g_u32EEPROMBlock3Buffer,}, {0xFF200300UL, 0xFF2004FFUL, EEPROM_BLOCK3_BUFFER_SIZE, g_u32EEPROMBlock3Buffer,},
{0xFF200400UL, 0xFF20047FUL, EEPROM_BLOCK4_BUFFER_SIZE, g_u32EEPROMBlock4Buffer,}, {0xFF200500UL, 0xFF20057FUL, EEPROM_BLOCK4_BUFFER_SIZE, g_u32EEPROMBlock4Buffer,},
{0xFF200480UL, 0xFF20057FUL, EEPROM_BLOCK5_BUFFER_SIZE, g_u32EEPROMBlock5Buffer,}, {0xFF200580UL, 0xFF20067FUL, EEPROM_BLOCK5_BUFFER_SIZE, g_u32EEPROMBlock5Buffer,},
{0xFF200580UL, 0xFF20097FUL, EEPROM_BLOCK6_BUFFER_SIZE, g_u32EEPROMBlock6Buffer,}, {0xFF200680UL, 0xFF200A7FUL, EEPROM_BLOCK6_BUFFER_SIZE, g_u32EEPROMBlock6Buffer,},
{0xFF200980UL, 0xFF200E7FUL, EEPROM_BLOCK7_BUFFER_SIZE, g_u32EEPROMBlock7Buffer,}, {0xFF200A80UL, 0xFF200F7FUL, EEPROM_BLOCK7_BUFFER_SIZE, g_u32EEPROMBlock7Buffer,},
{0xFF200E80UL, 0xFF20187FUL, EEPROM_BLOCK8_BUFFER_SIZE, g_u32EEPROMBlock8Buffer,}, {0xFF200F80UL, 0xFF20197FUL, EEPROM_BLOCK8_BUFFER_SIZE, g_u32EEPROMBlock8Buffer,},
{0xFF201880UL, 0xFF2018FFUL, EEPROM_BLOCK9_BUFFER_SIZE, g_u32EEPROMBlock9Buffer,}, {0xFF201980UL, 0xFF2019FFUL, EEPROM_BLOCK9_BUFFER_SIZE, g_u32EEPROMBlock9Buffer,},
{0xFF201900UL, 0xFF201EFFUL, EEPROM_BLOCK10_BUFFER_SIZE, g_u32EEPROMBlock10Buffer,}, {0xFF201A00UL, 0xFF201AFFUL, EEPROM_BLOCK10_BUFFER_SIZE, g_u32EEPROMBlock10Buffer,},
}; };
/**************************************************************************** /****************************************************************************
* !!! End of code generation !!! * * !!! End of code generation !!! *
****************************************************************************/ ****************************************************************************/
EEPROM_Block_Access_st_t g_stEEPROMBlockAccess[EEPROM_TOTAL_BLOCK_NUM]; EEPROM_Block_Access_st_t g_stEEPROMBlockAccess[EEPROM_TOTAL_BLOCK_NUM];
void EEPROM_Init(void) void EEPROM_Init(void)
{ {
EEPROM_Media_Access_st_t stFlashAccessFunc; EEPROM_Media_Access_st_t stFlashAccessFunc;
stFlashAccessFunc.pfnMemErase = Int_Data_Flash_Erase; stFlashAccessFunc.pfnMemErase = Int_Data_Flash_Erase;
stFlashAccessFunc.pfnMemBlankChk = Int_Data_Flash_Blank_Check; stFlashAccessFunc.pfnMemBlankChk = Int_Data_Flash_Blank_Check;
stFlashAccessFunc.pfnMemRead = Int_Data_Flash_Read; stFlashAccessFunc.pfnMemRead = Int_Data_Flash_Read;
stFlashAccessFunc.pfnMemWrite = Int_Data_Flash_Write; stFlashAccessFunc.pfnMemWrite = Int_Data_Flash_Write;
Int_Data_Flash_Register_P_E_Complete_Cb(EEPROM_Mem_Access_Complete_Callback); Int_Data_Flash_Register_P_E_Complete_Cb(EEPROM_Mem_Access_Complete_Callback);
EEPROM_Access_Init( g_stEEPROMBlockTable, EEPROM_Access_Init( g_stEEPROMBlockTable,
g_stEEPROMBlockAccess, g_stEEPROMBlockAccess,
&stFlashAccessFunc, &stFlashAccessFunc,
EEPROM_TOTAL_BLOCK_NUM); EEPROM_TOTAL_BLOCK_NUM);
} }
EEPROM_Status_en_t EEPROM_Get_Status(void) EEPROM_Status_en_t EEPROM_Get_Status(void)
{ {
EEPROM_Status_en_t enStatus; EEPROM_Status_en_t enStatus;
if(EEPROM_Access_Busy()) if(EEPROM_Access_Busy())
{ {
enStatus = EEPROM_STAT_BUSY; enStatus = EEPROM_STAT_BUSY;
} }
else else
{ {
enStatus = EEPROM_STAT_IDLE; enStatus = EEPROM_STAT_IDLE;
} }
return enStatus; return enStatus;
} }
EEPROM_Block_Status_en_t EEPROM_Get_Block_Status(uint16_t u16BlockID) EEPROM_Block_Status_en_t EEPROM_Get_Block_Status(uint16_t u16BlockID)
{ {
uint8_t u8BlockStatus; uint8_t u8BlockStatus;
EEPROM_Block_Status_en_t enStatus; EEPROM_Block_Status_en_t enStatus;
u8BlockStatus = EEPROM_Block_Access_Status(u16BlockID); u8BlockStatus = EEPROM_Block_Access_Status(u16BlockID);
if (u8BlockStatus == EEPROM_BLOCK_BLANK) if (u8BlockStatus == EEPROM_BLOCK_BLANK)
{ {
enStatus = EEPROM_STAT_BLANK; enStatus = EEPROM_STAT_BLANK;
} }
else if (u8BlockStatus == EEPROM_BLOCK_ACTIVE) else if (u8BlockStatus == EEPROM_BLOCK_ACTIVE)
{ {
enStatus = EEPROM_STAT_ACTIVE; enStatus = EEPROM_STAT_ACTIVE;
} }
else else
{ {
enStatus = EEPROM_STAT_ERROR; enStatus = EEPROM_STAT_ERROR;
} }
return enStatus; return enStatus;
} }
EEPROM_RW_Result_en_t EEPROM_Read_Data(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len) EEPROM_RW_Result_en_t EEPROM_Read_Data(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len)
{ {
uint8_t u8Error; uint8_t u8Error;
EEPROM_RW_Result_en_t enResult; EEPROM_RW_Result_en_t enResult;
u8Error = EEPROM_Read_Block_Data(u16BlockID, u32Data, u16Len); u8Error = EEPROM_Read_Block_Data(u16BlockID, u32Data, u16Len);
if (u8Error) if (u8Error)
{ {
enResult = EEPROM_RW_FAIL; enResult = EEPROM_RW_FAIL;
} }
else else
{ {
enResult = EEPROM_RW_PASS; enResult = EEPROM_RW_PASS;
} }
return enResult; return enResult;
} }
EEPROM_RW_Result_en_t EEPROM_Write_Data(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len) EEPROM_RW_Result_en_t EEPROM_Write_Data(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len)
{ {
uint8_t u8Error; uint8_t u8Error;
EEPROM_RW_Result_en_t enResult; EEPROM_RW_Result_en_t enResult;
u8Error = EEPROM_Write_Block_Data(u16BlockID, u32Data, u16Len); u8Error = EEPROM_Write_Block_Data(u16BlockID, u32Data, u16Len);
if (u8Error) if (u8Error)
{ {
enResult = EEPROM_RW_FAIL; enResult = EEPROM_RW_FAIL;
} }
else else
{ {
enResult = EEPROM_RW_PASS; enResult = EEPROM_RW_PASS;
} }
return enResult; return enResult;
} }
#ifndef EMULATED_EEPROM_H__ #ifndef EMULATED_EEPROM_H__
#define EMULATED_EEPROM_H__ #define EMULATED_EEPROM_H__
typedef enum typedef enum
{ {
EEPROM_STAT_BLANK = 0U, EEPROM_STAT_BLANK = 0U,
EEPROM_STAT_ACTIVE, EEPROM_STAT_ACTIVE,
EEPROM_STAT_ERROR, EEPROM_STAT_ERROR,
}EEPROM_Block_Status_en_t; }EEPROM_Block_Status_en_t;
typedef enum typedef enum
{ {
EEPROM_RW_PASS = 0, EEPROM_RW_PASS = 0,
EEPROM_RW_FAIL, EEPROM_RW_FAIL,
}EEPROM_RW_Result_en_t; }EEPROM_RW_Result_en_t;
typedef enum typedef enum
{ {
EEPROM_STAT_IDLE = 0, EEPROM_STAT_IDLE = 0,
EEPROM_STAT_BUSY, EEPROM_STAT_BUSY,
}EEPROM_Status_en_t; }EEPROM_Status_en_t;
/**************************************************************************** /****************************************************************************
* !!! The following code should be generated by configuration tool !!! * * !!! The following code should be generated by configuration tool !!! *
****************************************************************************/ ****************************************************************************/
enum g_enEEPROMBlockName enum g_enEEPROMBlockName
{ {
EEPROM_BLOCK_UDS_FLAG = 0U, EEPROM_BLOCK_UDS_FLAG = 0U,
EEPROM_BLOCK_UDS_S27 = 1U, EEPROM_BLOCK_UDS_S27 = 1U,
EEPROM_BLOCK_UDS_S2E0 = 2U, EEPROM_BLOCK_UDS_S2E0 = 2U,
EEPROM_BLOCK_UDS_S2E = 3U, EEPROM_BLOCK_UDS_S2E = 3U,
EEPROM_BLOCK_UDS_CONFIG = 4U, EEPROM_BLOCK_UDS_CONFIG = 4U,
EEPROM_BLOCK_UDS_DTC = 5U, EEPROM_BLOCK_UDS_DTC = 5U,
EEPROM_BLOCK_ODO = 6U, EEPROM_BLOCK_ODO = 6U,
EEPROM_BLOCK_ODO_STAMP = 7U, EEPROM_BLOCK_ODO_STAMP = 7U,
EEPROM_BLOCK_TRIP_STAMP = 8U, EEPROM_BLOCK_TRIP_STAMP = 8U,
EEPROM_BLOCK_SERVICE_INFO = 9U, EEPROM_BLOCK_SERVICE_INFO = 9U,
EEPROM_BLOCK_UE_INFO = 10U, EEPROM_BLOCK_EOL_K_LINE = 10U,
}; };
#define EEPROM_BLOCK_UDS_FLAG_SIZE (16U)/*Life:20.0W*/ #define EEPROM_BLOCK_UDS_FLAG_SIZE (16U)/*Life:20.0W*/
#define EEPROM_BLOCK_UDS_S27_SIZE (16U)/*Life:20.0W*/ #define EEPROM_BLOCK_UDS_S27_SIZE (16U)/*Life:20.0W*/
#define EEPROM_BLOCK_UDS_S2E0_SIZE (160U)/*Life:20.0W*/ #define EEPROM_BLOCK_UDS_S2E0_SIZE (216U)/*Life:20.0W*/
#define EEPROM_BLOCK_UDS_S2E_SIZE (160U)/*Life:20.0W*/ #define EEPROM_BLOCK_UDS_S2E_SIZE (216U)/*Life:20.0W*/
#define EEPROM_BLOCK_UDS_CONFIG_SIZE (40U)/*Life:20.0W*/ #define EEPROM_BLOCK_UDS_CONFIG_SIZE (40U)/*Life:20.0W*/
#define EEPROM_BLOCK_UDS_DTC_SIZE (76U)/*Life:20.0W*/ #define EEPROM_BLOCK_UDS_DTC_SIZE (76U)/*Life:20.0W*/
#define EEPROM_BLOCK_ODO_SIZE (4U)/*Life:1000.0W*/ #define EEPROM_BLOCK_ODO_SIZE (4U)/*Life:1000.0W*/
#define EEPROM_BLOCK_ODO_STAMP_SIZE (8U)/*Life:1000.0W*/ #define EEPROM_BLOCK_ODO_STAMP_SIZE (8U)/*Life:1000.0W*/
#define EEPROM_BLOCK_TRIP_STAMP_SIZE (16U)/*Life:1000.0W*/ #define EEPROM_BLOCK_TRIP_STAMP_SIZE (16U)/*Life:1000.0W*/
#define EEPROM_BLOCK_SERVICE_INFO_SIZE (56U)/*Life:20.0W*/ #define EEPROM_BLOCK_SERVICE_INFO_SIZE (56U)/*Life:20.0W*/
#define EEPROM_BLOCK_UE_INFO_SIZE (124U)/*Life:100.0W*/ #define EEPROM_BLOCK_EOL_K_LINE_SIZE (64U)/*Life:20.0W*/
#define EEPROM_TOTAL_BLOCK_NUM (11U) #define EEPROM_TOTAL_BLOCK_NUM (11U)
/**************************************************************************** /****************************************************************************
* !!! End of code generation !!! * * !!! End of code generation !!! *
****************************************************************************/ ****************************************************************************/
extern void EEPROM_Init(void); extern void EEPROM_Init(void);
extern EEPROM_Status_en_t EEPROM_Get_Status(void); extern EEPROM_Status_en_t EEPROM_Get_Status(void);
extern EEPROM_Block_Status_en_t EEPROM_Get_Block_Status(uint16_t u16BlockID); extern EEPROM_Block_Status_en_t EEPROM_Get_Block_Status(uint16_t u16BlockID);
extern EEPROM_RW_Result_en_t EEPROM_Read_Data(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len); extern EEPROM_RW_Result_en_t EEPROM_Read_Data(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len);
extern EEPROM_RW_Result_en_t EEPROM_Write_Data(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len); extern EEPROM_RW_Result_en_t EEPROM_Write_Data(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len);
#endif #endif
...@@ -137,7 +137,7 @@ void Sys_Run_Mode_5ms_Tasks(void) ...@@ -137,7 +137,7 @@ void Sys_Run_Mode_5ms_Tasks(void)
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
void Sys_Run_Mode_10ms_Tasks(void) void Sys_Run_Mode_10ms_Tasks(void)
{ {
DisplayServices(); DisplayServices();
loc_Display_Service(); loc_Display_Service();
Data_Mileage_Write_EEPROM(); Data_Mileage_Write_EEPROM();
Line_In_Debounce_Service(); Line_In_Debounce_Service();
...@@ -145,7 +145,7 @@ void Sys_Run_Mode_10ms_Tasks(void) ...@@ -145,7 +145,7 @@ void Sys_Run_Mode_10ms_Tasks(void)
// Test_LED_AllLight(); // Test_LED_AllLight();
Key_Service(); Key_Service();
CAN_BUSOFF_Recover(); CAN_BUSOFF_Recover();
/*表头调度函数 added by yutian*/ /*表头调度函数 added by yutian*/
UserGaugeSchedule(); /*在主循环中调用*/ UserGaugeSchedule(); /*在主循环中调用*/
/*end*/ /*end*/
...@@ -220,14 +220,14 @@ void Sys_Run_Mode_100ms_Tasks(void) ...@@ -220,14 +220,14 @@ void Sys_Run_Mode_100ms_Tasks(void)
// Menu_Get_Battery_Sts_Exist(); // Menu_Get_Battery_Sts_Exist();
Popups_Management_Service(); Popups_Management_Service();
Popup_Scheduling_Service(); Popup_Scheduling_Service();
/*综合油耗信息*/
Data_FuelCounsComprehensive();
/*小计油耗信息*/
Data_FuelCounsumpTrip();
/*本次油耗信息*/ /*加速度计算*/
Data_FuelCounsumpThisTime(); Data_Acc_Speed_Processing();
/*加油后行车信息*/ /*高速路一般路报警判断*/
Data_Info_Last_Refueling(); Data_GsLYbL_Speed_Processing();
} }
/*============================================================================*/ /*============================================================================*/
......
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