Commit b2121838 authored by 李俭双's avatar 李俭双

🐞 fix:43125 【天鹰TY100】【车速数值】车速遍历缺值

parent f227c404
......@@ -4,6 +4,7 @@
static uint16_t DataVSpeedActual;
static uint16_t DataVSpeedDisp;
static uint32_t DataVSpeedTarget;
static uint16_t DataVSpeedHysteresis;
static uint8_t DataVSpeedValid;
// static uint16_t DataVSpeedDisp_Mile;
......@@ -34,6 +35,7 @@ void Data_Vehicle_Speed_KL30_Init(void)
DataVSPeedDamping.Dir = DATA_APPR_DIR_INC;
DataVSpeedSampler.Timer1 = 0;
DataVSpeedSampler.Timer = 0;
DataVSpeedTarget = 0;
}
/******************************************************************************
......@@ -53,6 +55,7 @@ void Data_Vehicle_Speed_Wakeup_Init(void)
DataVSPeedDamping.Dir = DATA_APPR_DIR_INC;
DataVSpeedSampler.Timer1 = 0;
DataVSpeedSampler.Timer = 0;
DataVSpeedTarget = 0;
}
/******************************************************************************
......@@ -120,8 +123,8 @@ void Data_Vehicle_Speed_Processing_Service(void)
VSpeed = DataVSpeedSampler.Buffer [ 1 ];
DataVSpeedActual = VSpeed * 10;
}
DataVSpeedSampler.Timer = 0;
DataVSpeedSampler.Timer1 = 0;
//DataVSpeedSampler.Timer = 0;
//DataVSpeedSampler.Timer1 = 0;
DataVSpeedSampler.Backup = DataVSpeedActual;
DataVSpeedValid = 1;
}
......@@ -132,18 +135,128 @@ void Data_Vehicle_Speed_Processing_Service(void)
{
DataVSpeedValid = 0;
DataVSpeedActual = 0;
DataVSpeedSampler.Timer = 0;
DataVSpeedSampler.Timer1 = 0;
//DataVSpeedSampler.Timer = 0;
//DataVSpeedSampler.Timer1 = 0;
DataVSpeedSampler.Cnt = 0;
DataVSpeedSampler.Backup = 0;
}
DataVSpeedTarget = DataVSpeedActual;
if ( DataVSpeedValid )
{
DataVSpeedTarget *= 108;
DataVSpeedTarget /= 100;
if(DataVSpeedTarget > 1990)
{
DataVSpeedTarget = 1990;
}
}
else
{
DataVSpeedTarget = 0;
}
if ( (DataVSpeedTarget >= DataVSpeedHysteresis) || (DataVSpeedTarget < DATA_VSPEED_HYSTERESIS) )
{
DataVSpeedHysteresis = DataVSpeedTarget;
}
else
{
if ( DataVSpeedHysteresis - DataVSpeedTarget >= DATA_VSPEED_HYSTERESIS )
{
DataVSpeedHysteresis = DataVSpeedTarget;
}
}
DataVSpeedSampler.Timer ++;
if(DataVSpeedSampler.Timer >= 10)
{
DataVSpeedSampler.Timer = 0;
if(DataVSpeedDisp < DataVSpeedHysteresis)
{
DataVSPeedDamping.Dir = DATA_APPR_DIR_INC;
}
else if (DataVSpeedDisp > DataVSpeedHysteresis)
{
DataVSPeedDamping.Dir = DATA_APPR_DIR_DEC;
}
else
{
;
}
if ( DataVSPeedDamping.Dir == DATA_APPR_DIR_INC)
{
if (DataVSpeedHysteresis >= DataVSpeedDisp)
{
if (DataVSpeedHysteresis > (DataVSpeedDisp + 400))
{
DataVSpeedDisp += 370;
}
else if (DataVSpeedHysteresis > (DataVSpeedDisp + 150))
{
DataVSpeedDisp += 120;
}
else if (DataVSpeedHysteresis > (DataVSpeedDisp + 50))
{
DataVSpeedDisp += 30;
}
else if (DataVSpeedHysteresis > (DataVSpeedDisp + 10))
{
DataVSpeedDisp += 10;
}
else
{
DataVSpeedDisp = DataVSpeedHysteresis;
}
}
}
else if (DataVSPeedDamping.Dir == DATA_APPR_DIR_DEC)
{
if (DataVSpeedHysteresis < DataVSpeedDisp)
{
if ((DataVSpeedHysteresis + 400) < DataVSpeedDisp)
{
DataVSpeedDisp -= 370;
}
else if ((DataVSpeedHysteresis + 150) < DataVSpeedDisp)
{
DataVSpeedDisp -= 120;
}
else if ((DataVSpeedHysteresis + 50) < DataVSpeedDisp)
{
DataVSpeedDisp -= 30;
}
else if ((DataVSpeedHysteresis + 10) < DataVSpeedDisp)
{
DataVSpeedDisp -= 10;
}
else
{
DataVSpeedDisp = DataVSpeedHysteresis;
}
}
if (DataVSpeedDisp >= 1990)
{
DataVSpeedDisp = 1990;
}
}
}
#if(0)
// 第2步:车速的阻尼处理
VSpeed = DataVSpeedActual;
if ( VSpeed > DataVSPeedDamping.Speed ) // 实际值比当前显示值大时
{
Delta = ( uint16_t )VSpeed - DataVSPeedDamping.Speed;
if ( DataVSPeedDamping.Dir == DATA_APPR_DIR_INC ) // 显示值正在向实际值增加,则维持当前方向调节增加速度
{
if ( DataVSPeedDamping.Delta < Delta ) // 当前增量小于显示值与实际值的差值,则提升增加的速度
......@@ -304,6 +417,7 @@ void Data_Vehicle_Speed_Processing_Service(void)
{
DataVSpeedDisp = 0;
}
#endif
}
/*车速有效位:有效=1,无效=0*/
......
......@@ -112,15 +112,8 @@ void Gauge_Service(void)
// BU98R10Chip1DDRAM.Byte[i] = 0x77;
//}
if (VSpeed_Count < 3)
{
VSpeed_Count++;
}
else
{
VSpeed_Count = 0;
SEG_SET_VSpeed_NUM(1u, Get_DispVechileSpeed( ) / 10u,Get_Dis_KM_Unit());
}
SEG_SET_ODO_TRIP_FAULTCODE_TCS_DIS(Get_Dis_KM_Unit(), Get_ODO_Value() / 10u, Get_Trip_Value());
Gauge_Clock_Display();
......
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