Commit d3fed906 authored by 郑萍's avatar 郑萍

feat:水温阻值接口开路接口,以及燃油电源一直拉低

parent f6ebd86d
#include "Data_Coolant.h" #include "Data_Coolant.h"
#include "Components.h" #include "Components.h"
#define Coolant_DATA_TIME 25u /*这里填写多长时间采集一个数据,单位ms*/ #define Coolant_DATA_TIME 25u /*这里填写多长时间采集一个数据,单位ms*/
#define Coolant_DATA_NUM 20u /*燃油电阻采集数据总数 最大255*/ #define Coolant_DATA_NUM 20u /*燃油电阻采集数据总数 最大255*/
#define Coolant_CAL_START 5u /*数据排序后取中间部分计算平均:起始*/ #define Coolant_CAL_START 5u /*数据排序后取中间部分计算平均:起始*/
...@@ -65,7 +63,7 @@ void Coolant_R_Cal(uint8_t deltaTime) ...@@ -65,7 +63,7 @@ void Coolant_R_Cal(uint8_t deltaTime)
uint32_t temp32; uint32_t temp32;
static uint16_t timeCount = 0; static uint16_t timeCount = 0;
if(g_u8CoolantStateInitFlag) if (g_u8CoolantStateInitFlag)
{ {
CoolantR = ADC_Read_Signal(ADC_CH_COOLANT_TEMP1_R); CoolantR = ADC_Read_Signal(ADC_CH_COOLANT_TEMP1_R);
} }
...@@ -123,26 +121,26 @@ void Coolant_R_Cal(uint8_t deltaTime) ...@@ -123,26 +121,26 @@ void Coolant_R_Cal(uint8_t deltaTime)
void Coolant_State_Check(uint8_t deltaTime) void Coolant_State_Check(uint8_t deltaTime)
{ {
if (CoolantR < 30) // if (CoolantR < 30)
{ /*短路3*/ // { /*短路3*/
g_u16CoolantSensorOpenTime = 0; // g_u16CoolantSensorOpenTime = 0;
g_u16CoolantSensorNormalTime = 0; // g_u16CoolantSensorNormalTime = 0;
if ((g_u16CoolantSensorShortTime > 3000) || ((g_u8CoolantStateInitFlag) && (g_u16CoolantSensorShortTime > 3000))) // if ((g_u16CoolantSensorShortTime > 3000) || ((g_u8CoolantStateInitFlag) && (g_u16CoolantSensorShortTime > 3000)))
{ // {
CoolantSensorState = CoolantSensorShortCircuit; // CoolantSensorState = CoolantSensorShortCircuit;
g_u8DesCoolantSetp = 0; // g_u8DesCoolantSetp = 0;
g_u8CurCoolantSetp = 6; // g_u8CurCoolantSetp = 6;
g_u8CoolantStateInitFlag = 0; // g_u8CoolantStateInitFlag = 0;
g_u8CoolantInitFlag = 1; // g_u8CoolantInitFlag = 1;
g_u8CoolantDir = Coolant_SEG_UP; // g_u8CoolantDir = Coolant_SEG_UP;
} // }
else // else
{ // {
g_u16CoolantSensorShortTime += deltaTime; // g_u16CoolantSensorShortTime += deltaTime;
} // }
} // }
else if (CoolantR > 3100) if (CoolantR > 3000)
{ /*开路 310*/ { /*开路 300*/
g_u16CoolantSensorShortTime = 0; g_u16CoolantSensorShortTime = 0;
g_u16CoolantSensorNormalTime = 0; g_u16CoolantSensorNormalTime = 0;
if ((g_u16CoolantSensorOpenTime > 3000) || ((g_u8CoolantStateInitFlag) && (g_u16CoolantSensorOpenTime > 3000))) if ((g_u16CoolantSensorOpenTime > 3000) || ((g_u8CoolantStateInitFlag) && (g_u16CoolantSensorOpenTime > 3000)))
...@@ -179,128 +177,16 @@ void Coolant_Gauges_Cal(uint8_t deltaTime) ...@@ -179,128 +177,16 @@ void Coolant_Gauges_Cal(uint8_t deltaTime)
{ {
static uint16_t time = 0; static uint16_t time = 0;
if ((CoolantSensorState == CoolantSensorNormal) && (CoolantR <= 3100) && (CoolantR >= 30)) if ((CoolantSensorState == CoolantSensorNormal) && (CoolantR <= 3000)) // && (CoolantR >= 30)
{
/*采集完第一组数据后,开始计算燃油格数*/
if (g_u8CoolantADCompleteFlg)
{
if (g_u8CoolantInitFlag)
{
CoolantRBak = CoolantR;
}
/*根据回差计算走动方向*/
if (g_u8CoolantDir == Coolant_SEG_UP)
{
if (CoolantR >= CoolantRBak + RETURN_DIFFERENCE)
{
g_u8CoolantDir = Coolant_SEG_DOWN;
CoolantRBak = CoolantR;
}
if (CoolantR < CoolantRBak)
{
CoolantRBak = CoolantR;
}
}
else
{
if (CoolantRBak >= CoolantR + RETURN_DIFFERENCE)
{
g_u8CoolantDir = Coolant_SEG_UP;
CoolantRBak = CoolantR;
}
if (CoolantR > CoolantRBak)
{
CoolantRBak = CoolantR;
}
}
/*计算目标格数*/
if (g_u8CoolantDir == Coolant_SEG_UP)
{ {
if (((g_u8DesCoolantSetp == 5) || g_u8CoolantInitFlag) && (CoolantR < 30)) if (CoolantR < 180)
{
g_u8DesCoolantSetp = 6;
}
else if (((g_u8DesCoolantSetp == 4) || g_u8CoolantInitFlag) && (CoolantR < 160))
{
g_u8DesCoolantSetp = 5;
}
else if (((g_u8DesCoolantSetp == 3) || g_u8CoolantInitFlag) && (CoolantR < 300))
{
g_u8DesCoolantSetp = 4;
}
else if (((g_u8DesCoolantSetp == 2) || g_u8CoolantInitFlag) && (CoolantR < 500))
{
g_u8DesCoolantSetp = 3;
}
else if (((g_u8DesCoolantSetp == 1) || g_u8CoolantInitFlag) && (CoolantR < 790))
{
g_u8DesCoolantSetp = 2;
}
else if (((g_u8DesCoolantSetp == 0) || g_u8CoolantInitFlag) && (CoolantR <= 3100))
{ {
g_u8DesCoolantSetp = 1; g_u8DesCoolantSetp = 1;
} }
} else if(CoolantR > 220)
else if (g_u8CoolantDir == Coolant_SEG_DOWN)
{
if (((g_u8DesCoolantSetp == 1) || g_u8CoolantInitFlag) && (CoolantR > 3100))
{ {
g_u8DesCoolantSetp = 0; g_u8DesCoolantSetp = 0;
} }
else if (((g_u8DesCoolantSetp == 2) || g_u8CoolantInitFlag) && (CoolantR >= 790))
{
g_u8DesCoolantSetp = 1;
}
else if (((g_u8DesCoolantSetp == 3) || g_u8CoolantInitFlag) && (CoolantR >= 500))
{
g_u8DesCoolantSetp = 2;
}
else if (((g_u8DesCoolantSetp == 4) || g_u8CoolantInitFlag) && (CoolantR >= 300))
{
g_u8DesCoolantSetp = 3;
}
else if (((g_u8DesCoolantSetp == 5) || g_u8CoolantInitFlag) && (CoolantR >= 160))
{
g_u8DesCoolantSetp = 4;
}
else if (((g_u8DesCoolantSetp == 6) || g_u8CoolantInitFlag) && (CoolantR >= 30))
{
g_u8DesCoolantSetp = 5;
}
}
}
/*IGN ON 1秒/故障恢复后,开始走格 立即指向当前格 20220704*/
if (Common_GetIgnOnTime() >= 3000)
{
time += deltaTime;
if (g_u8CoolantInitFlag)
{
g_u8CoolantInitFlag = 0;
time = 0;
g_u8CurCoolantSetp = g_u8DesCoolantSetp;
}
if (time >= 15000)
{ /* 15S变化一格 */
time = 0;
if (g_u8CurCoolantSetp < g_u8DesCoolantSetp)
{
g_u8CurCoolantSetp++;
}
else if (g_u8CurCoolantSetp > g_u8DesCoolantSetp)
{
g_u8CurCoolantSetp--;
}
}
if (g_u8CurCoolantSetp == g_u8DesCoolantSetp)
{
time = 0;
}
}
} }
} }
...@@ -313,67 +199,12 @@ void Coolant_Cal_Sevice(uint8_t deltaTime) ...@@ -313,67 +199,12 @@ void Coolant_Cal_Sevice(uint8_t deltaTime)
Coolant_Gauges_Cal(deltaTime); Coolant_Gauges_Cal(deltaTime);
} }
uint8_t Get_CurCoolantSetp(void) uint8_t Get_CurCoolantSetpState(void)
{ {
uint8_t u8CurCoolantSetp = g_u8CurCoolantSetp; return g_u8DesCoolantSetp;
if(CoolantSensorState == CoolantSensorOpenCircuit)
{
if(FLASH_SYNC_1Hz)
{
u8CurCoolantSetp = 6;
}
else
{
u8CurCoolantSetp = 0;
}
}
else if(CoolantSensorState == CoolantSensorShortCircuit)
{
if(FLASH_SYNC_1Hz)
{
u8CurCoolantSetp = 7;
}
else
{
u8CurCoolantSetp = 0;
}
}
else if(u8CurCoolantSetp == 1)
{
if(FLASH_SYNC_1Hz)
{
u8CurCoolantSetp = 1;
}
else
{
u8CurCoolantSetp = 0;
}
}
else
{
;
}
return u8CurCoolantSetp;
} }
CoolantSensorSts_t Get_Coolant_Sensor_State(void) CoolantSensorSts_t Get_Coolant_Sensor_State(void)
{ {
uint8_t u8CurCoolantSetp = 0; return CoolantSensorState;
if(CoolantSensorState == CoolantSensorOpenCircuit || g_u8CurCoolantSetp == 1u)
{
if(FLASH_SYNC_1Hz)
{
u8CurCoolantSetp = 2;
}
else
{
u8CurCoolantSetp = 0;
}
}
else
{
u8CurCoolantSetp = 1u;
}
return u8CurCoolantSetp;
} }
...@@ -160,7 +160,7 @@ void Amt630hInit(void) ...@@ -160,7 +160,7 @@ void Amt630hInit(void)
LcdSoundParamterData.LcdWiringMode = LCD_WIRING_MODE_BGR; LcdSoundParamterData.LcdWiringMode = LCD_WIRING_MODE_BGR;
LcdSoundParamterData.LcdWiringBitOrder = LCD_WIRING_BIT_ORDER_MSB; LcdSoundParamterData.LcdWiringBitOrder = LCD_WIRING_BIT_ORDER_MSB;
LcdSoundParamterData.LcdDotClkReverse = 0; /* NuoMa 50pin TFT */ LcdSoundParamterData.LcdDotClkReverse = 0; /* NuoMa 50pin TFT */
LcdSoundParamterData.LvdsPanelFormat = LVDS_PANEL_FORMAT_NS; LcdSoundParamterData.LvdsPanelFormat = LVDS_PANEL_FORMAT_TI;
LcdSoundParamterData.LvdsPanelData = LVDS_PANEL_DATA_8BIT; LcdSoundParamterData.LvdsPanelData = LVDS_PANEL_DATA_8BIT;
LcdSoundParamterData.LcdTimingVBP = 12; LcdSoundParamterData.LcdTimingVBP = 12;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#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 "Data_Coolant.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"
......
...@@ -66,7 +66,7 @@ static void Power_KL30_Init(void) ...@@ -66,7 +66,7 @@ static void Power_KL30_Init(void)
Menu_User_Init(); Menu_User_Init();
Can_Init(); Can_Init();
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);
} }
static void Power_Wakeup_Init(void) static void Power_Wakeup_Init(void)
...@@ -90,7 +90,7 @@ static void Power_Wakeup_Init(void) ...@@ -90,7 +90,7 @@ static void Power_Wakeup_Init(void)
Menu_User_WAKEUP(); Menu_User_WAKEUP();
Can_Init(); Can_Init();
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);
} }
static void Power_LVP_Init(void) static void Power_LVP_Init(void)
......
...@@ -32,6 +32,7 @@ void Sys_10ms_Tasks(void) ...@@ -32,6 +32,7 @@ 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);
} }
void Sys_20ms_Tasks(void) void Sys_20ms_Tasks(void)
...@@ -46,12 +47,17 @@ void Sys_50ms_Tasks(void) ...@@ -46,12 +47,17 @@ void Sys_50ms_Tasks(void)
g_u8Cursor_Posittion = Menu_Get_Current_Cursor_Information(); g_u8Cursor_Posittion = Menu_Get_Current_Cursor_Information();
} }
void Sys_100ms_Tasks(void) void Sys_100ms_Tasks(void)
{ {
Get_DisTime_Service(); Get_DisTime_Service();
Fuel_Cal_Sevice(100u); Fuel_Cal_Sevice(100u);
Coolant_Cal_Sevice(100u);
Services_Mileage_Callback(); Services_Mileage_Callback();
RTE_GPIO_Set_Level(Blacklight_PWM, 1); RTE_GPIO_Set_Level(Blacklight_PWM, 1);
RTE_GPIO_Config(RTE_GPIO_PORT05_PIN04, GpioOut_High);
} }
static uint16_t task_2ms = 0u; static uint16_t task_2ms = 0u;
void Sys_Exact_50us_Tasks(void) void Sys_Exact_50us_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