Commit 89e57de4 authored by 张金硕's avatar 张金硕

feat:新增佳伟的水温部分逻辑和水温表走格贴图

parent b0870e31
...@@ -738,6 +738,16 @@ ...@@ -738,6 +738,16 @@
<FileType>5</FileType> <FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\BlueTooth.h</FilePath> <FilePath>..\..\..\..\Source\Application\BlueTooth.h</FilePath>
</File> </File>
<File>
<FileName>Hysteresis.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\Hysteresis.h</FilePath>
</File>
<File>
<FileName>Hysteresis_V10_239.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Application\Hysteresis_V10_239.lib</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
......
#include "Data_Coolant.h" #include "Data_Coolant.h"
#include "Components.h" #include "Components.h"
#include "Hysteresis.h"
#define FAST_TIME 20 //20*20 400ms变化一格
#define NORMAL_TIME 500 //500*20 10s变化一格
#define Disconnected_TIME 25 //掉线时间
#pragma ghs section bss = ".myNonInitArea"
//_Data_Cng Data_Cng_Percent;
//_Data_Cng Data_Cng_Pressure;
Hys_uint8_t u8HysRamData[HYS_RAM_DATA_LEN];
#pragma ghs section bss = default
#define Coolant_DATA_TIME 25u /*这里填写多长时间采集一个数据,单位ms*/ DataCoolantTempStruct DataCoolantTemp ;
#define Coolant_DATA_NUM 20u /*燃油电阻采集数据总数 最大255*/ DataCoolantTempDisStruct DataCoolantTemp_Dis;
#define Coolant_CAL_START 5u /*数据排序后取中间部分计算平均:起始*/
#define Coolant_CAL_END 15u /*数据排序后取中间部分计算平均:结束*/
#define RETURN_DIFFERENCE 25u /*判断上升或下降的回差,精度0.1*/ DataCoolantTempSamplerStruct DataResCoolantTempSampler ;
#define Coolant_SEG_UP 0u uint8_t u8SelfCheckTime;
#define Coolant_SEG_DOWN 1u uint8_t u8SelfCheckTime_Finish;
#define SelfCheckTime 60
uint16_t TEMP_SPEED;
uint16_t time_temp;
uint16_t time_power_on = 0;
uint16_t time_lost = 0;
uint16_t g_u16CoolantData[Coolant_DATA_NUM]; const HYS_Seg_Table_st_t stHYSSegTableCng[9] =
uint8_t g_u8CoolantDataCount = 0u; {
{0,529},
{550, 609},
{630, 689},
{710, 859},
{880, 939},
{960, 1019},
{1040, 1099},
{1120, 1179},
{1200,0xFFFF},
};
/*为了过QAC用的,实际完全不会使用*/
const HYS_Seg_Table_st_t stHYSSegTablePWM[3] =
{
{0U, 40U},
{50U, 60U},
{70U, 100U},
};
uint16_t CoolantR = 0u; /*滤波后的燃油电阻,精度0.1*/ const HYS_Attribute_st_t stHysAttribute[HYS_NUM_MAX] =
static uint16_t CoolantRBak = 0; {
{stHYSSegTableCng, 0U, 7U, 1U},
{stHYSSegTablePWM, 0U, 3U, 1U}, /*为了过QAC用的,实际完全不会使用*/
};
uint8_t g_u8DesCoolantSetp = 0u; uint16_t Coolant_Res[Coolant_LEN] =
uint8_t g_u8CurCoolantSetp = 0u; {
uint8_t g_u8CoolantInitFlag = 0u; 3000,
uint8_t g_u8CoolantStateInitFlag = 0u; 1540,
uint8_t g_u8CoolantDir = Coolant_SEG_UP; 1510,
CoolantSensorSts_t CoolantSensorState = CoolantSensorNormal; 1130,
uint16_t g_u16CoolantSensorNormalTime = 0u; 1100,
uint16_t g_u16CoolantSensorShortTime = 0u; 990,
uint16_t g_u16CoolantSensorOpenTime = 0u; 960,
uint8_t g_u8CoolantADCompleteFlg = 0u; 850,
820,
680,
650,
500,
470,
410,
380,
230,
200,
};
uint16_t Coolant_Temp[Coolant_LEN] =
{
0,
52,
55,
60,
63,
68,
71,
85,
88,
93,
96,
101,
104,
109,
112,
117,
120,
} ;
void Coolant_KL30_Init(void) /*
* DataCoolantTemp.Temp_Value 当前温度值
* DataCoolantTemp.u8Res_Valid AD采集的数据是否有效
* DataCoolantTemp.u8Res_ADValid AD采集是否有效
* DataCoolantTemp.TEMPMode 此时水温表所在状态
* DataCoolantTemp_Dis.u8_CurSeg 当前格数
* DataCoolantTemp.TEMPSetp 目标个数
*/
void TEMP_KL30_Init ( void )
{ {
g_u8DesCoolantSetp = 0u; DataCoolantTemp.Temp_Value = 0;
g_u8CurCoolantSetp = 0u; DataCoolantTemp.u8Can_Valid = 0;
g_u8CoolantInitFlag = 1u; DataCoolantTemp.u16Can_Actual = 0;
g_u8CoolantStateInitFlag = 1u; DataCoolantTemp.u8Res_Valid = 0 ;
g_u8CoolantDir = Coolant_SEG_UP; DataCoolantTemp.u16Res_ADValue = 0;
CoolantSensorState = CoolantSensorNormal; DataCoolantTemp.u8Res_ADValid = 0;
g_u16CoolantSensorNormalTime = 0u;
g_u16CoolantSensorShortTime = 0u; DataResCoolantTempSampler.Cnt = 0;
g_u16CoolantSensorOpenTime = 0u; DataCoolantTemp.TEMPMode = 0;
g_u8CoolantADCompleteFlg = 0u; DataCoolantTemp_Dis.u8_CurSeg = 0;
DataCoolantTemp.TEMPSetp = 0;
TEMP_SPEED = 0;
time_power_on = 0;
time_lost = 0;
time_temp = 0;
HYS_Init_st_t stHYSInit;
stHYSInit.u8HYSNum = HYS_NUM_MAX;
HYS_KL30_Init(&u8HysRamData[0], stHysAttribute, &stHYSInit);
} }
void Coolant_KL15_Init(void) void TEMP_KL15_Init ( void )
{ {
g_u8DesCoolantSetp = 0u;
g_u8CurCoolantSetp = 0u; DataCoolantTemp.Temp_Value = 0;
g_u8CoolantInitFlag = 1u; DataCoolantTemp.u8Can_Valid = 0;
g_u8CoolantStateInitFlag = 1u; DataCoolantTemp.u16Can_Actual = 0;
g_u8CoolantDir = Coolant_SEG_UP; DataCoolantTemp.u8Res_Valid = 0 ;
CoolantSensorState = CoolantSensorNormal; DataCoolantTemp.u16Res_ADValue = 0;
g_u16CoolantSensorNormalTime = 0u; DataCoolantTemp.u8Res_ADValid = 0;
g_u16CoolantSensorShortTime = 0u; DataCoolantTemp_Dis.u8_CurSeg = 0;
g_u16CoolantSensorOpenTime = 0u; DataResCoolantTempSampler.Cnt = 0;
g_u8CoolantADCompleteFlg = 0u; DataCoolantTemp.TEMPMode = 0;
TEMP_SPEED = 0;
time_power_on = 0;
time_lost = 0;
time_temp = 0;
} }
void Coolant_R_Cal(uint8_t deltaTime) void Data_Coolant_Temp_Processing_Service ( void )
{ {
uint16_t CoolantRes = 0; uint16_t Coolant_Temperature;
uint8_t i, j; uint32_t Temp;
uint32_t temp32; uint8_t i;
static uint16_t timeCount = 0;
if (g_u8CoolantStateInitFlag) Coolant_Temperature = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature();
//can
if (SYS_OPR_STAT_IGN_ON )
{ {
CoolantR = ADC_Read_Signal(ADC_CH_COOLANT_TEMP1_R); //can
if( (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_101_Msg_Count) == CAN_SIG_LOST))
{
DataCoolantTemp.u8Can_Valid = 0;
DataCoolantTemp.u16Can_Actual = 0;
} }
else
if (timeCount >= Coolant_DATA_TIME)
{ {
timeCount = 0; if(Coolant_Temperature >= 0x6338)
if (g_u8CoolantDataCount < Coolant_DATA_NUM)
{ {
/*获取燃油电阻*/ DataCoolantTemp.u8Can_Valid = 0;
CoolantRes = ADC_Read_Signal(ADC_CH_COOLANT_TEMP1_R); DataCoolantTemp.u16Can_Actual = 0;
}
/*四舍五入*/ else
if (CoolantRes < 3100) {
DataCoolantTemp.u8Can_Valid = 1;
if(Coolant_Temperature >= 2730)
{ {
if (CoolantRes % 10 >= 5) Coolant_Temperature -= 2730;
}
else if(Coolant_Temperature <= 2430)
{ {
CoolantRes += 5; Coolant_Temperature =0;
DataCoolantTemp.u8Can_Valid = 0;
}
else
{
Coolant_Temperature =0;
}
DataCoolantTemp.u16Can_Actual = Coolant_Temperature;
}
} }
} }
else else
{ {
CoolantRes = 0xFFFF; DataCoolantTemp.u8Can_Valid = 0;
DataCoolantTemp.u16Can_Actual = 0;
} }
/*由小到大插入数据*/ //Res
for (i = 0; i < g_u8CoolantDataCount; i++) if(ADC_Read_Signal_Valid(ADC_CH_COOLANT_TEMP1_R) == 0)
{ {
if (CoolantRes < g_u16CoolantData[i]) DataCoolantTemp.u8Res_ADValid = 0;
DataResCoolantTempSampler.Cnt = 0;
DataCoolantTemp.u16Res_ADValue = 65535;
DataCoolantTemp.u8Res_Flashtimer = 0;
}
else
{ {
break; DataCoolantTemp.u8Res_Flashtimer ++;
if(DataCoolantTemp.u8Res_Flashtimer >= 5)
{
DataCoolantTemp.u8Res_Flashtimer = 5;
if(DataCoolantTemp.u8Res_ADValid == 0)
{
DataCoolantTemp.u16Res_ADValue = ADC_Read_Signal(ADC_CH_COOLANT_TEMP1_R);
DataCoolantTemp.u8Res_ADValid = 1;
} }
else
{
DataResCoolantTempSampler.Buffer[DataResCoolantTempSampler.Cnt] = ADC_Read_Signal(ADC_CH_COOLANT_TEMP1_R);
i = DataResCoolantTempSampler.Cnt;
while ((i > 0) && (DataResCoolantTempSampler.Buffer[i] < DataResCoolantTempSampler.Buffer[i - 1]))
{
Temp = DataResCoolantTempSampler.Buffer[i];
DataResCoolantTempSampler.Buffer[i] = DataResCoolantTempSampler.Buffer[i - 1];
DataResCoolantTempSampler.Buffer[i - 1] = Temp;
i--;
} }
for (j = g_u8CoolantDataCount; j > i; j--)
DataResCoolantTempSampler.Cnt++;
if (DataResCoolantTempSampler.Cnt >= 5)
{ {
g_u16CoolantData[j] = g_u16CoolantData[j - 1]; DataResCoolantTempSampler.Cnt = 0;
Temp = (DataResCoolantTempSampler.Buffer[1]+DataResCoolantTempSampler.Buffer[2]+DataResCoolantTempSampler.Buffer[3])/3;
DataCoolantTemp.u16Res_ADValue = (uint16_t)(Temp);
}
} }
g_u16CoolantData[i] = CoolantRes; }
g_u8CoolantDataCount++; }
if((ADC_Read_Signal_Valid(ADC_CH_COOLANT_TEMP1_R) == 0)||(DataCoolantTemp.u8Res_Flashtimer < 5))
{
DataCoolantTemp.u8Res_Valid = 0 ;
DataCoolantTemp.u16Res_Actual = 0;
DataResCoolantTempSampler.ResOpen_ActTimer = 10;
DataResCoolantTempSampler.ResOpen_InActTimer = 25;
} }
else else
{ {
/*一组数据采集完毕,取中间部分计算平均值*/ if((DataCoolantTemp.u8Res_ADValid)&&(DataCoolantTemp.u16Res_ADValue >= 3000))
temp32 = 0; {
for (i = Coolant_CAL_START; i < Coolant_CAL_END; i++) if(DataResCoolantTempSampler.ResOpen_ActTimer < 10)
{ {
temp32 += g_u16CoolantData[i]; DataResCoolantTempSampler.ResOpen_ActTimer++;
} }
CoolantR = temp32 / (Coolant_CAL_END - Coolant_CAL_START); else
g_u8CoolantDataCount = 0; {
g_u8CoolantADCompleteFlg = 1; DataCoolantTemp.u8Res_Valid = 0 ;
DataCoolantTemp.u16Res_Actual = 0 ;
DataResCoolantTempSampler.ResOpen_InActTimer = 0;
} }
} }
timeCount += deltaTime; else
} {
if(DataResCoolantTempSampler.ResOpen_InActTimer < 5)
void Coolant_State_Check(uint8_t deltaTime) {
{ DataResCoolantTempSampler.ResOpen_InActTimer++;
// if (CoolantR < 30)
// { /*短路3*/
// g_u16CoolantSensorOpenTime = 0;
// g_u16CoolantSensorNormalTime = 0;
// if ((g_u16CoolantSensorShortTime > 3000) || ((g_u8CoolantStateInitFlag) && (g_u16CoolantSensorShortTime > 3000)))
// {
// CoolantSensorState = CoolantSensorShortCircuit;
// g_u8DesCoolantSetp = 0;
// g_u8CurCoolantSetp = 6;
// g_u8CoolantStateInitFlag = 0;
// g_u8CoolantInitFlag = 1;
// g_u8CoolantDir = Coolant_SEG_UP;
// }
// else
// {
// g_u16CoolantSensorShortTime += deltaTime;
// }
// }
if (CoolantR > 3000)
{ /*开路 300*/
g_u16CoolantSensorShortTime = 0;
g_u16CoolantSensorNormalTime = 0;
if ((g_u16CoolantSensorOpenTime > 3000) || ((g_u8CoolantStateInitFlag) && (g_u16CoolantSensorOpenTime > 3000)))
{
CoolantSensorState = CoolantSensorOpenCircuit;
g_u8DesCoolantSetp = 0;
g_u8CurCoolantSetp = 0;
g_u8CoolantStateInitFlag = 0;
g_u8CoolantInitFlag = 1;
g_u8CoolantDir = Coolant_SEG_UP;
} }
else else
{ {
g_u16CoolantSensorOpenTime += deltaTime; DataCoolantTemp.u8Res_Valid = 1 ;
DataResCoolantTempSampler.ResOpen_ActTimer = 0;
if(DataCoolantTemp.u16Res_ADValue < 3000)
{
DataCoolantTemp.u16Res_Actual = Get_Coolant_Res_To_Temp(DataCoolantTemp.u16Res_ADValue);
}
}
}
}
if (DataCoolantTemp.u8Can_Valid ==1)
{
DataCoolantTemp.Temp_Value = DataCoolantTemp.u16Can_Actual;
} }
else if( DataCoolantTemp.u8Res_Valid ==1)
{
DataCoolantTemp.Temp_Value = DataCoolantTemp.u16Res_Actual;
} }
else else
{ {
g_u16CoolantSensorShortTime = 0; DataCoolantTemp.Temp_Value = 0;
g_u16CoolantSensorOpenTime = 0; }
if (g_u16CoolantSensorNormalTime > 3000)
TEMP_Gauges_Cal();
time_power_on++;
if(time_power_on >= 100)//上电延时获取数据
{
time_power_on = 100;
if(DataCoolantTemp.u8Can_Valid||DataCoolantTemp.u8Res_Valid)
{
time_lost = 0;
if(DataCoolantTemp.TEMPMode == 3)//掉线
{
TEMP_SPEED = FAST_TIME;
}
else if(DataCoolantTemp.TEMPMode == 0)//自检
{ {
CoolantSensorState = CoolantSensorNormal; DataCoolantTemp_Dis.u8_CurSeg = DataCoolantTemp.TEMPSetp;
g_u8CoolantStateInitFlag = 0; }
if(DataCoolantTemp.TEMPMode == 3)
{
DataCoolantTemp.TEMP_Fastime = 100;
}
DataCoolantTemp.TEMPMode = 1;
} }
else else
{ {
g_u16CoolantSensorNormalTime += deltaTime; time_lost++;
if(time_lost >= Disconnected_TIME)
{
time_lost = Disconnected_TIME;
if(DataCoolantTemp.TEMPMode != 3)
{
DataCoolantTemp.TEMPMode = 3;
TEMP_SPEED = NORMAL_TIME;
}
DataCoolantTemp.TEMPSetp = 0;
}
}
}
time_temp ++;
if(DataCoolantTemp.TEMP_Fastime>0)
{
DataCoolantTemp.TEMP_Fastime--;
}
if(DataCoolantTemp.TEMP_Fastime==0)
{
if(DataCoolantTemp.TEMPSetp == DataCoolantTemp_Dis.u8_CurSeg)
{
TEMP_SPEED = NORMAL_TIME;
time_temp = 0;
}
}
if(time_temp>=TEMP_SPEED)
{
time_temp = 0;
if(DataCoolantTemp.TEMPSetp > DataCoolantTemp_Dis.u8_CurSeg)
{
DataCoolantTemp_Dis.u8_CurSeg++;
} }
else if(DataCoolantTemp.TEMPSetp < DataCoolantTemp_Dis.u8_CurSeg)
{
DataCoolantTemp_Dis.u8_CurSeg--;
} }
}
}
//硬线数据
uint16_t Get_Coolant_Res_To_Temp(uint16_t Temp_Res)
{
uint16_t TempValue = 0;
TempValue = Get_Res_To_Temp(Coolant_Res, Coolant_Temp, Coolant_LEN, Temp_Res) ;
return TempValue*10;
} }
void Coolant_Gauges_Cal(uint8_t deltaTime)
void TEMP_Gauges_Cal(void)//计算目标格数
{ {
static uint16_t time = 0;
if ((CoolantSensorState == CoolantSensorNormal) && (CoolantR <= 3000)) // && (CoolantR >= 30) DataCoolantTemp.TEMPSetp = 0;
HYS_Physical_Quantity_Input(HYS_TEMP, DataCoolantTemp.Temp_Value);
DataCoolantTemp.TEMPSetp = HYS_Get_Seg(HYS_TEMP);
if(DataCoolantTemp.TEMPSetp > 9 )
{
DataCoolantTemp.TEMPSetp = 0;
}
DataCoolantTemp.TEMPSetp = DataCoolantTemp.TEMPSetp - 1;
}
uint16_t Get_Res_To_Temp(uint16_t *ResBoard, uint16_t *TempBoard, uint8_t Len, uint16_t input)
{
uint8_t i = 0;
uint16_t ret = 0;
uint32_t temp = 0;
if(input >= ResBoard[0])
{ {
if (CoolantR < 180) ret = TempBoard[0];
}
else if(input <= ResBoard[Len - 1])
{ {
g_u8DesCoolantSetp = 1; ret = TempBoard[Len - 1];
} }
else if(CoolantR > 220) else
{
for(i = 0; i < (Len - 1); i++)
{ {
g_u8DesCoolantSetp = 0; if((input < ResBoard[i]) && (input >= ResBoard[i + 1]))
{
temp = TempBoard[i + 1] - TempBoard[i];
temp *= (ResBoard[i] - input);
temp /= (ResBoard[i] - ResBoard[i + 1]);
temp += TempBoard[i];
ret = (uint16_t)temp;
break;
}
} }
} }
return ret;
} }
void Coolant_Cal_Sevice(uint8_t deltaTime) void Common_SelfCheckTime_Init(void)
{ {
/*检测燃油电阻状态*/ u8SelfCheckTime = 0;
Coolant_State_Check(deltaTime); u8SelfCheckTime_Finish = 0;
}
/*显示燃油格*/ void Common_SelfCheckTime(void)
Coolant_Gauges_Cal(deltaTime); {
if (SYS_OPR_STAT_IGN_ON)
{
if (u8SelfCheckTime < SelfCheckTime)
{
u8SelfCheckTime++;
u8SelfCheckTime_Finish = 0;
}
else
{
u8SelfCheckTime = SelfCheckTime;
u8SelfCheckTime_Finish = 1;
}
}
else
{
u8SelfCheckTime = SelfCheckTime;
u8SelfCheckTime_Finish = 1;
}
} }
uint8_t Get_CurCoolantSetpState(void)
uint8_t GET_DataCoolantTempSegDisp(void)
{ {
return g_u8DesCoolantSetp; return DataCoolantTemp_Dis.u8_CurSeg;
} }
CoolantSensorSts_t Get_Coolant_Sensor_State(void) uint16_t GET_DataCollantTempSegValid(void)
{ {
return CoolantSensorState; return DataCoolantTemp.u16Res_ADValue;//DataCoolantTemp_Dis.Dis_Valid;
} }
#ifndef DATA_COOLANT_H #ifndef DATA_COOLANT_H
#define DATA_COOLANT_H #define DATA_COOLANT_H
#include "stdint.h" #include "Components.h"
typedef enum{ #define Coolant_LEN 17
CoolantSensorNormal = 0,
CoolantSensorShortCircuit,
CoolantSensorOpenCircuit,
}CoolantSensorSts_t;
extern void Coolant_KL15_Init(void); typedef unsigned int INT16U;
extern void Coolant_KL30_Init(void); /*** 控制结构 ***/
extern void Coolant_Cal_Sevice(uint8_t deltaTime);
extern uint8_t Get_CurCoolantSetp(void); typedef struct
extern CoolantSensorSts_t Get_Coolant_Sensor_State(void); {
void Coolant_R_Cal(uint8_t deltaTime); uint8_t u8_DestSeg;
uint8_t u8_CurSeg;
}DataCoolantTempDisStruct;
extern DataCoolantTempDisStruct DataCoolantTemp_Dis;
typedef struct
{
uint16_t Temp_Value;
uint8_t Symbol;
uint16_t u16Can_Actual;
uint8_t u8Can_Valid;
uint16_t u16Res_Actual;
uint16_t u16Res_ADValue;
uint8_t u8Res_Valid;
uint8_t u8Res_ADValid;
uint8_t u8Res_Flashtimer ;
uint8_t TEMPSetp;
uint8_t TEMPMode;
uint16_t TEMP_Fastime ;
}DataCoolantTempStruct; //水温数据结构
typedef struct
{
uint32_t Buffer[5];
uint8_t Cnt;
uint8_t time;
uint16_t ResOpen_ActTimer;
uint16_t ResOpen_InActTimer;
}DataCoolantTempSamplerStruct;
void Common_SelfCheckTime_Init(void);
void Common_SelfCheckTime(void);
void Data_Coolant_Temp_Processing_Service(void);
uint16_t Get_Coolant_Res_To_Temp(uint16_t Temp_Res);
void Get_Coolant_Temp_Seg(uint16_t Temp_Value);
void Data_Coolant_Temp_Display ( void );
extern uint16_t GET_DataCollantTempSegValid(void);
extern void TEMP_KL30_Init ( void );
extern void TEMP_KL15_Init ( void );
extern uint8_t GET_DataCoolantTempSegDisp(void);
void TEMP_Gauges_Cal(void);
uint16_t Get_Res_To_Temp(uint16_t *ResBoard, uint16_t *TempBoard, uint8_t Len, uint16_t input);
extern DataCoolantTempStruct DataCoolantTemp ;
#endif #endif
#ifndef HYSTERESIS_H__
#define HYSTERESIS_H__
// #define HYS_PLATFORM_16BIT
#ifdef HYS_PLATFORM_16BIT
typedef unsigned char Hys_uint8_t;
typedef unsigned int Hys_uint16_t;
typedef unsigned long Hys_uint32_t;
#else
typedef unsigned char Hys_uint8_t;
typedef unsigned short Hys_uint16_t;
typedef unsigned int Hys_uint32_t;
typedef unsigned long long Hys_uint64_t;
#endif
/*所有需要处理的物理量枚举*/
typedef enum
{
HYS_TEMP = 0U, /*水温*/
HYS_PWM, /*..*/
HYS_NUM_MAX,
} HYS_Num_en_t;
/***************************Do not modify the following*********************************/
/***************************Do not modify the following*********************************/
/***************************Do not modify the following*********************************/
/*当前文件版本号*/
#define HYS_VERSION_NUM 0X10U
#define HYS_RAM_DATA_LEN (HYS_NUM_MAX * 2U)
/*操作函数返回状态*/
typedef enum
{
HYS_OPERATE_SUCCESS = 0UL, /*函数操作成功*/
HYS_OPERATE_FAIL, /*函数操作失败*/
} HYS_Operate_Type_en_t;
typedef struct
{
/*该段的下限值*/
Hys_uint16_t u16HYSSegLow;
/*该段的上限值*/
Hys_uint16_t u16HYSSegHigh;
} HYS_Seg_Table_st_t;
typedef struct
{
/*参数分段属性表*/
const HYS_Seg_Table_st_t *pstHYSSegTable;
/*默认填0U即可*/
Hys_uint16_t u16HYSReserved;
/*分段属性表长度*/
Hys_uint8_t u8HYSSegTableLen;
/*1U:正序 0U:降序*/
Hys_uint8_t u8HYSSortBy;
} HYS_Attribute_st_t;
typedef struct
{
/*物理量数量,也就是 HYS_NUM_MAX */
Hys_uint8_t u8HYSNum;
} HYS_Init_st_t;
/************************************************************************/
/*30初始化,所有状态重新开始计算*/
void HYS_KL30_Init(Hys_uint8_t *pu8HYSRamData, const HYS_Attribute_st_t *pstHYSAttribute, HYS_Init_st_t *pstHYSInit);
/*唤醒初始化,会保持休眠唤醒前的状态*/
void HYS_Wakeup_Init(Hys_uint8_t *pu8HYSRamData, const HYS_Attribute_st_t *pstHYSAttribute, HYS_Init_st_t *pstHYSInit);
/*输入对应索引的物理量参数*/
HYS_Operate_Type_en_t HYS_Physical_Quantity_Input(HYS_Num_en_t enHYSIndex, Hys_uint16_t u16HYSPhysValue);
/*获取分段结果,返回0xFF表示无效*/
Hys_uint8_t HYS_Get_Seg(HYS_Num_en_t enHYSIndex);
/*复位某个物理量,重新判断计算*/
HYS_Operate_Type_en_t HYS_Reset_Physical_Quantity(HYS_Num_en_t enHYSIndex);
/*读取版本号*/
Hys_uint8_t HYS_Version_Read(void);
#endif
\ No newline at end of file
...@@ -3554,11 +3554,20 @@ static void AMT630H_GUI_PhoneConnect_Fuel(uint8_t Fuel) ...@@ -3554,11 +3554,20 @@ static void AMT630H_GUI_PhoneConnect_Fuel(uint8_t Fuel)
*PARAMETER : uint8_t Coolant-水温等级 0 - 红区一格 1 - 正常一格 *PARAMETER : uint8_t Coolant-水温等级 0 - 红区一格 1 - 正常一格
*RETURN : NULL *RETURN : NULL
*/ */
void AMT630H_GUI_PhoneConnect_Coolant(void) void AMT630H_GUI_PhoneConnect_Coolant(uint8_t Coolant)
{ {
SetPagePic(GRAPHICS_PAGE_0, Pic_0947_709_533); SetPagePic(GRAPHICS_PAGE_0, Pic_0947_709_533);
SetPagePic(GRAPHICS_PAGE_0, Pic_0948_967_533); SetPagePic(GRAPHICS_PAGE_0, Pic_0948_967_533);
SetPagePic(GRAPHICS_PAGE_0, Pic_0413_727_533); SetPagePic(GRAPHICS_PAGE_0, Pic_0413_727_533);
if(Coolant>0)
{
for(uint8_t i=0;i<Coolant;i++)
{
SetPagePic(GRAPHICS_PAGE_0, Pic_0427_729_536+i);
}
}
} }
/*电压显示函数*/ /*电压显示函数*/
static void AMT630H_GUI_Voltage(uint16_t Voltage) static void AMT630H_GUI_Voltage(uint16_t Voltage)
...@@ -4802,7 +4811,7 @@ void AMT630H_GUI_PhoneConnect_Second_LowHalf(void) ...@@ -4802,7 +4811,7 @@ void AMT630H_GUI_PhoneConnect_Second_LowHalf(void)
AMT630H_GUI_PhoneConnect_VSpeed(VechileSpeed); AMT630H_GUI_PhoneConnect_VSpeed(VechileSpeed);
AMT630H_GUI_PhoneConnect_ESpeed(Get_DispEngineSpeed()); AMT630H_GUI_PhoneConnect_ESpeed(Get_DispEngineSpeed());
AMT630H_GUI_PhoneConnect_Fuel(Get_CurFuelSetp()); AMT630H_GUI_PhoneConnect_Fuel(Get_CurFuelSetp());
AMT630H_GUI_PhoneConnect_Coolant(); AMT630H_GUI_PhoneConnect_Coolant(GET_DataCoolantTempSegDisp());
AMT630H_GUI_PhoneConnect_Telephone(); AMT630H_GUI_PhoneConnect_Telephone();
if(KL30_VOLTAGE_time < 10) if(KL30_VOLTAGE_time < 10)
{ {
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "Data_VSpeed.h" #include "Data_VSpeed.h"
#include "Data_Coolant.h" #include "Data_Coolant.h"
#include "Data_Fuel.h" #include "Data_Fuel.h"
#include "Hysteresis.h"
#include "Mileage\Services_Mileage_User.h" #include "Mileage\Services_Mileage_User.h"
#include "BackLight.h" #include "BackLight.h"
#include "RTC\RTE_RTC.h" #include "RTC\RTE_RTC.h"
......
...@@ -72,6 +72,7 @@ static void Power_KL30_Init(void) ...@@ -72,6 +72,7 @@ static void Power_KL30_Init(void)
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising); RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising);
FaultCode_Init(); FaultCode_Init();
TEMP_KL30_Init();
} }
static void Power_Wakeup_Init(void) static void Power_Wakeup_Init(void)
...@@ -106,6 +107,7 @@ static void Power_Wakeup_Init(void) ...@@ -106,6 +107,7 @@ static void Power_Wakeup_Init(void)
Protocol_KL30_Wakeup_Init(); Protocol_KL30_Wakeup_Init();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising); RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising);
FaultCode_Init(); FaultCode_Init();
TEMP_KL30_Init();
} }
static void Power_LVP_Init(void) static void Power_LVP_Init(void)
...@@ -129,6 +131,7 @@ static void Power_IG_ON_Init(void) ...@@ -129,6 +131,7 @@ static void Power_IG_ON_Init(void)
Line_In_KL15_ON_Init(); Line_In_KL15_ON_Init();
Telltales_KL15_Init(); Telltales_KL15_Init();
Fuel_KL15_Init(); Fuel_KL15_Init();
TEMP_KL15_Init();
//RTE_GPIO_Set_Level(Blacklight_PWM, 1); //RTE_GPIO_Set_Level(Blacklight_PWM, 1);
FaultCode_Init(); FaultCode_Init();
mwAmt630hUartSendDatainit(); mwAmt630hUartSendDatainit();
......
...@@ -41,7 +41,6 @@ void Sys_10ms_Tasks(void) ...@@ -41,7 +41,6 @@ void Sys_10ms_Tasks(void)
Key_Clear_Time(); Key_Clear_Time();
Key_TimeOut_Service(); Key_TimeOut_Service();
Fuel_R_Cal(10u); Fuel_R_Cal(10u);
Coolant_R_Cal(10u);
Data_Light_Res_service(10); Data_Light_Res_service(10);
BackLight_Process(); BackLight_Process();
} }
...@@ -50,6 +49,7 @@ void Sys_20ms_Tasks(void) ...@@ -50,6 +49,7 @@ void Sys_20ms_Tasks(void)
{ {
Data_Vehicle_Speed_Processing_Service(); Data_Vehicle_Speed_Processing_Service();
Data_Engine_Speed_Processing_Service(); Data_Engine_Speed_Processing_Service();
Data_Coolant_Temp_Processing_Service();
} }
void Sys_50ms_Tasks(void) void Sys_50ms_Tasks(void)
...@@ -83,7 +83,6 @@ void Sys_100ms_Tasks(void) ...@@ -83,7 +83,6 @@ void Sys_100ms_Tasks(void)
S3_ServerCNTT(); S3_ServerCNTT();
Get_DisTime_Service(); Get_DisTime_Service();
Fuel_Cal_Sevice(100u); Fuel_Cal_Sevice(100u);
Coolant_Cal_Sevice(100u);
Services_Mileage_Callback(); Services_Mileage_Callback();
// Data_Mileage_Clear(); // Data_Mileage_Clear();
RTE_GPIO_Config(RTE_GPIO_PORT05_PIN04, GpioOut_High); RTE_GPIO_Config(RTE_GPIO_PORT05_PIN04, GpioOut_High);
......
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