Key_user.c 63.1 KB
Newer Older
hu's avatar
hu committed
1 2

#include "Key.h"
3
#include "Menu.h"
4 5
#include "GUI.h"
#include "CD4051.h"
6
#include "Services_ODO_User.h"
hu's avatar
hu committed
7 8

#include "DisplaySch_user.h"
hu's avatar
hu committed
9
#include "DispSch.h"
hu's avatar
hu committed
10 11 12
#include "Sound_Scheduler.h"
#include "System_Monitor.h"
#include "RTE_ADC.h"
hu's avatar
hu committed
13

hu's avatar
hu committed
14
#include "kwp2000_service.h"
hu's avatar
hu committed
15 16
#include "CAN_Communication_Matrix.h"

hu's avatar
hu committed
17
/*-------------------------------------------------------*/
18
/*无车速限制值*/
hu's avatar
hu committed
19
#define DISPSPEEDNULLMAX 66
hu's avatar
hu committed
20

hu's avatar
hu committed
21 22 23 24 25 26 27
/*----------按键具体功能执行的回调函数-----------------------*/

void Key_Operation_Enter(Key_Event_en_t enKeyEvent);
void Key_Operation_Return(Key_Event_en_t enKeyEvent);
void Key_Operation_Up(Key_Event_en_t enKeyEvent);
void Key_Operation_Down(Key_Event_en_t enKeyEvent);
void Key_Operation_Menu(Key_Event_en_t enKeyEvent);
28
void Key_Operation_ODOTrip(Key_Event_en_t enKeyEvent);
hu's avatar
hu committed
29 30 31 32 33 34 35 36 37 38 39

Key_IGN_en_t Key_Get_IGN_Status(void);

/*******************************UP***********************************************
  Function: Key_Operation_Up
  Description:
  Input:
  Output:
 *******************************UP***********************************************/
void Key_Operation_Up(Key_Event_en_t enKeyEvent)
{
hu's avatar
hu committed
40
    uint8_t CanStatus1 = 0u;
41
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
42
    UElib_uint16_t HMI_MENU_Sta = 0u;
43

44
    HMI_Set_KEY_UP(enKeyEvent);
hu's avatar
hu committed
45

hu's avatar
hu committed
46 47 48
    HMI_MENU_Sta = Get_Cur_HMI();

    DispVSpeed = Common_Get_Disp_V_Speed();
hu's avatar
hu committed
49
    CanStatus1 = CAN_MSG_Status(ID_CanMsg0CF00400_Msg_Count);
50 51 52

    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
53
        /*----无车速,无报警----*/
hu's avatar
hu committed
54
        if (HMI_MENU_Sta != Display_Alarm)
55
        {
56
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
57
            {
58 59
                /*主界面 一级菜单 二级菜单那*/
                if (((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_6_MENU_2)) ||
60
                        ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
hu's avatar
hu committed
61
                {
hu's avatar
hu committed
62
                    /*系统演示模式*/
63
                    if ((bCurMenuIDX == _MN_DSP_LEVEL2MENU_6) && (K_Line_Set.K_Line_LID27 != 0x01u) && (K_Line_Set.K_Line_LID28 != 0x01u))
hu's avatar
hu committed
64 65 66
                    {
                        NextMenu(_MN_DSP_LEVEL2MENU_4);
                    }
67 68 69 70 71
                    /*TPMS轮胎设定*/
                    else if ((bCurMenuIDX == _MN_DSP_LEVEL2_4_MENU_6) && (K_Line_Set.K_Line_LID3E != 0x01u))
                    {
                        NextMenu(_MN_DSP_LEVEL2_4_MENU_4);
                    }
72 73 74 75
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_UP);
                    }
hu's avatar
hu committed
76
                }
hu's avatar
hu committed
77
                /*系统演示模式子菜单*/
78
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL2_5_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_5_MENU_4))
hu's avatar
hu committed
79
                {
80
                    if ((K_Line_Set.K_Line_LID27 != 0x01u) && (bCurMenuIDX == _MN_DSP_LEVEL2_5_MENU_2))
hu's avatar
hu committed
81
                    {
82
                        ; /*Do Nothing!*/
hu's avatar
hu committed
83 84 85
                    }
                    else
                    {
86 87
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_UP);
                    }
hu's avatar
hu committed
88
                }
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
                /*背光调节*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_1)
                {
                    if (User_set_Num.User_Light1 < 16u)
                    {
                        User_set_Num.User_Light1++;
                    }
                }
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_2)
                {
                    if (User_set_Num.User_Light2 < 16u)
                    {
                        User_set_Num.User_Light2++;
                    }
                }
104 105
                /*保养通知设定 更换机油&机油滤清器*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_1)
hu's avatar
hu committed
106
                {
107
                    if (User_set_Num.User_FDJYLQQ == (uint32_t)K_Line_Set.K_Line_LID4F * 1000u)
hu's avatar
hu committed
108
                    {
hu's avatar
hu committed
109
                        User_set_Num.User_FDJYLQQ = 0u;
hu's avatar
hu committed
110
                    }
hu's avatar
hu committed
111
                }
112 113
                /*保养通知设定 更换燃油滤清器*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_2)
hu's avatar
hu committed
114
                {
115
                    if (User_set_Num.User_RYLQQ == (uint32_t)K_Line_User_RYLQQ * 1000u)
hu's avatar
hu committed
116
                    {
hu's avatar
hu committed
117
                        User_set_Num.User_RYLQQ = 0u;
hu's avatar
hu committed
118
                    }
hu's avatar
hu committed
119
                }
120 121
                /*保养通知设定 更换变速箱油*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_3)
hu's avatar
hu committed
122
                {
123
                    if (User_set_Num.User_BSXY == (uint32_t)K_Line_Set.K_Line_LID4A * 1000u)
hu's avatar
hu committed
124
                    {
125
                        User_set_Num.User_BSXY = 0u;
hu's avatar
hu committed
126
                    }
hu's avatar
hu committed
127
                }
128 129
                /*保养通知设定 更换差速器右*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_4)
hu's avatar
hu committed
130
                {
131
                    if (User_set_Num.User_CSQY == (uint32_t)K_Line_Set.K_Line_LID4B * 1000u)
hu's avatar
hu committed
132
                    {
hu's avatar
hu committed
133
                        User_set_Num.User_CSQY = 0u;
hu's avatar
hu committed
134
                    }
135 136 137 138 139
                }
                /*保养通知设定 更换动力转向油*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_6)
                {
                    if (User_set_Num.User_DLZXY == (uint32_t)K_Line_Set.K_Line_LID4D * 1000u)
hu's avatar
hu committed
140
                    {
hu's avatar
hu committed
141
                        User_set_Num.User_DLZXY = 0u;
hu's avatar
hu committed
142
                    }
143 144 145 146 147
                }
                /*保养通知设定 轮胎换位.更换*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_7)
                {
                    if (User_set_Num.User_LT == (uint32_t)K_Line_Set.K_Line_LID4E * 1000u)
hu's avatar
hu committed
148
                    {
hu's avatar
hu committed
149
                        User_set_Num.User_LT = 0u;
hu's avatar
hu committed
150
                    }
151 152 153 154
                }
                /*设置日期-年*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11)
                {
hu's avatar
hu committed
155
                    User_set_Num.Year++;
156

hu's avatar
hu committed
157
                    if (User_set_Num.Year > 99u)
hu's avatar
hu committed
158
                    {
159
                        User_set_Num.Year = 0u;
hu's avatar
hu committed
160
                    }
161 162 163 164 165 166 167
                }
                /*设置日期-月*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_12)
                {
                    User_set_Num.Month++;

                    if (User_set_Num.Month > 12u)
hu's avatar
hu committed
168
                    {
169
                        User_set_Num.Month = 1u;
hu's avatar
hu committed
170
                    }
171 172 173 174 175
                }
                /*设置日期-日*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_13)
                {
                    User_set_Num.Date++;
hu's avatar
hu committed
176

177
                    switch (User_set_Num.Month)
hu's avatar
hu committed
178
                    {
179 180 181 182 183 184 185 186
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (User_set_Num.Date > 31u)
hu's avatar
hu committed
187 188 189
                        {
                            User_set_Num.Date = 1u;
                        }
190 191 192 193 194 195
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (User_set_Num.Date > 30u)
hu's avatar
hu committed
196 197 198
                        {
                            User_set_Num.Date = 1u;
                        }
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
                        break;
                    case 2:
                        if (((User_set_Num.Year % 4u == 0u) && (User_set_Num.Year % 100 != 0u)) || (User_set_Num.Year % 400u == 0u))
                        {
                            User_set_Num.LeapYear = 1u;
                        }
                        else
                        {
                            User_set_Num.LeapYear = 0u;
                        }

                        if (User_set_Num.LeapYear)
                        {
                            if (User_set_Num.Date > 29u)
                            {
                                User_set_Num.Date = 1u;
                            }
                        }
                        else
                        {
                            if (User_set_Num.Date > 28u)
                            {
                                User_set_Num.Date = 1u;
                            }
                        }
                        break;
                    default:
                        break;
hu's avatar
hu committed
227 228
                    }
                }
229 230
                /*设置时间-时*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_21)
hu's avatar
hu committed
231
                {
hu's avatar
hu committed
232
                    User_set_Num.Hour++;
hu's avatar
hu committed
233

234 235
                    if (User_set_Num.Hour > 23u)
                    {
hu's avatar
hu committed
236
                        User_set_Num.Hour = 0u;
237
                    }
hu's avatar
hu committed
238
                }
239 240
                /*设置时间-分*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_22)
hu's avatar
hu committed
241
                {
242 243 244 245
                    User_set_Num.Minute++;

                    if (User_set_Num.Minute > 59u)
                    {
hu's avatar
hu committed
246
                        User_set_Num.Minute = 0u;
247
                    }
hu's avatar
hu committed
248
                }
249 250
                /*语言设置 ----反*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3)
hu's avatar
hu committed
251
                {
252 253
                    if (User_set_Num.User_Language > 0u)
                    {
hu's avatar
hu committed
254
                        User_set_Num.User_Language--;
255
                    }
hu's avatar
hu committed
256
                }
hu's avatar
hu committed
257 258 259 260
                /*胎压匹配界面*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5)
                {
                    if (User_set_Num.User_TpmsStatus == 0)
hu's avatar
hu committed
261
                    {
hu's avatar
hu committed
262
                        User_set_Num.User_TpmsStatus = 1;
hu's avatar
hu committed
263
                    }
hu's avatar
hu committed
264
                    if ((User_set_Num.User_TpmsStatus == 1) && (User_set_Num.User_Tpms < 12))
hu's avatar
hu committed
265
                    {
hu's avatar
hu committed
266
                        User_set_Num.User_Tpms++;
hu's avatar
hu committed
267
                    }
hu's avatar
hu committed
268
                }
269 270
                /*高速路*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_1)
hu's avatar
hu committed
271
                {
272 273 274 275 276 277 278 279
                    if (User_set_Num.User_Gsl < 110)
                    {
                        User_set_Num.User_Gsl++;
                    }
                    else if (User_set_Num.User_Gsl == 0xFF)
                    {
                        User_set_Num.User_Gsl = 20;
                    }
hu's avatar
hu committed
280
                }
281 282
                /*一般路*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_2)
hu's avatar
hu committed
283
                {
284 285 286 287 288 289 290 291
                    if (User_set_Num.User_Ybl < 110)
                    {
                        User_set_Num.User_Ybl++;
                    }
                    else if (User_set_Num.User_Ybl == 0xFF)
                    {
                        User_set_Num.User_Ybl = 20;
                    }
hu's avatar
hu committed
292
                }
293 294
                /*发动机转速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_3)
hu's avatar
hu committed
295
                {
296 297
                    if (User_set_Num.User_Speed < 99)
                    {
hu's avatar
hu committed
298
                        User_set_Num.User_Speed++;
299 300 301 302 303
                    }
                    else if (User_set_Num.User_Speed == 0xFF)
                    {
                        User_set_Num.User_Speed = 0;
                    }
hu's avatar
hu committed
304
                }
305 306
                /*急加速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_4)
hu's avatar
hu committed
307
                {
308 309 310 311 312 313 314 315
                    if (User_set_Num.User_JADD < 99)
                    {
                        User_set_Num.User_JADD++;
                    }
                    else if (User_set_Num.User_JADD == 0xFF)
                    {
                        User_set_Num.User_JADD = 5;
                    }
hu's avatar
hu committed
316
                }
317 318
                /*急减速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_5)
hu's avatar
hu committed
319
                {
320 321 322 323 324 325 326 327
                    if (User_set_Num.User_JSUB < 99)
                    {
                        User_set_Num.User_JSUB++;
                    }
                    else if (User_set_Num.User_JSUB == 0xFF)
                    {
                        User_set_Num.User_JSUB = 5;
                    }
hu's avatar
hu committed
328
                }
329 330
                /*长时间怠速设定*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_6)
hu's avatar
hu committed
331
                {
332 333 334 335
                    if (User_set_Num.User_IDLING == 0xFFu)
                    {
                        User_set_Num.User_IDLING = 0u;
                    }
hu's avatar
hu committed
336
                }
337 338
                /*辅助驻车解除设定*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_7)
hu's avatar
hu committed
339
                {
hu's avatar
hu committed
340
                    if (User_set_Num.User_Parking == 0xFFu)
341 342 343
                    {
                        User_set_Num.User_Parking = 0u;
                    }
hu's avatar
hu committed
344
                }
hu's avatar
hu committed
345 346 347
                /*工厂模式*/ /*经销商模式*/
                else if (((bCurMenuIDX >= _FAC_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1MENU_6)) ||
                         ((bCurMenuIDX >= _FAC_DSP_LEVEL1_3MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1_3MENU_2)) ||
hu's avatar
hu committed
348 349
                         ((bCurMenuIDX >= _DEA_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1MENU_6)) ||
                         ((bCurMenuIDX >= _DEA_DSP_LEVEL1_3MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1_3MENU_2)))
hu's avatar
hu committed
350 351 352
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_UP);
                }
hu's avatar
hu committed
353 354 355 356
                else
                {
                    ;/*Do Nothing!*/
                }
hu's avatar
hu committed
357
            }
358
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
359
            {
hu's avatar
hu committed
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
                MenuFlag.Menu_Key_Time++;
                if (MenuFlag.Menu_Key_Time > 10)
                {
                    MenuFlag.Menu_Key_Time = 0;
                    /*设置日期-年*/
                    if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11)
                    {
                        User_set_Num.Year++;

                        if (User_set_Num.Year > 99u)
                        {
                            User_set_Num.Year = 0u;
                        }
                    }
                    /*设置日期-月*/
                    else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_12)
                    {
                        User_set_Num.Month++;

                        if (User_set_Num.Month > 12u)
                        {
                            User_set_Num.Month = 1u;
                        }
                    }
                    /*设置日期-日*/
                    else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_13)
                    {
                        User_set_Num.Date++;

                        switch (User_set_Num.Month)
                        {
                        case 1:
                        case 3:
                        case 5:
                        case 7:
                        case 8:
                        case 10:
                        case 12:
                            if (User_set_Num.Date > 31u)
                            {
                                User_set_Num.Date = 1u;
                            }
                            break;
                        case 4:
                        case 6:
                        case 9:
                        case 11:
                            if (User_set_Num.Date > 30u)
                            {
                                User_set_Num.Date = 1u;
                            }
                            break;
                        case 2:
                            if (((User_set_Num.Year % 4u == 0u) && (User_set_Num.Year % 100 != 0u)) || (User_set_Num.Year % 400u == 0u))
                            {
                                User_set_Num.LeapYear = 1u;
                            }
                            else
                            {
                                User_set_Num.LeapYear = 0u;
                            }

                            if (User_set_Num.LeapYear)
                            {
                                if (User_set_Num.Date > 29u)
                                {
                                    User_set_Num.Date = 1u;
                                }
                            }
                            else
                            {
                                if (User_set_Num.Date > 28u)
                                {
                                    User_set_Num.Date = 1u;
                                }
                            }
                            break;
                        default:
                            break;
                        }
                    }
                    /*设置时间-时*/
                    else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_21)
                    {
                        User_set_Num.Hour++;

                        if (User_set_Num.Hour > 23u)
                        {
                            User_set_Num.Hour = 0u;
                        }
                    }
                    /*设置时间-分*/
                    else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_22)
                    {
                        User_set_Num.Minute++;

                        if (User_set_Num.Minute > 59u)
                        {
                            User_set_Num.Minute = 0u;
                        }
                    }
                }
hu's avatar
hu committed
462
            }
463 464 465 466 467
        }
        /*----无车速,有报警----*/
        else
        {
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
468
            {
hu's avatar
hu committed
469
                ; /*D0 Nothing!*/
hu's avatar
hu committed
470
            }
471
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
472
            {
hu's avatar
hu committed
473
                ; /*D0 Nothing!*/
hu's avatar
hu committed
474
            }
475 476 477 478
        }
    }
    else
    {
479
        /*----有车速,无报警----*/
hu's avatar
hu committed
480
        if (HMI_MENU_Sta != Display_Alarm)
481 482 483
        {
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
484 485 486 487 488 489 490 491
                /*工厂模式*/ /*经销商模式*/
                if (((bCurMenuIDX >= _FAC_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1MENU_6)) ||
                        ((bCurMenuIDX >= _FAC_DSP_LEVEL1_3MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1_3MENU_2)) ||
                        ((bCurMenuIDX >= _DEA_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1MENU_6)) ||
                        ((bCurMenuIDX >= _DEA_DSP_LEVEL1_3MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1_3MENU_2)))
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_UP);
                }
hu's avatar
hu committed
492 493 494 495 496 497 498 499 500 501 502 503 504 505
                /*主界面 一级菜单 二级菜单那*/
                else if (((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL1MENU_6)) ||
                         ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
                {
                    /*系统演示模式*/
                    if ((bCurMenuIDX == _MN_DSP_LEVEL2MENU_6) && (K_Line_Set.K_Line_LID27 != 0x01u) && (K_Line_Set.K_Line_LID28 != 0x01u))
                    {
                        NextMenu(_MN_DSP_LEVEL2MENU_4);
                    }
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_UP);
                    }
                }
hu's avatar
hu committed
506 507 508 509
                else
                {
                    ;/*Do Nothing!*/
                }
510 511 512
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
513
                ; /*D0 Nothing!*/
514 515 516 517
            }
        }
        /*----有车速,有报警----*/
        else
518
        {
519 520
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
521
                ; /*D0 Nothing!*/
522 523 524
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
525
                ; /*D0 Nothing!*/
526
            }
527 528
        }
    }
hu's avatar
hu committed
529 530 531 532 533 534 535 536 537 538
}

/*******************************DOWN***********************************************
  Function: Key_Operation_Down
  Description:
  Input:
  Output:
 *******************************DOWN***********************************************/
void Key_Operation_Down(Key_Event_en_t enKeyEvent)
{
539
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
540
    UElib_uint16_t HMI_MENU_Sta = 0u;
541

542
    HMI_Set_KEY_DOWN(enKeyEvent);
hu's avatar
hu committed
543 544 545

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
546 547 548

    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
549
        /*----无车速,无报警----*/
hu's avatar
hu committed
550
        if (HMI_MENU_Sta != Display_Alarm)
551
        {
552
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
553
            {
554 555
                /*主界面 一级菜单 二级菜单*/
                if (((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_6_MENU_2)) ||
556
                        ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
hu's avatar
hu committed
557
                {
hu's avatar
hu committed
558 559 560
                    /*系统演示模式*/
                    if ((bCurMenuIDX == _MN_DSP_LEVEL2MENU_4) && (K_Line_Set.K_Line_LID27 != 0x01u) && (K_Line_Set.K_Line_LID28 != 0x01u))
                    {
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
                        if (K_Line_Set.K_Line_LID3E == 0x01u)
                        {
                            NextMenu(_MN_DSP_LEVEL2MENU_6);
                        }
                        else
                        {
                            ;/*Do Notingh!*/
                        }
                    }
                    /*轮胎状态显示*/
                    else if ((bCurMenuIDX == _MN_DSP_LEVEL2MENU_5) && (K_Line_Set.K_Line_LID3E != 0x01u))
                    {
                        ;/*Do Notingh!*/
                    }
                    /*TPMS轮胎设定*/
                    else if ((bCurMenuIDX == _MN_DSP_LEVEL2_4_MENU_4) && (K_Line_Set.K_Line_LID3E != 0x01u))
                    {
                        NextMenu(_MN_DSP_LEVEL2_4_MENU_6);
hu's avatar
hu committed
579 580 581 582 583
                    }
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN);
                    }
hu's avatar
hu committed
584
                }
585 586 587 588 589 590 591 592 593 594 595 596
                /*系统演示模式子菜单*/
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL2_5_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_5_MENU_4))
                {
                    if ((K_Line_Set.K_Line_LID28 != 0x01u) && (bCurMenuIDX == _MN_DSP_LEVEL2_5_MENU_1))
                    {
                        ; /*Do Nothing!*/
                    }
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN);
                    }
                }
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
                /*背光调节*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_1)
                {
                    if (User_set_Num.User_Light1 > 1u)
                    {
                        User_set_Num.User_Light1--;
                    }
                }
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_2)
                {
                    if (User_set_Num.User_Light2 > 1u)
                    {
                        User_set_Num.User_Light2--;
                    }
                }
612 613
                /*保养通知设定 更换机油&机油滤清器*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_1)
hu's avatar
hu committed
614
                {
hu's avatar
hu committed
615
                    if (User_set_Num.User_FDJYLQQ == 0u)
hu's avatar
hu committed
616
                    {
hu's avatar
hu committed
617
                        User_set_Num.User_FDJYLQQ = (uint32_t)K_Line_Set.K_Line_LID4F * 1000u;
hu's avatar
hu committed
618
                    }
hu's avatar
hu committed
619
                }
620 621
                /*保养通知设定 更换燃油滤清器*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_2)
hu's avatar
hu committed
622
                {
hu's avatar
hu committed
623
                    if (User_set_Num.User_RYLQQ == 0u)
hu's avatar
hu committed
624
                    {
hu's avatar
hu committed
625
                        User_set_Num.User_RYLQQ = (uint32_t)K_Line_User_RYLQQ * 1000u;
hu's avatar
hu committed
626
                    }
hu's avatar
hu committed
627
                }
628 629
                /*保养通知设定 更换变速箱油*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_3)
hu's avatar
hu committed
630
                {
hu's avatar
hu committed
631
                    if (User_set_Num.User_BSXY == 0u)
hu's avatar
hu committed
632
                    {
hu's avatar
hu committed
633
                        User_set_Num.User_BSXY = (uint32_t)K_Line_Set.K_Line_LID4A * 1000u;
hu's avatar
hu committed
634
                    }
hu's avatar
hu committed
635
                }
636 637 638
                /*保养通知设定 更换差速器油*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_4)
                {
hu's avatar
hu committed
639
                    if (User_set_Num.User_CSQY == 0u)
hu's avatar
hu committed
640
                    {
hu's avatar
hu committed
641
                        User_set_Num.User_CSQY = (uint32_t)K_Line_Set.K_Line_LID4B * 1000u;
hu's avatar
hu committed
642
                    }
643 644 645 646
                }
                /*保养通知设定 更换动力转向液*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_6)
                {
hu's avatar
hu committed
647
                    if (User_set_Num.User_DLZXY == 0u)
hu's avatar
hu committed
648
                    {
hu's avatar
hu committed
649
                        User_set_Num.User_DLZXY = (uint32_t)K_Line_Set.K_Line_LID4D * 1000u;
hu's avatar
hu committed
650
                    }
651 652 653
                }
                /*保养通知设定 轮胎换位.更换*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_7)
hu's avatar
hu committed
654
                {
hu's avatar
hu committed
655
                    if (User_set_Num.User_LT == 0u)
hu's avatar
hu committed
656
                    {
hu's avatar
hu committed
657
                        User_set_Num.User_LT = (uint32_t)K_Line_Set.K_Line_LID4E * 1000u;
hu's avatar
hu committed
658
                    }
659 660 661 662
                }
                /*设置日期-年*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11)
                {
hu's avatar
hu committed
663
                    if (User_set_Num.Year > 0u)
hu's avatar
hu committed
664
                    {
665
                        User_set_Num.Year--;
hu's avatar
hu committed
666
                    }
667
                    else
hu's avatar
hu committed
668
                    {
669
                        User_set_Num.Year = 99u;
hu's avatar
hu committed
670
                    }
671 672 673 674 675
                }
                /*设置日期-月*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_12)
                {
                    if (User_set_Num.Month > 1u)
hu's avatar
hu committed
676
                    {
677
                        User_set_Num.Month--;
hu's avatar
hu committed
678 679 680
                    }
                    else
                    {
681
                        User_set_Num.Month = 12u;
hu's avatar
hu committed
682
                    }
683 684 685 686 687 688
                }
                /*设置日期-日*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_13)
                {
                    User_set_Num.Date--;
                    switch (User_set_Num.Month)
hu's avatar
hu committed
689
                    {
690 691 692 693 694 695 696
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
hu's avatar
hu committed
697 698
                        if (User_set_Num.Date < 1u)
                        {
699
                            User_set_Num.Date = 31u;
hu's avatar
hu committed
700
                        }
701 702 703 704 705
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
hu's avatar
hu committed
706 707
                        if (User_set_Num.Date < 1u)
                        {
708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733
                            User_set_Num.Date = 30u;
                        }
                        break;
                    case 2:
                        if (((User_set_Num.Year % 4u == 0u) && (User_set_Num.Year % 100u != 0u)) || (User_set_Num.Year % 400u == 0u))
                        {
                            User_set_Num.LeapYear = 1u;
                        }
                        else
                        {
                            User_set_Num.LeapYear = 0u;
                        }

                        if (User_set_Num.LeapYear)
                        {
                            if (User_set_Num.Date < 1u)
                            {
                                User_set_Num.Date = 29u;
                            }
                        }
                        else
                        {
                            if (User_set_Num.Date < 1u)
                            {
                                User_set_Num.Date = 28u;
                            }
hu's avatar
hu committed
734
                        }
735 736 737
                        break;
                    default:
                        break;
hu's avatar
hu committed
738 739
                    }
                }
740 741
                /*设置时间-时*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_21)
hu's avatar
hu committed
742
                {
743 744 745 746 747 748
                    if (User_set_Num.Hour > 0u)
                    {
                        User_set_Num.Hour--;
                    }
                    else
                    {
hu's avatar
hu committed
749
                        User_set_Num.Hour = 23u;
750
                    }
hu's avatar
hu committed
751
                }
752 753
                /*设置时间-分*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_22)
hu's avatar
hu committed
754
                {
755 756
                    if (User_set_Num.Minute > 0u)
                    {
hu's avatar
hu committed
757
                        User_set_Num.Minute--;
758 759 760
                    }
                    else
                    {
hu's avatar
hu committed
761
                        User_set_Num.Minute = 59u;
762
                    }
hu's avatar
hu committed
763
                }
764 765
                /*语言设置 ----反*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3)
hu's avatar
hu committed
766
                {
hu's avatar
hu committed
767 768
                    if (User_set_Num.User_Language < 1)
                        User_set_Num.User_Language++;
hu's avatar
hu committed
769
                }
hu's avatar
hu committed
770 771 772 773 774 775 776 777 778 779 780 781 782 783
                /*胎压匹配界面*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5)
                {
                    /*if(User_set_Num.User_TpmsStatus == 0)
                    {
                      if(User_set_Num.User_Par_Temp == 0)
                        User_set_Num.User_Par_Temp = 1;
                      else
                        User_set_Num.User_Par_Temp = 0;
                    }
                    else */
                    if ((User_set_Num.User_TpmsStatus == 1) && (User_set_Num.User_Tpms > 1))
                        User_set_Num.User_Tpms--;
                }
784 785
                /*高速路*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_1)
hu's avatar
hu committed
786
                {
787 788 789 790 791 792 793 794
                    if ((User_set_Num.User_Gsl > 20) && (User_set_Num.User_Gsl <= 110))
                    {
                        User_set_Num.User_Gsl--;
                    }
                    else
                    {
                        User_set_Num.User_Gsl = 0xFF;
                    }
hu's avatar
hu committed
795
                }
796 797
                /*一般路*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_2)
hu's avatar
hu committed
798
                {
799 800 801 802 803 804 805 806
                    if ((User_set_Num.User_Ybl > 20) && (User_set_Num.User_Ybl <= 110))
                    {
                        User_set_Num.User_Ybl--;
                    }
                    else
                    {
                        User_set_Num.User_Ybl = 0xFF;
                    }
hu's avatar
hu committed
807
                }
808 809
                /*发动机转速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_3)
hu's avatar
hu committed
810
                {
811 812 813 814
                    if ((User_set_Num.User_Speed >= 0) && (User_set_Num.User_Speed <= 99))
                    {
                        User_set_Num.User_Speed--;
                    }
hu's avatar
hu committed
815
                }
816 817
                /*急加速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_4)
hu's avatar
hu committed
818
                {
819 820 821 822 823 824 825 826
                    if ((User_set_Num.User_JADD > 5) && (User_set_Num.User_JADD <= 99))
                    {
                        User_set_Num.User_JADD--;
                    }
                    else
                    {
                        User_set_Num.User_JADD = 0xFF;
                    }
hu's avatar
hu committed
827
                }
828 829
                /*急减速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_5)
hu's avatar
hu committed
830
                {
831 832 833 834 835 836 837 838
                    if ((User_set_Num.User_JSUB > 5) && (User_set_Num.User_JSUB <= 99))
                    {
                        User_set_Num.User_JSUB--;
                    }
                    else
                    {
                        User_set_Num.User_JSUB = 0xFF;
                    }
hu's avatar
hu committed
839
                }
840 841
                /*长时间怠速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_6)
hu's avatar
hu committed
842
                {
843 844 845 846
                    if (User_set_Num.User_IDLING == 0u)
                    {
                        User_set_Num.User_IDLING = 0xFFu;
                    }
hu's avatar
hu committed
847
                }
848 849
                /*辅助驻车解除*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_7)
hu's avatar
hu committed
850
                {
851 852 853 854
                    if (User_set_Num.User_Parking == 0u)
                    {
                        User_set_Num.User_Parking = 0xFFu;
                    }
hu's avatar
hu committed
855
                }
hu's avatar
hu committed
856 857 858
                /*工厂模式*/ /*经销商模式*/
                else if (((bCurMenuIDX >= _FAC_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1MENU_6)) ||
                         ((bCurMenuIDX >= _FAC_DSP_LEVEL1_3MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1_3MENU_2)) ||
hu's avatar
hu committed
859 860
                         ((bCurMenuIDX >= _DEA_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1MENU_6)) ||
                         ((bCurMenuIDX >= _DEA_DSP_LEVEL1_3MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1_3MENU_2)))
hu's avatar
hu committed
861 862 863
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN);
                }
hu's avatar
hu committed
864 865 866 867
                else
                {
                    ;/*Do Nothing!*/
                }
hu's avatar
hu committed
868
            }
869
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
870
            {
hu's avatar
hu committed
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979
                MenuFlag.Menu_Key_Time++;
                if (MenuFlag.Menu_Key_Time > 10)
                {
                    MenuFlag.Menu_Key_Time = 0;
                    /*设置日期-年*/
                    if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11)
                    {
                        if (User_set_Num.Year > 0u)
                        {
                            User_set_Num.Year--;
                        }
                        else
                        {
                            User_set_Num.Year = 99u;
                        }
                    }
                    /*设置日期-月*/
                    else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_12)
                    {
                        if (User_set_Num.Month > 1u)
                        {
                            User_set_Num.Month--;
                        }
                        else
                        {
                            User_set_Num.Month = 12u;
                        }
                    }
                    /*设置日期-日*/
                    else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_13)
                    {
                        User_set_Num.Date--;
                        switch (User_set_Num.Month)
                        {
                        case 1:
                        case 3:
                        case 5:
                        case 7:
                        case 8:
                        case 10:
                        case 12:
                            if (User_set_Num.Date < 1u)
                            {
                                User_set_Num.Date = 31u;
                            }
                            break;
                        case 4:
                        case 6:
                        case 9:
                        case 11:
                            if (User_set_Num.Date < 1u)
                            {
                                User_set_Num.Date = 30u;
                            }
                            break;
                        case 2:
                            if (((User_set_Num.Year % 4u == 0u) && (User_set_Num.Year % 100u != 0u)) || (User_set_Num.Year % 400u == 0u))
                            {
                                User_set_Num.LeapYear = 1u;
                            }
                            else
                            {
                                User_set_Num.LeapYear = 0u;
                            }

                            if (User_set_Num.LeapYear)
                            {
                                if (User_set_Num.Date < 1u)
                                {
                                    User_set_Num.Date = 29u;
                                }
                            }
                            else
                            {
                                if (User_set_Num.Date < 1u)
                                {
                                    User_set_Num.Date = 28u;
                                }
                            }
                            break;
                        default:
                            break;
                        }
                    }
                    /*设置时间-时*/
                    else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_21)
                    {
                        if (User_set_Num.Hour > 0u)
                        {
                            User_set_Num.Hour--;
                        }
                        else
                        {
                            User_set_Num.Hour = 23u;
                        }
                    }
                    /*设置时间-分*/
                    else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_22)
                    {
                        if (User_set_Num.Minute > 0u)
                        {
                            User_set_Num.Minute--;
                        }
                        else
                        {
                            User_set_Num.Minute = 59u;
                        }
                    }
                }
hu's avatar
hu committed
980
            }
981 982 983 984 985
        }
        else
        {
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
986
            {
hu's avatar
hu committed
987
                ; /*D0 Nothing!*/
hu's avatar
hu committed
988
            }
989
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
990
            {
hu's avatar
hu committed
991
                ; /*D0 Nothing!*/
hu's avatar
hu committed
992
            }
993 994 995 996
        }
    }
    else
    {
997
        /*----有车速,无报警----*/
hu's avatar
hu committed
998
        if (HMI_MENU_Sta != Display_Alarm)
999
        {
1000 1001
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1002 1003 1004 1005 1006 1007 1008 1009
                /*工厂模式*/ /*经销商模式*/
                if (((bCurMenuIDX >= _FAC_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1MENU_6)) ||
                        ((bCurMenuIDX >= _FAC_DSP_LEVEL1_3MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1_3MENU_2)) ||
                        ((bCurMenuIDX >= _DEA_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1MENU_6)) ||
                        ((bCurMenuIDX >= _DEA_DSP_LEVEL1_3MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1_3MENU_2)))
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN);
                }
hu's avatar
hu committed
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
                /*主界面 一级菜单 二级菜单*/
                else if (((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL1MENU_6)) ||
                         ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
                {
                    /*系统演示模式*/
                    if ((bCurMenuIDX == _MN_DSP_LEVEL2MENU_4) && (K_Line_Set.K_Line_LID27 != 0x01u) && (K_Line_Set.K_Line_LID28 != 0x01u))
                    {
                        NextMenu(_MN_DSP_LEVEL2MENU_6);
                    }
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN);
                    }
                }
hu's avatar
hu committed
1024 1025 1026 1027
                else
                {
                    ;/*Do Nothing!*/
                }
1028 1029 1030
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1031
                ; /*D0 Nothing!*/
1032 1033 1034 1035 1036 1037 1038
            }
        }
        /*----有车速,有报警----*/
        else
        {
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1039
                ; /*D0 Nothing!*/
1040 1041 1042
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1043
                ; /*D0 Nothing!*/
1044
            }
1045 1046
        }
    }
hu's avatar
hu committed
1047 1048 1049 1050 1051 1052 1053 1054 1055
}
/*******************************ENTER***********************************************
  Function: Key_Operation_Enter
  Description:
  Input:
  Output:
 *******************************ENTER***********************************************/
void Key_Operation_Enter(Key_Event_en_t enKeyEvent)
{
1056
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
1057
    UElib_uint16_t HMI_MENU_Sta = 0u;
1058

1059
    HMI_Set_KEY_CONFIRM(enKeyEvent);
hu's avatar
hu committed
1060

hu's avatar
hu committed
1061 1062
    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
1063 1064 1065

    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
1066
        /*----无车速,无报警----*/
hu's avatar
hu committed
1067
        if (HMI_MENU_Sta != Display_Alarm)
1068
        {
1069
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
1070
            {
1071
                if (((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_5_MENU_4)) ||
1072
                        ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
1073
                {
hu's avatar
hu committed
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089
                    /*系统演示模式*/
                    if (bCurMenuIDX == _MN_DSP_LEVEL2MENU_5)
                    {
                        if (K_Line_Set.K_Line_LID27 == 0x01u)
                        {
                            NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
                        }
                        else
                        {
                            NextMenu(_MN_DSP_LEVEL2_5_MENU_2);
                        }
                    }
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
                    }
1090 1091 1092 1093 1094 1095 1096
                }
                else if (((bCurMenuIDX >= _MN_DSP_LEVEL3_3_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_3)) ||
                         ((bCurMenuIDX >= _MN_DSP_LEVEL4_4_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL4_4_MENU_7)))
                {
                    MenuFlag.Menu_Return = 1u;
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
                }
1097 1098 1099
                /*背光调节*/
                else if ((bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_1) || (bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_2))
                {
1100
                    MenuFlag.Menu_Return = 1u;
1101 1102
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
                }
1103 1104 1105
                /*轮胎匹配界面*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5)
                {
hu's avatar
hu committed
1106 1107 1108
                    if (User_set_Num.User_TpmsStatus == 1)
                    {
                        User_set_Num.User_TpmsStatus = 2;  /*匹配轮胎*/
hu's avatar
hu committed
1109
                        User_set_Num.User_TpmsSend = 3;    /*报文外发状态*/
hu's avatar
hu committed
1110 1111
                        User_set_Num.User_Temp_Return = 0; /*清空取消标记位*/
                    }
1112 1113 1114 1115 1116 1117 1118
                }
                /*Go Return*/
                else if (bCurMenuIDX == _MN_DSP_ENTER_MENU)
                {
                    MenuFlag.Menu_Return = 1;
                    NextMenu(_MN_DSP_RETURN_MENU);
                }
hu's avatar
hu committed
1119
                /*工厂模式 经销商模式*/
hu's avatar
hu committed
1120
                else if ((bCurMenuIDX >= _FAC_DSP_LEVEL0MENU_1) && (bCurMenuIDX <= _MN_DSP_MENU_MAX))
hu's avatar
hu committed
1121
                {
hu's avatar
hu committed
1122
                    if ((bCurMenuIDX == _FAC_DSP_LEVEL2_5MENU_1) || (bCurMenuIDX == _DEA_DSP_LEVEL2_5MENU_1))
hu's avatar
hu committed
1123 1124 1125
                    {
                        K_Line_Set.K_Line_LID51 = 1u;
                    }
hu's avatar
hu committed
1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137
                    /*工厂模式*/
                    else if (bCurMenuIDX == _FAC_DSP_LEVEL1MENU_4)
                    {
                        K_Line_Set.K_Line_LID51 = 0x01u;
                        MenuFlag.Menu_StaFlag = 0x00u;
                    }
                    /*经销商模式*/
                    else if (bCurMenuIDX == _DEA_DSP_LEVEL1MENU_4)
                    {
                        K_Line_Set.K_Line_LID51 = 0x01u;
                        MenuFlag.Menu_StaFlag = 0x02u;
                    }
hu's avatar
hu committed
1138 1139 1140 1141 1142 1143 1144 1145
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
                    }
                }
                else
                {
                    ;/*Do Nothing!*/
hu's avatar
hu committed
1146
                }
hu's avatar
hu committed
1147
            }
1148
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
1149
            {
1150 1151 1152
                /*Go Enter*/
                if ((bCurMenuIDX >= _MN_DSP_LEVEL3_2_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_2_MENU_8))
                {
hu's avatar
hu committed
1153
                    MenuFlag.Menu_Enter_Return = bCurMenuIDX;
1154 1155
                    NextMenu(_MN_DSP_ENTER_MENU);
                }
1156 1157
            }
        }
1158
        else
hu's avatar
hu committed
1159
        {
1160 1161 1162
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1163
                ; /*D0 Nothing!*/
1164 1165
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
1166
            {
hu's avatar
hu committed
1167
                ; /*D0 Nothing!*/
hu's avatar
hu committed
1168 1169
            }
        }
1170 1171 1172
    }
    else
    {
1173
        /*----有车速,无报警----*/
hu's avatar
hu committed
1174
        if (HMI_MENU_Sta != Display_Alarm)
1175
        {
1176 1177
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1178 1179 1180
                /*工厂模式 经销商模式*/
                if ((bCurMenuIDX >= _FAC_DSP_LEVEL0MENU_1) && (bCurMenuIDX <= _MN_DSP_MENU_MAX))
                {
hu's avatar
hu committed
1181
                    if ((bCurMenuIDX == _FAC_DSP_LEVEL2_5MENU_1) || (bCurMenuIDX == _DEA_DSP_LEVEL2_5MENU_1))
hu's avatar
hu committed
1182 1183 1184
                    {
                        K_Line_Set.K_Line_LID51 = 1u;
                    }
hu's avatar
hu committed
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196
                    /*工厂模式*/
                    else if (bCurMenuIDX == _FAC_DSP_LEVEL1MENU_4)
                    {
                        K_Line_Set.K_Line_LID51 = 0x01u;
                        MenuFlag.Menu_StaFlag = 0x00u;
                    }
                    /*经销商模式*/
                    else if (bCurMenuIDX == _DEA_DSP_LEVEL1MENU_4)
                    {
                        K_Line_Set.K_Line_LID51 = 0x01u;
                        MenuFlag.Menu_StaFlag = 0x02u;
                    }
hu's avatar
hu committed
1197 1198 1199 1200 1201 1202 1203 1204 1205
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
                    }
                }
                else
                {
                    ;/*Do Nothing!*/
                }
1206 1207 1208
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1209
                ; /*D0 Nothing!*/
1210
            }
1211
        }
1212 1213
        /*----有车速,有报警----*/
        else
hu's avatar
hu committed
1214
        {
1215 1216
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1217
                ; /*D0 Nothing!*/
1218 1219 1220
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1221
                ; /*D0 Nothing!*/
1222
            }
hu's avatar
hu committed
1223
        }
1224
    }
hu's avatar
hu committed
1225 1226 1227 1228 1229 1230 1231 1232 1233 1234
}

/*******************************RETURN***********************************************
  Function: Key_Operation_Return
  Description:
  Input:
  Output:
 *******************************RETURN***********************************************/
void Key_Operation_Return(Key_Event_en_t enKeyEvent)
{
1235
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
1236
    UElib_uint16_t HMI_MENU_Sta = 0u;
1237

1238
    HMI_Set_KEY_CANCEL(enKeyEvent);
hu's avatar
hu committed
1239 1240 1241

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
1242 1243 1244

    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
1245
        /*----无车速,无报警----*/
hu's avatar
hu committed
1246
        if (HMI_MENU_Sta != Display_Alarm)
1247
        {
1248
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
1249
            {
1250
                if ((bCurMenuIDX >= _MN_DSP_LEVEL2_1_MENU_1) && (bCurMenuIDX < _MN_DSP_ENTER_MENU))
hu's avatar
hu committed
1251
                {
1252
                    if (
hu's avatar
hu committed
1253
                        (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3) ||                                              /*语言设定*/
1254
                        (bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_1) || (bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_2) ||  /*亮度调节*/
hu's avatar
hu committed
1255
                        ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)) /*省油设定子菜单*/
1256
                    )
hu's avatar
hu committed
1257
                    {
1258
                        MenuFlag.Menu_Return = 0u;
hu's avatar
hu committed
1259 1260
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
                    }
hu's avatar
hu committed
1261
                    else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5) /*胎压设置界面返回操作*/
hu's avatar
hu committed
1262
                    {
1263
                        if (User_set_Num.User_TpmsStatus != 2u) /*不是正在匹配状态*/
hu's avatar
hu committed
1264
                        {
1265
                            NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
hu's avatar
hu committed
1266 1267 1268
                        }
                        else
                        {
1269 1270
                            User_set_Num.User_TpmsStatus = 1u; /*退出匹配界面*/
                            if (User_set_Num.User_Temp_Return == 0u)
1271
                            {
1272
                                User_set_Num.User_Temp_Return = 1u; /*取消配对标记*/
hu's avatar
hu committed
1273
                                User_set_Num.User_TpmsSend = 3u;    /*报文外发状态*/
1274 1275 1276 1277 1278
                            }
                            else
                            {
                                ; /* do nonthing*/
                            }
hu's avatar
hu committed
1279 1280
                        }
                    }
1281 1282 1283 1284
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
                    }
hu's avatar
hu committed
1285
                }
1286 1287
                /*系统演示模式*/
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL3_5_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_5_MENU_4))
1288
                {
1289
                    MenuFlag.Menu_Return = 0;
1290 1291
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
                }
1292 1293 1294 1295 1296 1297
                /*Enter Go*/
                else if (bCurMenuIDX == _MN_DSP_ENTER_MENU)
                {
                    MenuFlag.Menu_Return = 0;
                    NextMenu(MenuFlag.Menu_Enter_Return);
                }
hu's avatar
hu committed
1298 1299 1300 1301 1302
                /*工厂模式 经销商模式*/
                else if ((bCurMenuIDX >= _FAC_DSP_LEVEL0MENU_1) && (bCurMenuIDX <= _MN_DSP_MENU_MAX))
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
                }
1303 1304
                else
                {
hu's avatar
hu committed
1305
                    ; /*do nothing*/
1306
                }
1307
            }
1308
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
1309
            {
hu's avatar
hu committed
1310
                ; /*D0 Nothing!*/
1311
            }
1312 1313 1314 1315 1316
        }
        else
        {
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
1317
            {
hu's avatar
hu committed
1318
                ; /*Do Nothing!*/
1319
            }
1320
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
1321
            {
1322
                MenuFlag.Key_Menu_Popup_time = 6000u;
1323 1324 1325 1326 1327
            }
        }
    }
    else
    {
hu's avatar
hu committed
1328
        if (HMI_MENU_Sta != Display_Alarm)
1329
        {
1330 1331 1332
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1333 1334 1335 1336 1337 1338 1339 1340 1341
                /*工厂模式 经销商模式*/
                if ((bCurMenuIDX >= _FAC_DSP_LEVEL0MENU_1) && (bCurMenuIDX <= _MN_DSP_MENU_MAX))
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
                }
                else
                {
                    ; /*do nothing*/
                }
1342 1343 1344
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1345
                ; /*Do Nothing!*/
1346 1347 1348 1349 1350 1351 1352
            }
        }
        else
        {
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1353
                ; /*Do Nothing!*/
1354 1355 1356 1357 1358
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
                MenuFlag.Key_Menu_Popup_time = 6000u;
            }
1359 1360
        }
    }
hu's avatar
hu committed
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370
}

/*******************************Menu***********************************************
  Function: Key_Operation_Menu
  Description:
  Input:
  Output:
 *******************************Menu***********************************************/
void Key_Operation_Menu(Key_Event_en_t enKeyEvent)
{
hu's avatar
hu committed
1371
    uint8_t CanStatus1 = 0u;
1372
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
1373
    UElib_uint16_t HMI_MENU_Sta = 0u;
hu's avatar
hu committed
1374

1375
    HMI_Set_KEY_MENU(enKeyEvent);
hu's avatar
hu committed
1376 1377 1378

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
hu's avatar
hu committed
1379

hu's avatar
hu committed
1380 1381
    CanStatus1 = CAN_MSG_Status(ID_CanMsg0CF00400_Msg_Count);

1382 1383
    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
1384
        /*----无车速,无报警----*/
hu's avatar
hu committed
1385
        if (HMI_MENU_Sta != Display_Alarm)
1386
        {
1387
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
1388
            {
hu's avatar
hu committed
1389 1390 1391 1392 1393 1394 1395 1396
                /*自检模式进入经销商模式*/
                if (bCurMenuIDX == _MN_DSP_Menu_Test)
                {
                    K_Line_Set.K_Line_LID51 = 0x02u;
                }
                /*工厂模式*/
                else if (MenuFlag.Menu_StaFlag == 0x00u)
                {
hu's avatar
hu committed
1397 1398
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1399 1400 1401 1402 1403 1404
                    K_Line_Set.K_Line_LID51 = 0x00u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
                /*经销商模式*/
                else if (MenuFlag.Menu_StaFlag == 0x02u)
                {
hu's avatar
hu committed
1405 1406
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1407 1408 1409
                    K_Line_Set.K_Line_LID51 = 0x02u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
1410
                /*记录进入menu菜单的位置*/
hu's avatar
hu committed
1411
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL1MENU_6))
1412
                {
hu's avatar
hu committed
1413
                    MenuFlag.Menu_Flag = bCurMenuIDX;
1414

1415
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
1416
                }
1417
                /*无论从哪里都能回去*/
hu's avatar
hu committed
1418
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_5_MENU_4))
1419
                {
hu's avatar
hu committed
1420
                    NextMenu(MenuFlag.Menu_Flag);
1421
                }
hu's avatar
hu committed
1422
            }
1423
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
1424
            {
hu's avatar
hu committed
1425
                ; /*Do Nothing!*/
1426 1427 1428 1429 1430 1431 1432
            }
        }
        else
        {
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1433 1434 1435 1436 1437
                /*自检模式进入经销商模式*/
                if (bCurMenuIDX == _MN_DSP_Menu_Test)
                {
                    K_Line_Set.K_Line_LID51 = 0x02;
                }
hu's avatar
hu committed
1438 1439 1440
                /*工厂模式*/
                else if (MenuFlag.Menu_StaFlag == 0x00u)
                {
hu's avatar
hu committed
1441 1442
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1443 1444 1445 1446 1447 1448
                    K_Line_Set.K_Line_LID51 = 0x00u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
                /*经销商模式*/
                else if (MenuFlag.Menu_StaFlag == 0x02u)
                {
hu's avatar
hu committed
1449 1450
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1451 1452 1453
                    K_Line_Set.K_Line_LID51 = 0x02u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
1454 1455 1456
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1457
                ; /*Do Nothing!*/
1458
            }
1459 1460 1461 1462
        }
    }
    else
    {
hu's avatar
hu committed
1463
        if (HMI_MENU_Sta != Display_Alarm)
1464
        {
1465 1466 1467
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483
                /*工厂模式*/
                if (MenuFlag.Menu_StaFlag == 0x00u)
                {
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

                    K_Line_Set.K_Line_LID51 = 0x00u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
                /*经销商模式*/
                else if (MenuFlag.Menu_StaFlag == 0x02u)
                {
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

                    K_Line_Set.K_Line_LID51 = 0x02u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
1484 1485 1486
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1487
                ; /*Do Nothing!*/
1488 1489 1490 1491 1492 1493 1494
            }
        }
        else
        {
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510
                /*工厂模式*/
                if (MenuFlag.Menu_StaFlag == 0x00u)
                {
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

                    K_Line_Set.K_Line_LID51 = 0x00u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
                /*经销商模式*/
                else if (MenuFlag.Menu_StaFlag == 0x02u)
                {
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

                    K_Line_Set.K_Line_LID51 = 0x02u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
1511 1512 1513
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1514
                ; /*Do Nothing!*/
1515
            }
1516 1517
        }
    }
hu's avatar
hu committed
1518 1519
}

1520 1521 1522 1523 1524 1525
/*******************************ODOTrip***********************************************
  Function: Key_Operation_ODOTrip
  Description:
  Input:
  Output:
 *******************************ODOTrip***********************************************/
hu's avatar
hu committed
1526
void Key_Operation_ODOTrip(Key_Event_en_t enKeyEvent)
1527 1528 1529
{
    uint16_t DispVSpeed = 0u;
    UElib_uint16_t HMI_MENU_Sta = 0u;
1530
    uint8_t PowerStatus;
1531 1532 1533 1534 1535

    HMI_Set_KEY_ODOTRIP(enKeyEvent);

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
hu's avatar
hu committed
1536
    PowerStatus = Common_Get_IG_Sts();
1537

hu's avatar
hu committed
1538
    if (enKeyEvent == KEY_EVENT_OFF_TO_ON)
1539
    {
hu's avatar
hu committed
1540 1541 1542 1543
        MenuFlag.Key_MenuTest_Long = 1u;
    }
    else if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
    {
1544
        if (PowerStatus == COMMON_POWER_ON)
hu's avatar
hu committed
1545
        {
1546
            if (HMI_MENU_Sta == Display_StartAnimation)
hu's avatar
hu committed
1547
            {
1548 1549 1550 1551
                if (MenuFlag.Key_MenuTest_ShortNum < 100u)
                {
                    MenuFlag.Key_MenuTest_ShortNum++;
                }
hu's avatar
hu committed
1552
            }
1553 1554
            else if (bCurMenuIDX == _MN_DSP_Menu_Test)
            {
hu's avatar
hu committed
1555

1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568
            }
            else if (User_set_Num.Trip_Type == TRAPA)
            {
                User_set_Num.Trip_Type = TRAPB;
            }
            else if (User_set_Num.Trip_Type == TRAPB)
            {
                User_set_Num.Trip_Type = TRAPA;
            }
            else
            {
                ;/*Do Nothing !*/
            }
1569 1570 1571
        }
        else
        {
1572
            State_Flag.Menu_Key_Static = 1u;
1573 1574 1575 1576
        }
    }
    else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
    {
hu's avatar
hu committed
1577
        if (PowerStatus == COMMON_POWER_ON)
1578
        {
hu's avatar
hu committed
1579 1580 1581 1582 1583 1584 1585 1586
            if (User_set_Num.Trip_Type == TRAPA)
            {
                Data_Clear_Trip(EM_TRIP_A);
            }
            else
            {
                Data_Clear_Trip(EM_TRIP_B);
            }
1587

hu's avatar
hu committed
1588 1589 1590 1591
            if (State_Flag.FState_ClearOilTx == 0u)
            {
                State_Flag.FState_ClearOilTx = 1u;
            }
1592
        }
1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651
    }
#if 0
    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
        if (HMI_MENU_Sta != Display_Alarm)
        {
            /*----无车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
                ;
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
                ; /*Do Nothing!*/
            }
        }
        else
        {
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
                ; /*Do Nothing!*/
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
                ; /*Do Nothing!*/
            }
        }
    }
    else
    {
        if (HMI_MENU_Sta != Display_Alarm)
        {
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
                ; /*Do Nothing!*/
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
                ; /*Do Nothing!*/
            }
        }
        else
        {
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
                ; /*Do Nothing!*/
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
                ; /*Do Nothing!*/
            }
        }
    }
#endif
}

hu's avatar
hu committed
1652 1653 1654 1655
uint8_t Common_Get_RetMenu_Flag(void)
{
    return MenuFlag.Menu_Flag;
}
hu's avatar
hu committed
1656 1657 1658 1659 1660
/*------------读按键实时状态的回调函数-------------------------------------------*/
Key_Real_Status_en_t Key_Real_Status_Read_Enter(void);
Key_Real_Status_en_t Key_Real_Status_Read_Return(void);
Key_Real_Status_en_t Key_Real_Status_Read_Up(void);
Key_Real_Status_en_t Key_Real_Status_Read_Down(void);
hu's avatar
hu committed
1661
Key_Real_Status_en_t Key_Real_Status_Read_Menu(void);
hu's avatar
hu committed
1662 1663
/*-------------------------------------------------*/

hu's avatar
hu committed
1664 1665 1666 1667 1668
// Menu_R   = 24000*470 / (24000 + 470) =  460.97Ω
// Enter_R  = 24000*6800 / (24000 + 6800) =  5298.7Ω
// Return_R = 24000*15000 / (24000 + 15000) =  9230.77Ω
// Up_R     = 24000*1200 / (24000 + 1200) =  1142.86Ω
// Down_R   = 24000*3300 / (24000 + 3300) =  2901.1Ω
hu's avatar
hu committed
1669

hu's avatar
hu committed
1670 1671 1672 1673 1674
// Menu_R   = 16000*470 / (16000 + 470) =  456.59Ω
// Enter_R  = 16000*6800 / (16000 + 6800) =  4771.9Ω
// Return_R = 16000*15000 / (16000 + 15000) =  7741.94Ω
// Up_R     = 16000*1200 / (16000 + 1200) =  1116.28Ω
// Down_R   = 16000*3300 / (16000 + 3300) =  2736Ω
hu's avatar
hu committed
1675 1676

//实际按键测试
1677
//无操作     21000~24000Ω
hu's avatar
hu committed
1678 1679 1680 1681 1682
// Menu_R        640~680Ω
// Enter_R       5300~5700Ω
// Return_R      9000~9500Ω
// Up_R          1300~1400Ω
// Down_R        3000~3200Ω
1683 1684 1685

/*上*/
Key_Real_Status_en_t Key_Real_Status_Read_Up(void)
hu's avatar
hu committed
1686 1687 1688
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1689 1690 1691 1692 1693 1694 1695 1696 1697

    Key_R = (uint16_t)RTE_Read_KEY_R();

    if (RTE_Read_KEY_R_Valid() == 0)
    {
        enKeyRealStatus = KEY_LINE_LOOSEN;
    }
    else
    {
hu's avatar
hu committed
1698
        if ((Key_R >= (1250 - 400)) && (Key_R <= (1250 + 400)))
1699 1700 1701 1702 1703 1704 1705 1706
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1707 1708 1709 1710

    return enKeyRealStatus;
}

1711 1712
/*下*/
Key_Real_Status_en_t Key_Real_Status_Read_Down(void)
hu's avatar
hu committed
1713 1714 1715
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1716 1717 1718 1719 1720 1721 1722 1723 1724

    Key_R = (uint16_t)RTE_Read_KEY_R();

    if (RTE_Read_KEY_R_Valid() == 0)
    {
        enKeyRealStatus = KEY_LINE_LOOSEN;
    }
    else
    {
hu's avatar
hu committed
1725
        if ((Key_R >= (2900 - 400)) && (Key_R <= (2900 + 400)))
1726 1727 1728 1729 1730 1731 1732 1733 1734
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }

hu's avatar
hu committed
1735 1736 1737
    return enKeyRealStatus;
}

1738 1739
/*Enter*/
Key_Real_Status_en_t Key_Real_Status_Read_Enter(void)
hu's avatar
hu committed
1740 1741 1742 1743
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;

1744 1745 1746 1747 1748 1749 1750 1751
    Key_R = (uint16_t)RTE_Read_KEY_R();

    if (RTE_Read_KEY_R_Valid() == 0)
    {
        enKeyRealStatus = KEY_LINE_LOOSEN;
    }
    else
    {
hu's avatar
hu committed
1752
        if ((Key_R >= (4800 - 400)) && (Key_R <= (4800 + 400)))
1753 1754 1755 1756 1757 1758 1759 1760
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1761 1762 1763
    return enKeyRealStatus;
}

1764 1765
/*Return*/
Key_Real_Status_en_t Key_Real_Status_Read_Return(void)
hu's avatar
hu committed
1766 1767 1768
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1769 1770 1771 1772 1773 1774 1775 1776 1777

    Key_R = (uint16_t)RTE_Read_KEY_R();

    if (RTE_Read_KEY_R_Valid() == 0)
    {
        enKeyRealStatus = KEY_LINE_LOOSEN;
    }
    else
    {
hu's avatar
hu committed
1778
        if ((Key_R >= (7800 - 400)) && (Key_R <= (7800 + 400)))
1779 1780 1781 1782 1783 1784 1785 1786
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1787 1788 1789 1790

    return enKeyRealStatus;
}

1791 1792
/*Menu*/
Key_Real_Status_en_t Key_Real_Status_Read_Menu(void)
hu's avatar
hu committed
1793 1794 1795
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1796 1797 1798 1799 1800 1801 1802 1803 1804

    Key_R = (uint16_t)RTE_Read_KEY_R();

    if (RTE_Read_KEY_R_Valid() == 0)
    {
        enKeyRealStatus = KEY_LINE_LOOSEN;
    }
    else
    {
hu's avatar
hu committed
1805
        if ((Key_R >= (500 - 300)) && (Key_R <= (500 + 300)))
1806 1807 1808 1809 1810 1811 1812 1813
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1814 1815 1816 1817

    return enKeyRealStatus;
}

1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836
/*TRIO-ODO*/
Key_Real_Status_en_t Key_Real_Status_Read_ODOTrip(void)
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;

    Key_R = (uint16_t)CD4051_COM3_X5_IN;

    if (Key_R == 0u)
    {
        enKeyRealStatus = KEY_LINE_PRESS;
    }
    else
    {
        enKeyRealStatus = KEY_LINE_LOOSEN;
    }

    return enKeyRealStatus;
}
hu's avatar
hu committed
1837 1838
/*---------------------------------------------------------------------------------------*/
const Key_Attribute_st_t stKeyAttribute[KEY_NUM_MAX] =
1839
{
hu's avatar
hu committed
1840 1841 1842 1843 1844
    {KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_Up, Key_Operation_Up},
    {KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_Down, Key_Operation_Down},
    {KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_Enter, Key_Operation_Enter},
    {KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_Return, Key_Operation_Return},
    {KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_Menu, Key_Operation_Menu},
1845
    {KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_ODOTrip, Key_Operation_ODOTrip},
hu's avatar
hu committed
1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859
};

Key_IGN_en_t Key_Get_IGN_Status(void)
{
    Key_IGN_en_t ret = KEY_IG_INVALID;
    if (SYS_OPR_STAT_IGN_ON)
    {
        ret = KEY_IG_ON;
    }
    else
    {
        ret = KEY_IG_OFF;
    }
    return ret;
1860
}