Commit 3a9ce203 authored by 李俭双's avatar 李俭双

feat:增加燃油表数据处理及外发

parent 06397f17
...@@ -44,6 +44,15 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[]) ...@@ -44,6 +44,15 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
{ {
p6EE -> Sig.Coolant_Warn_TX = 0; p6EE -> Sig.Coolant_Warn_TX = 0;
} }
p6EE -> Sig.Fuel_Seg_TX = Get_CurFuelSetp() ;
if(Get_Fuel_RES() > 255)
{
p6EE -> Sig.Fuel_Res_TX = 0xFF ;
}
else
{
p6EE -> Sig.Fuel_Res_TX = Get_Fuel_RES() ;
}
} }
......
...@@ -78,8 +78,7 @@ void Fuel_R_Cal(uint8_t deltaTime) ...@@ -78,8 +78,7 @@ void Fuel_R_Cal(uint8_t deltaTime)
if (FuelDataCount < FUEL_DATA_NUM) if (FuelDataCount < FUEL_DATA_NUM)
{ {
/*获取燃油电阻*/ /*获取燃油电阻*/
FuelRes = ADC_Read_Signal(ADC_CH_FUEL1);; // ADC_Read_Signal(ADC_CH_FUEL1); FuelRes = ADC_Read_Signal(ADC_CH_FUEL1);
/*四舍五入*/ /*四舍五入*/
//if (FuelRes < 32000) //if (FuelRes < 32000)
//{ //{
...@@ -146,7 +145,7 @@ void Fuel_State_Check(uint8_t deltaTime) ...@@ -146,7 +145,7 @@ void Fuel_State_Check(uint8_t deltaTime)
// } // }
// else // else
if (FuelR >= 1100) if (FuelR >= 10000)
{ /*断路 320*/ { /*断路 320*/
FuelSensorShortTime = 0; FuelSensorShortTime = 0;
FuelSensorNormalTime = 0; FuelSensorNormalTime = 0;
...@@ -185,7 +184,7 @@ void Fuel_Gauges_Cal(uint8_t deltaTime) ...@@ -185,7 +184,7 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
{ {
static uint16_t time = 0; static uint16_t time = 0;
if ((FuelSensorState == FuelSensorNormal) && (FuelR < 1100)) if ((FuelSensorState == FuelSensorNormal) && (FuelR < 10000))
{ // 32000 //FuelR >10 change FuelR >20 { // 32000 //FuelR >10 change FuelR >20
/*采集完第一组数据后,开始计算燃油格数*/ /*采集完第一组数据后,开始计算燃油格数*/
if (FuelADCompleteFlg) if (FuelADCompleteFlg)
...@@ -226,46 +225,46 @@ void Fuel_Gauges_Cal(uint8_t deltaTime) ...@@ -226,46 +225,46 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
/*计算目标格数*/ /*计算目标格数*/
if (FuelDir == FUEL_SEG_UP) if (FuelDir == FUEL_SEG_UP)
{ {
if (((DesFuelSetp == 4) || FuelInitFlag) && (FuelR < 240)) if (((DesFuelSetp == 4) || FuelInitFlag) && (FuelR < 130))
{ {
DesFuelSetp = 5; DesFuelSetp = 5;
} }
else if (((DesFuelSetp == 3) || FuelInitFlag) && (FuelR < 430)) else if (((DesFuelSetp == 3) || FuelInitFlag) && (FuelR < 280))
{ {
DesFuelSetp = 4; DesFuelSetp = 4;
} }
else if (((DesFuelSetp == 2) || FuelInitFlag) && (FuelR < 610)) else if (((DesFuelSetp == 2) || FuelInitFlag) && (FuelR < 430))
{ {
DesFuelSetp = 3; DesFuelSetp = 3;
} }
else if (((DesFuelSetp == 1) || FuelInitFlag) && (FuelR < 790)) else if (((DesFuelSetp == 1) || FuelInitFlag) && (FuelR < 630))
{ {
DesFuelSetp = 2; DesFuelSetp = 2;
} }
else if (((DesFuelSetp == 0) || FuelInitFlag) && (FuelR < 970)) else if (((DesFuelSetp == 0) || FuelInitFlag) && (FuelR < 880))
{ {
DesFuelSetp = 1; DesFuelSetp = 1;
} }
} }
else if (FuelDir == FUEL_SEG_DOWN) else if (FuelDir == FUEL_SEG_DOWN)
{ {
if (((DesFuelSetp == 1) || FuelInitFlag) && (FuelR >= 970)) if (((DesFuelSetp == 1) || FuelInitFlag) && (FuelR >= 880))
{ {
DesFuelSetp = 0; DesFuelSetp = 0;
} }
else if (((DesFuelSetp == 2) || FuelInitFlag) && (FuelR >= 790)) else if (((DesFuelSetp == 2) || FuelInitFlag) && (FuelR >= 630))
{ {
DesFuelSetp = 1; DesFuelSetp = 1;
} }
else if (((DesFuelSetp == 3) || FuelInitFlag) && (FuelR >= 610)) else if (((DesFuelSetp == 3) || FuelInitFlag) && (FuelR >= 430))
{ {
DesFuelSetp = 2; DesFuelSetp = 2;
} }
else if (((DesFuelSetp == 4) || FuelInitFlag) && (FuelR >= 430)) else if (((DesFuelSetp == 4) || FuelInitFlag) && (FuelR >= 280))
{ {
DesFuelSetp = 3; DesFuelSetp = 3;
} }
else if (((DesFuelSetp == 5) || FuelInitFlag) && (FuelR >= 240)) else if (((DesFuelSetp == 5) || FuelInitFlag) && (FuelR >= 130))
{ {
DesFuelSetp = 4; DesFuelSetp = 4;
} }
...@@ -282,8 +281,10 @@ void Fuel_Gauges_Cal(uint8_t deltaTime) ...@@ -282,8 +281,10 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
time = 0; time = 0;
CurFuelSetp = DesFuelSetp; CurFuelSetp = DesFuelSetp;
} }
if (time >= 10000) if(Get_ActualVechileSpeed() == 0)
{ /* 10S变化一格 */ {
if (time >= 24000)
{ /* 24S变化一格 */
time = 0; time = 0;
...@@ -298,6 +299,27 @@ void Fuel_Gauges_Cal(uint8_t deltaTime) ...@@ -298,6 +299,27 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
CurFuelSetp--; CurFuelSetp--;
} }
} }
}
else
{
if (time >= 360000)
{ /* 360S变化一格 */
time = 0;
if (CurFuelSetp < DesFuelSetp)
{
CurFuelSetp++;
}
else if (CurFuelSetp > DesFuelSetp)
{
CurFuelSetp--;
}
}
}
if (CurFuelSetp == DesFuelSetp) if (CurFuelSetp == DesFuelSetp)
{ {
time = 0; time = 0;
...@@ -336,8 +358,6 @@ uint8_t Get_Fuel_Disp_Byte(void) ...@@ -336,8 +358,6 @@ uint8_t Get_Fuel_Disp_Byte(void)
void Fuel_Cal_Sevice(uint8_t deltaTime) void Fuel_Cal_Sevice(uint8_t deltaTime)
{ {
...@@ -359,3 +379,10 @@ FuelSensorSts_t Get_Fuel_Sensor_State(void) ...@@ -359,3 +379,10 @@ FuelSensorSts_t Get_Fuel_Sensor_State(void)
{ {
return FuelSensorState; return FuelSensorState;
} }
//燃油阻值,用于外发
uint16_t Get_Fuel_RES(void)
{
uint16_t Fuel_Res = 0;
Fuel_Res = FuelR / 10;
return Fuel_Res;
}
...@@ -16,5 +16,6 @@ extern void Fuel_Cal_Sevice(uint8_t deltaTime); ...@@ -16,5 +16,6 @@ extern void Fuel_Cal_Sevice(uint8_t deltaTime);
extern uint8_t Get_Fuel_Disp_Byte(void); extern uint8_t Get_Fuel_Disp_Byte(void);
extern uint8_t Get_CurFuelSetp(void); extern uint8_t Get_CurFuelSetp(void);
extern FuelSensorSts_t Get_Fuel_Sensor_State(void); extern FuelSensorSts_t Get_Fuel_Sensor_State(void);
uint16_t Get_Fuel_RES(void);
#endif #endif
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