Commit 82e0e965 authored by 李俭双's avatar 李俭双

feat:增加胎压相关处理,包括数据,外发,指示灯等

parent 33bc1913
SET PATH=C:\Keil_v5\ARM\ARMCC\Bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\tyw05\AppData\Local\Microsoft\WindowsApps;
SET ARMCC5_ASMOPT=--diag_suppress=9931
SET ARMCC5_CCOPT=--diag_suppress=9931
SET ARMCC5_LINKOPT=--diag_suppress=9931
SET CPU_TYPE=BAT32G139GK64FB
SET CPU_VENDOR=Cmsemicon
SET UV2_TARGET=TianYing200
......
......@@ -89,5 +89,7 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
p450->Msg [ i ] = 0xFFu;
}
}
p450 -> Sig.Front_Pressure_TX = Get_Front_TPMS_TX();
p450 -> Sig.Rear_Pressure_TX = Get_Rear_TPMS_TX();
}
#include "Application.h"
#include "Data_TPMS\Data_TPMS.h"
\ No newline at end of file
#include "Data_TPMS\Data_TPMS.h"
_TPMS_Display TPMS;
void Data_TPMS_KL30_Init ( void )
{
TPMS.Front_Press_Value = 0;
TPMS.Rear_Press_Value = 0;
TPMS.Front_TPMS_Valid = 0;
TPMS.Rear_TPMS_Valid = 0;
TPMS.TPMS_Warning = 0;
TPMS.TPMS_Unit = Get_Dis_Tpms_Unit();
}
void Data_TPMS_Processing_Service ( void )
{
uint16_t Front_TPMS = 0;
uint16_t Rear_TPMS = 0;
TPMS.TPMS_Unit = Get_Dis_Tpms_Unit();
Front_TPMS = Get_CAN_CH0_ID_341_Sig_Front_Pressure();
Rear_TPMS = Get_CAN_CH0_ID_341_Sig_Rear_Pressure();
if ( Common_Get_IG_Sts() == COMMON_POWER_ON )
{
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x341_Msg_Count) == CAN_SIG_LOST)
{
TPMS.Front_TPMS_Valid = 0; //信号掉线,显示--
TPMS.Rear_TPMS_Valid = 0; //信号掉线,显示--
TPMS.Front_Press_Value = 0;
TPMS.Rear_Press_Value = 0;
TPMS.TPMS_Warning = 0; //白灯
}
else
{
if((Front_TPMS == 0xFF) || (Rear_TPMS == 0xFF))
{
if((Front_TPMS == 0xFF) && (Rear_TPMS != 0xFF))
{
TPMS.Front_TPMS_Valid = 0;
TPMS.Rear_TPMS_Valid = 1;
TPMS.Front_Press_Value = 99;
TPMS.Rear_Press_Value *= Rear_TPMS ;
TPMS.Rear_Press_Value /= 10 ;
if(TPMS.Rear_Press_Value > 99)
{
TPMS.Rear_Press_Value = 99;
}
if((TPMS.Rear_Press_Value < 17) || (TPMS.Rear_Press_Value > 25))
{
TPMS.TPMS_Warning = 1;
}
else
{
TPMS.TPMS_Warning = 0;
}
}
else if ((Front_TPMS != 0xFF) || (Rear_TPMS == 0xFF))
{
TPMS.Front_TPMS_Valid = 1;
TPMS.Rear_TPMS_Valid = 0;
TPMS.Rear_Press_Value = 99;
TPMS.Front_Press_Value *= Front_TPMS ;
TPMS.Front_Press_Value /= 10 ;
if(TPMS.Front_Press_Value > 99)
{
TPMS.Front_Press_Value = 99;
}
if((TPMS.Front_Press_Value < 17) || (TPMS.Front_Press_Value > 23))
{
TPMS.TPMS_Warning = 1;
}
else
{
TPMS.TPMS_Warning = 0;
}
}
else
{
TPMS.Front_Press_Value = 99;
TPMS.Rear_Press_Value = 99;
TPMS.TPMS_Warning = 0;
TPMS.Front_TPMS_Valid = 0;
TPMS.Rear_TPMS_Valid = 0;
}
}
else
{
TPMS.Front_TPMS_Valid = 1;
TPMS.Rear_TPMS_Valid = 1;
TPMS.Front_Press_Value *= Front_TPMS ;
TPMS.Front_Press_Value /= 10 ;
if(TPMS.Front_Press_Value > 99)
{
TPMS.Front_Press_Value = 99;
}
TPMS.Rear_Press_Value *= Rear_TPMS ;
TPMS.Rear_Press_Value /= 10 ;
if(TPMS.Rear_Press_Value > 99)
{
TPMS.Rear_Press_Value = 99;
}
if ((TPMS.Front_Press_Value < 17) || (TPMS.Front_Press_Value > 23) || (TPMS.Rear_Press_Value < 17) || (TPMS.Rear_Press_Value > 25))
{
TPMS.TPMS_Warning = 1;
}
else
{
TPMS.TPMS_Warning = 0;
}
}
}
}
else
{
TPMS.Front_TPMS_Valid = 0;
TPMS.Rear_TPMS_Valid = 0;
TPMS.Front_Press_Value = 0;
TPMS.Rear_Press_Value = 0;
TPMS.TPMS_Warning = 0;
}
}
uint16_t Data_Bar_To_Psi (uint16_t bar)
{
bar *= 145;
bar /= 10;
if((bar % 5) >= 5)
{
bar += 5;
}
return bar;
}
uint8_t Get_Led_TPMS_Waring (void)
{
return TPMS.TPMS_Warning;
}
uint8_t Get_Front_TPMS_Sig_Vaild (void)
{
return TPMS.Front_TPMS_Valid;
}
uint8_t Get_Rear_TPMS_Sig_Vaild (void)
{
return TPMS.Rear_TPMS_Valid;
}
uint16_t Get_Front_TPMS_Sig_Value (void)
{
uint16_t value = 0;
if (TPMS.TPMS_Unit == 1)
{
value = Data_Bar_To_Psi(TPMS.Front_Press_Value);
if(value > 99)
{
value = 99;
}
}
else
{
value = TPMS.Front_Press_Value;
}
return value;
}
uint16_t Get_Rear_TPMS_Sig_Value (void)
{
uint16_t value = 0;
if (TPMS.TPMS_Unit == 1)
{
if(value > 99)
{
value = 99;
}
value = Data_Bar_To_Psi(TPMS.Rear_Press_Value);
}
else
{
value = TPMS.Rear_Press_Value;
}
return value;
}
uint16_t Get_Rear_TPMS_TX (void)
{
return TPMS.Rear_Press_Value;
}
uint16_t Get_Front_TPMS_TX (void)
{
return TPMS.Front_Press_Value;
}
\ No newline at end of file
......@@ -2,4 +2,24 @@
#define _DATA_TPMS_H_
#include "common.h"
typedef struct
{
uint16_t Front_Press_Value;
uint16_t Rear_Press_Value;
uint8_t Front_TPMS_Valid;
uint8_t Rear_TPMS_Valid;
uint8_t TPMS_Warning;
uint8_t TPMS_Unit;
}_TPMS_Display;
void Data_TPMS_KL30_Init ( void );
void Data_TPMS_Processing_Service ( void );
uint16_t Data_Bar_To_Psi (uint16_t bar);
uint8_t Get_Led_TPMS_Waring (void);
uint8_t Get_Front_TPMS_Sig_Vaild (void);
uint8_t Get_Rear_TPMS_Sig_Vaild (void);
uint16_t Get_Front_TPMS_Sig_Value (void);
uint16_t Get_Rear_TPMS_Sig_Value (void);
uint16_t Get_Rear_TPMS_TX (void);
uint16_t Get_Front_TPMS_TX (void);
#endif
......@@ -407,7 +407,7 @@ uint8_t Get_Dis_KM_Unit(void)
uint8_t Get_Dis_Tpms_Unit(void)
{
return MenuData.Tpms_Unit; //0km,1mile
return MenuData.Tpms_Unit; //0bar,1psi
}
uint8_t Get_Dis_Tcs_Val(void)
......
......@@ -484,11 +484,29 @@ static void LED_Lateral_Strut_Execution(Tellib_uint16_t led_status)
static Tellib_uint16_t LED_Tire_Pressure_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if(Get_Led_TPMS_Waring() == 1)
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
return LED_STATE;
}
static void LED_Tire_Pressure_Execution(Tellib_uint16_t led_status)
{
;
if ( led_status == 1u )
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_27_Tire_PressureY, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_26_Tire_PressureW, LED_OFF);
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_26_Tire_PressureW, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_27_Tire_PressureY, LED_OFF);
}
}
static Tellib_uint16_t LED_Navigato_Judgement(void)
{
......@@ -504,36 +522,36 @@ static void LED_Navigato_Execution(Tellib_uint16_t led_status)
void Turn_Left_Right_Lamp(void)
{
//if ( SYS_OPR_STAT_IGN_ON )
//{
// if (Common_GetIgnOnTime() >= 3000)
// {
// if (Line_In_Get_Status(LINE_IN_TurnLeft))
// {
// RTE_GPIO_Set_Level(LeftTurn_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(LeftTurn_MUC_OUT, LED_LINEOUT_Low);
// }
// if (Line_In_Get_Status(LINE_IN_TurnRight))
// {
// RTE_GPIO_Set_Level(RightTurn_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(RightTurn_MUC_OUT, LED_LINEOUT_Low);
// }
// }
// else
// {
// RTE_GPIO_Set_Level(RightTurn_MUC_OUT, LED_LINEOUT_High);
// RTE_GPIO_Set_Level(LeftTurn_MUC_OUT, LED_LINEOUT_High);
// }
//}
//else
//{
// RTE_GPIO_Set_Level(RightTurn_MUC_OUT, LED_LINEOUT_Low);
// RTE_GPIO_Set_Level(LeftTurn_MUC_OUT, LED_LINEOUT_Low);
//}
if ( SYS_OPR_STAT_IGN_ON )
{
if (Common_GetIgnOnTime() >= 3000)
{
if (Line_In_Get_Status(LINE_IN_TurnLeft))
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_06_Turn_Left, LED_ON);
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_06_Turn_Left, LED_OFF);
}
if (Line_In_Get_Status(LINE_IN_TurnRight))
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Turn_Right, LED_ON);
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Turn_Right, LED_OFF);
}
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_06_Turn_Left, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Turn_Right, LED_ON);
}
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_06_Turn_Left, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Turn_Right, LED_OFF);
}
}
......@@ -33,6 +33,6 @@ extern Led_HighBeam_Count HighBeam_Timer;
void Telltales_Init(void);
void Telltales_UserInit(void);
void Turn_Left_Right_Lamp(void);
#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