Commit 490dac50 authored by hu's avatar hu

调整指示灯

parent 0d1dff89
No preview for this file type
This diff is collapsed.
project .intvect 1536
project .text 299276
project .text 299324
project .rodata 412383
project .secinfo 120
project .syscall 6
project .romdata 7861
project .romdata 7853
project .ROM.ramfunc 208
project .ramfunc 208
......@@ -11,12 +11,12 @@
//-------------------------------------------
static struct
{
uint8_t Value ;
uint8_t Valid ;
uint8_t CurSeg ;
}CoolantVariable ;
uint8_t Value ;
uint8_t Valid ;
uint8_t CurSeg ;
} CoolantVariable ;
static uint8_t CalCoolant_CurSeg(uint8_t Valid,uint8_t Temp);
static uint8_t CalCoolant_CurSeg(uint8_t Valid, uint8_t Temp);
static uint8_t CalCoolant_TarSeg(uint16_t CanMsg);
/*-------------------------------------------------------------------------
* Function Name : Coolant_KL30_Init
......@@ -28,34 +28,34 @@ static uint8_t CalCoolant_TarSeg(uint16_t CanMsg);
--------------------------------------------------------------------------*/
void Coolant_KL30_Init(void)
{
CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0 ;
CoolantVariable.CurSeg = 0 ;
CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0 ;
CoolantVariable.CurSeg = 0 ;
}
void Coolant_KL15_ON_Init(void)
{
CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0 ;
CoolantVariable.CurSeg = 0 ;
CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0 ;
CoolantVariable.CurSeg = 0 ;
}
void Coolant_KL15_OFF_Init(void)
{
CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0 ;
CoolantVariable.CurSeg = 0 ;
CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0 ;
CoolantVariable.CurSeg = 0 ;
}
void Coolant_Wakeup_Init(void)
{
CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0 ;
CoolantVariable.CurSeg = 0 ;
CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0 ;
CoolantVariable.CurSeg = 0 ;
}
void Coolant_Sleep_Init(void)
{
CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0 ;
CoolantVariable.CurSeg = 0 ;
CoolantVariable.Valid = 0 ;
CoolantVariable.Value = 0 ;
CoolantVariable.CurSeg = 0 ;
}
/*-------------------------------------------------------------------------
* Function Name : Coolant_Processing_Service
......@@ -68,56 +68,57 @@ void Coolant_Sleep_Init(void)
static uint8_t wbyTestSeg = 0 ;
void Coolant_Processing_Service(void)
{
static uint8_t Timer2s = 0 ;
static uint8_t Timer2s = 0 ;
uint8_t TargetSeg = 0 ;
uint8_t TargetSeg = 0 ;
uint8_t Msg_CoolTemp = 0 ;
uint8_t Msg_CoolTemp = 0 ;
if(CAN_MSG_Status(ID_CanMsg18FEEE00_Msg_Count) == 0x55u)
{//timeout
CoolantVariable.Valid = 0 ;
Timer2s = 0 ;
}
else
{
Msg_CoolTemp = Get_ID_18FEEE00_Sig_Engine_Coolant_Temperature();
if(Msg_CoolTemp > 0xFA)
{
//if(Timer2s < 100)
//{
// Timer2s ++ ;
//}
//else
{
CoolantVariable.Valid = 0 ;
}
}
else
{
Timer2s = 0 ;
CoolantVariable.Valid = 1 ;
CoolantVariable.Value = Msg_CoolTemp ;
if (CAN_MSG_Status(ID_CanMsg18FEEE00_Msg_Count) == 0x55u)
{
//timeout
CoolantVariable.Valid = 0 ;
Timer2s = 0 ;
}
else
{
Msg_CoolTemp = Get_ID_18FEEE00_Sig_Engine_Coolant_Temperature();
TargetSeg = CalCoolant_TarSeg(Msg_CoolTemp);
}
}
if (Msg_CoolTemp > 0xFA)
{
//if(Timer2s < 100)
//{
// Timer2s ++ ;
//}
//else
{
CoolantVariable.Valid = 0 ;
}
}
else
{
Timer2s = 0 ;
CoolantVariable.Valid = 1 ;
CoolantVariable.Value = Msg_CoolTemp ;
TargetSeg = CalCoolant_TarSeg(Msg_CoolTemp);
}
}
if (Msg_CoolTemp < 40)
{
Msg_CoolTemp = 0 ;
}
else
{
Msg_CoolTemp -= 40 ;
}
//CoolantVariable.CurSeg = CalCoolant_CurSeg(CoolantVariable.Valid,Msg_CoolTemp);
//TargetSeg - 目标段
//CoolantVariable.Valid - 有效值
//CoolantVariable.CurSeg - 当前段
CoolantVariable.CurSeg = Coolant_Temp_Filter(TargetSeg, CoolantVariable.Valid);
if(Msg_CoolTemp < 40)
{
Msg_CoolTemp = 0 ;
}
else
{
Msg_CoolTemp -= 40 ;
}
//CoolantVariable.CurSeg = CalCoolant_CurSeg(CoolantVariable.Valid,Msg_CoolTemp);
//TargetSeg - 目标段
//CoolantVariable.Valid - 有效值
//CoolantVariable.CurSeg - 当前段
CoolantVariable.CurSeg = Coolant_Temp_Filter(TargetSeg, CoolantVariable.Valid);
}
/*-------------------------------------------------------------------------
* Function Name : CalCoolant_TarSeg
......@@ -129,61 +130,61 @@ void Coolant_Processing_Service(void)
--------------------------------------------------------------------------*/
static uint8_t CalCoolant_TarSeg(uint16_t CanMsg)
{
uint8_t TargetSeg = 0 ;
if(CanMsg >= 0x00 && CanMsg <= 0x59)
{
TargetSeg = 0 ;
}
if(CanMsg >= 0x5A && CanMsg <= 0x5E)
{
TargetSeg = 1 ;
}
if(CanMsg >= 0x5F && CanMsg <= 0x64)
{
TargetSeg = 2 ;
}
if(CanMsg >= 0x65 && CanMsg <= 0x69)
{
TargetSeg = 3 ;
}
if(CanMsg >= 0x6A && CanMsg <= 0x6F)
{
TargetSeg = 4 ;
}
if(CanMsg >= 0x70 && CanMsg <= 0x74)
{
TargetSeg = 5 ;
}
if(CanMsg >= 0x75 && CanMsg <= 0x8D)
{
TargetSeg = 6 ;
}
if(CanMsg >= 0x8E && CanMsg <= 0x8F)
{
TargetSeg = 7 ;
}
if(CanMsg >= 0x90 && CanMsg <= 0x91)
{
TargetSeg = 8 ;
}
if(CanMsg >= 0x92 && CanMsg <= 0x93)
{
TargetSeg = 9 ;
}
if(CanMsg >= 0x94 && CanMsg <= 0x95)
{
TargetSeg = 10 ;
}
if(CanMsg == 0x96)
{
TargetSeg = 11 ;
}
if(CanMsg >= 0x97)
{
TargetSeg = 12 ;
}
uint8_t TargetSeg = 0 ;
if (CanMsg >= 0x00 && CanMsg <= 0x59)
{
TargetSeg = 0 ;
}
if (CanMsg >= 0x5A && CanMsg <= 0x5E)
{
TargetSeg = 1 ;
}
if (CanMsg >= 0x5F && CanMsg <= 0x64)
{
TargetSeg = 2 ;
}
if (CanMsg >= 0x65 && CanMsg <= 0x69)
{
TargetSeg = 3 ;
}
if (CanMsg >= 0x6A && CanMsg <= 0x6F)
{
TargetSeg = 4 ;
}
if (CanMsg >= 0x70 && CanMsg <= 0x74)
{
TargetSeg = 5 ;
}
if (CanMsg >= 0x75 && CanMsg <= 0x8D)
{
TargetSeg = 6 ;
}
if (CanMsg >= 0x8E && CanMsg <= 0x8F)
{
TargetSeg = 7 ;
}
if (CanMsg >= 0x90 && CanMsg <= 0x91)
{
TargetSeg = 8 ;
}
if (CanMsg >= 0x92 && CanMsg <= 0x93)
{
TargetSeg = 9 ;
}
if (CanMsg >= 0x94 && CanMsg <= 0x95)
{
TargetSeg = 10 ;
}
if (CanMsg == 0x96)
{
TargetSeg = 11 ;
}
if (CanMsg >= 0x97)
{
TargetSeg = 12 ;
}
return TargetSeg ;
return TargetSeg ;
}
/*-------------------------------------------------------------------------
* Function Name : CalCoolant_CurSeg
......@@ -193,22 +194,22 @@ static uint8_t CalCoolant_TarSeg(uint16_t CanMsg)
* Return : None
* onther : None
--------------------------------------------------------------------------*/
static uint8_t CalCoolant_CurSeg(uint8_t Valid,uint8_t Temp)
static uint8_t CalCoolant_CurSeg(uint8_t Valid, uint8_t Temp)
{
uint8_t u8Result = 0u;
uint8_t u8Result = 0u;
if(Valid)
{
SetGaugesPara(TempGauges,Temp);
u8Result = GetGaugesCurrentPos(TempGauges) ;
}
else
{
//范围外/CAN中断
u8Result = 0 ;
}
if (Valid)
{
SetGaugesPara(TempGauges, Temp);
u8Result = GetGaugesCurrentPos(TempGauges) ;
}
else
{
//范围外/CAN中断
u8Result = 0 ;
}
return u8Result ;
return u8Result ;
}
/*-------------------------------------------------------------------------
* Function Name : Coolant_Get_ActualValue
......@@ -221,12 +222,12 @@ static uint8_t CalCoolant_CurSeg(uint8_t Valid,uint8_t Temp)
uint8_t Coolant_Get_ActualValue(void)
{
uint8_t u8Result = 0u;
u8Result = CoolantVariable.Value ;
u8Result = CoolantVariable.Value ;
return u8Result;
}
/*-------------------------------------------------------------------------
* Function Name : Coolant_Get_Valid
* Description :
* Description :
* Input : None
* Output : None
* Return : None
......@@ -235,7 +236,7 @@ uint8_t Coolant_Get_ActualValue(void)
uint8_t Coolant_Get_Valid(void)
{
uint8_t u8Result = 0u;
u8Result = CoolantVariable.Valid ;
u8Result = CoolantVariable.Valid ;
return u8Result;
}
/*-------------------------------------------------------------------------
......@@ -249,9 +250,6 @@ uint8_t Coolant_Get_Valid(void)
uint8_t Coolant_Get_CurSeg(void)
{
uint8_t u8Result = 0u;
u8Result = CoolantVariable.CurSeg ;
u8Result = CoolantVariable.CurSeg ;
return u8Result;
}
}
\ No newline at end of file
#ifndef _FUELCONFIG_H
#define _FUELCONFIG_H
#ifndef _FUELCONFIG_H
#define _FUELCONFIG_H
typedef unsigned short INT16U;
typedef unsigned char INT8U;
typedef unsigned char INT8U;
typedef unsigned int INT32U;
#define DISPLAY_BOUNDARY_ES 2300
#define DISPLAY_BOUNDARY_1 2060
#define DISPLAY_BOUNDARY_2 1850
#define DISPLAY_BOUNDARY_3 1570
#define DISPLAY_BOUNDARY_4 1430
#define DISPLAY_BOUNDARY_5 1130
#define DISPLAY_BOUNDARY_6 970
#define DISPLAY_BOUNDARY_7 550
#define DISPLAY_BOUNDARY_8 460
#define DISPLAY_BOUNDARY_9 460
#define DISPLAY_BOUNDARY_10 460
#define DISPLAY_BOUNDARY_11 460
#define DISPLAY_BOUNDARY_12 460
#define DISPLAY_BOUNDARY_FS 460
#define BOUNDARY_FUEL_ES 0
#define BOUNDARY_FUEL_1 70
#define BOUNDARY_FUEL_2 130
#define BOUNDARY_FUEL_3 190
#define BOUNDARY_FUEL_4 250
#define BOUNDARY_FUEL_5 310
#define BOUNDARY_FUEL_6 370
#define BOUNDARY_FUEL_7 440
#define BOUNDARY_FUEL_8 510
#define BOUNDARY_FUEL_9 510
#define BOUNDARY_FUEL_10 510
#define BOUNDARY_FUEL_11 510
#define BOUNDARY_FUEL_12 510
#define BOUNDARY_FUEL_FS 510
#define FUEL_R_MIN_VAL 300 //10 X ohm
#define FUEL_R_MAX_VAL 2700 //10 X ohm
//Fuel Config
typedef struct _FuelStruct {
INT16U FuelShortCircuitR;
INT16U FuelOpenCircuitR;
INT16U DisplayZoneBoundary[22];
INT16U FuelCapacityBoundary[22];
}FuelStruct;
#define DISPLAY_BOUNDARY_ES 1500
#define DISPLAY_BOUNDARY_1 1500
#define DISPLAY_BOUNDARY_2 1373
#define DISPLAY_BOUNDARY_3 1191
#define DISPLAY_BOUNDARY_4 1009
#define DISPLAY_BOUNDARY_5 848
#define DISPLAY_BOUNDARY_6 697
#define DISPLAY_BOUNDARY_7 545
#define DISPLAY_BOUNDARY_8 436
#define DISPLAY_BOUNDARY_9 345
#define DISPLAY_BOUNDARY_10 254
#define DISPLAY_BOUNDARY_11 188
#define DISPLAY_BOUNDARY_12 132
#define DISPLAY_BOUNDARY_13 84
#define DISPLAY_BOUNDARY_FS 65
#define BOUNDARY_FUEL_ES 0
#define BOUNDARY_FUEL_1 400
#define BOUNDARY_FUEL_2 720
#define BOUNDARY_FUEL_3 860
#define BOUNDARY_FUEL_4 1040
#define BOUNDARY_FUEL_5 1428
#define BOUNDARY_FUEL_6 2577
#define BOUNDARY_FUEL_7 3750
#define BOUNDARY_FUEL_8 4931
#define BOUNDARY_FUEL_9 5536
#define BOUNDARY_FUEL_10 5724
#define BOUNDARY_FUEL_11 6491
#define BOUNDARY_FUEL_12 6850
#define BOUNDARY_FUEL_13 7199
#define BOUNDARY_FUEL_FS 7600
#define FUEL_R_MIN_VAL 40 // 10 X ohm
#define FUEL_R_MAX_VAL 3000 // 10 X ohm
// Fuel Config
typedef struct _FuelStruct
{
INT16U FuelShortCircuitR;
INT16U FuelOpenCircuitR;
INT16U DisplayZoneBoundary[22];
INT16U FuelCapacityBoundary[22];
} FuelStruct;
extern void InitFuelParamter(FuelStruct *para);
extern INT8U* GetFuelLibVersion(void);
extern INT8U *GetFuelLibVersion(void);
extern void FuelFSM(INT16U FuelResistance); //unit:ohm,accuracy:0.1
extern void FuelFSM(INT16U FuelResistance); // unit:ohm,accuracy:0.1
extern void SetMaxFuelBlockNum(INT8U n); //call after InitFuelParamter(),default 12,max 20
extern void SetMaxFuelBlockNum(INT8U n); // call after InitFuelParamter(),default 12,max 20
extern void SetFuelSensorRecoverGroupCnt(INT16U n); //1:500ms,2:1000ms,3:1500ms.......,range:5s(10)-30min(3600)
extern void SetFuelSensorOpenCircuitGroupCnt(INT16U n); //1:500ms,2:1000ms,3:1500ms.......,range:5s(10)-30min(3600)
extern void SetFuelSensorShortCircuitGroupCnt(INT16U n); //1:500ms,2:1000ms,3:1500ms.......,range:5s(10)-30min(3600)
extern void SetFuelSensorRecoverGroupCnt(INT16U n); // 1:500ms,2:1000ms,3:1500ms.......,range:5s(10)-30min(3600)
extern void SetFuelSensorOpenCircuitGroupCnt(INT16U n); // 1:500ms,2:1000ms,3:1500ms.......,range:5s(10)-30min(3600)
extern void SetFuelSensorShortCircuitGroupCnt(INT16U n); // 1:500ms,2:1000ms,3:1500ms.......,range:5s(10)-30min(3600)
extern void SetPowerSt(INT8U n);
extern INT8U GetFuelSeg(void); //Segment, range:0~8
extern INT8U GetFuelStep(void); //Pointer or Mono TFT stepless,range:0,10~((MaxFuelBlockNum + 1) * 10) 0,10:E, ((MaxFuelBlockNum + 1) * 10):F
extern INT8U GetFuelSeg(void); // Segment, range:0~8
extern INT8U GetFuelStep(void); // Pointer or Mono TFT stepless,range:0,10~((MaxFuelBlockNum + 1) * 10) 0,10:E, ((MaxFuelBlockNum + 1) * 10):F
extern INT16U GetFuelCapacityVal(void); //unit:L,accuracy:0.1
extern INT16U GetFuelCapacityVal(void); // unit:L,accuracy:0.1
enum {
FuelSensorNormal,
FuelSensorShortCircuit,
FuelSensorOpenCircuit,
FuelSensorPreFault,
enum
{
FuelSensorNormal,
FuelSensorShortCircuit,
FuelSensorOpenCircuit,
FuelSensorPreFault,
};
extern INT8U GetFuelSensorState(void);
enum
{
FUEL_ST_IGN_ON_PROCESS = 1, // 1
FUEL_ST_POWER_ON_ADD_FUEL, // 2
FUEL_ST_VEHICLE_RUN, // 3
FUEL_ST_IGN_OFF_PROCESS, // 4
FUEL_ST_IGN_OFF, // 5
};
extern INT8U GetFuelSensorState(void);
enum {
FUEL_ST_IGN_ON_PROCESS = 1, //1
FUEL_ST_POWER_ON_ADD_FUEL, //2
FUEL_ST_VEHICLE_RUN, //3
FUEL_ST_IGN_OFF_PROCESS, //4
FUEL_ST_IGN_OFF, //5
};
extern INT8U GetFuelFSM_St(void);
extern INT16U GetFuelResistance(void); //unit:ohm,accuracy:0.1
extern INT16U GetFuelResistance(void); // unit:ohm,accuracy:0.1
extern void SetPowerDnStep(INT8U step); //call every ign on (after InitFuelParamter())
extern INT8U GetPowerDnStep(void); //every 10km or ign off or refuel(FUEL_ST_POWER_ON_ADD_FUEL->FUEL_ST_VEHICLE_RUN) record
extern void SetPowerDnStep(INT8U step); // call every ign on (after InitFuelParamter())
extern INT8U GetPowerDnStep(void); // every 10km or ign off or refuel(FUEL_ST_POWER_ON_ADD_FUEL->FUEL_ST_VEHICLE_RUN) record
// AFC & DrivingRange
typedef struct _AFC_INIT {
INT8U CalcAFCMaxNum; //max 100km,default 50
INT16U AFCMin; //unit:L,accuracy:0.1
INT16U AFCMax; //unit:L,accuracy:0.1
INT16U AFCPreinstall; //unit:L,accuracy:0.1
INT32U CurODO; // unit:m,accuracy:1
INT32U MaxDRMileage; //unit:km,accuracy:0.01
}AFC_INIT;
typedef struct _AFC_INIT
{
INT8U CalcAFCMaxNum; // max 100km,default 50
INT16U AFCMin; // unit:L,accuracy:0.1
INT16U AFCMax; // unit:L,accuracy:0.1
INT16U AFCPreinstall; // unit:L,accuracy:0.1
INT32U CurODO; // unit:m,accuracy:1
INT32U MaxDRMileage; // unit:km,accuracy:0.01
} AFC_INIT;
extern void InitAFC(AFC_INIT *data);
extern void ResetAFC(AFC_INIT *data);
typedef struct _AFC_PARA {
INT32U CurODO; // unit:m,accuracy:1
INT16U FuleConsume; // unit:ul,accuracy:1
INT16U RPM; // unit:RPM,accuracy:1
INT8U Speed; // unit:km/h,accuracy:1
}AFC_PARA;
typedef struct _AFC_PARA
{
INT32U CurODO; // unit:m,accuracy:1
INT16U FuleConsume; // unit:ul,accuracy:1
INT16U RPM; // unit:RPM,accuracy:1
INT8U Speed; // unit:km/h,accuracy:1
} AFC_PARA;
extern void SetAFCPara(AFC_PARA *data);
typedef struct _DAFC_PARA{
INT32U DAFC_FuelConsumeSum; //unit:ul (ul:m->ml:km->L:1000km)
INT32U DAFC_ODO; //unit:m
}DAFC_PARA;
extern void DAFC_GetPowerDownPara(DAFC_PARA *data); //call every 10km or ign off or reset afc
extern void DAFC_SetPowerDownPara(DAFC_PARA *data); //call every KL30 OFF -> KL30 ON (after InitAFC())
typedef struct _DR_PARA{
INT32U DR_FuelConsumeSum; //unit:ul (ul:m->ml:km->L:1000km)
INT32U DR_Mileage; //unit:km,accuracy:0.01
}DR_PARA;
extern void DR_GetPowerDownPara(DR_PARA *data); //call every 10km or ign off
extern void DR_SetPowerDownPara(DR_PARA *data); //call every KL30 OFF -> KL30 ON (after InitAFC())
extern void AFCTimerCall(void); //must per 10ms interrupt
extern INT16U GetDRMileage(void); //unit:km,accuracy:1
extern INT16U GetCurAFC(void); //unit:L,accuracy:0.1
//display afc
typedef struct _DAFC_PARA
{
INT32U DAFC_FuelConsumeSum; // unit:ul (ul:m->ml:km->L:1000km)
INT32U DAFC_ODO; // unit:m
} DAFC_PARA;
extern void DAFC_GetPowerDownPara(DAFC_PARA *data); // call every 10km or ign off or reset afc
extern void DAFC_SetPowerDownPara(DAFC_PARA *data); // call every KL30 OFF -> KL30 ON (after InitAFC())
typedef struct _DR_PARA
{
INT32U DR_FuelConsumeSum; // unit:ul (ul:m->ml:km->L:1000km)
INT32U DR_Mileage; // unit:km,accuracy:0.01
} DR_PARA;
extern void DR_GetPowerDownPara(DR_PARA *data); // call every 10km or ign off
extern void DR_SetPowerDownPara(DR_PARA *data); // call every KL30 OFF -> KL30 ON (after InitAFC())
extern void AFCTimerCall(void); // must per 10ms interrupt
extern INT16U GetDRMileage(void); // unit:km,accuracy:1
extern INT16U GetCurAFC(void); // unit:L,accuracy:0.1
// display afc
extern void DAFC_Reset(AFC_INIT *data);
extern INT16U DAFC_GetAFC(void); //unit:L,accuracy:0.1
//display afc end
#endif
extern INT16U DAFC_GetAFC(void); // unit:L,accuracy:0.1
// display afc end
extern void SetIgnOffRefuelThreshold(uint8_t data);
#endif
......@@ -10,7 +10,7 @@ uint16_t Speed_PPK_Calc(uint16_t V_Speed, uint16_t m_PPK)
{
uint32_t Frequency;
Frequency = (uint32_t)V_Speed / 10u;
Frequency = (uint32_t)(Frequency * m_PPK / 10u);
Frequency = (uint32_t)(Frequency * m_PPK);
Frequency = Frequency / 3600u;
return (uint16_t)Frequency;
}
......
......@@ -11,7 +11,7 @@ static struct
uint16_t Data[VEH_FILTER_LEN];
} VehcleFilter;
static uint32_t SPEED_PPK = 159246ul;
static uint32_t SPEED_PPK = 15925ul;
static uint32_t SPEED_RADIO = 637;
uint16_t Vehicle_ACT_Speed;
......@@ -34,7 +34,7 @@ void Speed_KL30_Init(void)
VehcleFilter.Data[i] = 0;
}
Set_Speed_PPK(159246ul);
Set_Speed_PPK(SPEED_RADIO);
}
void Speed_KL15_ON_Init(void)
{
......@@ -49,7 +49,7 @@ void Speed_KL15_ON_Init(void)
VehcleFilter.Data[i] = 0;
}
Veh_Fre_Init(Get_Speed_PPK() / 10);
Veh_Fre_Init(Get_Speed_PPK());
}
void Speed_KL15_OFF_Init(void)
{
......@@ -93,31 +93,13 @@ void Speed_Processing_Service(void)
{
uint32_t VehValTmp = 0u;
uint32_t PPK = 0u;
// if(Get_Veh_Fre_Event())
//{
// VehValTmp = Cal_VehSpeed(Get_Veh_Fre(),VEH_FILTER_LEN) ;
// VehValTmp *= 3600 ;
// VehValTmp *= 10 ;
// VehValTmp *= 10 ;
// VehValTmp /= PPK ;
// Vehicle_ACT_Speed = VehValTmp ;
//}
PPK = Get_Speed_PPK();
VehValTmp = Cal_Veh_Frequency();
VehValTmp *= 3600;
VehValTmp *= 10;
VehValTmp *= 10;
VehValTmp *= 36000u;
VehValTmp /= PPK;
// VehValTmp = Cal_Veh_Frequency();
// VehValTmp *= 3600 ;
// VehValTmp *= 10 ;
// VehValTmp /= PPK ;
if (VehValTmp > 2250)
{
VehValTmp = 0;
......
......@@ -334,8 +334,8 @@ 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 / (220u * PPK)) / 4u / 50u;
//VehFreLimit = (3600000000u / (250u * PPK)) / 4u / 50u;
}
/*-------------------------------------------------------------------------
......
GetVehDisValGetVehDisVal#include "GaugesInterface.h"
#include "GaugesInterface.h"
#include "Menu.h"
/**@struct _GaugesInfoInit
*this is _GaugesInfoInit
......
......@@ -28,19 +28,22 @@ typedef struct
uint16_t u16KeyValidTimeCount;
uint16_t u16KeyFirstIGNTimeRecord;
Key_IGN_en_t enKeyIGNFirstStatus;
Key_IGN_en_t enKeyIGNStatusLast;
uint8_t u8KeyIGNChangeFlag;
uint16_t u16KeyIGNTimeCount;
} Key_Ctr_st_t;
/*------------------------------------------------------------------------------------------*/
#pragma ghs section bss=".myNonInitArea"
#pragma ghs section bss = ".myNonInitArea"
static Key_Parameter_st_t stKeyParameter;
#pragma ghs section bss=default
#pragma ghs section bss = default
static Key_Ctr_st_t stKeyCtrVariate[KEY_NUM_MAX];
//static Key_IGN_en_t enKeyIGNFirstStatus = KEY_IG_INVALID;
static Key_IGN_en_t enKeyIGNStatusLast = KEY_IG_INVALID;
static uint8_t u8KeyIGNChangeFlag = 0U;
static uint16_t u16KeyIGNTimeCount;
//static Key_IGN_en_t enKeyIGNStatusLast = KEY_IG_INVALID;
//static uint8_t u8KeyIGNChangeFlag = 0U;
//static uint16_t u16KeyIGNTimeCount;
/*-----------------------------------------------------------------------------------------*/
static void Key_Process(Key_Num_en_t enKeyIndex);
......@@ -149,9 +152,9 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
stKeyCtrVariate[enKeyIndex].enKeyTypeLast = KEY_LINE_LOOSEN;
stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord = 0U;
stKeyCtrVariate[enKeyIndex].enKeyIGNFirstStatus = KEY_IG_INVALID;
enKeyIGNStatusLast = KEY_IG_INVALID;
u8KeyIGNChangeFlag = 0U;
u16KeyIGNTimeCount = 0U;
stKeyCtrVariate[enKeyIndex].enKeyIGNStatusLast = KEY_IG_INVALID;
stKeyCtrVariate[enKeyIndex].u8KeyIGNChangeFlag = 0U;
stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount = 0U;
}
if ((stKeyCtrVariate[enKeyIndex].u16KeyInvalidTimeCount >= stKeyParameter.u16KeyLoosenTime) &&
(stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount >= stKeyParameter.u16KeyShortPressTime) &&
......@@ -172,29 +175,29 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount = 0U;
stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord = 0U;
stKeyCtrVariate[enKeyIndex].enKeyTypeLast = enKeyRealType;
u16KeyIGNTimeCount = 0U;
stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount = 0U;
stKeyCtrVariate[enKeyIndex].enKeyIGNFirstStatus = enKeyIGNRealStatus;
enKeyIGNStatusLast = enKeyIGNRealStatus;
stKeyCtrVariate[enKeyIndex].enKeyIGNStatusLast = enKeyIGNRealStatus;
}
else
{
if (enKeyIGNStatusLast != enKeyIGNRealStatus)
if (stKeyCtrVariate[enKeyIndex].enKeyIGNStatusLast != enKeyIGNRealStatus)
{
enKeyIGNStatusLast = enKeyIGNRealStatus;
stKeyCtrVariate[enKeyIndex].enKeyIGNStatusLast = enKeyIGNRealStatus;
if (stKeyCtrVariate[enKeyIndex].enKeyIGNFirstStatus != enKeyIGNRealStatus)
{
stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord = u16KeyIGNTimeCount;
stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord = stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount;
}
u16KeyIGNTimeCount = 0U;
stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount = 0U;
}
else
{
if (u16KeyIGNTimeCount < 0xFFF0U)
if (stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount < 0xFFF0U)
{
u16KeyIGNTimeCount += KEY_CALL_CYCLE;
stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount += KEY_CALL_CYCLE;
}
}
......@@ -204,14 +207,14 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
}
if (stKeyCtrVariate[enKeyIndex].enKeyIGNFirstStatus != enKeyIGNRealStatus)
{
u8KeyIGNChangeFlag = 1U;
stKeyCtrVariate[enKeyIndex].u8KeyIGNChangeFlag = 1U;
}
if (stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount >= stKeyParameter.u16KeyShortPressTime)
{
stKeyCtrVariate[enKeyIndex].u16KeyInvalidTimeCount = 0U;
}
if (u8KeyIGNChangeFlag == 0U)
if (stKeyCtrVariate[enKeyIndex].u8KeyIGNChangeFlag == 0U)
{
if (stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount >= stKeyParameter.u16KeySuperLongPressTime)
{
......@@ -235,12 +238,13 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
if (enKeyIGNRealStatus == KEY_IG_ON)
{
if ((stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord >= stKeyParameter.u16KeyValidOFFTime) &&
(u16KeyIGNTimeCount >= stKeyParameter.u16KeyValidONTime))
(stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount >= stKeyParameter.u16KeyValidONTime))
{
if (stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack != 0U)
{
stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack(KEY_EVENT_OFF_TO_ON);
}
stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord = 0U;
}
}
}
......@@ -249,12 +253,13 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
if (enKeyIGNRealStatus == KEY_IG_OFF)
{
if ((stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord >= stKeyParameter.u16KeyValidONTime) &&
(u16KeyIGNTimeCount >= stKeyParameter.u16KeyValidOFFTime))
(stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount >= stKeyParameter.u16KeyValidOFFTime))
{
if (stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack != 0U)
{
stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack(KEY_EVENT_ON_TO_OFF);
}
stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord = 0U;
}
}
}
......@@ -292,11 +297,18 @@ void Key_Init(void)
stKeyCtrVariate[i].enKeyTypeLast = KEY_CAN_NONE;
stKeyCtrVariate[i].u16KeyInvalidTimeCount = 0U;
stKeyCtrVariate[i].u16KeyValidTimeCount = 0U;
stKeyCtrVariate[i].u16KeyFirstIGNTimeRecord = 0U;
stKeyCtrVariate[i].enKeyIGNFirstStatus = KEY_IG_INVALID;
stKeyCtrVariate[i].enKeyIGNStatusLast = KEY_IG_INVALID;
stKeyCtrVariate[i].u8KeyIGNChangeFlag = 0U;
stKeyCtrVariate[i].u16KeyIGNTimeCount = 0U;
}
stKeyParameter.u16KeyLoosenTime = 50U;
stKeyParameter.u16KeyShortPressTime = 40U;
stKeyParameter.u16KeyLongPressTime = 2000U;
stKeyParameter.u16KeySuperLongPressTime = 30000U;
stKeyParameter.u16KeyValidOFFTime = 200U;/*按键动作时间*/
stKeyParameter.u16KeyValidONTime = 1000U;
}
/*对于硬线按键而言,判断短按的时间参数*/
Key_Set_en_t Key_Parameter_Set_Short_Press_Time(uint16_t u16Time)
......
......@@ -70,7 +70,7 @@ typedef struct
Popuplib_uint8_t Class;
const Popuplib_uint8_t *pMbrList;
Popuplib_uint8_t MbrCnt;
Popuplib_uint8_t Message;
Popuplib_uint16_t Message;
Popuplib_uint8_t DispMode;
Popuplib_uint8_t Snd;
Popuplib_uint8_t SndMode;
......
This diff is collapsed.
#ifndef GPIO_H__
#define GPIO_H__
#include "dr7f701441.dvf.h"
/* --- PORT Data Direction --- */
......@@ -457,8 +458,8 @@
#define ADC_AIR2 GPIO_IN_PORT10_PIN09
#define ADC_AIR GPIO_IN_PORT10_PIN10
#define ADC_KEY GPIO_IN_PORT10_PIN11
#define T1_LED_OUT GPIO_OUT_PORT11_PIN00
#define R5_LED_OUT GPIO_OUT_PORT11_PIN01
#define RR_DIFF_LOCK_MCU GPIO_OUT_PORT11_PIN00
#define BRAKE_AIR_EBS_LED_MCU GPIO_OUT_PORT11_PIN01
#define CD4051A_COM6_MCU_IN GPIO_IN_PORT11_PIN02
#define CD4051A_COM7_MCU_IN GPIO_IN_PORT11_PIN03
#define CD4051A_COM1_MCU_IN GPIO_IN_PORT16_PIN00
......
......@@ -577,8 +577,8 @@ void TimerB_PWM_Init(void)
TimerB_VehFreOut_Init();
TimerB_EngFreOut_Init();
TimerB_Input_Channel_Init(TIMERB_0_CH2, TIMERB_CLOCK_3, TIMERB_RISING); //车速输入捕获
TimerB_Input_Channel_Start(TIMERB_0_CH2);
//TimerB_Input_Channel_Init(TIMERB_0_CH2, TIMERB_CLOCK_3, TIMERB_RISING); //车速输入捕获
//TimerB_Input_Channel_Start(TIMERB_0_CH2);
}
static void TimerB_PWM_Master_Channel_Init(TIMERB_Channel_en_t enTimerBChannel, TIMERB_Clock_en_t enTimerBClock)
{
......
......@@ -93,17 +93,17 @@ void Sys_Startup_Init(void)
/* init graphic tick driver */
R_TICK_Init(0);
Gfx_Init(GFX_VO_SINGLE_RGB888/* | GFX_VI_ITU656*/);
Gfx_Init(GFX_VO_SINGLE_RGB888 | GFX_VI_ITU656);
CPU_Init();
RTC_Init();
Sys_Tick_Timer_Start();
COM_CAN_Init();
/*COM_CAN_Init(); 原CAN初始化位置*/
RTE_ADC_Init();
InitSeriFlashExternReadMode();
Int_Flash_Init();
EEPROM_Init();
......@@ -113,7 +113,11 @@ void Sys_Startup_Init(void)
d_printf("Init complete!\n");
InitSeriFlashExternReadMode();
/*30电数据初始化*/
APP_Startup_Init(Clock_Get_Startup_Mode());
/*外发要用到EEP数据,位置移动*/
COM_CAN_Init();
Gfx_Sys_Start();
}
......
......@@ -137,6 +137,7 @@ void Sys_Run_Mode_5ms_Tasks(void)
------------------------------------------------------------------------------*/
void Sys_Run_Mode_10ms_Tasks(void)
{
DisplayServices();
loc_Display_Service();
Data_Mileage_Write_EEPROM();
Line_In_Debounce_Service();
......@@ -144,7 +145,7 @@ void Sys_Run_Mode_10ms_Tasks(void)
// Test_LED_AllLight();
Key_Service();
CAN_BUSOFF_Recover();
DisplayServices();
/*表头调度函数 added by yutian*/
UserGaugeSchedule(); /*在主循环中调用*/
/*end*/
......
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