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

feat:增加转速数据处理

parent 63eebee0
...@@ -46,11 +46,15 @@ void Data_Engine_Speed_Processing_Service ( void ) ...@@ -46,11 +46,15 @@ void Data_Engine_Speed_Processing_Service ( void )
uint8_t i; uint8_t i;
uint16_t ESpeed; uint16_t ESpeed;
uint16_t Delta; uint16_t Delta;
uint16_t Engine_Speed_Value;
uint8_t Engine_Speed_State;
Engine_Speed_Value = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed();
Engine_Speed_State = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed_State();
//第1步:获取实际转速值及转速有效性 //第1步:获取实际转速值及转速有效性
if ( Common_Get_IG_Sts() == COMMON_POWER_ON ) if ( Common_Get_IG_Sts() == COMMON_POWER_ON )
{ {
if((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST)||(Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed() > 0xFFFF)) if((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST)||(Engine_Speed_State == 1))
{ {
DataESpeedValid = 0; DataESpeedValid = 0;
DataESpeedActual = 0; DataESpeedActual = 0;
...@@ -61,15 +65,15 @@ void Data_Engine_Speed_Processing_Service ( void ) ...@@ -61,15 +65,15 @@ void Data_Engine_Speed_Processing_Service ( void )
if ( DataESpeedValid == 0 ) if ( DataESpeedValid == 0 )
{ {
DataESpeedValid = 1; DataESpeedValid = 1;
ESpeed = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed(); ESpeed = Engine_Speed_Value;
ESpeed /= 4; ESpeed /= 4;
if ( ESpeed > 11000 ) if ( ESpeed > 12000 )
ESpeed = 11000; ESpeed = 12000;
DataESpeedActual = ESpeed; DataESpeedActual = ESpeed;
} }
else else
{ {
DataESpeedSampler.Buffer[DataESpeedSampler.Cnt] = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed(); DataESpeedSampler.Buffer[DataESpeedSampler.Cnt] = Engine_Speed_Value;
i = DataESpeedSampler.Cnt; i = DataESpeedSampler.Cnt;
while ( ( i > 0 ) && ( DataESpeedSampler.Buffer[i] < DataESpeedSampler.Buffer[i - 1] ) ) while ( ( i > 0 ) && ( DataESpeedSampler.Buffer[i] < DataESpeedSampler.Buffer[i - 1] ) )
...@@ -86,8 +90,8 @@ void Data_Engine_Speed_Processing_Service ( void ) ...@@ -86,8 +90,8 @@ void Data_Engine_Speed_Processing_Service ( void )
DataESpeedSampler.Cnt = 0; DataESpeedSampler.Cnt = 0;
ESpeed = DataESpeedSampler.Buffer[3]; ESpeed = DataESpeedSampler.Buffer[3];
ESpeed /= 4; ESpeed /= 4;
if ( ESpeed > 11000 ) if ( ESpeed > 12000 )
ESpeed = 11000; ESpeed = 12000;
DataESpeedActual = ESpeed; DataESpeedActual = ESpeed;
} }
} }
...@@ -220,8 +224,8 @@ void Data_Engine_Speed_Processing_Service ( void ) ...@@ -220,8 +224,8 @@ void Data_Engine_Speed_Processing_Service ( void )
else else
{ {
DataESPeedDamping.Speed += Delta; DataESPeedDamping.Speed += Delta;
if ( DataESPeedDamping.Speed > 11000 ) if ( DataESPeedDamping.Speed > 12000 )
DataESPeedDamping.Speed = 11000; DataESPeedDamping.Speed = 12000;
} }
} }
else //显示值正在向实际值减小,则维持当前方向调节增加速度 else //显示值正在向实际值减小,则维持当前方向调节增加速度
...@@ -269,8 +273,8 @@ void Data_Engine_Speed_Processing_Service ( void ) ...@@ -269,8 +273,8 @@ void Data_Engine_Speed_Processing_Service ( void )
else else
{ {
DataESPeedDamping.Speed += Delta; DataESPeedDamping.Speed += Delta;
if ( DataESPeedDamping.Speed > 11000 ) if ( DataESPeedDamping.Speed > 12000 )
DataESPeedDamping.Speed = 11000; DataESPeedDamping.Speed = 12000;
} }
} }
else //显示值当前是减小方向 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