Key_user.c 62.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 19 20 21 22 23
/*----------按键具体功能执行的回调函数-----------------------*/

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);
24
void Key_Operation_ODOTrip(Key_Event_en_t enKeyEvent);
hu's avatar
hu committed
25 26 27 28 29 30 31 32 33 34 35

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
36
    uint8_t CanStatus1 = 0u;
37
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
38
    UElib_uint16_t HMI_MENU_Sta = 0u;
39

40
    HMI_Set_KEY_UP(enKeyEvent);
hu's avatar
hu committed
41

hu's avatar
hu committed
42 43 44
    HMI_MENU_Sta = Get_Cur_HMI();

    DispVSpeed = Common_Get_Disp_V_Speed();
hu's avatar
hu committed
45
    CanStatus1 = CAN_MSG_Status(ID_CanMsg0CF00400_Msg_Count);
46 47 48

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

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

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

173
                    switch (User_set_Num.Month)
hu's avatar
hu committed
174
                    {
175 176 177 178 179 180 181 182
                    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
183 184 185
                        {
                            User_set_Num.Date = 1u;
                        }
186 187 188 189 190 191
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (User_set_Num.Date > 30u)
hu's avatar
hu committed
192 193 194
                        {
                            User_set_Num.Date = 1u;
                        }
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
                        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
223 224
                    }
                }
225 226
                /*设置时间-时*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_21)
hu's avatar
hu committed
227
                {
hu's avatar
hu committed
228
                    User_set_Num.Hour++;
hu's avatar
hu committed
229

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

                    if (User_set_Num.Minute > 59u)
                    {
hu's avatar
hu committed
242
                        User_set_Num.Minute = 0u;
243
                    }
hu's avatar
hu committed
244
                }
245 246
                /*语言设置 ----反*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3)
hu's avatar
hu committed
247
                {
248 249
                    if (User_set_Num.User_Language > 0u)
                    {
hu's avatar
hu committed
250
                        User_set_Num.User_Language--;
251
                    }
hu's avatar
hu committed
252
                }
hu's avatar
hu committed
253 254 255 256
                /*胎压匹配界面*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5)
                {
                    if (User_set_Num.User_TpmsStatus == 0)
hu's avatar
hu committed
257
                    {
hu's avatar
hu committed
258
                        User_set_Num.User_TpmsStatus = 1;
hu's avatar
hu committed
259
                    }
hu's avatar
hu committed
260
                    if ((User_set_Num.User_TpmsStatus == 1) && (User_set_Num.User_Tpms < 12))
hu's avatar
hu committed
261
                    {
hu's avatar
hu committed
262
                        User_set_Num.User_Tpms++;
hu's avatar
hu committed
263
                    }
hu's avatar
hu committed
264
                }
265 266
                /*高速路*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_1)
hu's avatar
hu committed
267
                {
268 269 270 271 272 273 274 275
                    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
276
                }
277 278
                /*一般路*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_2)
hu's avatar
hu committed
279
                {
280 281 282 283 284 285 286 287
                    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
288
                }
289 290
                /*发动机转速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_3)
hu's avatar
hu committed
291
                {
292 293
                    if (User_set_Num.User_Speed < 99)
                    {
hu's avatar
hu committed
294
                        User_set_Num.User_Speed++;
295 296 297 298 299
                    }
                    else if (User_set_Num.User_Speed == 0xFF)
                    {
                        User_set_Num.User_Speed = 0;
                    }
hu's avatar
hu committed
300
                }
301 302
                /*急加速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_4)
hu's avatar
hu committed
303
                {
304 305 306 307 308 309 310 311
                    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
312
                }
313 314
                /*急减速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_5)
hu's avatar
hu committed
315
                {
316 317 318 319 320 321 322 323
                    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
324
                }
325 326
                /*长时间怠速设定*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_6)
hu's avatar
hu committed
327
                {
328 329 330 331
                    if (User_set_Num.User_IDLING == 0xFFu)
                    {
                        User_set_Num.User_IDLING = 0u;
                    }
hu's avatar
hu committed
332
                }
333 334
                /*辅助驻车解除设定*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_7)
hu's avatar
hu committed
335
                {
hu's avatar
hu committed
336
                    if (User_set_Num.User_Parking == 0xFFu)
337 338 339
                    {
                        User_set_Num.User_Parking = 0u;
                    }
hu's avatar
hu committed
340
                }
hu's avatar
hu committed
341
                /*工厂模式*/ /*经销商模式*/
hu's avatar
hu committed
342 343
                else if (((bCurMenuIDX >= _FAC_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1_3MENU_2)) ||
                         ((bCurMenuIDX >= _DEA_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1_3MENU_2)))
hu's avatar
hu committed
344 345 346
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_UP);
                }
hu's avatar
hu committed
347 348 349 350
                else
                {
                    ;/*Do Nothing!*/
                }
hu's avatar
hu committed
351
            }
352
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
353
            {
hu's avatar
hu committed
354 355 356 357 358 359 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
                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
456
            }
457 458 459 460 461
        }
        /*----无车速,有报警----*/
        else
        {
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
462
            {
hu's avatar
hu committed
463
                ; /*D0 Nothing!*/
hu's avatar
hu committed
464
            }
465
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
466
            {
hu's avatar
hu committed
467
                ; /*D0 Nothing!*/
hu's avatar
hu committed
468
            }
469 470 471 472
        }
    }
    else
    {
473
        /*----有车速,无报警----*/
hu's avatar
hu committed
474
        if (HMI_MENU_Sta != Display_Alarm)
475 476 477
        {
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
478
                /*工厂模式*/ /*经销商模式*/
hu's avatar
hu committed
479 480
                if (((bCurMenuIDX >= _FAC_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1_3MENU_2)) ||
                        ((bCurMenuIDX >= _DEA_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1_3MENU_2)))
hu's avatar
hu committed
481 482 483
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_UP);
                }
hu's avatar
hu committed
484 485 486 487 488 489 490 491 492 493 494 495 496 497
                /*主界面 一级菜单 二级菜单那*/
                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
498 499 500 501
                else
                {
                    ;/*Do Nothing!*/
                }
502 503 504
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
505
                ; /*D0 Nothing!*/
506 507 508 509
            }
        }
        /*----有车速,有报警----*/
        else
510
        {
511 512
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
513
                ; /*D0 Nothing!*/
514 515 516
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
517
                ; /*D0 Nothing!*/
518
            }
519 520
        }
    }
hu's avatar
hu committed
521 522 523 524 525 526 527 528 529 530
}

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

534
    HMI_Set_KEY_DOWN(enKeyEvent);
hu's avatar
hu committed
535 536 537

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
538 539 540

    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
541
        /*----无车速,无报警----*/
hu's avatar
hu committed
542
        if (HMI_MENU_Sta != Display_Alarm)
543
        {
544
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
545
            {
546 547
                /*主界面 一级菜单 二级菜单*/
                if (((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_6_MENU_2)) ||
548
                        ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
hu's avatar
hu committed
549
                {
hu's avatar
hu committed
550 551 552
                    /*系统演示模式*/
                    if ((bCurMenuIDX == _MN_DSP_LEVEL2MENU_4) && (K_Line_Set.K_Line_LID27 != 0x01u) && (K_Line_Set.K_Line_LID28 != 0x01u))
                    {
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570
                        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
571 572 573 574 575
                    }
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN);
                    }
hu's avatar
hu committed
576
                }
577 578 579 580 581 582 583 584 585 586 587 588
                /*系统演示模式子菜单*/
                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);
                    }
                }
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603
                /*背光调节*/
                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--;
                    }
                }
604 605
                /*保养通知设定 更换机油&机油滤清器*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_1)
hu's avatar
hu committed
606
                {
hu's avatar
hu committed
607
                    if (User_set_Num.User_FDJYLQQ == 0u)
hu's avatar
hu committed
608
                    {
hu's avatar
hu committed
609
                        User_set_Num.User_FDJYLQQ = (uint32_t)K_Line_Set.K_Line_LID4F * 1000u;
hu's avatar
hu committed
610
                    }
hu's avatar
hu committed
611
                }
612 613
                /*保养通知设定 更换燃油滤清器*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_2)
hu's avatar
hu committed
614
                {
hu's avatar
hu committed
615
                    if (User_set_Num.User_RYLQQ == 0u)
hu's avatar
hu committed
616
                    {
hu's avatar
hu committed
617
                        User_set_Num.User_RYLQQ = (uint32_t)K_Line_User_RYLQQ * 1000u;
hu's avatar
hu committed
618
                    }
hu's avatar
hu committed
619
                }
620 621
                /*保养通知设定 更换变速箱油*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_3)
hu's avatar
hu committed
622
                {
hu's avatar
hu committed
623
                    if (User_set_Num.User_BSXY == 0u)
hu's avatar
hu committed
624
                    {
hu's avatar
hu committed
625
                        User_set_Num.User_BSXY = (uint32_t)K_Line_Set.K_Line_LID4A * 1000u;
hu's avatar
hu committed
626
                    }
hu's avatar
hu committed
627
                }
628 629 630
                /*保养通知设定 更换差速器油*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_4)
                {
hu's avatar
hu committed
631
                    if (User_set_Num.User_CSQY == 0u)
hu's avatar
hu committed
632
                    {
hu's avatar
hu committed
633
                        User_set_Num.User_CSQY = (uint32_t)K_Line_Set.K_Line_LID4B * 1000u;
hu's avatar
hu committed
634
                    }
635 636 637 638
                }
                /*保养通知设定 更换动力转向液*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_6)
                {
hu's avatar
hu committed
639
                    if (User_set_Num.User_DLZXY == 0u)
hu's avatar
hu committed
640
                    {
hu's avatar
hu committed
641
                        User_set_Num.User_DLZXY = (uint32_t)K_Line_Set.K_Line_LID4D * 1000u;
hu's avatar
hu committed
642
                    }
643 644 645
                }
                /*保养通知设定 轮胎换位.更换*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_7)
hu's avatar
hu committed
646
                {
hu's avatar
hu committed
647
                    if (User_set_Num.User_LT == 0u)
hu's avatar
hu committed
648
                    {
hu's avatar
hu committed
649
                        User_set_Num.User_LT = (uint32_t)K_Line_Set.K_Line_LID4E * 1000u;
hu's avatar
hu committed
650
                    }
651 652 653 654
                }
                /*设置日期-年*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11)
                {
hu's avatar
hu committed
655
                    if (User_set_Num.Year > 0u)
hu's avatar
hu committed
656
                    {
657
                        User_set_Num.Year--;
hu's avatar
hu committed
658
                    }
659
                    else
hu's avatar
hu committed
660
                    {
661
                        User_set_Num.Year = 99u;
hu's avatar
hu committed
662
                    }
663 664 665 666 667
                }
                /*设置日期-月*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_12)
                {
                    if (User_set_Num.Month > 1u)
hu's avatar
hu committed
668
                    {
669
                        User_set_Num.Month--;
hu's avatar
hu committed
670 671 672
                    }
                    else
                    {
673
                        User_set_Num.Month = 12u;
hu's avatar
hu committed
674
                    }
675 676 677 678 679 680
                }
                /*设置日期-日*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_13)
                {
                    User_set_Num.Date--;
                    switch (User_set_Num.Month)
hu's avatar
hu committed
681
                    {
682 683 684 685 686 687 688
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
hu's avatar
hu committed
689 690
                        if (User_set_Num.Date < 1u)
                        {
691
                            User_set_Num.Date = 31u;
hu's avatar
hu committed
692
                        }
693 694 695 696 697
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
hu's avatar
hu committed
698 699
                        if (User_set_Num.Date < 1u)
                        {
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725
                            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
726
                        }
727 728 729
                        break;
                    default:
                        break;
hu's avatar
hu committed
730 731
                    }
                }
732 733
                /*设置时间-时*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_21)
hu's avatar
hu committed
734
                {
735 736 737 738 739 740
                    if (User_set_Num.Hour > 0u)
                    {
                        User_set_Num.Hour--;
                    }
                    else
                    {
hu's avatar
hu committed
741
                        User_set_Num.Hour = 23u;
742
                    }
hu's avatar
hu committed
743
                }
744 745
                /*设置时间-分*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_22)
hu's avatar
hu committed
746
                {
747 748
                    if (User_set_Num.Minute > 0u)
                    {
hu's avatar
hu committed
749
                        User_set_Num.Minute--;
750 751 752
                    }
                    else
                    {
hu's avatar
hu committed
753
                        User_set_Num.Minute = 59u;
754
                    }
hu's avatar
hu committed
755
                }
756 757
                /*语言设置 ----反*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3)
hu's avatar
hu committed
758
                {
hu's avatar
hu committed
759 760
                    if (User_set_Num.User_Language < 1)
                        User_set_Num.User_Language++;
hu's avatar
hu committed
761
                }
hu's avatar
hu committed
762 763 764 765 766 767 768 769 770 771 772 773 774 775
                /*胎压匹配界面*/
                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--;
                }
776 777
                /*高速路*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_1)
hu's avatar
hu committed
778
                {
779 780 781 782 783 784 785 786
                    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
787
                }
788 789
                /*一般路*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_2)
hu's avatar
hu committed
790
                {
791 792 793 794 795 796 797 798
                    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
799
                }
800 801
                /*发动机转速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_3)
hu's avatar
hu committed
802
                {
803 804 805 806
                    if ((User_set_Num.User_Speed >= 0) && (User_set_Num.User_Speed <= 99))
                    {
                        User_set_Num.User_Speed--;
                    }
hu's avatar
hu committed
807
                }
808 809
                /*急加速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_4)
hu's avatar
hu committed
810
                {
811 812 813 814 815 816 817 818
                    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
819
                }
820 821
                /*急减速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_5)
hu's avatar
hu committed
822
                {
823 824 825 826 827 828 829 830
                    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
831
                }
832 833
                /*长时间怠速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_6)
hu's avatar
hu committed
834
                {
835 836 837 838
                    if (User_set_Num.User_IDLING == 0u)
                    {
                        User_set_Num.User_IDLING = 0xFFu;
                    }
hu's avatar
hu committed
839
                }
840 841
                /*辅助驻车解除*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_7)
hu's avatar
hu committed
842
                {
843 844 845 846
                    if (User_set_Num.User_Parking == 0u)
                    {
                        User_set_Num.User_Parking = 0xFFu;
                    }
hu's avatar
hu committed
847
                }
hu's avatar
hu committed
848
                /*工厂模式*/ /*经销商模式*/
hu's avatar
hu committed
849 850
                else if (((bCurMenuIDX >= _FAC_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1_3MENU_2)) ||
                         ((bCurMenuIDX >= _DEA_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1_3MENU_2)))
hu's avatar
hu committed
851 852 853
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN);
                }
hu's avatar
hu committed
854 855 856 857
                else
                {
                    ;/*Do Nothing!*/
                }
hu's avatar
hu committed
858
            }
859
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
860
            {
hu's avatar
hu committed
861 862 863 864 865 866 867 868 869 870 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
                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
970
            }
971 972 973 974 975
        }
        else
        {
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
976
            {
hu's avatar
hu committed
977
                ; /*D0 Nothing!*/
hu's avatar
hu committed
978
            }
979
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
980
            {
hu's avatar
hu committed
981
                ; /*D0 Nothing!*/
hu's avatar
hu committed
982
            }
983 984 985 986
        }
    }
    else
    {
987
        /*----有车速,无报警----*/
hu's avatar
hu committed
988
        if (HMI_MENU_Sta != Display_Alarm)
989
        {
990 991
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
992
                /*工厂模式*/ /*经销商模式*/
hu's avatar
hu committed
993 994
                if (((bCurMenuIDX >= _FAC_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _FAC_DSP_LEVEL1_3MENU_2)) ||
                        ((bCurMenuIDX >= _DEA_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _DEA_DSP_LEVEL1_3MENU_2)))
hu's avatar
hu committed
995 996 997
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN);
                }
hu's avatar
hu committed
998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011
                /*主界面 一级菜单 二级菜单*/
                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
1012 1013 1014 1015
                else
                {
                    ;/*Do Nothing!*/
                }
1016 1017 1018
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1019
                ; /*D0 Nothing!*/
1020 1021 1022 1023 1024 1025 1026
            }
        }
        /*----有车速,有报警----*/
        else
        {
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1027
                ; /*D0 Nothing!*/
1028 1029 1030
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1031
                ; /*D0 Nothing!*/
1032
            }
1033 1034
        }
    }
hu's avatar
hu committed
1035 1036 1037 1038 1039 1040 1041 1042 1043
}
/*******************************ENTER***********************************************
  Function: Key_Operation_Enter
  Description:
  Input:
  Output:
 *******************************ENTER***********************************************/
void Key_Operation_Enter(Key_Event_en_t enKeyEvent)
{
1044
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
1045
    UElib_uint16_t HMI_MENU_Sta = 0u;
1046

1047
    HMI_Set_KEY_CONFIRM(enKeyEvent);
hu's avatar
hu committed
1048

hu's avatar
hu committed
1049 1050
    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
1051 1052 1053

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

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

1226
    HMI_Set_KEY_CANCEL(enKeyEvent);
hu's avatar
hu committed
1227 1228 1229

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
1230 1231 1232

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

/*******************************Menu***********************************************
  Function: Key_Operation_Menu
  Description:
  Input:
  Output:
 *******************************Menu***********************************************/
void Key_Operation_Menu(Key_Event_en_t enKeyEvent)
{
hu's avatar
hu committed
1359
    uint8_t CanStatus1 = 0u;
1360
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
1361
    UElib_uint16_t HMI_MENU_Sta = 0u;
hu's avatar
hu committed
1362

1363
    HMI_Set_KEY_MENU(enKeyEvent);
hu's avatar
hu committed
1364 1365 1366

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

hu's avatar
hu committed
1368 1369
    CanStatus1 = CAN_MSG_Status(ID_CanMsg0CF00400_Msg_Count);

1370 1371
    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
1372
        /*----无车速,无报警----*/
hu's avatar
hu committed
1373
        if (HMI_MENU_Sta != Display_Alarm)
1374
        {
1375
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
1376
            {
hu's avatar
hu committed
1377 1378 1379 1380 1381 1382 1383 1384
                /*自检模式进入经销商模式*/
                if (bCurMenuIDX == _MN_DSP_Menu_Test)
                {
                    K_Line_Set.K_Line_LID51 = 0x02u;
                }
                /*工厂模式*/
                else if (MenuFlag.Menu_StaFlag == 0x00u)
                {
hu's avatar
hu committed
1385 1386
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1387 1388 1389 1390 1391 1392
                    K_Line_Set.K_Line_LID51 = 0x00u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
                /*经销商模式*/
                else if (MenuFlag.Menu_StaFlag == 0x02u)
                {
hu's avatar
hu committed
1393 1394
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1395 1396 1397
                    K_Line_Set.K_Line_LID51 = 0x02u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
1398
                /*记录进入menu菜单的位置*/
hu's avatar
hu committed
1399
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL1MENU_6))
1400
                {
hu's avatar
hu committed
1401
                    MenuFlag.Menu_Flag = bCurMenuIDX;
1402

1403
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
1404
                }
1405
                /*无论从哪里都能回去*/
hu's avatar
hu committed
1406
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_5_MENU_4))
1407
                {
hu's avatar
hu committed
1408
                    NextMenu(MenuFlag.Menu_Flag);
1409
                }
hu's avatar
hu committed
1410
            }
1411
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
1412
            {
hu's avatar
hu committed
1413
                ; /*Do Nothing!*/
1414 1415 1416 1417 1418 1419 1420
            }
        }
        else
        {
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1421 1422 1423 1424 1425
                /*自检模式进入经销商模式*/
                if (bCurMenuIDX == _MN_DSP_Menu_Test)
                {
                    K_Line_Set.K_Line_LID51 = 0x02;
                }
hu's avatar
hu committed
1426 1427 1428
                /*工厂模式*/
                else if (MenuFlag.Menu_StaFlag == 0x00u)
                {
hu's avatar
hu committed
1429 1430
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1431 1432 1433 1434 1435 1436
                    K_Line_Set.K_Line_LID51 = 0x00u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
                /*经销商模式*/
                else if (MenuFlag.Menu_StaFlag == 0x02u)
                {
hu's avatar
hu committed
1437 1438
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1439 1440 1441
                    K_Line_Set.K_Line_LID51 = 0x02u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
1442 1443 1444
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1445
                ; /*Do Nothing!*/
1446
            }
1447 1448 1449 1450
        }
    }
    else
    {
hu's avatar
hu committed
1451
        if (HMI_MENU_Sta != Display_Alarm)
1452
        {
1453 1454 1455
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471
                /*工厂模式*/
                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;
                }
1472 1473 1474
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1475
                ; /*Do Nothing!*/
1476 1477 1478 1479 1480 1481 1482
            }
        }
        else
        {
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498
                /*工厂模式*/
                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;
                }
1499 1500 1501
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1502
                ; /*Do Nothing!*/
1503
            }
1504 1505
        }
    }
hu's avatar
hu committed
1506 1507
}

1508 1509 1510 1511 1512 1513
/*******************************ODOTrip***********************************************
  Function: Key_Operation_ODOTrip
  Description:
  Input:
  Output:
 *******************************ODOTrip***********************************************/
hu's avatar
hu committed
1514
void Key_Operation_ODOTrip(Key_Event_en_t enKeyEvent)
1515 1516 1517
{
    uint16_t DispVSpeed = 0u;
    UElib_uint16_t HMI_MENU_Sta = 0u;
1518
    uint8_t PowerStatus;
1519 1520 1521 1522 1523

    HMI_Set_KEY_ODOTRIP(enKeyEvent);

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
hu's avatar
hu committed
1524
    PowerStatus = Common_Get_IG_Sts();
1525

hu's avatar
hu committed
1526
    if (enKeyEvent == KEY_EVENT_OFF_TO_ON)
1527
    {
hu's avatar
hu committed
1528 1529 1530 1531
        MenuFlag.Key_MenuTest_Long = 1u;
    }
    else if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
    {
1532
        if (PowerStatus == COMMON_POWER_ON)
hu's avatar
hu committed
1533
        {
1534
            if (HMI_MENU_Sta == Display_StartAnimation)
hu's avatar
hu committed
1535
            {
1536 1537 1538 1539
                if (MenuFlag.Key_MenuTest_ShortNum < 100u)
                {
                    MenuFlag.Key_MenuTest_ShortNum++;
                }
hu's avatar
hu committed
1540
            }
1541 1542
            else if (bCurMenuIDX == _MN_DSP_Menu_Test)
            {
hu's avatar
hu committed
1543

1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556
            }
            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 !*/
            }
1557 1558 1559
        }
        else
        {
1560
            State_Flag.Menu_Key_Static = 1u;
1561 1562 1563 1564
        }
    }
    else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
    {
hu's avatar
hu committed
1565
        if (PowerStatus == COMMON_POWER_ON)
1566
        {
hu's avatar
hu committed
1567 1568 1569 1570 1571 1572 1573 1574
            if (User_set_Num.Trip_Type == TRAPA)
            {
                Data_Clear_Trip(EM_TRIP_A);
            }
            else
            {
                Data_Clear_Trip(EM_TRIP_B);
            }
1575

hu's avatar
hu committed
1576 1577 1578 1579
            if (State_Flag.FState_ClearOilTx == 0u)
            {
                State_Flag.FState_ClearOilTx = 1u;
            }
1580
        }
1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 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
    }
#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
1640 1641 1642 1643
uint8_t Common_Get_RetMenu_Flag(void)
{
    return MenuFlag.Menu_Flag;
}
hu's avatar
hu committed
1644 1645 1646 1647 1648
/*------------读按键实时状态的回调函数-------------------------------------------*/
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
1649
Key_Real_Status_en_t Key_Real_Status_Read_Menu(void);
hu's avatar
hu committed
1650 1651
/*-------------------------------------------------*/

hu's avatar
hu committed
1652 1653 1654 1655 1656
// 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
1657

hu's avatar
hu committed
1658 1659 1660 1661 1662
// 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
1663 1664

//实际按键测试
1665
//无操作     21000~24000Ω
hu's avatar
hu committed
1666 1667 1668 1669 1670
// Menu_R        640~680Ω
// Enter_R       5300~5700Ω
// Return_R      9000~9500Ω
// Up_R          1300~1400Ω
// Down_R        3000~3200Ω
1671 1672 1673

/*上*/
Key_Real_Status_en_t Key_Real_Status_Read_Up(void)
hu's avatar
hu committed
1674 1675 1676
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1677 1678 1679 1680 1681 1682 1683 1684 1685

    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
1686
        if ((Key_R >= (1250 - 400)) && (Key_R <= (1250 + 400)))
1687 1688 1689 1690 1691 1692 1693 1694
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1695 1696 1697 1698

    return enKeyRealStatus;
}

1699 1700
/*下*/
Key_Real_Status_en_t Key_Real_Status_Read_Down(void)
hu's avatar
hu committed
1701 1702 1703
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1704 1705 1706 1707 1708 1709 1710 1711 1712

    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
1713
        if ((Key_R >= (2900 - 400)) && (Key_R <= (2900 + 400)))
1714 1715 1716 1717 1718 1719 1720 1721 1722
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }

hu's avatar
hu committed
1723 1724 1725
    return enKeyRealStatus;
}

1726 1727
/*Enter*/
Key_Real_Status_en_t Key_Real_Status_Read_Enter(void)
hu's avatar
hu committed
1728 1729 1730 1731
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;

1732 1733 1734 1735 1736 1737 1738 1739
    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
1740
        if ((Key_R >= (4800 - 400)) && (Key_R <= (4800 + 400)))
1741 1742 1743 1744 1745 1746 1747 1748
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1749 1750 1751
    return enKeyRealStatus;
}

1752 1753
/*Return*/
Key_Real_Status_en_t Key_Real_Status_Read_Return(void)
hu's avatar
hu committed
1754 1755 1756
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1757 1758 1759 1760 1761 1762 1763 1764 1765

    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
1766
        if ((Key_R >= (7800 - 400)) && (Key_R <= (7800 + 400)))
1767 1768 1769 1770 1771 1772 1773 1774
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1775 1776 1777 1778

    return enKeyRealStatus;
}

1779 1780
/*Menu*/
Key_Real_Status_en_t Key_Real_Status_Read_Menu(void)
hu's avatar
hu committed
1781 1782 1783
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1784 1785 1786 1787 1788 1789 1790 1791 1792

    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
1793
        if ((Key_R >= (500 - 300)) && (Key_R <= (500 + 300)))
1794 1795 1796 1797 1798 1799 1800 1801
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1802 1803 1804 1805

    return enKeyRealStatus;
}

1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824
/*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
1825 1826
/*---------------------------------------------------------------------------------------*/
const Key_Attribute_st_t stKeyAttribute[KEY_NUM_MAX] =
1827
{
hu's avatar
hu committed
1828 1829 1830 1831 1832
    {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},
1833
    {KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_ODOTrip, Key_Operation_ODOTrip},
hu's avatar
hu committed
1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847
};

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;
1848
}