Commit 4788817e authored by hu's avatar hu

调整车速显示

parent 490dac50
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 .text 299324
project .rodata 412383
project .text 299212
project .rodata 412367
project .secinfo 120
project .syscall 6
project .romdata 7853
......
......@@ -7,7 +7,7 @@
//-------------------------------------------
//主负气压 数据处理 wangboyu
//-------------------------------------------
//断码显示
//断码显示
//-------------------------------------------
//344 - 3.1.2.FRONT/REAR空气计显示
//342 - 3.3. FRONT/REAR气压指针
......@@ -24,30 +24,30 @@
static struct
{
uint8_t SumCnt ;
uint32_t Voltage ;
uint16_t Result ;
}AirPressureFilter[2u] ;
uint8_t SumCnt ;
uint32_t Voltage ;
uint16_t Result ;
} AirPressureFilter[2u] ;
static struct
{
uint16_t VoltageTable[TableLenMax] ;
uint16_t kPaTable[TableLenMax] ;
uint16_t slopeTable[TableLenMax - 1 ] ;// 100倍的
uint16_t ResultkPa[2u] ; // 100倍的
uint16_t AvrVoltage[2u] ;
uint8_t Valid[2u] ;
uint8_t CurSeg[2u] ;
uint8_t ValidTimer[2u] ;
uint8_t InvalidTimer[2u] ;
}AirPressureVariable ;
static void Calc_AirPressure_Table(uint16_t Voltage,uint16_t * kPa);
uint16_t VoltageTable[TableLenMax] ;
uint16_t kPaTable[TableLenMax] ;
uint16_t slopeTable[TableLenMax - 1 ] ;// 100倍的
uint16_t ResultkPa[2u] ; // 100倍的
uint16_t AvrVoltage[2u] ;
uint8_t Valid[2u] ;
uint8_t CurSeg[2u] ;
uint8_t ValidTimer[2u] ;
uint8_t InvalidTimer[2u] ;
} AirPressureVariable ;
static void Calc_AirPressure_Table(uint16_t Voltage, uint16_t * kPa);
static uint16_t Get_AirPressure_AdC_Filter(uint8_t ID);
static uint8_t CalAirPressure_CurSeg(uint8_t ID,uint8_t Valid,uint16_t Voltage);
static uint8_t CalAirPressure_CurSeg(uint8_t ID, uint8_t Valid, uint16_t Voltage);
/*-------------------------------------------------------------------------
* Function Name : AirPressure_KL30_Init
* Description :
* Description :
* Input : None
* Output : None
* Return : None
......@@ -55,49 +55,50 @@ static uint8_t CalAirPressure_CurSeg(uint8_t ID,uint8_t Valid,uint16_t Voltage);
--------------------------------------------------------------------------*/
void AirPressure_KL30_Init(void)
{
uint8_t i = 0 ;
uint32_t u32slope = 0 ;
AirPressureVariable.VoltageTable[ 0 ] = 500 ;
AirPressureVariable.kPaTable[ 0 ] = 0 ;
AirPressureVariable.VoltageTable[ 1 ] = 1750 ;
AirPressureVariable.kPaTable[ 1 ] = 500 ;
AirPressureVariable.VoltageTable[ 2 ] = 1960 ;
AirPressureVariable.kPaTable[ 2 ] = 583 ;
AirPressureVariable.VoltageTable[ 3 ] = 2000 ;
AirPressureVariable.kPaTable[ 3 ] = 600 ;
AirPressureVariable.VoltageTable[ 4 ] = 3000 ;
AirPressureVariable.kPaTable[ 4 ] = 1000 ;
AirPressureVariable.VoltageTable[ 5 ] = 4250 ;
AirPressureVariable.kPaTable[ 5 ] = 1500 ;
for(i = 0;i < (TableLenMax - 1);i ++)
{/*100倍 斜率*/
u32slope = AirPressureVariable.kPaTable[ i + 1] - AirPressureVariable.kPaTable[ i ];
u32slope *= 100 ;
u32slope /= (AirPressureVariable.VoltageTable[ i + 1 ] - AirPressureVariable.VoltageTable[ i ]);
AirPressureVariable.slopeTable[i] = u32slope ;
}
for(i = 0;i < 2;i ++)
{
AirPressureFilter[ i ].SumCnt = 0 ;
AirPressureFilter[ i ].Voltage = 0 ;
AirPressureFilter[ i ].Result = 0 ;
AirPressureVariable.ResultkPa[ i ] = 0 ;
AirPressureVariable.Valid[ i ] = 0 ;
AirPressureVariable.ValidTimer[ i ] = 0 ;
AirPressureVariable.InvalidTimer[ i ] = 0 ;
}
uint8_t i = 0 ;
uint32_t u32slope = 0 ;
AirPressureVariable.VoltageTable[ 0 ] = 500 ;
AirPressureVariable.kPaTable[ 0 ] = 0 ;
AirPressureVariable.VoltageTable[ 1 ] = 1750 ;
AirPressureVariable.kPaTable[ 1 ] = 500 ;
AirPressureVariable.VoltageTable[ 2 ] = 1960 ;
AirPressureVariable.kPaTable[ 2 ] = 583 ;
AirPressureVariable.VoltageTable[ 3 ] = 2000 ;
AirPressureVariable.kPaTable[ 3 ] = 600 ;
AirPressureVariable.VoltageTable[ 4 ] = 3000 ;
AirPressureVariable.kPaTable[ 4 ] = 1000 ;
AirPressureVariable.VoltageTable[ 5 ] = 4250 ;
AirPressureVariable.kPaTable[ 5 ] = 1500 ;
for (i = 0; i < (TableLenMax - 1); i ++)
{
/*100倍 斜率*/
u32slope = AirPressureVariable.kPaTable[ i + 1] - AirPressureVariable.kPaTable[ i ];
u32slope *= 100 ;
u32slope /= (AirPressureVariable.VoltageTable[ i + 1 ] - AirPressureVariable.VoltageTable[ i ]);
AirPressureVariable.slopeTable[i] = u32slope ;
}
for (i = 0; i < 2; i ++)
{
AirPressureFilter[ i ].SumCnt = 0 ;
AirPressureFilter[ i ].Voltage = 0 ;
AirPressureFilter[ i ].Result = 0 ;
AirPressureVariable.ResultkPa[ i ] = 0 ;
AirPressureVariable.Valid[ i ] = 0 ;
AirPressureVariable.ValidTimer[ i ] = 0 ;
AirPressureVariable.InvalidTimer[ i ] = 0 ;
}
}
void AirPressure_KL15_ON_Init(void)
{
......@@ -125,44 +126,45 @@ void AirPressure_Sleep_Init(void)
--------------------------------------------------------------------------*/
void AirPressure_Processing_Service(void)
{
uint8_t i = 0 ;
AirPressure_AdcData_Filter();
for(i = 0;i < 2;i ++)
{
AirPressureVariable.AvrVoltage[ i ] = Get_AirPressure_AdC_Filter(i) ;
if((AirPressureVariable.AvrVoltage[ i ] < 500)||(AirPressureVariable.AvrVoltage[ i ] > 4250) )
{
if(AirPressureVariable.InvalidTimer[ i ] < VALID_TIME)
{//2s
AirPressureVariable.InvalidTimer[ i ] ++ ;
}
else
{
AirPressureVariable.ValidTimer[ i ] = 0 ;
AirPressureVariable.Valid[i] = 0 ;
}
}
else
{
if(AirPressureVariable.ValidTimer[ i ] < VALID_TIME)
{
AirPressureVariable.ValidTimer[ i ] ++ ;
}
else
{
AirPressureVariable.InvalidTimer[ i ] = 0 ;
AirPressureVariable.Valid[i] = 1 ;
}
}
Calc_AirPressure_Table(AirPressureVariable.AvrVoltage[i],(uint16_t *)&AirPressureVariable.ResultkPa[i]);
AirPressureVariable.CurSeg[ i ] = CalAirPressure_CurSeg(i,AirPressureVariable.Valid[i],AirPressureVariable.AvrVoltage[ i ]);
}
uint8_t i = 0 ;
AirPressure_AdcData_Filter();
for (i = 0; i < 2; i ++)
{
AirPressureVariable.AvrVoltage[ i ] = Get_AirPressure_AdC_Filter(i) ;
if ((AirPressureVariable.AvrVoltage[ i ] < 500) || (AirPressureVariable.AvrVoltage[ i ] > 4250) )
{
if (AirPressureVariable.InvalidTimer[ i ] < VALID_TIME)
{
//2s
AirPressureVariable.InvalidTimer[ i ] ++ ;
}
else
{
AirPressureVariable.ValidTimer[ i ] = 0 ;
AirPressureVariable.Valid[i] = 0 ;
}
}
else
{
if (AirPressureVariable.ValidTimer[ i ] < VALID_TIME)
{
AirPressureVariable.ValidTimer[ i ] ++ ;
}
else
{
AirPressureVariable.InvalidTimer[ i ] = 0 ;
AirPressureVariable.Valid[i] = 1 ;
}
}
Calc_AirPressure_Table(AirPressureVariable.AvrVoltage[i], (uint16_t *)&AirPressureVariable.ResultkPa[i]);
AirPressureVariable.CurSeg[ i ] = CalAirPressure_CurSeg(i, AirPressureVariable.Valid[i], AirPressureVariable.AvrVoltage[ i ]);
}
}
/*-------------------------------------------------------------------------
* Function Name : Calc_AirPressure_Table
......@@ -172,71 +174,72 @@ void AirPressure_Processing_Service(void)
* Return : None
* onther : None
--------------------------------------------------------------------------*/
static void Calc_AirPressure_Table(uint16_t Voltage,uint16_t * kPa)
static void Calc_AirPressure_Table(uint16_t Voltage, uint16_t * kPa)
{
uint8_t i = 0 ;
uint8_t Index = 0 ;
uint32_t u32Result = 0 ;
uint8_t i = 0 ;
uint8_t Index = 0 ;
uint32_t u32Result = 0 ;
#if EnTable
if(Voltage <= AirPressureVariable.VoltageTable[ 0 ])
{
u32Result = AirPressureVariable.kPaTable[ 0 ] ;
}
else if(Voltage >= AirPressureVariable.VoltageTable[ TableLenMax - 1 ])
{
u32Result = AirPressureVariable.kPaTable[ TableLenMax - 1 ] ;
}
else
{
for(i = 0;i < TableLenMax;i ++ )
{
if(Voltage < AirPressureVariable.VoltageTable[ i ])
{
Index = i ;
break ;
}
}
if((Index < 1)||(Index > (TableLenMax - 1)) )
{//err
while(1)
{
;
}
}
//y=kx + b
Voltage -= AirPressureVariable.VoltageTable[Index - 1] ;
u32Result = AirPressureVariable.slopeTable[Index - 1] * Voltage ;
u32Result += 50 ;
u32Result /= 100 ;
u32Result += AirPressureVariable.kPaTable[ Index - 1 ] ;
}
if (Voltage <= AirPressureVariable.VoltageTable[ 0 ])
{
u32Result = AirPressureVariable.kPaTable[ 0 ] ;
}
else if (Voltage >= AirPressureVariable.VoltageTable[ TableLenMax - 1 ])
{
u32Result = AirPressureVariable.kPaTable[ TableLenMax - 1 ] ;
}
else
{
for (i = 0; i < TableLenMax; i ++ )
{
if (Voltage < AirPressureVariable.VoltageTable[ i ])
{
Index = i ;
break ;
}
}
if ((Index < 1) || (Index > (TableLenMax - 1)) )
{
//err
while (1)
{
;
}
}
//y=kx + b
Voltage -= AirPressureVariable.VoltageTable[Index - 1] ;
u32Result = AirPressureVariable.slopeTable[Index - 1] * Voltage ;
u32Result += 50 ;
u32Result /= 100 ;
u32Result += AirPressureVariable.kPaTable[ Index - 1 ] ;
}
#else
if(Voltage <= AirPressureVariable.VoltageTable[ 0 ])
{
u32Result = AirPressureVariable.kPaTable[ 0 ] ;
}
else if(Voltage >= AirPressureVariable.VoltageTable[ TableLenMax - 1 ])
{
u32Result = AirPressureVariable.kPaTable[ TableLenMax - 1 ] ;
}
else
{
//指示刻度 = (输入电压– 0.5) / 0.0025
if(Voltage >= 500)
{
Voltage -= 500 ;
}
u32Result = Voltage ;
u32Result *= 10 ;
u32Result /= 25 ;
}
if (Voltage <= AirPressureVariable.VoltageTable[ 0 ])
{
u32Result = AirPressureVariable.kPaTable[ 0 ] ;
}
else if (Voltage >= AirPressureVariable.VoltageTable[ TableLenMax - 1 ])
{
u32Result = AirPressureVariable.kPaTable[ TableLenMax - 1 ] ;
}
else
{
//指示刻度 = (输入电压– 0.5) / 0.0025
if (Voltage >= 500)
{
Voltage -= 500 ;
}
u32Result = Voltage ;
u32Result *= 10 ;
u32Result /= 25 ;
}
#endif
*kPa = (uint16_t)u32Result ;
*kPa = (uint16_t)u32Result ;
}
/*-------------------------------------------------------------------------
* Function Name : AirPressure_AdcData_Filter
......@@ -248,67 +251,67 @@ static void Calc_AirPressure_Table(uint16_t Voltage,uint16_t * kPa)
--------------------------------------------------------------------------*/
void AirPressure_AdcData_Filter(void)
{
uint8_t u8PriValid = 0 ;
uint8_t u8SecValid = 0 ;
uint16_t PriVoltage = 0 ;
uint16_t SecVoltage = 0 ;
u8PriValid = RTE_Read_PRIMARY_AIR_Valid();
u8SecValid = RTE_Read_SECONDARY_AIR_Valid();
if(u8PriValid)
{
if(AirPressureFilter[PRI_ID].SumCnt < 10)
{
AirPressureFilter[PRI_ID].SumCnt ++ ;
PriVoltage = RTE_Read_PRIMARY_AIR_Voltage() ;
AirPressureFilter[PRI_ID].Voltage += PriVoltage ;
PriVoltage = (uint16_t)(AirPressureFilter[PRI_ID].Voltage/AirPressureFilter[PRI_ID].SumCnt) ;
}
else
{
AirPressureFilter[PRI_ID].SumCnt = 0 ;
AirPressureFilter[PRI_ID].Voltage = 0 ;
PriVoltage = RTE_Read_PRIMARY_AIR_Voltage() ;
AirPressureFilter[PRI_ID].SumCnt ++ ;
AirPressureFilter[PRI_ID].Voltage += PriVoltage ;
PriVoltage = (uint16_t)(AirPressureFilter[PRI_ID].Voltage/AirPressureFilter[PRI_ID].SumCnt) ;
}
AirPressureFilter[PRI_ID].Result = PriVoltage ;
}
else
{
AirPressureFilter[PRI_ID].SumCnt = 0 ;
AirPressureFilter[PRI_ID].Voltage = 0 ;
PriVoltage = 0 ;
}
if(u8SecValid)
{
if(AirPressureFilter[SEC_ID].SumCnt < 10)
{
AirPressureFilter[SEC_ID].SumCnt ++ ;
SecVoltage = RTE_Read_SECONDARY_AIR_Voltage() ;
AirPressureFilter[SEC_ID].Voltage += SecVoltage ;
SecVoltage = (uint16_t)(AirPressureFilter[SEC_ID].Voltage/AirPressureFilter[SEC_ID].SumCnt) ;
}
else
{
AirPressureFilter[SEC_ID].SumCnt = 0 ;
AirPressureFilter[SEC_ID].Voltage = 0 ;
SecVoltage = RTE_Read_SECONDARY_AIR_Voltage() ;
AirPressureFilter[SEC_ID].SumCnt ++ ;
AirPressureFilter[SEC_ID].Voltage += SecVoltage ;
SecVoltage = (uint16_t)(AirPressureFilter[SEC_ID].Voltage/AirPressureFilter[SEC_ID].SumCnt) ;
}
AirPressureFilter[SEC_ID].Result = SecVoltage ;
}
else
{
AirPressureFilter[SEC_ID].SumCnt = 0 ;
AirPressureFilter[SEC_ID].Voltage = 0 ;
SecVoltage = 0 ;
}
uint8_t u8PriValid = 0 ;
uint8_t u8SecValid = 0 ;
uint16_t PriVoltage = 0 ;
uint16_t SecVoltage = 0 ;
u8PriValid = RTE_Read_PRIMARY_AIR_Valid();
u8SecValid = RTE_Read_SECONDARY_AIR_Valid();
if (u8PriValid)
{
if (AirPressureFilter[PRI_ID].SumCnt < 10)
{
AirPressureFilter[PRI_ID].SumCnt ++ ;
PriVoltage = RTE_Read_PRIMARY_AIR_Voltage() ;
AirPressureFilter[PRI_ID].Voltage += PriVoltage ;
PriVoltage = (uint16_t)(AirPressureFilter[PRI_ID].Voltage / AirPressureFilter[PRI_ID].SumCnt) ;
}
else
{
AirPressureFilter[PRI_ID].SumCnt = 0 ;
AirPressureFilter[PRI_ID].Voltage = 0 ;
PriVoltage = RTE_Read_PRIMARY_AIR_Voltage() ;
AirPressureFilter[PRI_ID].SumCnt ++ ;
AirPressureFilter[PRI_ID].Voltage += PriVoltage ;
PriVoltage = (uint16_t)(AirPressureFilter[PRI_ID].Voltage / AirPressureFilter[PRI_ID].SumCnt) ;
}
AirPressureFilter[PRI_ID].Result = PriVoltage ;
}
else
{
AirPressureFilter[PRI_ID].SumCnt = 0 ;
AirPressureFilter[PRI_ID].Voltage = 0 ;
PriVoltage = 0 ;
}
if (u8SecValid)
{
if (AirPressureFilter[SEC_ID].SumCnt < 10)
{
AirPressureFilter[SEC_ID].SumCnt ++ ;
SecVoltage = RTE_Read_SECONDARY_AIR_Voltage() ;
AirPressureFilter[SEC_ID].Voltage += SecVoltage ;
SecVoltage = (uint16_t)(AirPressureFilter[SEC_ID].Voltage / AirPressureFilter[SEC_ID].SumCnt) ;
}
else
{
AirPressureFilter[SEC_ID].SumCnt = 0 ;
AirPressureFilter[SEC_ID].Voltage = 0 ;
SecVoltage = RTE_Read_SECONDARY_AIR_Voltage() ;
AirPressureFilter[SEC_ID].SumCnt ++ ;
AirPressureFilter[SEC_ID].Voltage += SecVoltage ;
SecVoltage = (uint16_t)(AirPressureFilter[SEC_ID].Voltage / AirPressureFilter[SEC_ID].SumCnt) ;
}
AirPressureFilter[SEC_ID].Result = SecVoltage ;
}
else
{
AirPressureFilter[SEC_ID].SumCnt = 0 ;
AirPressureFilter[SEC_ID].Voltage = 0 ;
SecVoltage = 0 ;
}
}
/*-------------------------------------------------------------------------
* Function Name : CalAirPressure_CurSeg
......@@ -318,30 +321,30 @@ void AirPressure_AdcData_Filter(void)
* Return : None
* onther : None
--------------------------------------------------------------------------*/
static uint8_t CalAirPressure_CurSeg(uint8_t ID,uint8_t Valid,uint16_t Voltage)
static uint8_t CalAirPressure_CurSeg(uint8_t ID, uint8_t Valid, uint16_t Voltage)
{
uint8_t u8Result = 0 ;
if(Valid)
{
}
else
{
}
if(ID == PRI_ID)
{
SetGaugesPara(PRIGasGauges,Voltage);
u8Result = GetGaugesCurrentPos(PRIGasGauges) ;
}
else
{
SetGaugesPara(SECGasGauges,Voltage);
u8Result = GetGaugesCurrentPos(SECGasGauges) ;
}
return u8Result ;
uint8_t u8Result = 0 ;
if (Valid)
{
}
else
{
}
if (ID == PRI_ID)
{
SetGaugesPara(PRIGasGauges, Voltage);
u8Result = GetGaugesCurrentPos(PRIGasGauges) ;
}
else
{
SetGaugesPara(SECGasGauges, Voltage);
u8Result = GetGaugesCurrentPos(SECGasGauges) ;
}
return u8Result ;
}
/*-------------------------------------------------------------------------
* Function Name : Get_AirPressure_AdC_Filter
......@@ -353,9 +356,9 @@ static uint8_t CalAirPressure_CurSeg(uint8_t ID,uint8_t Valid,uint16_t Voltage)
--------------------------------------------------------------------------*/
static uint16_t Get_AirPressure_AdC_Filter(uint8_t ID)
{
uint16_t u16Result ;
u16Result = AirPressureFilter[ID].Result ;
return u16Result ;
uint16_t u16Result ;
u16Result = AirPressureFilter[ID].Result ;
return u16Result ;
}
/*-------------------------------------------------------------------------
* Function Name : AirPressure_Get_kPa
......@@ -373,7 +376,7 @@ uint16_t AirPressure_Get_kPa(uint8_t ID)
}
/*-------------------------------------------------------------------------
* Function Name : AirPressure_Get_Valid
* Description :
* Description :
* Input : None
* Output : None
* Return : None
......@@ -381,9 +384,9 @@ uint16_t AirPressure_Get_kPa(uint8_t ID)
--------------------------------------------------------------------------*/
uint8_t AirPressure_Get_Valid(uint8_t ID)
{
uint8_t u8Result = 0u;
u8Result = AirPressureVariable.Valid[ID];
return u8Result ;
uint8_t u8Result = 0u;
u8Result = AirPressureVariable.Valid[ID];
return u8Result ;
}
/*-------------------------------------------------------------------------
* Function Name : AirPressure_Get_CurSeg
......@@ -395,7 +398,7 @@ uint8_t AirPressure_Get_Valid(uint8_t ID)
--------------------------------------------------------------------------*/
uint8_t AirPressure_Get_CurSeg(uint8_t ID)
{
return AirPressureVariable.CurSeg[ ID ] ;
return AirPressureVariable.CurSeg[ ID ] ;
}
......
......@@ -7,7 +7,7 @@
//-------------------------------------------
//断码显示
//-------------------------------------------
//344 - 3.1.1. 水温计显示
//344 - 3.1.1. 水温计显示
//-------------------------------------------
static struct
{
......@@ -84,16 +84,10 @@ void Coolant_Processing_Service(void)
{
Msg_CoolTemp = Get_ID_18FEEE00_Sig_Engine_Coolant_Temperature();
if (Msg_CoolTemp > 0xFA)
if (Msg_CoolTemp > 0xFAu)
{
//if(Timer2s < 100)
//{
// Timer2s ++ ;
//}
//else
{
CoolantVariable.Valid = 0 ;
}
CoolantVariable.Valid = 0u ;
TargetSeg = 0u;
}
else
{
......
......@@ -11,8 +11,8 @@ static struct
uint16_t Data[VEH_FILTER_LEN];
} VehcleFilter;
static uint32_t SPEED_PPK = 15925ul;
static uint32_t SPEED_RADIO = 637;
static uint32_t SPEED_PPK = 15925u;
static uint32_t SPEED_RADIO = 637u;
uint16_t Vehicle_ACT_Speed;
uint16_t Vehicle_DISP_Speed;
......@@ -92,6 +92,7 @@ void Speed_Sleep_Init(void)
void Speed_Processing_Service(void)
{
uint32_t VehValTmp = 0u;
uint32_t VehValDisp = 0u;
uint32_t PPK = 0u;
PPK = Get_Speed_PPK();
......@@ -102,22 +103,35 @@ void Speed_Processing_Service(void)
if (VehValTmp > 2250)
{
VehValTmp = 0;
VehicleSpeedValid = 0;
Vehicle_ACT_Speed = 0;
}
else
{
VehicleSpeedValid = 1;
if (VehValTmp >= 1400u)
{
Vehicle_ACT_Speed = 1400u;
}
else if (VehValTmp <= 40u)
{
Vehicle_ACT_Speed = 0u;
}
else
{
Vehicle_ACT_Speed = VehValTmp;
}
}
Vehicle_ACT_Speed = VehValTmp;
//传入表头
VehValTmp = VehSpeedAmplification((uint16_t)VehValTmp);
SetGaugesPara(VehGauges, (uint16_t)VehValTmp);
//传入表头 计算放大系数
VehValDisp = VehSpeedAmplification((uint16_t)Vehicle_ACT_Speed);
SetGaugesPara(VehGauges, (uint16_t)VehValDisp);
//获得显示格和显示车速
Vehicle_CurSeg = GetGaugesCurrentPos(VehGauges);
Vehicle_DISP_Speed = 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)
......
......@@ -18,7 +18,7 @@
//#include "CAN_Signal_Tx.h"
#define VEH_SPEED_CURVE_NUM 12u
#define VEH_SPEED_CURVE_NUM 8u
uint16_t RevDispSpeed = 0u;
uint16_t RevTargetSpeed = 0u;
uint16_t RevCurrentSpeed = 0u;
......@@ -47,9 +47,6 @@ typedef struct
volatile Frequency_t VehFre;
uint32_t VehFreLimit;
uint16_t PPK;
/*
......@@ -60,18 +57,13 @@ uint16_t PPK;
const VehSpeedCurve_t VehSpeedCurve[ VEH_SPEED_CURVE_NUM ] =
{
{0u , 0u},
{200u , 210u},
{400u , 420u},
{600u , 620u},
{800u , 830u},
{1000u, 1030u},
{1200u, 1250u},
{1400u, 1450u},
{1600u, 1650u},
{1800u, 1850u},
{2000u, 2050u},
{2250u, 2250u},
{200u , 200u},
{400u , 400u},
{600u , 600u},
{800u , 800u},
{1000u, 1000u},
{1200u, 1200u},
{1400u, 1400u},
};
/*--------------------------------------------------------------------------
* Function Name : VehSpeedFindSector
......@@ -334,8 +326,7 @@ void Veh_Fre_Init(uint32_t PPK)
VehFre.Cycle = 0u;
VehFre.Frequency = 0u;
VehFre.PulseCnt = 0u;
VehFreLimit = (3600000000u / (220u * PPK)) / 4u / 50u;
//VehFreLimit = (3600000000u / (250u * PPK)) / 4u / 50u;
VehFreLimit = (3600000000u / (225u * PPK)) / 4u / 50u;
}
/*-------------------------------------------------------------------------
......@@ -477,7 +468,12 @@ uint16_t Cal_Veh_Frequency(void)
//uint16_t Cal_Veh_Val(void)
//{
// uint32_t VehValTmp;
//
// VehValTmp = Cal_Veh_Frequency();
// VehValTmp = (VehValTmp * 36000u) / PPK;
//
// return (uint16_t)VehValTmp;
//}
uint8_t FuelDropTimes = 0;
......@@ -498,57 +494,4 @@ void Data_ESpeed_LED_Processing_Service(void)
}
/***************************************
数据处理服务函数
***************************************/
void Data_Group_Processing_Service(void)
{
}
void Data_VehicleSpeed_Fre_CaptureSimulata(void)
{
}
void TRIP_FuelConsump(void)
{
uint32_t trip = 0u;
trip = Data_Read_Trip(EM_TRIP_A);
if (trip > 99999u)
{
Data_Clear_Trip(EM_TRIP_A);
}
else
{
;
}
trip = Data_Read_Trip(EM_TRIP_B);
if (trip > 99999u)
{
Rest_FuelCounsumpTrip_Data();
}
else
{
;
}
trip = Data_Read_Trip(EM_TRIP_C);
if (trip > 99999u)
{
Rest_FuelCounsumpThisTime_Data();
}
else
{
;
}
}
uint8_t Common_Get_TempHigh_Type(void)
{
return LED_TEMP_HIGH_FLAG ;
}
uint8_t Common_Get_FuelLow_Type(void)
{
return LED_FUEL_LOW_FLAG ;
}
***************************************/
\ No newline at end of file
......@@ -15,6 +15,8 @@
#define TACHO_SEG_NUM_MAX 27U
#define VEH_SEG_NUM_MAX 30U
static uint8_t GaugesTimer;
static void Seg_General_Digit_Display(uint32_t Digit, uint8_t Len, uint8_t Blank, uint8_t *DigitBuf, uint8_t *Reg);
static void Seg_Digit_1_Disp(uint8_t Digit);
static void Seg_Digit_2_Disp(uint8_t Digit);
......@@ -563,6 +565,7 @@ static void SEG_PRI_Display(uint8_t Value, uint8_t Valid, uint8_t seg_status)
SEG_BUFF_Set(BU98_CHIP1, SEG_REDEFINE_115, seg_status); // A83
SEG_BUFF_Set(BU98_CHIP1, SEG_REDEFINE_116, seg_status); // A84
SEG_BUFF_Set(BU98_CHIP1, SEG_REDEFINE_117, seg_status); // A85
if (Valid == GUI_DISP_MODE_BLANK)
{
for (i = 0; i < PRI_SEG_NUM_MAX; i++)
......@@ -577,6 +580,7 @@ static void SEG_PRI_Display(uint8_t Value, uint8_t Valid, uint8_t seg_status)
SEG_BUFF_Set(BU98_CHIP1, SEG_REDEFINE_115, 0); // A83
SEG_BUFF_Set(BU98_CHIP1, SEG_REDEFINE_116, 0); // A84
SEG_BUFF_Set(BU98_CHIP1, SEG_REDEFINE_117, 0); // A85
for (i = 0; i < PRI_SEG_NUM_MAX; i++)
{
mSEG[i] = 0;
......@@ -1015,14 +1019,19 @@ static void Seg_General_Digit_Display(uint32_t Digit, uint8_t Len, uint8_t Blank
static uint8_t wbyTestSeg = 0;
static uint16_t wbyTestNum;
static uint8_t WBY_SET = 0;
/******************************************************************************
Seg_Display_Service 在 20MS任务中
信号接口:
信号定义:
输出信号:
******************************************************************************/
void Seg_Display_Service(void)
{
uint32_t Ign_Time;
Ign_Time = Common_GetIgnOnTime();
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
if (WBY_SET == 1)
if (WBY_SET == 1)/*测试用点亮全部断码*/
{
Seg_Display_ON();
}
......@@ -1030,6 +1039,7 @@ void Seg_Display_Service(void)
{
SEG_A25_Disp(7u); //左侧弧线
SEG_C25_Disp(7u); //右侧弧线
if (Ign_Time < 3100)
{
SEG_PRI_Display(GetGaugesCurrentPos(PRIGasGauges), GUI_DISP_MODE_NORMAL, 7u); // PRI气压格
......@@ -1038,53 +1048,65 @@ void Seg_Display_Service(void)
SEG_Fuel_Display(GetGaugesCurrentPos(TempGauges), GUI_DISP_MODE_NORMAL, 7u); //燃油格
SEG_Tacho_Display(GetGaugesCurrentPos(RevGauges), GUI_DISP_MODE_NORMAL, 7u); //转速格
SEG_VehicleSpeed_Display(GetGaugesCurrentPos(VehGauges), GUI_DISP_MODE_NORMAL, 7u); //车速格
/*车速数字 暂时没有变化,只是全部点亮*/
Seg_Digit_1_Disp(12);
Seg_Digit_2_Disp(12);
Seg_Digit_3_Disp(12);
return;
}
if (AirPressure_Get_Valid(0))
{
SEG_PRI_Display(AirPressure_Get_CurSeg(0), GUI_DISP_MODE_NORMAL, 7u); // PRI气压格
GaugesTimer = 15u;
}
else
{
SEG_PRI_Display(AirPressure_Get_CurSeg(0), GUI_DISP_MODE_INVALID, 7u); // PRI气压格
}
if (AirPressure_Get_Valid(1))
{
SEG_SEC_Display(AirPressure_Get_CurSeg(1), GUI_DISP_MODE_NORMAL, 7u); // SEC气压格
}
else
else if (GaugesTimer == 0u)
{
SEG_SEC_Display(AirPressure_Get_CurSeg(1), GUI_DISP_MODE_INVALID, 7u); // SEC气压格
}
GaugesTimer = 15u;
if (Coolant_Get_Valid())
{
SEG_Coolant_Display(Coolant_Get_CurSeg(), GUI_DISP_MODE_NORMAL, 7u); //水温格
if (AirPressure_Get_Valid(0))
{
SEG_PRI_Display(AirPressure_Get_CurSeg(0), GUI_DISP_MODE_NORMAL, 7u); // PRI气压格
}
else
{
SEG_PRI_Display(AirPressure_Get_CurSeg(0), GUI_DISP_MODE_INVALID, 7u); // PRI气压格
}
if (AirPressure_Get_Valid(1))
{
SEG_SEC_Display(AirPressure_Get_CurSeg(1), GUI_DISP_MODE_NORMAL, 7u); // SEC气压格
}
else
{
SEG_SEC_Display(AirPressure_Get_CurSeg(1), GUI_DISP_MODE_INVALID, 7u); // SEC气压格
}
if (Coolant_Get_Valid())
{
SEG_Coolant_Display(Coolant_Get_CurSeg(), GUI_DISP_MODE_NORMAL, 7u); //水温格
}
else
{
SEG_Coolant_Display(Coolant_Get_CurSeg(), GUI_DISP_MODE_INVALID, 7u); //水温格
}
SEG_Fuel_Display(Fuel_Get_CurSeg(), GUI_DISP_MODE_NORMAL, 7u); //燃油格
SEG_Tacho_Display(Tacho_Get_CurSeg(), GUI_DISP_MODE_NORMAL, 7u); //转速格
SEG_VehicleSpeed_Display(Speed_Get_CurSeg(), GUI_DISP_MODE_NORMAL, 7u); //车速格
wbyTestNum = Common_Get_Disp_V_Speed();
// Speed_Get_Display_Value()
SEG_VehicleSpeed_Num(wbyTestNum, GUI_DISP_MODE_NORMAL); //车速值
// SEG_PRI_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u) ;//PRI气压格
// SEG_SEC_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u) ;//SEC气压格
// SEG_Coolant_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u) ;//水温格
// SEG_Fuel_Display(wbyTestSeg, GUI_DISP_MODE_NORMAL,7u);//燃油格
// SEG_Tacho_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u);//转速格
// SEG_VehicleSpeed_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u);//车速格
// SEG_VehicleSpeed_Num(wbyTestNum,GUI_DISP_MODE_NORMAL);//车速值
}
else
{
SEG_Coolant_Display(Coolant_Get_CurSeg(), GUI_DISP_MODE_INVALID, 7u); //水温格
GaugesTimer--;
}
SEG_Fuel_Display(Fuel_Get_CurSeg(), GUI_DISP_MODE_NORMAL, 7u); //燃油格
SEG_Tacho_Display(Tacho_Get_CurSeg(), GUI_DISP_MODE_NORMAL, 7u); //转速格
SEG_VehicleSpeed_Display(Speed_Get_CurSeg(), GUI_DISP_MODE_NORMAL, 7u); //车速格
wbyTestNum = Common_Get_Disp_V_Speed();
// Speed_Get_Display_Value()
SEG_VehicleSpeed_Num(wbyTestNum, GUI_DISP_MODE_NORMAL); //车速值
// SEG_PRI_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u) ;//PRI气压格
// SEG_SEC_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u) ;//SEC气压格
// SEG_Coolant_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u) ;//水温格
// SEG_Fuel_Display(wbyTestSeg, GUI_DISP_MODE_NORMAL,7u);//燃油格
// SEG_Tacho_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u);//转速格
// SEG_VehicleSpeed_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u);//车速格
// SEG_VehicleSpeed_Num(wbyTestNum,GUI_DISP_MODE_NORMAL);//车速值
}
}
else
......
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