Commit 4788817e authored by hu's avatar hu

调整车速显示

parent 490dac50
No preview for this file type
This diff is collapsed.
project .intvect 1536
project .text 299324
project .rodata 412383
project .text 299212
project .rodata 412367
project .secinfo 120
project .syscall 6
project .romdata 7853
......
......@@ -27,7 +27,7 @@ static struct
uint8_t SumCnt ;
uint32_t Voltage ;
uint16_t Result ;
}AirPressureFilter[2u] ;
} AirPressureFilter[2u] ;
static struct
{
......@@ -40,11 +40,11 @@ static struct
uint8_t CurSeg[2u] ;
uint8_t ValidTimer[2u] ;
uint8_t InvalidTimer[2u] ;
}AirPressureVariable ;
} AirPressureVariable ;
static void Calc_AirPressure_Table(uint16_t Voltage,uint16_t * kPa);
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 :
......@@ -76,15 +76,16 @@ void AirPressure_KL30_Init(void)
AirPressureVariable.VoltageTable[ 5 ] = 4250 ;
AirPressureVariable.kPaTable[ 5 ] = 1500 ;
for(i = 0;i < (TableLenMax - 1);i ++)
{/*100倍 斜率*/
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 ++)
for (i = 0; i < 2; i ++)
{
AirPressureFilter[ i ].SumCnt = 0 ;
AirPressureFilter[ i ].Voltage = 0 ;
......@@ -129,13 +130,14 @@ void AirPressure_Processing_Service(void)
AirPressure_AdcData_Filter();
for(i = 0;i < 2;i ++)
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.AvrVoltage[ i ] < 500) || (AirPressureVariable.AvrVoltage[ i ] > 4250) )
{
if (AirPressureVariable.InvalidTimer[ i ] < VALID_TIME)
{
if(AirPressureVariable.InvalidTimer[ i ] < VALID_TIME)
{//2s
//2s
AirPressureVariable.InvalidTimer[ i ] ++ ;
}
else
......@@ -147,7 +149,7 @@ void AirPressure_Processing_Service(void)
}
else
{
if(AirPressureVariable.ValidTimer[ i ] < VALID_TIME)
if (AirPressureVariable.ValidTimer[ i ] < VALID_TIME)
{
AirPressureVariable.ValidTimer[ i ] ++ ;
}
......@@ -159,9 +161,9 @@ void AirPressure_Processing_Service(void)
}
Calc_AirPressure_Table(AirPressureVariable.AvrVoltage[i],(uint16_t *)&AirPressureVariable.ResultkPa[i]);
Calc_AirPressure_Table(AirPressureVariable.AvrVoltage[i], (uint16_t *)&AirPressureVariable.ResultkPa[i]);
AirPressureVariable.CurSeg[ i ] = CalAirPressure_CurSeg(i,AirPressureVariable.Valid[i],AirPressureVariable.AvrVoltage[ i ]);
AirPressureVariable.CurSeg[ i ] = CalAirPressure_CurSeg(i, AirPressureVariable.Valid[i], AirPressureVariable.AvrVoltage[ i ]);
}
}
/*-------------------------------------------------------------------------
......@@ -172,34 +174,35 @@ 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 ;
#if EnTable
if(Voltage <= AirPressureVariable.VoltageTable[ 0 ])
if (Voltage <= AirPressureVariable.VoltageTable[ 0 ])
{
u32Result = AirPressureVariable.kPaTable[ 0 ] ;
}
else if(Voltage >= AirPressureVariable.VoltageTable[ TableLenMax - 1 ])
else if (Voltage >= AirPressureVariable.VoltageTable[ TableLenMax - 1 ])
{
u32Result = AirPressureVariable.kPaTable[ TableLenMax - 1 ] ;
}
else
{
for(i = 0;i < TableLenMax;i ++ )
for (i = 0; i < TableLenMax; i ++ )
{
if(Voltage < AirPressureVariable.VoltageTable[ i ])
if (Voltage < AirPressureVariable.VoltageTable[ i ])
{
Index = i ;
break ;
}
}
if((Index < 1)||(Index > (TableLenMax - 1)) )
{//err
while(1)
if ((Index < 1) || (Index > (TableLenMax - 1)) )
{
//err
while (1)
{
;
}
......@@ -214,18 +217,18 @@ static void Calc_AirPressure_Table(uint16_t Voltage,uint16_t * kPa)
}
#else
if(Voltage <= AirPressureVariable.VoltageTable[ 0 ])
if (Voltage <= AirPressureVariable.VoltageTable[ 0 ])
{
u32Result = AirPressureVariable.kPaTable[ 0 ] ;
}
else if(Voltage >= AirPressureVariable.VoltageTable[ TableLenMax - 1 ])
else if (Voltage >= AirPressureVariable.VoltageTable[ TableLenMax - 1 ])
{
u32Result = AirPressureVariable.kPaTable[ TableLenMax - 1 ] ;
}
else
{
//指示刻度 = (输入电压– 0.5) / 0.0025
if(Voltage >= 500)
if (Voltage >= 500)
{
Voltage -= 500 ;
}
......@@ -255,14 +258,14 @@ void AirPressure_AdcData_Filter(void)
u8PriValid = RTE_Read_PRIMARY_AIR_Valid();
u8SecValid = RTE_Read_SECONDARY_AIR_Valid();
if(u8PriValid)
if (u8PriValid)
{
if(AirPressureFilter[PRI_ID].SumCnt < 10)
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) ;
PriVoltage = (uint16_t)(AirPressureFilter[PRI_ID].Voltage / AirPressureFilter[PRI_ID].SumCnt) ;
}
else
{
......@@ -271,7 +274,7 @@ void AirPressure_AdcData_Filter(void)
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) ;
PriVoltage = (uint16_t)(AirPressureFilter[PRI_ID].Voltage / AirPressureFilter[PRI_ID].SumCnt) ;
}
AirPressureFilter[PRI_ID].Result = PriVoltage ;
......@@ -283,14 +286,14 @@ void AirPressure_AdcData_Filter(void)
PriVoltage = 0 ;
}
if(u8SecValid)
if (u8SecValid)
{
if(AirPressureFilter[SEC_ID].SumCnt < 10)
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) ;
SecVoltage = (uint16_t)(AirPressureFilter[SEC_ID].Voltage / AirPressureFilter[SEC_ID].SumCnt) ;
}
else
{
......@@ -299,7 +302,7 @@ void AirPressure_AdcData_Filter(void)
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) ;
SecVoltage = (uint16_t)(AirPressureFilter[SEC_ID].Voltage / AirPressureFilter[SEC_ID].SumCnt) ;
}
AirPressureFilter[SEC_ID].Result = SecVoltage ;
}
......@@ -318,10 +321,10 @@ 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)
if (Valid)
{
}
......@@ -330,14 +333,14 @@ static uint8_t CalAirPressure_CurSeg(uint8_t ID,uint8_t Valid,uint16_t Voltage)
}
if(ID == PRI_ID)
if (ID == PRI_ID)
{
SetGaugesPara(PRIGasGauges,Voltage);
SetGaugesPara(PRIGasGauges, Voltage);
u8Result = GetGaugesCurrentPos(PRIGasGauges) ;
}
else
{
SetGaugesPara(SECGasGauges,Voltage);
SetGaugesPara(SECGasGauges, Voltage);
u8Result = GetGaugesCurrentPos(SECGasGauges) ;
}
......
......@@ -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;
}
}
//传入表头
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;
......@@ -499,56 +495,3 @@ void Data_ESpeed_LED_Processing_Service(void)
/***************************************
数据处理服务函数
***************************************/
\ No newline at end of file
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 ;
}
......@@ -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,12 +1048,17 @@ 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;
GaugesTimer = 15u;
}
else if (GaugesTimer == 0u)
{
GaugesTimer = 15u;
if (AirPressure_Get_Valid(0))
{
......@@ -1072,7 +1087,9 @@ void Seg_Display_Service(void)
}
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()
......@@ -1086,6 +1103,11 @@ void Seg_Display_Service(void)
// SEG_VehicleSpeed_Display(wbyTestSeg,GUI_DISP_MODE_NORMAL,7u);//车速格
// SEG_VehicleSpeed_Num(wbyTestNum,GUI_DISP_MODE_NORMAL);//车速值
}
else
{
GaugesTimer--;
}
}
}
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