Commit 87a4d6ec authored by 李俭双's avatar 李俭双

Merge branch 'lijianshuang' into 'dev'

Lijianshuang

See merge request ty/tianying_ty100!10
parents 1b44baf5 845936e2
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'HaoJin'
* Target: 'HaoJin232'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "BAT32A239.h"
#endif /* RTE_COMPONENTS_H */
......@@ -503,6 +503,46 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\CAN_User\Can_App.h</FilePath>
</File>
<File>
<FileName>Data_Coolant.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Application\Data_Coolant\Data_Coolant.c</FilePath>
</File>
<File>
<FileName>Data_Coolant.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\Data_Coolant\Data_Coolant.h</FilePath>
</File>
<File>
<FileName>Data_TPMS.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Application\Data_TPMS\Data_TPMS.c</FilePath>
</File>
<File>
<FileName>Data_TPMS.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\Data_TPMS\Data_TPMS.h</FilePath>
</File>
<File>
<FileName>FaultCode.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Application\FaultCode\FaultCode.c</FilePath>
</File>
<File>
<FileName>FaultCode.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\FaultCode\FaultCode.h</FilePath>
</File>
<File>
<FileName>Data_Voltage.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Application\Data_Voltage\Data_Voltage.c</FilePath>
</File>
<File>
<FileName>Data_Voltage.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\Data_Voltage\Data_Voltage.h</FilePath>
</File>
</Files>
</Group>
<Group>
......
......@@ -14,6 +14,10 @@ SET CPU_CLOCK=0x00B71B00
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\gui_display.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\can_user.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\can_app.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\data_coolant.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\data_tpms.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\faultcode.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\data_voltage.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\bu98r10.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\services_mileage_user.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\eemanager_interface.__i"
......
......@@ -14,9 +14,10 @@
#include "CAN_APP\CAN_CH0_CAN_Communication_Matrix.h"
#include "Can_User/Can_User.h"
#include "Can_User/Can_App.h"
#include "Data_Coolant/Data_Coolant.h"
#include "Data_TPMS/Data_TPMS.h"
#include "Data_Voltage/Data_Voltage.h"
#include "FaultCode/FaultCode.h"
#endif
#include "Can_App.h"
#include "Components.h"
#include "Application.h"
void Can_Set_Buff_220(canlib_uint8_t CopyData[])
......@@ -21,7 +22,8 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
{
CANMsg6EEUnion *p6EE;
uint8_t i = 0;
uint16_t Vspeed_tx = 0;
Vspeed_tx = Get_DispVechileSpeed_TX()/10;
p6EE = (CANMsg6EEUnion *)CopyData;
if ( p6EE != ( void * )0 )
{
......@@ -29,13 +31,37 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
{
p6EE->Msg [ i ] = 0xFFu;
}
}
p6EE -> Sig.Vsppe_H3_TX = (Vspeed_tx >> 8) & 0x7u ;
p6EE -> Sig.Vsppe_L8_TX = Vspeed_tx & 0xFF ;
p6EE -> Sig.Uint_TX = Get_Dis_KM_Unit() ;
p6EE -> Sig.Coolant_Seg_TX = GET_DataCoolantTempSegDisp() ;
if (GET_DataCollantTempWarnflg() == 2)
{
p6EE -> Sig.Coolant_Warn_TX = 1;
}
else
{
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() ;
}
}
void Can_Set_Buff_6EF(canlib_uint8_t CopyData[])
{
CANMsg6EFUnion *p6EF;
uint8_t i = 0;
uint16_t Espeed_tx = 0;
Espeed_tx = Get_DispEngineSpeed()/100;
p6EF = (CANMsg6EFUnion *)CopyData;
if ( p6EF != ( void * )0 )
{
......@@ -44,6 +70,8 @@ void Can_Set_Buff_6EF(canlib_uint8_t CopyData[])
p6EF->Msg [ i ] = 0xFFu;
}
}
p6EF -> Sig.Espeed_TX = Espeed_tx;
p6EF -> Sig.Coolant_TX = GET_DataCoolantTempValueDisp() + 40;
}
void Can_Set_Buff_450(canlib_uint8_t CopyData[])
{
......
......@@ -168,7 +168,8 @@ uint32_t Common_GetSocTime(void)
*/
uint32_t Data_Km_To_Mile(uint32_t Km)
{
Km = (Km * 64u) / 103u;
Km *= 100;
Km /= 161;
return Km;
}
/**
......
#include "Data_Coolant\Data_Coolant.h"
#include "Application.h"
DataCoolantTempStruct DataCoolantTemp ;
DataCoolantTempDisStruct DataCoolantTemp_Dis;
void Data_Coolant_Temp_KL30_Init ( void )
{
DataCoolantTemp.Value = 0;
DataCoolantTemp.Valid = 0;
DataCoolantTemp_Dis.u8_CurSeg = 0;
DataCoolantTemp_Dis.u8_DestSeg = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer = CoolantFlashtimer;
DataCoolantTemp_Dis.u8_DownFlashtimer = CoolantFlashtimer;
DataCoolantTemp_Dis.u8_Warnflg = 0;
DataCoolantTemp_Dis.u8_Flg = 0;
}
void Data_Coolant_Temp_KL15_Init ( void )
{
DataCoolantTemp_Dis.u8_CurSeg = 0;
DataCoolantTemp_Dis.u8_DestSeg = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer = 0;
DataCoolantTemp_Dis.u8_DownFlashtimer = 0;
DataCoolantTemp_Dis.u8_Warnflg = 0;
DataCoolantTemp_Dis.u8_Flg = 0;
}
void Data_Coolant_Temp_Processing_Service ( void )
{
uint16_t Coolant_Temperature;
uint8_t Coolant_Temperature_State;
uint32_t Temp;
uint8_t i;
Coolant_Temperature = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature();
Coolant_Temperature_State = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature_State();
if (SYS_OPR_STAT_IGN_ON )
{
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST)
{
DataCoolantTemp.Valid = 0;
DataCoolantTemp.Value = 0;
}
else
{
if(Coolant_Temperature_State == 1)
{
DataCoolantTemp.Valid = 0;
DataCoolantTemp.Value = 0;
}
else
{
DataCoolantTemp.Valid = 1;
if(Coolant_Temperature >= 2730)
{
Coolant_Temperature -= 2730;
}
else
{
Coolant_Temperature = 0;
}
if ((Coolant_Temperature % 10) >= 5)
{
Coolant_Temperature += 5;
}
if(Coolant_Temperature > 1990)
{
Coolant_Temperature = 1990 ;
}
DataCoolantTemp.Value = Coolant_Temperature / 10;
}
}
}
else
{
DataCoolantTemp.Valid = 0;
DataCoolantTemp.Value = 0;
}
//显示
Data_Coolant_Temp_Display();
}
void Data_Coolant_Temp_Display ( void )
{
if(SYS_OPR_STAT_IGN_ON)
{
if (Common_GetIgnOnTime() >= 3000)
{
DataCoolantTemp_Dis.u8_Uptimer = CoolantSelfCheckFlashtimer;
DataCoolantTemp_Dis.u8_Downtimer = CoolantSelfCheckFlashtimer;
if(DataCoolantTemp_Dis.u8_CurSeg == 0)
{
DataCoolantTemp_Dis.u8_DestSeg = 5;
}
if(DataCoolantTemp_Dis.u8_CurSeg == 5)
{
DataCoolantTemp_Dis.u8_DestSeg = 0;
}
DataCoolantTemp_Dis.u8_Warnflg = 0;
DataCoolantTemp_Dis.u8_Flg = 0;
DataCoolantTemp_Dis.Dis_Valid = 0;
}
else
{
DataCoolantTemp_Dis.u8_Uptimer = CoolantFlashtimer;
DataCoolantTemp_Dis.u8_Downtimer = CoolantFlashtimer;
Get_Coolant_Temp_Seg(DataCoolantTemp.Value);
if(DataCoolantTemp.Valid == 0)
{
DataCoolantTemp_Dis.Dis_Valid = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer = DataCoolantTemp_Dis.u8_Uptimer;
DataCoolantTemp_Dis.u8_DownFlashtimer = DataCoolantTemp_Dis.u8_Downtimer;
DataCoolantTemp_Dis.u8_CurSeg = 0;
DataCoolantTemp_Dis.u8_DestSeg = 0 ;
DataCoolantTemp_Dis.u8_Flg = 0;
}
else
{
DataCoolantTemp_Dis.Dis_Valid = 1;
if(DataCoolantTemp_Dis.u8_Flg == 0)
{
DataCoolantTemp_Dis.u8_Flg = 1;
DataCoolantTemp_Dis.u8_CurSeg = DataCoolantTemp_Dis.u8_DestSeg;
DataCoolantTemp_Dis.u8_UpFlashtimer = DataCoolantTemp_Dis.u8_Uptimer;
DataCoolantTemp_Dis.u8_DownFlashtimer = DataCoolantTemp_Dis.u8_Downtimer;
}
}
}
if(DataCoolantTemp_Dis.u8_CurSeg > DataCoolantTemp_Dis.u8_DestSeg )
{
DataCoolantTemp_Dis.u8_UpFlashtimer = 0;
DataCoolantTemp_Dis.u8_DownFlashtimer++;
if(DataCoolantTemp_Dis.u8_DownFlashtimer >= DataCoolantTemp_Dis.u8_Downtimer)
{
DataCoolantTemp_Dis.u8_DownFlashtimer = 0;
DataCoolantTemp_Dis.u8_CurSeg --;
}
}
else if(DataCoolantTemp_Dis.u8_CurSeg < DataCoolantTemp_Dis.u8_DestSeg)
{
DataCoolantTemp_Dis.u8_DownFlashtimer = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer++;
if(DataCoolantTemp_Dis.u8_UpFlashtimer >= DataCoolantTemp_Dis.u8_Uptimer)
{
DataCoolantTemp_Dis.u8_UpFlashtimer = 0;
DataCoolantTemp_Dis.u8_CurSeg ++;
}
}
//warning
if( DataCoolantTemp.Valid == 0 )
{
DataCoolantTemp_Dis.u8_Warnflg = 1;
}
else
{
if (DataCoolantTemp.Value >= 115)
{
DataCoolantTemp_Dis.u8_Warnflg = 2;
}
else if(DataCoolantTemp.Value >= 112)
{
DataCoolantTemp_Dis.u8_Warnflg = 0;
}
else
{
;
}
}
}
else
{
DataCoolantTemp_Dis.Dis_Valid = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer = DataCoolantTemp_Dis.u8_Uptimer;
DataCoolantTemp_Dis.u8_DownFlashtimer = DataCoolantTemp_Dis.u8_Downtimer;
DataCoolantTemp_Dis.u8_Warnflg = 0;
DataCoolantTemp_Dis.u8_Flg = 0;
}
}
void Get_Coolant_Temp_Seg(uint16_t Temp_Value)
{
uint8_t TempSeg;
uint8_t CurTempSeg;
if(Temp_Value < 50)
{
if(DataCoolantTemp_Dis.u8_CurSeg > 1)
{
DataCoolantTemp_Dis.u8_DestSeg = 1;
}
else if (DataCoolantTemp_Dis.u8_CurSeg > 0)
{
if(Temp_Value <= 47)
{
DataCoolantTemp_Dis.u8_DestSeg = 0;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 0;
}
}
else if((Temp_Value < 62)&&(Temp_Value >= 50))
{
if(DataCoolantTemp_Dis.u8_CurSeg > 2)
{
DataCoolantTemp_Dis.u8_DestSeg = 2;
}
else if(DataCoolantTemp_Dis.u8_CurSeg > 1 )
{
if(Temp_Value <= 59)
{
DataCoolantTemp_Dis.u8_DestSeg = 1;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 1;
}
}
else if((Temp_Value < 80)&&(Temp_Value >= 62))
{
if(DataCoolantTemp_Dis.u8_CurSeg > 3)
{
DataCoolantTemp_Dis.u8_DestSeg = 3;
}
else if(DataCoolantTemp_Dis.u8_CurSeg > 2)
{
if(Temp_Value <= 77)
{
DataCoolantTemp_Dis.u8_DestSeg = 2;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 2;
}
}
else if((Temp_Value < 98)&&(Temp_Value >= 80))
{
if(DataCoolantTemp_Dis.u8_CurSeg > 4)
{
DataCoolantTemp_Dis.u8_DestSeg = 4;
}
else if(DataCoolantTemp_Dis.u8_CurSeg > 3)
{
if(Temp_Value <= 95 )
{
DataCoolantTemp_Dis.u8_DestSeg = 3;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 3;
}
}
else if((Temp_Value < 115)&&(Temp_Value >= 98))
{
if(DataCoolantTemp_Dis.u8_CurSeg > 4)
{
if(Temp_Value <= 112)
{
DataCoolantTemp_Dis.u8_DestSeg = 4;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 4;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 5;
}
}
//水温显示格数
uint8_t GET_DataCoolantTempSegDisp(void)
{
return DataCoolantTemp_Dis.u8_CurSeg;
}
//水温显示有效标志
uint8_t GET_DataCollantTempSegValid(void)
{
return DataCoolantTemp_Dis.Dis_Valid;
}
//水温数显。作为外发使用的时候+40
uint16_t GET_DataCoolantTempValueDisp(void)
{
return DataCoolantTemp.Value ;
}
uint8_t GET_DataCollantTempValueValid(void)
{
return DataCoolantTemp.Valid;
}
//水温灯及显示的报警信号 0:无报警,正常显示 1:掉线或者state无效,白色闪烁 2:高温,红色闪烁
uint8_t GET_DataCollantTempWarnflg(void)
{
return DataCoolantTemp_Dis.u8_Warnflg;
}
#ifndef _DATA_Coolant_H_
#define _DATA_Coolant_H_
#include "common.h"
#define CoolantFlashtimer 250
#define CoolantSelfCheckFlashtimer 15
/*** 控制结构 ***/
typedef struct
{
uint8_t Dis_Valid;
uint8_t u8_DestSeg;
uint8_t u8_CurSeg;
uint8_t u8_UpFlashtimer ;
uint8_t u8_DownFlashtimer ;
uint8_t u8_Uptimer ;
uint8_t u8_Downtimer ;
uint8_t u8_Flashflg;
uint8_t u8_Warnflg;
uint8_t u8_Flg;
}DataCoolantTempDisStruct;
extern DataCoolantTempDisStruct DataCoolantTemp_Dis;
typedef struct
{
uint16_t Value;
uint8_t Valid;
}DataCoolantTempStruct; //水温数据结构
void Data_Coolant_Temp_KL30_Init(void);
void Data_Coolant_Temp_KL15_Init(void);
void Data_Coolant_Temp_Processing_Service(void);
void Get_Coolant_Temp_Seg(uint16_t Temp_Value);
void Data_Coolant_Temp_Display ( void );
uint8_t GET_DataCollantTempSegValid(void);
uint8_t GET_DataCoolantTempSegDisp(void);
uint16_t GET_DataCoolantTempValueDisp(void);
uint8_t GET_DataCollantTempWarnflg(void);
extern DataCoolantTempStruct DataCoolantTemp ;
#endif
......@@ -46,11 +46,15 @@ void Data_Engine_Speed_Processing_Service ( void )
uint8_t i;
uint16_t ESpeed;
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步:获取实际转速值及转速有效性
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;
DataESpeedActual = 0;
......@@ -61,15 +65,15 @@ void Data_Engine_Speed_Processing_Service ( void )
if ( DataESpeedValid == 0 )
{
DataESpeedValid = 1;
ESpeed = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed();
ESpeed = Engine_Speed_Value;
ESpeed /= 4;
if ( ESpeed > 11000 )
ESpeed = 11000;
if ( ESpeed > 12000 )
ESpeed = 12000;
DataESpeedActual = ESpeed;
}
else
{
DataESpeedSampler.Buffer[DataESpeedSampler.Cnt] = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed();
DataESpeedSampler.Buffer[DataESpeedSampler.Cnt] = Engine_Speed_Value;
i = DataESpeedSampler.Cnt;
while ( ( i > 0 ) && ( DataESpeedSampler.Buffer[i] < DataESpeedSampler.Buffer[i - 1] ) )
......@@ -86,8 +90,8 @@ void Data_Engine_Speed_Processing_Service ( void )
DataESpeedSampler.Cnt = 0;
ESpeed = DataESpeedSampler.Buffer[3];
ESpeed /= 4;
if ( ESpeed > 11000 )
ESpeed = 11000;
if ( ESpeed > 12000 )
ESpeed = 12000;
DataESpeedActual = ESpeed;
}
}
......@@ -220,8 +224,8 @@ void Data_Engine_Speed_Processing_Service ( void )
else
{
DataESPeedDamping.Speed += Delta;
if ( DataESPeedDamping.Speed > 11000 )
DataESPeedDamping.Speed = 11000;
if ( DataESPeedDamping.Speed > 12000 )
DataESPeedDamping.Speed = 12000;
}
}
else //显示值正在向实际值减小,则维持当前方向调节增加速度
......@@ -269,8 +273,8 @@ void Data_Engine_Speed_Processing_Service ( void )
else
{
DataESPeedDamping.Speed += Delta;
if ( DataESPeedDamping.Speed > 11000 )
DataESPeedDamping.Speed = 11000;
if ( DataESPeedDamping.Speed > 12000 )
DataESPeedDamping.Speed = 12000;
}
}
else //显示值当前是减小方向
......
#include "Application.h"
#include "Data_TPMS\Data_TPMS.h"
\ No newline at end of file
#ifndef _DATA_TPMS_H_
#define _DATA_TPMS_H_
#include "common.h"
#endif
......@@ -339,6 +339,18 @@ uint16_t Get_DispVechileSpeed(void)
return Vspeed;
}
/*外发显示车速,精度10倍,取整,舍去小数点*/
uint16_t Get_DispVechileSpeed_TX(void)
{
uint16_t Vspeed = 0;
if ( DataVSpeedDisp >= 1990 )
{
DataVSpeedDisp = 1990;
}
Vspeed = DataVSpeedDisp;
return Vspeed;
}
......@@ -11,7 +11,7 @@
#define DATA_VSPEED_INC_STEP 2 //速度增加时慢加速速度变化步长
#define DATA_VSPEED_DEC_STEP 6 //方向改变时急减速速度变化步长
#define DATA_VSPEED_APPR_SPEED_MIN 2 //最小逼近速度
#define DATA_VSPEED_HYSTERESIS 10 //回差
#define DATA_VSPEED_HYSTERESIS 15 //回差
/*** 控制结构 ***/
typedef struct
......@@ -69,5 +69,6 @@ uint16_t Get_ActualVechileSpeed(void);
/*显示车速,精度10倍,取整,舍去小数点*/
uint16_t Get_DispVechileSpeed(void);
uint16_t Get_DispVechileSpeed_Mile(void);
uint16_t Get_DispVechileSpeed_TX(void);
#endif
#include "Application.h"
#include "Data_Voltage\Data_Voltage.h"
\ No newline at end of file
#ifndef _DATA_VOLTAGE_H_
#define _DATA_VOLTAGE_H_
#include "common.h"
#endif
#include "FaultCode\FaultCode.h"
#include "Application.h"
#ifndef FAULTCODE_H__
#define FAULTCODE_H__
#include "Application.h"
#include "common.h"
#endif
\ No newline at end of file
......@@ -78,8 +78,7 @@ void Fuel_R_Cal(uint8_t deltaTime)
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)
//{
......@@ -146,7 +145,7 @@ void Fuel_State_Check(uint8_t deltaTime)
// }
// else
if (FuelR >= 1100)
if (FuelR >= 10000)
{ /*断路 320*/
FuelSensorShortTime = 0;
FuelSensorNormalTime = 0;
......@@ -185,7 +184,7 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
{
static uint16_t time = 0;
if ((FuelSensorState == FuelSensorNormal) && (FuelR < 1100))
if ((FuelSensorState == FuelSensorNormal) && (FuelR < 10000))
{ // 32000 //FuelR >10 change FuelR >20
/*采集完第一组数据后,开始计算燃油格数*/
if (FuelADCompleteFlg)
......@@ -226,46 +225,46 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
/*计算目标格数*/
if (FuelDir == FUEL_SEG_UP)
{
if (((DesFuelSetp == 4) || FuelInitFlag) && (FuelR < 240))
if (((DesFuelSetp == 4) || FuelInitFlag) && (FuelR < 130))
{
DesFuelSetp = 5;
}
else if (((DesFuelSetp == 3) || FuelInitFlag) && (FuelR < 430))
else if (((DesFuelSetp == 3) || FuelInitFlag) && (FuelR < 280))
{
DesFuelSetp = 4;
}
else if (((DesFuelSetp == 2) || FuelInitFlag) && (FuelR < 610))
else if (((DesFuelSetp == 2) || FuelInitFlag) && (FuelR < 430))
{
DesFuelSetp = 3;
}
else if (((DesFuelSetp == 1) || FuelInitFlag) && (FuelR < 790))
else if (((DesFuelSetp == 1) || FuelInitFlag) && (FuelR < 630))
{
DesFuelSetp = 2;
}
else if (((DesFuelSetp == 0) || FuelInitFlag) && (FuelR < 970))
else if (((DesFuelSetp == 0) || FuelInitFlag) && (FuelR < 880))
{
DesFuelSetp = 1;
}
}
else if (FuelDir == FUEL_SEG_DOWN)
{
if (((DesFuelSetp == 1) || FuelInitFlag) && (FuelR >= 970))
if (((DesFuelSetp == 1) || FuelInitFlag) && (FuelR >= 880))
{
DesFuelSetp = 0;
}
else if (((DesFuelSetp == 2) || FuelInitFlag) && (FuelR >= 790))
else if (((DesFuelSetp == 2) || FuelInitFlag) && (FuelR >= 630))
{
DesFuelSetp = 1;
}
else if (((DesFuelSetp == 3) || FuelInitFlag) && (FuelR >= 610))
else if (((DesFuelSetp == 3) || FuelInitFlag) && (FuelR >= 430))
{
DesFuelSetp = 2;
}
else if (((DesFuelSetp == 4) || FuelInitFlag) && (FuelR >= 430))
else if (((DesFuelSetp == 4) || FuelInitFlag) && (FuelR >= 280))
{
DesFuelSetp = 3;
}
else if (((DesFuelSetp == 5) || FuelInitFlag) && (FuelR >= 240))
else if (((DesFuelSetp == 5) || FuelInitFlag) && (FuelR >= 130))
{
DesFuelSetp = 4;
}
......@@ -282,22 +281,45 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
time = 0;
CurFuelSetp = DesFuelSetp;
}
if (time >= 10000)
{ /* 10S变化一格 */
if(Get_ActualVechileSpeed() == 0)
{
if (time >= 24000)
{ /* 24S变化一格 */
time = 0;
time = 0;
if (CurFuelSetp < DesFuelSetp)
{
if (CurFuelSetp < DesFuelSetp)
{
CurFuelSetp++;
CurFuelSetp++;
}
else if (CurFuelSetp > DesFuelSetp)
{
CurFuelSetp--;
}
}
else if (CurFuelSetp > DesFuelSetp)
{
}
else
{
if (time >= 360000)
{ /* 360S变化一格 */
time = 0;
if (CurFuelSetp < DesFuelSetp)
{
CurFuelSetp++;
}
else if (CurFuelSetp > DesFuelSetp)
{
CurFuelSetp--;
CurFuelSetp--;
}
}
}
if (CurFuelSetp == DesFuelSetp)
{
time = 0;
......@@ -336,8 +358,6 @@ uint8_t Get_Fuel_Disp_Byte(void)
void Fuel_Cal_Sevice(uint8_t deltaTime)
{
......@@ -359,3 +379,10 @@ FuelSensorSts_t Get_Fuel_Sensor_State(void)
{
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);
extern uint8_t Get_Fuel_Disp_Byte(void);
extern uint8_t Get_CurFuelSetp(void);
extern FuelSensorSts_t Get_Fuel_Sensor_State(void);
uint16_t Get_Fuel_RES(void);
#endif
......@@ -4,6 +4,7 @@
#include "Application.h"
#include "RTE.h"
RTC_Information_st_t g_stRTCInformation;
static void Power_KL30_Init(void);
......@@ -54,6 +55,7 @@ static void Power_KL30_Init(void)
Checkself_Init();
Data_Vehicle_Speed_KL30_Init();
Data_Engine_Speed_KL30_Wakeup_Init();
Data_Coolant_Temp_KL30_Init();
LINE_IN_Init();
Key_KL30_Init_EXample();
Light_Sensor_Init_Example();//注意顺序1
......@@ -139,7 +141,7 @@ static void Power_IG_ON_Init(void)
Telltales_KL15_Init();
Telltales_UserInit();
Fuel_KL15_Init();
Data_Coolant_Temp_KL15_Init();
}
static void Power_Sleep_Init(void)
......
......@@ -55,6 +55,7 @@ void Sys_20ms_Tasks(void)
Key_Auto_Save();
Data_Vehicle_Speed_Processing_Service();
Data_Engine_Speed_Processing_Service();
Data_Coolant_Temp_Processing_Service();
}
void Sys_50ms_Tasks(void)
......
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