Data_Gear.c 8.67 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#include "Data_Gear.h"
#include "Flash_synchronizer.h"
#include "CAN_Communication_Matrix.h"
#include "Common_Interface.h"
#include "images.h"
#include "CAN_Lib.h"

#include "GaugesInterface.h"


#include "Gauges.h"



/******************************************************************************
  Function:Data_Gear_KL30_Init
  Description:该服务函数首次KL30时调用一次
  Input:
  Output:
 ******************************************************************************/
void Data_Gear_KL30_Init(void)
{

}
/******************************************************************************
  Function:Data_Gear_KL15_Init
  Description:该服务函数首次KL15时调用一次
  Input:
  Output:
 ******************************************************************************/
void Data_Gear_KL15_Init(void)
{

}

/******************************************************************************
  Function:Data_Service_Gear_Processing
  Description:如果有特殊数据处理在此函数中进行处理
  Input:
  Output:
 ******************************************************************************/
void Data_Service_Gear_Processing(void)
{
hu's avatar
hu committed
44
    Gear_Processing_Service();
hu's avatar
hu committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
}
/******************************************************************************
  Function:Get_Gear_Mode_Type
  Description:Get Gear  P/R/N/D/M/S
  Input:
  Output: P/R/N/D/M/S
 ******************************************************************************/
uint8_t Get_Gear_Mode_Type(void)
{
}

/******************************************************************************
  Get_Gear_Mode_UPDOWN_Number
  Description:Get Gear  1/2/3/4/...
  Input:
  Output:   1/2/3/4/...
 ******************************************************************************/
uint8_t Get_Gear_Mode_UPDOWN_Number(void)
{
}
/******************************************************************************
  Function:Get_Gear_Mode_Up_Down
  Description:Get Gear  UP/DOWN
  Input:
  Output:   UP/DOWN
 ******************************************************************************/
uint8_t Get_Gear_Mode_Up_Down(void)
{
hu's avatar
hu committed
73

hu's avatar
hu committed
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
}
/******************************************************************************
  Function:Gear_Mode_Display
  Description:
  Input:
  Output:
 ******************************************************************************/
uint8_t  Get_Gear_Mode_Display_Flash(void)
{
    uint8_t Gear_Status = 0u;

    Gear_Status = FlashSync1Hz;
    return  (uint8_t)Gear_Status ;
}

uint8_t Get_Gear_Mode_M_A_Display(void)
{
hu's avatar
hu committed
91

hu's avatar
hu committed
92 93 94 95 96 97 98 99 100
}

uint8_t Get_Gear_Mode_P_E_Display(void)
{

}

uint8_t Get_Gear_Mode_L_C_Display(void)
{
hu's avatar
hu committed
101

hu's avatar
hu committed
102 103 104
}

//-------------------------------------------
hu's avatar
hu committed
105
//档位 数据处理
hu's avatar
hu committed
106 107 108 109 110 111 112 113
//-------------------------------------------
//区域7显示逻辑
//-------------------------------------------
//344 - 3.2.档位显示
//-------------------------------------------

static struct
{
hu's avatar
hu committed
114 115 116
    uint8_t Number ;//档位编号
    en_GEAR_Sta Manual ;//是否 M A N U A L
} GearVariable ;
hu's avatar
hu committed
117 118 119

/*-------------------------------------------------------------------------
 * Function Name  : Gear_KL30_Init
hu's avatar
hu committed
120
 * Description    :
hu's avatar
hu committed
121 122 123 124 125 126 127 128 129 130 131 132
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
void Gear_KL30_Init(void)
{
    GearVariable.Number = 0u;
    GearVariable.Manual = GEAR_MANUAL_OFF;
}
void Gear_KL15_ON_Init(void)
{
hu's avatar
hu committed
133
    GearVariable.Number = 0u;
hu's avatar
hu committed
134 135 136 137
    GearVariable.Manual = GEAR_MANUAL_OFF;
}
void Gear_KL15_OFF_Init(void)
{
hu's avatar
hu committed
138
    GearVariable.Number = 0u;
hu's avatar
hu committed
139 140 141 142
    GearVariable.Manual = GEAR_MANUAL_OFF;
}
void Gear_Wakeup_Init(void)
{
hu's avatar
hu committed
143
    GearVariable.Number = 0u;
hu's avatar
hu committed
144 145 146 147
    GearVariable.Manual = GEAR_MANUAL_OFF;
}
void Gear_Sleep_Init(void)
{
hu's avatar
hu committed
148
    GearVariable.Number = 0u;
hu's avatar
hu committed
149 150 151 152
    GearVariable.Manual = GEAR_MANUAL_OFF;
}
/*-------------------------------------------------------------------------
 * Function Name  : Gear_Processing_Service
hu's avatar
hu committed
153
 * Description    :
hu's avatar
hu committed
154 155 156 157 158 159 160
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
void Gear_Processing_Service(void)
{
hu's avatar
hu committed
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
    uint8_t can1_4_1_8 = 0 ; //***************************************** 接收报文的变量
    uint8_t can2_1_5_2 = 0 ; //***************************************** 接收报文的变量
    uint8_t can3_3_7_2 = 0 ; //***************************************** 接收报文的变量
    uint8_t can4_5_1_8 = 0 ; //***************************************** 接收报文的变量
    uint8_t can5_1_7_2 = 0 ; //***************************************** 接收报文的变量

    uint8_t u8Number = 0 ; //************************************** 档位 编号
    en_GEAR_Sta u8Manual = GEAR_MANUAL_OFF ; //******************** 是否MANUAL

    can1_4_1_8 = Get_ID_18F00503_Sig_Current_Gear(); //can1_4_1_8含义是: byte 4     bit 1    length 8
    can2_1_5_2 = Get_ID_18FF8503_Sig_Manouvering_mode();
    can3_3_7_2 = Get_ID_18FE4A03_Sig_TransmissionSiftMode1_Indicator();
    can4_5_1_8 = Get_ID_18F00503_Sig_ID18F00503_byte5();
    can5_1_7_2 = Get_ID_18FF8503_Sig_Automatic_or_Manual_Mode();

    if (/*Get_CanFirstRecv_Event(ID_CanMsg18F00503_Msg_Count) == 0*/  0u)
    {
        u8Number = 0u;
        u8Manual = GEAR_MANUAL_OFF;
    }
    else if (CAN_MSG_Status(ID_CanMsg18F00503_Msg_Count) == CAN_SIG_LOST)
    {
        u8Number = 20u;
        u8Manual = GEAR_MANUAL_OFF;
    }
    else
    {
        if ((can1_4_1_8 == 0x7E) && (can2_1_5_2 != 0x01)) //档位1
        {
            u8Number = 1u;
        }
        else if (can1_4_1_8 == 0x7F) //档位2
        {
            u8Number = 2u;
        }
        else if (can1_4_1_8 == 0x80) //档位3
        {
            u8Number = 3u;
        }
        else if (can1_4_1_8 == 0x81) //档位4
        {
            u8Number = 4u;
        }
        else if (can1_4_1_8 == 0x82) //档位5
        {
            u8Number = 5u;
        }
        else if (can1_4_1_8 == 0x83) //档位6
        {
            u8Number = 6u;
        }
        else if (can1_4_1_8 == 0x84) //档位7
        {
            u8Number = 7u;
        }
        else if (can1_4_1_8 == 0x85) //档位8
        {
            u8Number = 8u;
        }
        else if (can1_4_1_8 == 0x86) //档位9
        {
            u8Number = 9u;
        }
        else if (can1_4_1_8 == 0x87) //档位10
        {
            u8Number = 10u;
        }
        else if (can1_4_1_8 == 0x88) //档位11
        {
            u8Number = 11u;
        }
        else if (can1_4_1_8 == 0x89) //档位12
        {
            u8Number = 12u;
        }
        else if (can1_4_1_8 == 0x7B) //档位R2
        {
            u8Number = 13u;
        }

        else if ((can1_4_1_8 == 0x7C) && (can2_1_5_2 != 0x01)) //档位R1
        {
            u8Number = 14u;
        }

        else if ((can1_4_1_8 == 0x7D) && (can3_3_7_2 != 0x01)) //档位N
        {
            u8Number = 15u;
        }
        else if ((can1_4_1_8 == 0x7C) && (can2_1_5_2 == 0x01)) //档位RM
        {
            u8Number = 16u;
        }
        else if ((can1_4_1_8 == 0x7E) && (can2_1_5_2 == 0x01)) //档位DM
        {
            u8Number = 17u;
        }
        else if ((can1_4_1_8 == 0x7D) && (can3_3_7_2 == 0x01)) //档位E
        {
            u8Number = 18u;
        }
        else if ((can4_5_1_8 == 0x7D) && (can3_3_7_2 == 0x01)) //档位NE
        {
            u8Number = 19u;
        }
        else//档位——
        {
            u8Number = 20u;
        }


        if (CAN_MSG_Status(ID_CanMsg18FF8503_Msg_Count) == CAN_SIG_LOST)
        {
            u8Manual = GEAR_MANUAL_OFF;
        }
        else if (can5_1_7_2 == 0x00)
        {
            u8Manual = GEAR_MANUAL_ON;
        }
        else
        {
            u8Manual = GEAR_MANUAL_OFF;
        }
    }

    GearVariable.Number = u8Number ;
    GearVariable.Manual = u8Manual ;
hu's avatar
hu committed
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
}

/*-------------------------------------------------------------------------
 * Function Name  : Gui_Get_Gear
 * Description    : 返回当前 档位
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
uint8_t Gui_Get_Gear(void)
{
    uint8_t u8Result = 0u;
    u8Result = GearVariable.Number;
    return u8Result;
}
/*-------------------------------------------------------------------------
 * Function Name  : Gui_Get_Gear_MANUAL
 * Description    : 返回当前档位栏MANUAL标志是否点亮
 * Input          : None
 * Output         : None
 * Return         : None
 * onther         : None
 --------------------------------------------------------------------------*/
en_GEAR_Sta Gui_Get_Gear_MANUAL(void)
{
    en_GEAR_Sta u8Result = GEAR_MANUAL_OFF;
    u8Result = GearVariable.Manual;
    return u8Result;
}