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
/*无车速限制值*/
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
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_UP);
                    }
hu's avatar
hu committed
71
                }
hu's avatar
hu committed
72
                /*系统演示模式子菜单*/
73
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL2_5_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_5_MENU_4))
hu's avatar
hu committed
74
                {
75
                    if ((K_Line_Set.K_Line_LID27 != 0x01u) && (bCurMenuIDX == _MN_DSP_LEVEL2_5_MENU_2))
hu's avatar
hu committed
76
                    {
77
                        ; /*Do Nothing!*/
hu's avatar
hu committed
78 79 80
                    }
                    else
                    {
81 82
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_UP);
                    }
hu's avatar
hu committed
83
                }
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
                /*背光调节*/
                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++;
                    }
                }
99 100
                /*保养通知设定 更换机油&机油滤清器*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_1)
hu's avatar
hu committed
101
                {
102
                    if (User_set_Num.User_FDJYLQQ == (uint32_t)K_Line_Set.K_Line_LID4F * 1000u)
hu's avatar
hu committed
103
                    {
hu's avatar
hu committed
104
                        User_set_Num.User_FDJYLQQ = 0u;
hu's avatar
hu committed
105
                    }
hu's avatar
hu committed
106
                }
107 108
                /*保养通知设定 更换燃油滤清器*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_2)
hu's avatar
hu committed
109
                {
110
                    if (User_set_Num.User_RYLQQ == (uint32_t)K_Line_User_RYLQQ * 1000u)
hu's avatar
hu committed
111
                    {
hu's avatar
hu committed
112
                        User_set_Num.User_RYLQQ = 0u;
hu's avatar
hu committed
113
                    }
hu's avatar
hu committed
114
                }
115 116
                /*保养通知设定 更换变速箱油*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_3)
hu's avatar
hu committed
117
                {
118
                    if (User_set_Num.User_BSXY == (uint32_t)K_Line_Set.K_Line_LID4A * 1000u)
hu's avatar
hu committed
119
                    {
120
                        User_set_Num.User_BSXY = 0u;
hu's avatar
hu committed
121
                    }
hu's avatar
hu committed
122
                }
123 124
                /*保养通知设定 更换差速器右*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_4)
hu's avatar
hu committed
125
                {
126
                    if (User_set_Num.User_CSQY == (uint32_t)K_Line_Set.K_Line_LID4B * 1000u)
hu's avatar
hu committed
127
                    {
hu's avatar
hu committed
128
                        User_set_Num.User_CSQY = 0u;
hu's avatar
hu committed
129
                    }
130 131 132 133 134
                }
                /*保养通知设定 更换动力转向油*/
                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
135
                    {
hu's avatar
hu committed
136
                        User_set_Num.User_DLZXY = 0u;
hu's avatar
hu committed
137
                    }
138 139 140 141 142
                }
                /*保养通知设定 轮胎换位.更换*/
                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
143
                    {
hu's avatar
hu committed
144
                        User_set_Num.User_LT = 0u;
hu's avatar
hu committed
145
                    }
146 147 148 149
                }
                /*设置日期-年*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11)
                {
hu's avatar
hu committed
150
                    User_set_Num.Year++;
151

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

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

172
                    switch (User_set_Num.Month)
hu's avatar
hu committed
173
                    {
174 175 176 177 178 179 180 181
                    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
182 183 184
                        {
                            User_set_Num.Date = 1u;
                        }
185 186 187 188 189 190
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (User_set_Num.Date > 30u)
hu's avatar
hu committed
191 192 193
                        {
                            User_set_Num.Date = 1u;
                        }
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
                        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
222 223
                    }
                }
224 225
                /*设置时间-时*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_21)
hu's avatar
hu committed
226
                {
hu's avatar
hu committed
227
                    User_set_Num.Hour++;
hu's avatar
hu committed
228

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

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

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

537
    HMI_Set_KEY_DOWN(enKeyEvent);
hu's avatar
hu committed
538 539 540

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
541 542 543

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

1037
    HMI_Set_KEY_CONFIRM(enKeyEvent);
hu's avatar
hu committed
1038

hu's avatar
hu committed
1039 1040
    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
1041 1042 1043

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

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

1215
    HMI_Set_KEY_CANCEL(enKeyEvent);
hu's avatar
hu committed
1216 1217 1218

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
1219 1220 1221

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

/*******************************Menu***********************************************
  Function: Key_Operation_Menu
  Description:
  Input:
  Output:
 *******************************Menu***********************************************/
void Key_Operation_Menu(Key_Event_en_t enKeyEvent)
{
hu's avatar
hu committed
1348
    uint8_t CanStatus1 = 0u;
1349
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
1350
    UElib_uint16_t HMI_MENU_Sta = 0u;
hu's avatar
hu committed
1351

1352
    HMI_Set_KEY_MENU(enKeyEvent);
hu's avatar
hu committed
1353 1354 1355

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

hu's avatar
hu committed
1357 1358
    CanStatus1 = CAN_MSG_Status(ID_CanMsg0CF00400_Msg_Count);

1359 1360
    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
1361
        /*----无车速,无报警----*/
hu's avatar
hu committed
1362
        if (HMI_MENU_Sta != Display_Alarm)
1363
        {
1364
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
1365
            {
hu's avatar
hu committed
1366 1367 1368 1369 1370 1371 1372 1373
                /*自检模式进入经销商模式*/
                if (bCurMenuIDX == _MN_DSP_Menu_Test)
                {
                    K_Line_Set.K_Line_LID51 = 0x02u;
                }
                /*工厂模式*/
                else if (MenuFlag.Menu_StaFlag == 0x00u)
                {
hu's avatar
hu committed
1374 1375
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1376 1377 1378 1379 1380 1381
                    K_Line_Set.K_Line_LID51 = 0x00u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
                /*经销商模式*/
                else if (MenuFlag.Menu_StaFlag == 0x02u)
                {
hu's avatar
hu committed
1382 1383
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1384 1385 1386
                    K_Line_Set.K_Line_LID51 = 0x02u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
1387
                /*记录进入menu菜单的位置*/
hu's avatar
hu committed
1388
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL1MENU_6))
1389
                {
hu's avatar
hu committed
1390
                    MenuFlag.Menu_Flag = bCurMenuIDX;
1391

1392
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
1393
                }
1394
                /*无论从哪里都能回去*/
hu's avatar
hu committed
1395
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_5_MENU_4))
1396
                {
hu's avatar
hu committed
1397
                    NextMenu(MenuFlag.Menu_Flag);
1398
                }
hu's avatar
hu committed
1399
            }
1400
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
1401
            {
hu's avatar
hu committed
1402
                ; /*Do Nothing!*/
1403 1404 1405 1406 1407 1408 1409
            }
        }
        else
        {
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1410 1411 1412 1413 1414
                /*自检模式进入经销商模式*/
                if (bCurMenuIDX == _MN_DSP_Menu_Test)
                {
                    K_Line_Set.K_Line_LID51 = 0x02;
                }
hu's avatar
hu committed
1415 1416 1417
                /*工厂模式*/
                else if (MenuFlag.Menu_StaFlag == 0x00u)
                {
hu's avatar
hu committed
1418 1419
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1420 1421 1422 1423 1424 1425
                    K_Line_Set.K_Line_LID51 = 0x00u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
                /*经销商模式*/
                else if (MenuFlag.Menu_StaFlag == 0x02u)
                {
hu's avatar
hu committed
1426 1427
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

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

1497 1498 1499 1500 1501 1502
/*******************************ODOTrip***********************************************
  Function: Key_Operation_ODOTrip
  Description:
  Input:
  Output:
 *******************************ODOTrip***********************************************/
hu's avatar
hu committed
1503
void Key_Operation_ODOTrip(Key_Event_en_t enKeyEvent)
1504 1505 1506
{
    uint16_t DispVSpeed = 0u;
    UElib_uint16_t HMI_MENU_Sta = 0u;
1507
    uint8_t PowerStatus;
1508 1509 1510 1511 1512

    HMI_Set_KEY_ODOTRIP(enKeyEvent);

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
hu's avatar
hu committed
1513
    PowerStatus = Common_Get_IG_Sts();
1514

hu's avatar
hu committed
1515
    if (enKeyEvent == KEY_EVENT_OFF_TO_ON)
1516
    {
hu's avatar
hu committed
1517 1518 1519 1520
        MenuFlag.Key_MenuTest_Long = 1u;
    }
    else if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
    {
1521
        if (PowerStatus == COMMON_POWER_ON)
hu's avatar
hu committed
1522
        {
1523
            if (HMI_MENU_Sta == Display_StartAnimation)
hu's avatar
hu committed
1524
            {
1525 1526 1527 1528
                if (MenuFlag.Key_MenuTest_ShortNum < 100u)
                {
                    MenuFlag.Key_MenuTest_ShortNum++;
                }
hu's avatar
hu committed
1529
            }
1530 1531
            else if (bCurMenuIDX == _MN_DSP_Menu_Test)
            {
hu's avatar
hu committed
1532

1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545
            }
            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 !*/
            }
1546 1547 1548
        }
        else
        {
1549
            State_Flag.Menu_Key_Static = 1u;
1550 1551 1552 1553
        }
    }
    else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
    {
hu's avatar
hu committed
1554
        if (PowerStatus == COMMON_POWER_ON)
1555
        {
hu's avatar
hu committed
1556 1557 1558 1559 1560 1561 1562 1563
            if (User_set_Num.Trip_Type == TRAPA)
            {
                Data_Clear_Trip(EM_TRIP_A);
            }
            else
            {
                Data_Clear_Trip(EM_TRIP_B);
            }
1564

hu's avatar
hu committed
1565 1566 1567 1568
            if (State_Flag.FState_ClearOilTx == 0u)
            {
                State_Flag.FState_ClearOilTx = 1u;
            }
1569
        }
1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 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
    }
#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
1629 1630 1631 1632
uint8_t Common_Get_RetMenu_Flag(void)
{
    return MenuFlag.Menu_Flag;
}
hu's avatar
hu committed
1633 1634 1635 1636 1637
/*------------读按键实时状态的回调函数-------------------------------------------*/
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
1638
Key_Real_Status_en_t Key_Real_Status_Read_Menu(void);
hu's avatar
hu committed
1639 1640
/*-------------------------------------------------*/

hu's avatar
hu committed
1641 1642 1643 1644 1645
// 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
1646

hu's avatar
hu committed
1647 1648 1649 1650 1651
// 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
1652 1653

//实际按键测试
1654
//无操作     21000~24000Ω
hu's avatar
hu committed
1655 1656 1657 1658 1659
// Menu_R        640~680Ω
// Enter_R       5300~5700Ω
// Return_R      9000~9500Ω
// Up_R          1300~1400Ω
// Down_R        3000~3200Ω
1660 1661 1662

/*上*/
Key_Real_Status_en_t Key_Real_Status_Read_Up(void)
hu's avatar
hu committed
1663 1664 1665
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1666 1667 1668 1669 1670 1671 1672 1673 1674

    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
1675
        if ((Key_R >= (1250 - 400)) && (Key_R <= (1250 + 400)))
1676 1677 1678 1679 1680 1681 1682 1683
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1684 1685 1686 1687

    return enKeyRealStatus;
}

1688 1689
/*下*/
Key_Real_Status_en_t Key_Real_Status_Read_Down(void)
hu's avatar
hu committed
1690 1691 1692
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1693 1694 1695 1696 1697 1698 1699 1700 1701

    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
1702
        if ((Key_R >= (2900 - 400)) && (Key_R <= (2900 + 400)))
1703 1704 1705 1706 1707 1708 1709 1710 1711
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }

hu's avatar
hu committed
1712 1713 1714
    return enKeyRealStatus;
}

1715 1716
/*Enter*/
Key_Real_Status_en_t Key_Real_Status_Read_Enter(void)
hu's avatar
hu committed
1717 1718 1719 1720
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;

1721 1722 1723 1724 1725 1726 1727 1728
    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
1729
        if ((Key_R >= (4800 - 400)) && (Key_R <= (4800 + 400)))
1730 1731 1732 1733 1734 1735 1736 1737
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1738 1739 1740
    return enKeyRealStatus;
}

1741 1742
/*Return*/
Key_Real_Status_en_t Key_Real_Status_Read_Return(void)
hu's avatar
hu committed
1743 1744 1745
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1746 1747 1748 1749 1750 1751 1752 1753 1754

    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
1755
        if ((Key_R >= (7800 - 400)) && (Key_R <= (7800 + 400)))
1756 1757 1758 1759 1760 1761 1762 1763
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1764 1765 1766 1767

    return enKeyRealStatus;
}

1768 1769
/*Menu*/
Key_Real_Status_en_t Key_Real_Status_Read_Menu(void)
hu's avatar
hu committed
1770 1771 1772
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1773 1774 1775 1776 1777 1778 1779 1780 1781

    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
1782
        if ((Key_R >= (500 - 300)) && (Key_R <= (500 + 300)))
1783 1784 1785 1786 1787 1788 1789 1790
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1791 1792 1793 1794

    return enKeyRealStatus;
}

1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813
/*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
1814 1815
/*---------------------------------------------------------------------------------------*/
const Key_Attribute_st_t stKeyAttribute[KEY_NUM_MAX] =
1816
{
hu's avatar
hu committed
1817 1818 1819 1820 1821
    {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},
1822
    {KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_ODOTrip, Key_Operation_ODOTrip},
hu's avatar
hu committed
1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836
};

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