Data_AdBule.c 4.28 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include "Data_AdBule.h"
#include "Gauges.h"
#include "GaugesInterface.h"
#include "CAN_Communication_Matrix.h"
//-------------------------------------------
//尿素 数据处理 wangboyu
//-------------------------------------------
//区域1显示逻辑
//-------------------------------------------
//342 - 4.3.DS油位显示器
//-------------------------------------------

static struct
{
hu's avatar
hu committed
15 16 17
    uint8_t	Number ;
    en_ADBULE_Sta	DisplaySta ;
} AdBuleVariable ;
hu's avatar
hu committed
18 19 20

/*-------------------------------------------------------------------------
 * Function Name  : AdBule_KL30_Init
hu's avatar
hu committed
21
 * Description    :
hu's avatar
hu committed
22 23 24 25 26 27 28 29 30 31 32 33
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
void AdBule_KL30_Init(void)
{
    AdBuleVariable.Number = 0u;
    AdBuleVariable.DisplaySta = ADBULE_LED_OFF;
}
void AdBule_KL15_ON_Init(void)
{
hu's avatar
hu committed
34
    AdBuleVariable.Number = 0u;
hu's avatar
hu committed
35 36 37 38
    AdBuleVariable.DisplaySta = ADBULE_LED_OFF;
}
void AdBule_KL15_OFF_Init(void)
{
hu's avatar
hu committed
39
    AdBuleVariable.Number = 0u;
hu's avatar
hu committed
40 41 42 43
    AdBuleVariable.DisplaySta = ADBULE_LED_OFF;
}
void AdBule_Wakeup_Init(void)
{
hu's avatar
hu committed
44
    AdBuleVariable.Number = 0u;
hu's avatar
hu committed
45 46 47 48
    AdBuleVariable.DisplaySta = ADBULE_LED_OFF;
}
void AdBule_Sleep_Init(void)
{
hu's avatar
hu committed
49
    AdBuleVariable.Number = 0u;
hu's avatar
hu committed
50 51 52 53
    AdBuleVariable.DisplaySta = ADBULE_LED_OFF;
}
/*-------------------------------------------------------------------------
 * Function Name  : AdBule_Processing_Service
hu's avatar
hu committed
54
 * Description    :
hu's avatar
hu committed
55 56 57 58 59 60 61
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
void AdBule_Processing_Service(void)
{
hu's avatar
hu committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
    uint8_t Msg_Tank_Level = 0 ;
    uint8_t Msg_Level_blinking = 0 ;
    uint8_t u8Number = 0 ;
    en_ADBULE_Sta u8DisplaySta = ADBULE_LED_OFF ;

    Msg_Tank_Level = Get_ID_18FF2300_Sig_Tank_Level();
    Msg_Level_blinking = Get_ID_18FF2300_Sig_Level_blinking();

    //if(Get_CanFirstRecv_Event(ID_CanMsg18FF2300_Msg_Count) == 0)
    //{
    //	u8Number = 0u;
    //	u8DisplaySta = ADBULE_LED_OFF;
    //}
    //else if (CAN_MSG_Status(ID_CanMsg18FF2300_Msg_Count) == CAN_SIG_LOST)
    if (CAN_MSG_Status(ID_CanMsg18FF2300_Msg_Count) == CAN_SIG_LOST)
    {
        u8Number = 0u;
        u8DisplaySta = ADBULE_LED_OFF;
    }
    else
    {
        if (Msg_Tank_Level == 0x3C)
        {
            u8Number = 5u;
        }
        else if (Msg_Tank_Level == 0x1C)
        {
            u8Number = 4u;
        }
        else if (Msg_Tank_Level == 0x0C)
        {
            u8Number = 3u;
        }
        else if (Msg_Tank_Level == 0x04)
        {
            u8Number = 2u;
        }
        else if (Msg_Tank_Level == 0x02)
        {
            u8Number = 1u;
        }
        else
        {
            u8Number = 0u;
        }

        if (Msg_Level_blinking == 0x03)
        {
            u8DisplaySta = ADBULE_LED_3HZ_FLASH ;
        }
        else if (Msg_Level_blinking == 0x01)
        {
            u8DisplaySta = ADBULE_LED_1HZ_FLASH ;
        }
        else
        {
            u8DisplaySta = ADBULE_LED_ON ;
        }
    }

    AdBuleVariable.Number = u8Number ;
    AdBuleVariable.DisplaySta =	u8DisplaySta ;
hu's avatar
hu committed
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
}

/*-------------------------------------------------------------------------
 * Function Name  : AdBule_Get_Number
 * Description    : 返回尿素当前格数
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
uint8_t AdBule_Get_Number(void)
{
    uint8_t u8Result = 0u;
    u8Result = AdBuleVariable.Number;
    return u8Result;
}
/*-------------------------------------------------------------------------
 * Function Name  : AdBule_Get_Display_Sta
 * Description    : 返回尿素当前显示模式(最后一格的显示模式)
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
en_ADBULE_Sta AdBule_Get_Display_Sta(void)
{
    en_ADBULE_Sta u8Result = ADBULE_LED_OFF;
    u8Result = AdBuleVariable.DisplaySta;
    return u8Result;
hu's avatar
hu committed
153
}