Key_user.c 54.2 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
                ; /*D0 Nothing!*/
hu's avatar
hu committed
356
            }
357 358 359 360 361
        }
        /*----无车速,有报警----*/
        else
        {
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
362
            {
hu's avatar
hu committed
363
                ; /*D0 Nothing!*/
hu's avatar
hu committed
364
            }
365
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
366
            {
hu's avatar
hu committed
367
                ; /*D0 Nothing!*/
hu's avatar
hu committed
368
            }
369 370 371 372
        }
    }
    else
    {
373
        /*----有车速,无报警----*/
hu's avatar
hu committed
374
        if (HMI_MENU_Sta != Display_Alarm)
375 376 377
        {
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
378 379 380 381 382 383 384 385
                /*工厂模式*/ /*经销商模式*/
                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
386 387 388 389 390 391 392 393 394 395 396 397 398 399
                /*主界面 一级菜单 二级菜单那*/
                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
400 401 402 403
                else
                {
                    ;/*Do Nothing!*/
                }
404 405 406
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
407
                ; /*D0 Nothing!*/
408 409 410 411
            }
        }
        /*----有车速,有报警----*/
        else
412
        {
413 414
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
415
                ; /*D0 Nothing!*/
416 417 418
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
419
                ; /*D0 Nothing!*/
420
            }
421 422
        }
    }
hu's avatar
hu committed
423 424 425 426 427 428 429 430 431 432
}

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

436
    HMI_Set_KEY_DOWN(enKeyEvent);
hu's avatar
hu committed
437 438 439

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
440 441 442

    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
443
        /*----无车速,无报警----*/
hu's avatar
hu committed
444
        if (HMI_MENU_Sta != Display_Alarm)
445
        {
446
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
447
            {
448 449
                /*主界面 一级菜单 二级菜单*/
                if (((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_6_MENU_2)) ||
450
                        ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
hu's avatar
hu committed
451
                {
hu's avatar
hu committed
452 453 454 455 456 457 458 459 460
                    /*系统演示模式*/
                    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
461
                }
462 463 464 465 466 467 468 469 470 471 472 473
                /*系统演示模式子菜单*/
                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);
                    }
                }
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
                /*背光调节*/
                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--;
                    }
                }
489 490
                /*保养通知设定 更换机油&机油滤清器*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_1)
hu's avatar
hu committed
491
                {
hu's avatar
hu committed
492
                    if (User_set_Num.User_FDJYLQQ == 0u)
hu's avatar
hu committed
493
                    {
hu's avatar
hu committed
494
                        User_set_Num.User_FDJYLQQ = (uint32_t)K_Line_Set.K_Line_LID4F * 1000u;
hu's avatar
hu committed
495
                    }
hu's avatar
hu committed
496
                }
497 498
                /*保养通知设定 更换燃油滤清器*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_2)
hu's avatar
hu committed
499
                {
hu's avatar
hu committed
500
                    if (User_set_Num.User_RYLQQ == 0u)
hu's avatar
hu committed
501
                    {
hu's avatar
hu committed
502
                        User_set_Num.User_RYLQQ = (uint32_t)K_Line_User_RYLQQ * 1000u;
hu's avatar
hu committed
503
                    }
hu's avatar
hu committed
504
                }
505 506
                /*保养通知设定 更换变速箱油*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_3)
hu's avatar
hu committed
507
                {
hu's avatar
hu committed
508
                    if (User_set_Num.User_BSXY == 0u)
hu's avatar
hu committed
509
                    {
hu's avatar
hu committed
510
                        User_set_Num.User_BSXY = (uint32_t)K_Line_Set.K_Line_LID4A * 1000u;
hu's avatar
hu committed
511
                    }
hu's avatar
hu committed
512
                }
513 514 515
                /*保养通知设定 更换差速器油*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_4)
                {
hu's avatar
hu committed
516
                    if (User_set_Num.User_CSQY == 0u)
hu's avatar
hu committed
517
                    {
hu's avatar
hu committed
518
                        User_set_Num.User_CSQY = (uint32_t)K_Line_Set.K_Line_LID4B * 1000u;
hu's avatar
hu committed
519
                    }
520 521 522 523
                }
                /*保养通知设定 更换动力转向液*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_6)
                {
hu's avatar
hu committed
524
                    if (User_set_Num.User_DLZXY == 0u)
hu's avatar
hu committed
525
                    {
hu's avatar
hu committed
526
                        User_set_Num.User_DLZXY = (uint32_t)K_Line_Set.K_Line_LID4D * 1000u;
hu's avatar
hu committed
527
                    }
528 529 530
                }
                /*保养通知设定 轮胎换位.更换*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_7)
hu's avatar
hu committed
531
                {
hu's avatar
hu committed
532
                    if (User_set_Num.User_LT == 0u)
hu's avatar
hu committed
533
                    {
hu's avatar
hu committed
534
                        User_set_Num.User_LT = (uint32_t)K_Line_Set.K_Line_LID4E * 1000u;
hu's avatar
hu committed
535
                    }
536 537 538 539
                }
                /*设置日期-年*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11)
                {
hu's avatar
hu committed
540
                    if (User_set_Num.Year > 0u)
hu's avatar
hu committed
541
                    {
542
                        User_set_Num.Year--;
hu's avatar
hu committed
543
                    }
544
                    else
hu's avatar
hu committed
545
                    {
546
                        User_set_Num.Year = 99u;
hu's avatar
hu committed
547
                    }
548 549 550 551 552
                }
                /*设置日期-月*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_12)
                {
                    if (User_set_Num.Month > 1u)
hu's avatar
hu committed
553
                    {
554
                        User_set_Num.Month--;
hu's avatar
hu committed
555 556 557
                    }
                    else
                    {
558
                        User_set_Num.Month = 12u;
hu's avatar
hu committed
559
                    }
560 561 562 563 564 565
                }
                /*设置日期-日*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_13)
                {
                    User_set_Num.Date--;
                    switch (User_set_Num.Month)
hu's avatar
hu committed
566
                    {
567 568 569 570 571 572 573
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
hu's avatar
hu committed
574 575
                        if (User_set_Num.Date < 1u)
                        {
576
                            User_set_Num.Date = 31u;
hu's avatar
hu committed
577
                        }
578 579 580 581 582
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
hu's avatar
hu committed
583 584
                        if (User_set_Num.Date < 1u)
                        {
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
                            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
611
                        }
612 613 614
                        break;
                    default:
                        break;
hu's avatar
hu committed
615 616
                    }
                }
617 618
                /*设置时间-时*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_21)
hu's avatar
hu committed
619
                {
620 621 622 623 624 625
                    if (User_set_Num.Hour > 0u)
                    {
                        User_set_Num.Hour--;
                    }
                    else
                    {
hu's avatar
hu committed
626
                        User_set_Num.Hour = 23u;
627
                    }
hu's avatar
hu committed
628
                }
629 630
                /*设置时间-分*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_22)
hu's avatar
hu committed
631
                {
632 633
                    if (User_set_Num.Minute > 0u)
                    {
hu's avatar
hu committed
634
                        User_set_Num.Minute--;
635 636 637
                    }
                    else
                    {
hu's avatar
hu committed
638
                        User_set_Num.Minute = 59u;
639
                    }
hu's avatar
hu committed
640
                }
641 642
                /*语言设置 ----反*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3)
hu's avatar
hu committed
643
                {
hu's avatar
hu committed
644 645
                    if (User_set_Num.User_Language < 1)
                        User_set_Num.User_Language++;
hu's avatar
hu committed
646
                }
hu's avatar
hu committed
647 648 649 650 651 652 653 654 655 656 657 658 659 660
                /*胎压匹配界面*/
                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--;
                }
661 662
                /*高速路*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_1)
hu's avatar
hu committed
663
                {
664 665 666 667 668 669 670 671
                    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
672
                }
673 674
                /*一般路*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_2)
hu's avatar
hu committed
675
                {
676 677 678 679 680 681 682 683
                    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
684
                }
685 686
                /*发动机转速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_3)
hu's avatar
hu committed
687
                {
688 689 690 691
                    if ((User_set_Num.User_Speed >= 0) && (User_set_Num.User_Speed <= 99))
                    {
                        User_set_Num.User_Speed--;
                    }
hu's avatar
hu committed
692
                }
693 694
                /*急加速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_4)
hu's avatar
hu committed
695
                {
696 697 698 699 700 701 702 703
                    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
704
                }
705 706
                /*急减速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_5)
hu's avatar
hu committed
707
                {
708 709 710 711 712 713 714 715
                    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
716
                }
717 718
                /*长时间怠速*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_6)
hu's avatar
hu committed
719
                {
720 721 722 723
                    if (User_set_Num.User_IDLING == 0u)
                    {
                        User_set_Num.User_IDLING = 0xFFu;
                    }
hu's avatar
hu committed
724
                }
725 726
                /*辅助驻车解除*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_7)
hu's avatar
hu committed
727
                {
728 729 730 731
                    if (User_set_Num.User_Parking == 0u)
                    {
                        User_set_Num.User_Parking = 0xFFu;
                    }
hu's avatar
hu committed
732
                }
hu's avatar
hu committed
733 734 735
                /*工厂模式*/ /*经销商模式*/
                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
736 737
                         ((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
738 739 740
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN);
                }
hu's avatar
hu committed
741 742 743 744
                else
                {
                    ;/*Do Nothing!*/
                }
hu's avatar
hu committed
745
            }
746
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
747
            {
hu's avatar
hu committed
748
                ; /*D0 Nothing!*/
hu's avatar
hu committed
749
            }
750 751 752 753 754
        }
        else
        {
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
755
            {
hu's avatar
hu committed
756
                ; /*D0 Nothing!*/
hu's avatar
hu committed
757
            }
758
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
759
            {
hu's avatar
hu committed
760
                ; /*D0 Nothing!*/
hu's avatar
hu committed
761
            }
762 763 764 765
        }
    }
    else
    {
766
        /*----有车速,无报警----*/
hu's avatar
hu committed
767
        if (HMI_MENU_Sta != Display_Alarm)
768
        {
769 770
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
771 772 773 774 775 776 777 778
                /*工厂模式*/ /*经销商模式*/
                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
779 780 781 782 783 784 785 786 787 788 789 790 791 792
                /*主界面 一级菜单 二级菜单*/
                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
793 794 795 796
                else
                {
                    ;/*Do Nothing!*/
                }
797 798 799
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
800
                ; /*D0 Nothing!*/
801 802 803 804 805 806 807
            }
        }
        /*----有车速,有报警----*/
        else
        {
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
808
                ; /*D0 Nothing!*/
809 810 811
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
812
                ; /*D0 Nothing!*/
813
            }
814 815
        }
    }
hu's avatar
hu committed
816 817 818 819 820 821 822 823 824
}
/*******************************ENTER***********************************************
  Function: Key_Operation_Enter
  Description:
  Input:
  Output:
 *******************************ENTER***********************************************/
void Key_Operation_Enter(Key_Event_en_t enKeyEvent)
{
825
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
826
    UElib_uint16_t HMI_MENU_Sta = 0u;
827

828
    HMI_Set_KEY_CONFIRM(enKeyEvent);
hu's avatar
hu committed
829

hu's avatar
hu committed
830 831
    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
832 833 834

    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
835
        /*----无车速,无报警----*/
hu's avatar
hu committed
836
        if (HMI_MENU_Sta != Display_Alarm)
837
        {
838
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
hu's avatar
hu committed
839
            {
840
                if (((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_5_MENU_4)) ||
841
                        ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
842
                {
hu's avatar
hu committed
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
                    /*系统演示模式*/
                    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);
                    }
859 860 861 862 863 864 865
                }
                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);
                }
866 867 868 869 870
                /*背光调节*/
                else if ((bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_1) || (bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_2))
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
                }
871 872 873
                /*轮胎匹配界面*/
                else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5)
                {
hu's avatar
hu committed
874 875 876
                    if (User_set_Num.User_TpmsStatus == 1)
                    {
                        User_set_Num.User_TpmsStatus = 2;  /*匹配轮胎*/
hu's avatar
hu committed
877
                        User_set_Num.User_TpmsSend = 3;    /*报文外发状态*/
hu's avatar
hu committed
878 879
                        User_set_Num.User_Temp_Return = 0; /*清空取消标记位*/
                    }
880 881 882 883 884 885 886
                }
                /*Go Return*/
                else if (bCurMenuIDX == _MN_DSP_ENTER_MENU)
                {
                    MenuFlag.Menu_Return = 1;
                    NextMenu(_MN_DSP_RETURN_MENU);
                }
hu's avatar
hu committed
887
                /*工厂模式 经销商模式*/
hu's avatar
hu committed
888
                else if ((bCurMenuIDX >= _FAC_DSP_LEVEL0MENU_1) && (bCurMenuIDX <= _MN_DSP_MENU_MAX))
hu's avatar
hu committed
889
                {
hu's avatar
hu committed
890
                    if ((bCurMenuIDX == _FAC_DSP_LEVEL2_5MENU_1) || (bCurMenuIDX == _DEA_DSP_LEVEL2_5MENU_1))
hu's avatar
hu committed
891 892 893
                    {
                        K_Line_Set.K_Line_LID51 = 1u;
                    }
hu's avatar
hu committed
894 895 896 897 898 899 900 901 902 903 904 905
                    /*工厂模式*/
                    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
906 907 908 909 910 911 912 913
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
                    }
                }
                else
                {
                    ;/*Do Nothing!*/
hu's avatar
hu committed
914
                }
hu's avatar
hu committed
915
            }
916
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
917
            {
918 919 920
                /*Go Enter*/
                if ((bCurMenuIDX >= _MN_DSP_LEVEL3_2_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_2_MENU_8))
                {
hu's avatar
hu committed
921
                    MenuFlag.Menu_Enter_Return = bCurMenuIDX;
922 923
                    NextMenu(_MN_DSP_ENTER_MENU);
                }
924 925
            }
        }
926
        else
hu's avatar
hu committed
927
        {
928 929 930
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
931
                ; /*D0 Nothing!*/
932 933
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
hu's avatar
hu committed
934
            {
hu's avatar
hu committed
935
                ; /*D0 Nothing!*/
hu's avatar
hu committed
936 937
            }
        }
938 939 940
    }
    else
    {
941
        /*----有车速,无报警----*/
hu's avatar
hu committed
942
        if (HMI_MENU_Sta != Display_Alarm)
943
        {
944 945
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
946 947 948
                /*工厂模式 经销商模式*/
                if ((bCurMenuIDX >= _FAC_DSP_LEVEL0MENU_1) && (bCurMenuIDX <= _MN_DSP_MENU_MAX))
                {
hu's avatar
hu committed
949
                    if ((bCurMenuIDX == _FAC_DSP_LEVEL2_5MENU_1) || (bCurMenuIDX == _DEA_DSP_LEVEL2_5MENU_1))
hu's avatar
hu committed
950 951 952
                    {
                        K_Line_Set.K_Line_LID51 = 1u;
                    }
hu's avatar
hu committed
953 954 955 956 957 958 959 960 961 962 963 964
                    /*工厂模式*/
                    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
965 966 967 968 969 970 971 972 973
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
                    }
                }
                else
                {
                    ;/*Do Nothing!*/
                }
974 975 976
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
977
                ; /*D0 Nothing!*/
978
            }
979
        }
980 981
        /*----有车速,有报警----*/
        else
hu's avatar
hu committed
982
        {
983 984
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
985
                ; /*D0 Nothing!*/
986 987 988
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
989
                ; /*D0 Nothing!*/
990
            }
hu's avatar
hu committed
991
        }
992
    }
hu's avatar
hu committed
993 994 995 996 997 998 999 1000 1001 1002
}

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

1006
    HMI_Set_KEY_CANCEL(enKeyEvent);
hu's avatar
hu committed
1007 1008 1009

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();
1010 1011 1012

    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
1013
        /*----无车速,无报警----*/
hu's avatar
hu committed
1014
        if (HMI_MENU_Sta != Display_Alarm)
1015
        {
1016
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
1017
            {
1018
                if ((bCurMenuIDX >= _MN_DSP_LEVEL2_1_MENU_1) && (bCurMenuIDX < _MN_DSP_ENTER_MENU))
hu's avatar
hu committed
1019
                {
1020
                    if (
hu's avatar
hu committed
1021
                        (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3) ||                                              /*语言设定*/
1022
                        (bCurMenuIDX == _MN_DSP_LEVEL3_7_MENU_1) ||                                              /*亮度调节*/
hu's avatar
hu committed
1023
                        ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)) /*省油设定子菜单*/
1024
                    )
hu's avatar
hu committed
1025
                    {
1026
                        MenuFlag.Menu_Return = 0u;
hu's avatar
hu committed
1027 1028
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
                    }
hu's avatar
hu committed
1029
                    else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5) /*胎压设置界面返回操作*/
hu's avatar
hu committed
1030
                    {
1031
                        if (User_set_Num.User_TpmsStatus != 2u) /*不是正在匹配状态*/
hu's avatar
hu committed
1032
                        {
1033
                            NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
hu's avatar
hu committed
1034 1035 1036
                        }
                        else
                        {
1037 1038
                            User_set_Num.User_TpmsStatus = 1u; /*退出匹配界面*/
                            if (User_set_Num.User_Temp_Return == 0u)
1039
                            {
1040
                                User_set_Num.User_Temp_Return = 1u; /*取消配对标记*/
hu's avatar
hu committed
1041
                                User_set_Num.User_TpmsSend = 3u;    /*报文外发状态*/
1042 1043 1044 1045 1046
                            }
                            else
                            {
                                ; /* do nonthing*/
                            }
hu's avatar
hu committed
1047 1048
                        }
                    }
1049 1050 1051 1052
                    else
                    {
                        NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
                    }
hu's avatar
hu committed
1053
                }
1054 1055
                /*系统演示模式*/
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL3_5_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_5_MENU_4))
1056
                {
1057
                    MenuFlag.Menu_Return = 0;
1058 1059
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
                }
1060 1061 1062 1063 1064 1065
                /*Enter Go*/
                else if (bCurMenuIDX == _MN_DSP_ENTER_MENU)
                {
                    MenuFlag.Menu_Return = 0;
                    NextMenu(MenuFlag.Menu_Enter_Return);
                }
hu's avatar
hu committed
1066 1067 1068 1069 1070
                /*工厂模式 经销商模式*/
                else if ((bCurMenuIDX >= _FAC_DSP_LEVEL0MENU_1) && (bCurMenuIDX <= _MN_DSP_MENU_MAX))
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
                }
1071 1072
                else
                {
hu's avatar
hu committed
1073
                    ; /*do nothing*/
1074
                }
1075
            }
1076
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
1077
            {
hu's avatar
hu committed
1078
                ; /*D0 Nothing!*/
1079
            }
1080 1081 1082 1083 1084
        }
        else
        {
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
1085
            {
hu's avatar
hu committed
1086
                ; /*Do Nothing!*/
1087
            }
1088
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
1089
            {
1090
                MenuFlag.Key_Menu_Popup_time = 6000u;
1091 1092 1093 1094 1095
            }
        }
    }
    else
    {
hu's avatar
hu committed
1096
        if (HMI_MENU_Sta != Display_Alarm)
1097
        {
1098 1099 1100
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1101 1102 1103 1104 1105 1106 1107 1108 1109
                /*工厂模式 经销商模式*/
                if ((bCurMenuIDX >= _FAC_DSP_LEVEL0MENU_1) && (bCurMenuIDX <= _MN_DSP_MENU_MAX))
                {
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
                }
                else
                {
                    ; /*do nothing*/
                }
1110 1111 1112
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1113
                ; /*Do Nothing!*/
1114 1115 1116 1117 1118 1119 1120
            }
        }
        else
        {
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1121
                ; /*Do Nothing!*/
1122 1123 1124 1125 1126
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
                MenuFlag.Key_Menu_Popup_time = 6000u;
            }
1127 1128
        }
    }
hu's avatar
hu committed
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138
}

/*******************************Menu***********************************************
  Function: Key_Operation_Menu
  Description:
  Input:
  Output:
 *******************************Menu***********************************************/
void Key_Operation_Menu(Key_Event_en_t enKeyEvent)
{
hu's avatar
hu committed
1139
    uint8_t CanStatus1 = 0u;
1140
    uint16_t DispVSpeed = 0u;
hu's avatar
hu committed
1141
    UElib_uint16_t HMI_MENU_Sta = 0u;
hu's avatar
hu committed
1142

1143
    HMI_Set_KEY_MENU(enKeyEvent);
hu's avatar
hu committed
1144 1145 1146

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

hu's avatar
hu committed
1148 1149
    CanStatus1 = CAN_MSG_Status(ID_CanMsg0CF00400_Msg_Count);

1150 1151
    if (DispVSpeed <= DISPSPEEDNULLMAX)
    {
1152
        /*----无车速,无报警----*/
hu's avatar
hu committed
1153
        if (HMI_MENU_Sta != Display_Alarm)
1154
        {
1155
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
1156
            {
hu's avatar
hu committed
1157 1158 1159 1160 1161 1162 1163 1164
                /*自检模式进入经销商模式*/
                if (bCurMenuIDX == _MN_DSP_Menu_Test)
                {
                    K_Line_Set.K_Line_LID51 = 0x02u;
                }
                /*工厂模式*/
                else if (MenuFlag.Menu_StaFlag == 0x00u)
                {
hu's avatar
hu committed
1165 1166
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1167 1168 1169 1170 1171 1172
                    K_Line_Set.K_Line_LID51 = 0x00u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
                /*经销商模式*/
                else if (MenuFlag.Menu_StaFlag == 0x02u)
                {
hu's avatar
hu committed
1173 1174
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1175 1176 1177
                    K_Line_Set.K_Line_LID51 = 0x02u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
1178
                /*记录进入menu菜单的位置*/
hu's avatar
hu committed
1179
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL1MENU_6))
1180
                {
hu's avatar
hu committed
1181
                    MenuFlag.Menu_Flag = bCurMenuIDX;
1182

1183
                    NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
1184
                }
1185
                /*无论从哪里都能回去*/
hu's avatar
hu committed
1186
                else if ((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_5_MENU_4))
1187
                {
hu's avatar
hu committed
1188
                    NextMenu(MenuFlag.Menu_Flag);
1189
                }
hu's avatar
hu committed
1190
            }
1191
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
1192
            {
hu's avatar
hu committed
1193
                ; /*Do Nothing!*/
1194 1195 1196 1197 1198 1199 1200
            }
        }
        else
        {
            /*----无车速,有报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1201 1202 1203 1204 1205
                /*自检模式进入经销商模式*/
                if (bCurMenuIDX == _MN_DSP_Menu_Test)
                {
                    K_Line_Set.K_Line_LID51 = 0x02;
                }
hu's avatar
hu committed
1206 1207 1208
                /*工厂模式*/
                else if (MenuFlag.Menu_StaFlag == 0x00u)
                {
hu's avatar
hu committed
1209 1210
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1211 1212 1213 1214 1215 1216
                    K_Line_Set.K_Line_LID51 = 0x00u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
                /*经销商模式*/
                else if (MenuFlag.Menu_StaFlag == 0x02u)
                {
hu's avatar
hu committed
1217 1218
                    Common_Set_Menu_FacDea_Time_Sta(0x00u);

hu's avatar
hu committed
1219 1220 1221
                    K_Line_Set.K_Line_LID51 = 0x02u;
                    MenuFlag.Menu_StaFlag = 0x01u;
                }
1222 1223 1224
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1225
                ; /*Do Nothing!*/
1226
            }
1227 1228 1229 1230
        }
    }
    else
    {
hu's avatar
hu committed
1231
        if (HMI_MENU_Sta != Display_Alarm)
1232
        {
1233 1234 1235
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251
                /*工厂模式*/
                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;
                }
1252 1253 1254
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1255
                ; /*Do Nothing!*/
1256 1257 1258 1259 1260 1261 1262
            }
        }
        else
        {
            /*----有车速,无报警----*/
            if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
            {
hu's avatar
hu committed
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278
                /*工厂模式*/
                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;
                }
1279 1280 1281
            }
            else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
            {
hu's avatar
hu committed
1282
                ; /*Do Nothing!*/
1283
            }
1284 1285
        }
    }
hu's avatar
hu committed
1286 1287
}

1288 1289 1290 1291 1292 1293
/*******************************ODOTrip***********************************************
  Function: Key_Operation_ODOTrip
  Description:
  Input:
  Output:
 *******************************ODOTrip***********************************************/
hu's avatar
hu committed
1294
void Key_Operation_ODOTrip(Key_Event_en_t enKeyEvent)
1295 1296 1297
{
    uint16_t DispVSpeed = 0u;
    UElib_uint16_t HMI_MENU_Sta = 0u;
1298
    uint8_t PowerStatus;
1299 1300 1301 1302 1303 1304

    HMI_Set_KEY_ODOTRIP(enKeyEvent);

    HMI_MENU_Sta = Get_Cur_HMI();
    DispVSpeed = Common_Get_Disp_V_Speed();

hu's avatar
hu committed
1305
    if (enKeyEvent == KEY_EVENT_OFF_TO_ON)
1306
    {
hu's avatar
hu committed
1307 1308 1309 1310
        MenuFlag.Key_MenuTest_Long = 1u;
    }
    else if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
    {
1311 1312 1313
        PowerStatus = Common_Get_IG_Sts();

        if (PowerStatus == COMMON_POWER_ON)
hu's avatar
hu committed
1314
        {
1315
            if (HMI_MENU_Sta == Display_StartAnimation)
hu's avatar
hu committed
1316
            {
1317 1318 1319 1320
                if (MenuFlag.Key_MenuTest_ShortNum < 100u)
                {
                    MenuFlag.Key_MenuTest_ShortNum++;
                }
hu's avatar
hu committed
1321
            }
1322 1323
            else if (bCurMenuIDX == _MN_DSP_Menu_Test)
            {
hu's avatar
hu committed
1324

1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337
            }
            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 !*/
            }
1338 1339 1340
        }
        else
        {
1341
            State_Flag.Menu_Key_Static = 1u;
1342 1343 1344 1345
        }
    }
    else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
    {
hu's avatar
hu committed
1346
        if (User_set_Num.Trip_Type == TRAPA)
1347 1348 1349 1350 1351 1352 1353
        {
            Data_Clear_Trip(EM_TRIP_A);
        }
        else
        {
            Data_Clear_Trip(EM_TRIP_B);
        }
1354 1355 1356

        if (State_Flag.FState_ClearOilTx == 0u)
        {
hu's avatar
hu committed
1357
            State_Flag.FState_ClearOilTx = 1u;
1358
        }
1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417
    }
#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
1418 1419 1420 1421
uint8_t Common_Get_RetMenu_Flag(void)
{
    return MenuFlag.Menu_Flag;
}
hu's avatar
hu committed
1422 1423 1424 1425 1426
/*------------读按键实时状态的回调函数-------------------------------------------*/
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
1427
Key_Real_Status_en_t Key_Real_Status_Read_Menu(void);
hu's avatar
hu committed
1428 1429
/*-------------------------------------------------*/

hu's avatar
hu committed
1430 1431 1432 1433 1434
// 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
1435

hu's avatar
hu committed
1436 1437 1438 1439 1440
// 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
1441 1442

//实际按键测试
1443
//无操作     21000~24000Ω
hu's avatar
hu committed
1444 1445 1446 1447 1448
// Menu_R        640~680Ω
// Enter_R       5300~5700Ω
// Return_R      9000~9500Ω
// Up_R          1300~1400Ω
// Down_R        3000~3200Ω
1449 1450 1451

/*上*/
Key_Real_Status_en_t Key_Real_Status_Read_Up(void)
hu's avatar
hu committed
1452 1453 1454
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1455 1456 1457 1458 1459 1460 1461 1462 1463

    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
1464
        if ((Key_R >= (1250 - 400)) && (Key_R <= (1250 + 400)))
1465 1466 1467 1468 1469 1470 1471 1472
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1473 1474 1475 1476

    return enKeyRealStatus;
}

1477 1478
/*下*/
Key_Real_Status_en_t Key_Real_Status_Read_Down(void)
hu's avatar
hu committed
1479 1480 1481
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1482 1483 1484 1485 1486 1487 1488 1489 1490

    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
1491
        if ((Key_R >= (2900 - 400)) && (Key_R <= (2900 + 400)))
1492 1493 1494 1495 1496 1497 1498 1499 1500
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }

hu's avatar
hu committed
1501 1502 1503
    return enKeyRealStatus;
}

1504 1505
/*Enter*/
Key_Real_Status_en_t Key_Real_Status_Read_Enter(void)
hu's avatar
hu committed
1506 1507 1508 1509
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;

1510 1511 1512 1513 1514 1515 1516 1517
    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
1518
        if ((Key_R >= (4800 - 400)) && (Key_R <= (4800 + 400)))
1519 1520 1521 1522 1523 1524 1525 1526
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1527 1528 1529
    return enKeyRealStatus;
}

1530 1531
/*Return*/
Key_Real_Status_en_t Key_Real_Status_Read_Return(void)
hu's avatar
hu committed
1532 1533 1534
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1535 1536 1537 1538 1539 1540 1541 1542 1543

    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
1544
        if ((Key_R >= (7800 - 400)) && (Key_R <= (7800 + 400)))
1545 1546 1547 1548 1549 1550 1551 1552
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1553 1554 1555 1556

    return enKeyRealStatus;
}

1557 1558
/*Menu*/
Key_Real_Status_en_t Key_Real_Status_Read_Menu(void)
hu's avatar
hu committed
1559 1560 1561
{
    Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
    uint16_t Key_R = 0;
1562 1563 1564 1565 1566 1567 1568 1569 1570

    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
1571
        if ((Key_R >= (500 - 300)) && (Key_R <= (500 + 300)))
1572 1573 1574 1575 1576 1577 1578 1579
        {
            enKeyRealStatus = KEY_LINE_PRESS;
        }
        else
        {
            enKeyRealStatus = KEY_LINE_LOOSEN;
        }
    }
hu's avatar
hu committed
1580 1581 1582 1583

    return enKeyRealStatus;
}

1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602
/*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
1603 1604
/*---------------------------------------------------------------------------------------*/
const Key_Attribute_st_t stKeyAttribute[KEY_NUM_MAX] =
1605
{
hu's avatar
hu committed
1606 1607 1608 1609 1610
    {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},
1611
    {KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_ODOTrip, Key_Operation_ODOTrip},
hu's avatar
hu committed
1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625
};

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