Commit 5c96b146 authored by hu's avatar hu

优化按键操作逻辑

parent 87249c1a
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
/*-----------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------*/
typedef struct typedef struct
{ {
uint16_t u16KeyShortPressTime; /*¶Ì°´¼ì²âʱ¼ä*/ uint16_t u16KeyShortPressTime; /*¶Ì°´¼ì²âʱ¼ä*/
uint16_t u16KeyLongPressTime; /*³¤°´¼ì²âʱ¼ä*/ uint16_t u16KeyLongPressTime; /*³¤°´¼ì²âʱ¼ä*/
uint16_t u16KeySuperLongPressTime; /*³¬³¤°´¼ì²âʱ¼ä*/ uint16_t u16KeySuperLongPressTime; /*³¬³¤°´¼ì²âʱ¼ä*/
uint16_t u16KeyLoosenTime; /*ËÉ¿ª¼ì²âʱ¼ä*/ uint16_t u16KeyLoosenTime; /*ËÉ¿ª¼ì²âʱ¼ä*/
uint16_t u16KeyValidOFFTime; /*ÓÐЧOFF¼ì²âʱ¼ä*/ uint16_t u16KeyValidOFFTime; /*ÓÐЧOFF¼ì²âʱ¼ä*/
uint16_t u16KeyValidONTime; /*ÓÐЧON¼ì²âʱ¼ä*/ uint16_t u16KeyValidONTime; /*ÓÐЧON¼ì²âʱ¼ä*/
} Key_Parameter_st_t; } Key_Parameter_st_t;
...@@ -40,10 +40,10 @@ static Key_Parameter_st_t stKeyParameter; ...@@ -40,10 +40,10 @@ static Key_Parameter_st_t stKeyParameter;
#pragma ghs section bss = default #pragma ghs section bss = default
static Key_Ctr_st_t stKeyCtrVariate[KEY_NUM_MAX]; static Key_Ctr_st_t stKeyCtrVariate[KEY_NUM_MAX];
//static Key_IGN_en_t enKeyIGNFirstStatus = KEY_IG_INVALID; // static Key_IGN_en_t enKeyIGNFirstStatus = KEY_IG_INVALID;
//static Key_IGN_en_t enKeyIGNStatusLast = KEY_IG_INVALID; // static Key_IGN_en_t enKeyIGNStatusLast = KEY_IG_INVALID;
//static uint8_t u8KeyIGNChangeFlag = 0U; // static uint8_t u8KeyIGNChangeFlag = 0U;
//static uint16_t u16KeyIGNTimeCount; // static uint16_t u16KeyIGNTimeCount;
/*-----------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------*/
static void Key_Process(Key_Num_en_t enKeyIndex); static void Key_Process(Key_Num_en_t enKeyIndex);
...@@ -76,7 +76,7 @@ static void Key_Process(Key_Num_en_t enKeyIndex) ...@@ -76,7 +76,7 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
if (stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack != 0U) if (stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack != 0U)
{ {
if ((stKeyCtrVariate[enKeyIndex].enKeyTypeLast == KEY_CAN_NONE) && if ((stKeyCtrVariate[enKeyIndex].enKeyTypeLast == KEY_CAN_NONE) &&
(enKeyRealType == KEY_CAN_SHORT_PRESS)) (enKeyRealType == KEY_CAN_SHORT_PRESS))
{ {
stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack(KEY_EVENT_SHORT_PRESS); stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack(KEY_EVENT_SHORT_PRESS);
} }
...@@ -110,7 +110,7 @@ static void Key_Process(Key_Num_en_t enKeyIndex) ...@@ -110,7 +110,7 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
if (stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack != 0U) if (stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack != 0U)
{ {
if ((stKeyCtrVariate[enKeyIndex].enKeyTypeLast == KEY_CAN_SHORT_PRESS) && if ((stKeyCtrVariate[enKeyIndex].enKeyTypeLast == KEY_CAN_SHORT_PRESS) &&
(enKeyRealType == KEY_CAN_NONE)) (enKeyRealType == KEY_CAN_NONE))
{ {
stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack(KEY_EVENT_SHORT_PRESS); stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack(KEY_EVENT_SHORT_PRESS);
} }
...@@ -157,8 +157,8 @@ static void Key_Process(Key_Num_en_t enKeyIndex) ...@@ -157,8 +157,8 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount = 0U; stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount = 0U;
} }
if ((stKeyCtrVariate[enKeyIndex].u16KeyInvalidTimeCount >= stKeyParameter.u16KeyLoosenTime) && if ((stKeyCtrVariate[enKeyIndex].u16KeyInvalidTimeCount >= stKeyParameter.u16KeyLoosenTime) &&
(stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount >= stKeyParameter.u16KeyShortPressTime) && (stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount >= stKeyParameter.u16KeyShortPressTime) &&
(stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount < stKeyParameter.u16KeyLongPressTime)) (stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount < stKeyParameter.u16KeyLongPressTime))
{ {
stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount = 0U; stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount = 0U;
/* call back */ /* call back */
...@@ -212,8 +212,10 @@ static void Key_Process(Key_Num_en_t enKeyIndex) ...@@ -212,8 +212,10 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
if (stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount >= stKeyParameter.u16KeyShortPressTime) if (stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount >= stKeyParameter.u16KeyShortPressTime)
{ {
stKeyCtrVariate[enKeyIndex].u16KeyInvalidTimeCount = 0U; // stKeyCtrVariate[enKeyIndex].u16KeyInvalidTimeCount = 0U;
} }
stKeyCtrVariate[enKeyIndex].u16KeyInvalidTimeCount = 0U;
if (stKeyCtrVariate[enKeyIndex].u8KeyIGNChangeFlag == 0U) if (stKeyCtrVariate[enKeyIndex].u8KeyIGNChangeFlag == 0U)
{ {
if (stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount >= stKeyParameter.u16KeySuperLongPressTime) if (stKeyCtrVariate[enKeyIndex].u16KeyValidTimeCount >= stKeyParameter.u16KeySuperLongPressTime)
...@@ -238,7 +240,7 @@ static void Key_Process(Key_Num_en_t enKeyIndex) ...@@ -238,7 +240,7 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
if (enKeyIGNRealStatus == KEY_IG_ON) if (enKeyIGNRealStatus == KEY_IG_ON)
{ {
if ((stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord >= stKeyParameter.u16KeyValidOFFTime) && if ((stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord >= stKeyParameter.u16KeyValidOFFTime) &&
(stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount >= stKeyParameter.u16KeyValidONTime)) (stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount >= stKeyParameter.u16KeyValidONTime))
{ {
if (stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack != 0U) if (stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack != 0U)
{ {
...@@ -253,7 +255,7 @@ static void Key_Process(Key_Num_en_t enKeyIndex) ...@@ -253,7 +255,7 @@ static void Key_Process(Key_Num_en_t enKeyIndex)
if (enKeyIGNRealStatus == KEY_IG_OFF) if (enKeyIGNRealStatus == KEY_IG_OFF)
{ {
if ((stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord >= stKeyParameter.u16KeyValidONTime) && if ((stKeyCtrVariate[enKeyIndex].u16KeyFirstIGNTimeRecord >= stKeyParameter.u16KeyValidONTime) &&
(stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount >= stKeyParameter.u16KeyValidOFFTime)) (stKeyCtrVariate[enKeyIndex].u16KeyIGNTimeCount >= stKeyParameter.u16KeyValidOFFTime))
{ {
if (stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack != 0U) if (stKeyAttribute[enKeyIndex].pfnKeyOperationCallBack != 0U)
{ {
...@@ -304,11 +306,11 @@ void Key_Init(void) ...@@ -304,11 +306,11 @@ void Key_Init(void)
stKeyCtrVariate[i].u16KeyIGNTimeCount = 0U; stKeyCtrVariate[i].u16KeyIGNTimeCount = 0U;
} }
/*按键动作时间*/ /*按键动作时间*/
stKeyParameter.u16KeyLoosenTime = 200U; stKeyParameter.u16KeyLoosenTime = 100U;
stKeyParameter.u16KeyShortPressTime = 40U; stKeyParameter.u16KeyShortPressTime = 40U;
stKeyParameter.u16KeyLongPressTime = 2000U; stKeyParameter.u16KeyLongPressTime = 2000U;
stKeyParameter.u16KeySuperLongPressTime = 10000U; stKeyParameter.u16KeySuperLongPressTime = 10000U;
stKeyParameter.u16KeyValidOFFTime = 200U;/*按键动作时间*/ stKeyParameter.u16KeyValidOFFTime = 200U; /*按键动作时间*/
stKeyParameter.u16KeyValidONTime = 1000U; stKeyParameter.u16KeyValidONTime = 1000U;
} }
/*对于硬线按键而言,判断短按的时间参数*/ /*对于硬线按键而言,判断短按的时间参数*/
......
...@@ -4,21 +4,20 @@ ...@@ -4,21 +4,20 @@
#include "Services_ODO_User.h" #include "Services_ODO_User.h"
#include "DisplaySch_user.h" #include "DisplaySch_user.h"
#include "DispSch.h"
#include "Sound_Scheduler.h" #include "Sound_Scheduler.h"
#include "System_Monitor.h" #include "System_Monitor.h"
#include "RTE_ADC.h" #include "RTE_ADC.h"
#include "Popup_Scheduler.h"
#include "CAN_Communication_Matrix.h" #include "CAN_Communication_Matrix.h"
#include "GUI.h" #include "GUI.h"
/*-------------------------------------------------------*/ /*-------------------------------------------------------*/
/*无车速限制值*/ /*无车速限制值*/
#define DISPSPEEDNULLMAX 66 #define DISPSPEEDNULLMAX 66
/*----------按键具体功能执行的回调函数-----------------------*/ /*----------按键具体功能执行的回调函数-----------------------*/
void Key_Operation_Enter(Key_Event_en_t enKeyEvent); void Key_Operation_Enter(Key_Event_en_t enKeyEvent);
void Key_Operation_Return(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_Up(Key_Event_en_t enKeyEvent);
...@@ -30,11 +29,11 @@ Key_IGN_en_t Key_Get_IGN_Status(void); ...@@ -30,11 +29,11 @@ Key_IGN_en_t Key_Get_IGN_Status(void);
struct struct
{ {
/* data */ /* data */
uint8_t Up ; uint8_t Up;
uint8_t Down ; uint8_t Down;
uint8_t Enter ; uint8_t Enter;
uint8_t Menu ; uint8_t Menu;
uint8_t Return ; uint8_t Return;
} KeyTest; } KeyTest;
...@@ -48,24 +47,25 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -48,24 +47,25 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
{ {
uint8_t CanStatus1 = 0u; uint8_t CanStatus1 = 0u;
uint16_t DispVSpeed = 0u; uint16_t DispVSpeed = 0u;
uint16_t popupID = 0U; UElib_uint16_t HMI_MENU_Sta = 0u;
popupID = Popup_Get_Current_Message( );
HMI_Set_KEY_UP(enKeyEvent); HMI_Set_KEY_UP(enKeyEvent);
DispVSpeed = Common_Get_Disp_V_Speed(); HMI_MENU_Sta = Get_Cur_HMI();
DispVSpeed = Common_Get_Disp_V_Speed();
CanStatus1 = CAN_MSG_Status(ID_CanMsg0CF00400_Msg_Count); CanStatus1 = CAN_MSG_Status(ID_CanMsg0CF00400_Msg_Count);
if (DispVSpeed <= DISPSPEEDNULLMAX) if (DispVSpeed <= DISPSPEEDNULLMAX)
{ {
/*----无车速,无报警----*/ /*----无车速,无报警----*/
if (popupID == 0xffffu ) if (HMI_MENU_Sta != Display_Alarm)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
/*主界面 一级菜单 二级菜单那*/ /*主界面 一级菜单 二级菜单那*/
if (((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_6_MENU_2)) || if (((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_6_MENU_2)) ||
((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47))) ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
{ {
/*故障码*/ /*故障码*/
if ((CanStatus1 == CAN_SIG_LOST) && (bCurMenuIDX == _MN_DSP_LEVEL2MENU_2)) if ((CanStatus1 == CAN_SIG_LOST) && (bCurMenuIDX == _MN_DSP_LEVEL2MENU_2))
...@@ -81,13 +81,13 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -81,13 +81,13 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_1) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_1)
{ {
if (User_set_Num.User_FDJYLQQ == (uint32_t)K_Line_Set.K_Line_LID4F * 1000u) if (User_set_Num.User_FDJYLQQ == (uint32_t)K_Line_Set.K_Line_LID4F * 1000u)
User_set_Num.User_FDJYLQQ = 0u ; User_set_Num.User_FDJYLQQ = 0u;
} }
/*保养通知设定 更换燃油滤清器*/ /*保养通知设定 更换燃油滤清器*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_2) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_2)
{ {
if (User_set_Num.User_RYLQQ == (uint32_t)K_Line_User_RYLQQ * 1000u) if (User_set_Num.User_RYLQQ == (uint32_t)K_Line_User_RYLQQ * 1000u)
User_set_Num.User_RYLQQ = 0u ; User_set_Num.User_RYLQQ = 0u;
} }
/*保养通知设定 更换变速箱油*/ /*保养通知设定 更换变速箱油*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_3) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_3)
...@@ -99,26 +99,26 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -99,26 +99,26 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_4) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_4)
{ {
if (User_set_Num.User_CSQY == (uint32_t)K_Line_Set.K_Line_LID4B * 1000u) if (User_set_Num.User_CSQY == (uint32_t)K_Line_Set.K_Line_LID4B * 1000u)
User_set_Num.User_CSQY = 0u ; User_set_Num.User_CSQY = 0u;
} }
/*保养通知设定 更换动力转向油*/ /*保养通知设定 更换动力转向油*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_6) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_6)
{ {
if (User_set_Num.User_DLZXY == (uint32_t)K_Line_Set.K_Line_LID4D * 1000u) if (User_set_Num.User_DLZXY == (uint32_t)K_Line_Set.K_Line_LID4D * 1000u)
User_set_Num.User_DLZXY = 0u ; User_set_Num.User_DLZXY = 0u;
} }
/*保养通知设定 轮胎换位.更换*/ /*保养通知设定 轮胎换位.更换*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_7) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_7)
{ {
if (User_set_Num.User_LT == (uint32_t)K_Line_Set.K_Line_LID4E * 1000u) if (User_set_Num.User_LT == (uint32_t)K_Line_Set.K_Line_LID4E * 1000u)
User_set_Num.User_LT = 0u ; User_set_Num.User_LT = 0u;
} }
/*设置日期-年*/ /*设置日期-年*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11) else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11)
{ {
User_set_Num.Year ++; User_set_Num.Year++;
if ( User_set_Num.Year > 99u) if (User_set_Num.Year > 99u)
{ {
User_set_Num.Year = 0u; User_set_Num.Year = 0u;
} }
...@@ -193,11 +193,11 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -193,11 +193,11 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
/*设置时间-时*/ /*设置时间-时*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_21) else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_21)
{ {
User_set_Num.Hour++ ; User_set_Num.Hour++;
if (User_set_Num.Hour > 23u) if (User_set_Num.Hour > 23u)
{ {
User_set_Num.Hour = 0u ; User_set_Num.Hour = 0u;
} }
} }
/*设置时间-分*/ /*设置时间-分*/
...@@ -207,7 +207,7 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -207,7 +207,7 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
if (User_set_Num.Minute > 59u) if (User_set_Num.Minute > 59u)
{ {
User_set_Num.Minute = 0u ; User_set_Num.Minute = 0u;
} }
} }
/*语言设置 ----反*/ /*语言设置 ----反*/
...@@ -215,7 +215,7 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -215,7 +215,7 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
{ {
if (User_set_Num.User_Language > 0u) if (User_set_Num.User_Language > 0u)
{ {
User_set_Num.User_Language-- ; User_set_Num.User_Language--;
} }
} }
/*高速路*/ /*高速路*/
...@@ -247,7 +247,7 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -247,7 +247,7 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
{ {
if (User_set_Num.User_Speed < 99) if (User_set_Num.User_Speed < 99)
{ {
User_set_Num.User_Speed ++; User_set_Num.User_Speed++;
} }
else if (User_set_Num.User_Speed == 0xFF) else if (User_set_Num.User_Speed == 0xFF)
{ {
...@@ -289,7 +289,7 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -289,7 +289,7 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
/*辅助驻车解除设定*/ /*辅助驻车解除设定*/
else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_7) else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_7)
{ {
if (User_set_Num.User_Parking == 0xFFu) if (User_set_Num.User_Parking == 0xFFu)
{ {
User_set_Num.User_Parking = 0u; User_set_Num.User_Parking = 0u;
} }
...@@ -297,7 +297,7 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -297,7 +297,7 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
/*----无车速,有报警----*/ /*----无车速,有报警----*/
...@@ -305,26 +305,26 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -305,26 +305,26 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
} }
else else
{ {
/*----有车速,无报警----*/ /*----有车速,无报警----*/
if (popupID == 0xffffu ) if (HMI_MENU_Sta != Display_Alarm)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
/*----有车速,有报警----*/ /*----有车速,有报警----*/
...@@ -332,11 +332,11 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -332,11 +332,11 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
} }
...@@ -351,65 +351,66 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent) ...@@ -351,65 +351,66 @@ void Key_Operation_Up(Key_Event_en_t enKeyEvent)
void Key_Operation_Down(Key_Event_en_t enKeyEvent) void Key_Operation_Down(Key_Event_en_t enKeyEvent)
{ {
uint16_t DispVSpeed = 0u; uint16_t DispVSpeed = 0u;
uint16_t popupID = 0U; UElib_uint16_t HMI_MENU_Sta = 0u;
popupID = Popup_Get_Current_Message( );
HMI_Set_KEY_DOWN(enKeyEvent); HMI_Set_KEY_DOWN(enKeyEvent);
DispVSpeed = Common_Get_Disp_V_Speed();
HMI_MENU_Sta = Get_Cur_HMI();
DispVSpeed = Common_Get_Disp_V_Speed();
if (DispVSpeed <= DISPSPEEDNULLMAX) if (DispVSpeed <= DISPSPEEDNULLMAX)
{ {
/*----无车速,无报警----*/ /*----无车速,无报警----*/
if (popupID == 0xffffu ) if (HMI_MENU_Sta != Display_Alarm)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
/*主界面 一级菜单 二级菜单*/ /*主界面 一级菜单 二级菜单*/
if (((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_6_MENU_2)) || if (((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_6_MENU_2)) ||
((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47))) ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
{ {
NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN); NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_DOWN);
} }
/*保养通知设定 更换机油&机油滤清器*/ /*保养通知设定 更换机油&机油滤清器*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_1) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_1)
{ {
if (User_set_Num.User_FDJYLQQ == 0u ) if (User_set_Num.User_FDJYLQQ == 0u)
User_set_Num.User_FDJYLQQ = (uint32_t)K_Line_Set.K_Line_LID4F * 1000u ; User_set_Num.User_FDJYLQQ = (uint32_t)K_Line_Set.K_Line_LID4F * 1000u;
} }
/*保养通知设定 更换燃油滤清器*/ /*保养通知设定 更换燃油滤清器*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_2) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_2)
{ {
if (User_set_Num.User_RYLQQ == 0u ) if (User_set_Num.User_RYLQQ == 0u)
User_set_Num.User_RYLQQ = (uint32_t)K_Line_User_RYLQQ * 1000u ; User_set_Num.User_RYLQQ = (uint32_t)K_Line_User_RYLQQ * 1000u;
} }
/*保养通知设定 更换变速箱油*/ /*保养通知设定 更换变速箱油*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_3) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_3)
{ {
if (User_set_Num.User_BSXY == 0u ) if (User_set_Num.User_BSXY == 0u)
User_set_Num.User_BSXY = (uint32_t)K_Line_Set.K_Line_LID4A * 1000u ; User_set_Num.User_BSXY = (uint32_t)K_Line_Set.K_Line_LID4A * 1000u;
} }
/*保养通知设定 更换差速器油*/ /*保养通知设定 更换差速器油*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_4) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_4)
{ {
if (User_set_Num.User_CSQY == 0u ) if (User_set_Num.User_CSQY == 0u)
User_set_Num.User_CSQY = (uint32_t)K_Line_Set.K_Line_LID4B * 1000u ; User_set_Num.User_CSQY = (uint32_t)K_Line_Set.K_Line_LID4B * 1000u;
} }
/*保养通知设定 更换动力转向液*/ /*保养通知设定 更换动力转向液*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_6) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_6)
{ {
if (User_set_Num.User_DLZXY == 0u ) if (User_set_Num.User_DLZXY == 0u)
User_set_Num.User_DLZXY = (uint32_t)K_Line_Set.K_Line_LID4D * 1000u ; User_set_Num.User_DLZXY = (uint32_t)K_Line_Set.K_Line_LID4D * 1000u;
} }
/*保养通知设定 轮胎换位.更换*/ /*保养通知设定 轮胎换位.更换*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_7) else if (bCurMenuIDX == _MN_DSP_LEVEL3_3_MENU_7)
{ {
if (User_set_Num.User_LT == 0u ) if (User_set_Num.User_LT == 0u)
User_set_Num.User_LT = (uint32_t)K_Line_Set.K_Line_LID4E * 1000u ; User_set_Num.User_LT = (uint32_t)K_Line_Set.K_Line_LID4E * 1000u;
} }
/*设置日期-年*/ /*设置日期-年*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11) else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_11)
{ {
if ( User_set_Num.Year > 0u) if (User_set_Num.Year > 0u)
{ {
User_set_Num.Year--; User_set_Num.Year--;
} }
...@@ -495,7 +496,7 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent) ...@@ -495,7 +496,7 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent)
} }
else else
{ {
User_set_Num.Hour = 23u ; User_set_Num.Hour = 23u;
} }
} }
/*设置时间-分*/ /*设置时间-分*/
...@@ -503,18 +504,18 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent) ...@@ -503,18 +504,18 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent)
{ {
if (User_set_Num.Minute > 0u) if (User_set_Num.Minute > 0u)
{ {
User_set_Num.Minute-- ; User_set_Num.Minute--;
} }
else else
{ {
User_set_Num.Minute = 59u ; User_set_Num.Minute = 59u;
} }
} }
/*语言设置 ----反*/ /*语言设置 ----反*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3) else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3)
{ {
if (User_set_Num.User_Language < 1 ) if (User_set_Num.User_Language < 1)
User_set_Num.User_Language++ ; User_set_Num.User_Language++;
} }
/*高速路*/ /*高速路*/
else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_1) else if (bCurMenuIDX == _MN_DSP_LEVEL4_4_MENU_1)
...@@ -591,7 +592,7 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent) ...@@ -591,7 +592,7 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent)
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
else else
...@@ -599,27 +600,26 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent) ...@@ -599,27 +600,26 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent)
/*----无车速,有报警----*/ /*----无车速,有报警----*/
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
} }
else else
{ {
/*----有车速,无报警----*/ /*----有车速,无报警----*/
if (popupID == 0xffffu ) if (HMI_MENU_Sta != Display_Alarm)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
/*----有车速,有报警----*/ /*----有车速,有报警----*/
...@@ -627,11 +627,11 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent) ...@@ -627,11 +627,11 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
} }
...@@ -645,22 +645,22 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent) ...@@ -645,22 +645,22 @@ void Key_Operation_Down(Key_Event_en_t enKeyEvent)
void Key_Operation_Enter(Key_Event_en_t enKeyEvent) void Key_Operation_Enter(Key_Event_en_t enKeyEvent)
{ {
uint16_t DispVSpeed = 0u; uint16_t DispVSpeed = 0u;
uint16_t popupID = 0U; UElib_uint16_t HMI_MENU_Sta = 0u;
popupID = Popup_Get_Current_Message( );
HMI_Set_KEY_CONFIRM(enKeyEvent); HMI_Set_KEY_CONFIRM(enKeyEvent);
DispVSpeed = Common_Get_Disp_V_Speed(); HMI_MENU_Sta = Get_Cur_HMI();
DispVSpeed = Common_Get_Disp_V_Speed();
if (DispVSpeed <= DISPSPEEDNULLMAX) if (DispVSpeed <= DISPSPEEDNULLMAX)
{ {
/*----无车速,无报警----*/ /*----无车速,无报警----*/
if (popupID == 0xffffu ) if (HMI_MENU_Sta != Display_Alarm)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
if (((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_6_MENU_2)) || if (((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL2_6_MENU_2)) ||
((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47))) ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)))
{ {
NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER); NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_ENTER);
} }
...@@ -673,7 +673,6 @@ void Key_Operation_Enter(Key_Event_en_t enKeyEvent) ...@@ -673,7 +673,6 @@ void Key_Operation_Enter(Key_Event_en_t enKeyEvent)
/*轮胎匹配界面*/ /*轮胎匹配界面*/
else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5) else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5)
{ {
} }
/*Go Return*/ /*Go Return*/
else if (bCurMenuIDX == _MN_DSP_ENTER_MENU) else if (bCurMenuIDX == _MN_DSP_ENTER_MENU)
...@@ -687,7 +686,7 @@ void Key_Operation_Enter(Key_Event_en_t enKeyEvent) ...@@ -687,7 +686,7 @@ void Key_Operation_Enter(Key_Event_en_t enKeyEvent)
/*Go Enter*/ /*Go Enter*/
if ((bCurMenuIDX >= _MN_DSP_LEVEL3_2_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_2_MENU_8)) if ((bCurMenuIDX >= _MN_DSP_LEVEL3_2_MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_2_MENU_8))
{ {
MenuFlag.Menu_Enter_Return = bCurMenuIDX ; MenuFlag.Menu_Enter_Return = bCurMenuIDX;
NextMenu(_MN_DSP_ENTER_MENU); NextMenu(_MN_DSP_ENTER_MENU);
} }
} }
...@@ -697,27 +696,26 @@ void Key_Operation_Enter(Key_Event_en_t enKeyEvent) ...@@ -697,27 +696,26 @@ void Key_Operation_Enter(Key_Event_en_t enKeyEvent)
/*----无车速,有报警----*/ /*----无车速,有报警----*/
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
} }
else else
{ {
/*----有车速,无报警----*/ /*----有车速,无报警----*/
if (popupID == 0xffffu ) if (HMI_MENU_Sta != Display_Alarm)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
/*----有车速,有报警----*/ /*----有车速,有报警----*/
...@@ -725,11 +723,11 @@ void Key_Operation_Enter(Key_Event_en_t enKeyEvent) ...@@ -725,11 +723,11 @@ void Key_Operation_Enter(Key_Event_en_t enKeyEvent)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
} }
...@@ -744,42 +742,43 @@ void Key_Operation_Enter(Key_Event_en_t enKeyEvent) ...@@ -744,42 +742,43 @@ void Key_Operation_Enter(Key_Event_en_t enKeyEvent)
void Key_Operation_Return(Key_Event_en_t enKeyEvent) void Key_Operation_Return(Key_Event_en_t enKeyEvent)
{ {
uint16_t DispVSpeed = 0u; uint16_t DispVSpeed = 0u;
uint16_t popupID = 0U; UElib_uint16_t HMI_MENU_Sta = 0u;
popupID = Popup_Get_Current_Message( );
HMI_Set_KEY_CANCEL(enKeyEvent); HMI_Set_KEY_CANCEL(enKeyEvent);
DispVSpeed = Common_Get_Disp_V_Speed();
HMI_MENU_Sta = Get_Cur_HMI();
DispVSpeed = Common_Get_Disp_V_Speed();
if (DispVSpeed <= DISPSPEEDNULLMAX) if (DispVSpeed <= DISPSPEEDNULLMAX)
{ {
/*----无车速,无报警----*/ /*----无车速,无报警----*/
if (popupID == 0xffffu ) if (HMI_MENU_Sta != Display_Alarm)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
if ((bCurMenuIDX >= _MN_DSP_LEVEL2_1_MENU_1) && (bCurMenuIDX < _MN_DSP_ENTER_MENU)) if ((bCurMenuIDX >= _MN_DSP_LEVEL2_1_MENU_1) && (bCurMenuIDX < _MN_DSP_ENTER_MENU))
{ {
if ( if (
( bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3 ) || /*语言设定*/ (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_3) || /*语言设定*/
((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41 ) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)) /*省油设定子菜单*/ ((bCurMenuIDX >= _MN_DSP_LEVEL3_4_MENU_41) && (bCurMenuIDX <= _MN_DSP_LEVEL3_4_MENU_47)) /*省油设定子菜单*/
) )
{ {
MenuFlag.Menu_Return = 0; MenuFlag.Menu_Return = 0;
NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT); NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
} }
else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5 ) /*胎压设置界面返回操作*/ else if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_5) /*胎压设置界面返回操作*/
{ {
if (User_set_Num.User_TpmsStatus != 2) /*不是正在匹配状态*/ if (User_set_Num.User_TpmsStatus != 2) /*不是正在匹配状态*/
{ {
NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT); NextMenu(MenuOptTab[bCurMenuIDX].VK_IDX_EXIT);
} }
else else
{ {
User_set_Num.User_TpmsStatus = 1; /*退出匹配界面*/ User_set_Num.User_TpmsStatus = 1; /*退出匹配界面*/
if (User_set_Num.User_Temp_Return == 0) if (User_set_Num.User_Temp_Return == 0)
{ {
User_set_Num.User_Temp_Return = 1; /*取消配对标记*/ User_set_Num.User_Temp_Return = 1; /*取消配对标记*/
User_set_Num.User_TpmsSend = 3; /*报文外发次数*/ User_set_Num.User_TpmsSend = 3; /*报文外发次数*/
} }
else else
{ {
...@@ -806,12 +805,12 @@ void Key_Operation_Return(Key_Event_en_t enKeyEvent) ...@@ -806,12 +805,12 @@ void Key_Operation_Return(Key_Event_en_t enKeyEvent)
} }
else else
{ {
;/*do nothing*/ ; /*do nothing*/
} }
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*D0 Nothing!*/ ; /*D0 Nothing!*/
} }
} }
else else
...@@ -819,7 +818,7 @@ void Key_Operation_Return(Key_Event_en_t enKeyEvent) ...@@ -819,7 +818,7 @@ void Key_Operation_Return(Key_Event_en_t enKeyEvent)
/*----无车速,有报警----*/ /*----无车速,有报警----*/
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
...@@ -829,16 +828,16 @@ void Key_Operation_Return(Key_Event_en_t enKeyEvent) ...@@ -829,16 +828,16 @@ void Key_Operation_Return(Key_Event_en_t enKeyEvent)
} }
else else
{ {
if (popupID == 0xffffu ) if (HMI_MENU_Sta != Display_Alarm)
{ {
/*----有车速,无报警----*/ /*----有车速,无报警----*/
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
} }
else else
...@@ -846,7 +845,7 @@ void Key_Operation_Return(Key_Event_en_t enKeyEvent) ...@@ -846,7 +845,7 @@ void Key_Operation_Return(Key_Event_en_t enKeyEvent)
/*----有车速,无报警----*/ /*----有车速,无报警----*/
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
...@@ -866,25 +865,26 @@ void Key_Operation_Menu(Key_Event_en_t enKeyEvent) ...@@ -866,25 +865,26 @@ void Key_Operation_Menu(Key_Event_en_t enKeyEvent)
{ {
uint8_t CanStatus1 = 0u; uint8_t CanStatus1 = 0u;
uint16_t DispVSpeed = 0u; uint16_t DispVSpeed = 0u;
uint16_t popupID = 0U; UElib_uint16_t HMI_MENU_Sta = 0u;
popupID = Popup_Get_Current_Message( );
HMI_Set_KEY_MENU(enKeyEvent); HMI_Set_KEY_MENU(enKeyEvent);
DispVSpeed = Common_Get_Disp_V_Speed();
HMI_MENU_Sta = Get_Cur_HMI();
DispVSpeed = Common_Get_Disp_V_Speed();
CanStatus1 = CAN_MSG_Status(ID_CanMsg0CF00400_Msg_Count); CanStatus1 = CAN_MSG_Status(ID_CanMsg0CF00400_Msg_Count);
if (DispVSpeed <= DISPSPEEDNULLMAX) if (DispVSpeed <= DISPSPEEDNULLMAX)
{ {
/*----无车速,无报警----*/ /*----无车速,无报警----*/
if (popupID == 0xffffu ) if (HMI_MENU_Sta != Display_Alarm)
{ {
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
/*记录进入menu菜单的位置*/ /*记录进入menu菜单的位置*/
if ((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL1MENU_6)) if ((bCurMenuIDX >= _MN_DSP_LEVEL1MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL1MENU_6))
{ {
MenuFlag.Menu_Flag = bCurMenuIDX; MenuFlag.Menu_Flag = bCurMenuIDX;
/*有故障码*/ /*有故障码*/
if (CanStatus1 == CAN_SIG_LOST) if (CanStatus1 == CAN_SIG_LOST)
...@@ -900,11 +900,11 @@ void Key_Operation_Menu(Key_Event_en_t enKeyEvent) ...@@ -900,11 +900,11 @@ void Key_Operation_Menu(Key_Event_en_t enKeyEvent)
/*无论从哪里都能回去*/ /*无论从哪里都能回去*/
else if ((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_RETURN_MENU)) else if ((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_RETURN_MENU))
{ {
//if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_A) /*胎压设置界面*/ // if (bCurMenuIDX == _MN_DSP_LEVEL3_4_MENU_A) /*胎压设置界面*/
//{ //{
// NextMenu(_MN_DSP_LEVEL2MENU_4); /*menu回到用户设置界面*/ // NextMenu(_MN_DSP_LEVEL2MENU_4); /*menu回到用户设置界面*/
//} // }
//else // else
{ {
NextMenu(MenuFlag.Menu_Flag); NextMenu(MenuFlag.Menu_Flag);
} }
...@@ -916,7 +916,7 @@ void Key_Operation_Menu(Key_Event_en_t enKeyEvent) ...@@ -916,7 +916,7 @@ void Key_Operation_Menu(Key_Event_en_t enKeyEvent)
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
} }
else else
...@@ -924,26 +924,26 @@ void Key_Operation_Menu(Key_Event_en_t enKeyEvent) ...@@ -924,26 +924,26 @@ void Key_Operation_Menu(Key_Event_en_t enKeyEvent)
/*----无车速,有报警----*/ /*----无车速,有报警----*/
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
} }
} }
else else
{ {
if (popupID == 0xffffu ) if (HMI_MENU_Sta != Display_Alarm)
{ {
/*----有车速,无报警----*/ /*----有车速,无报警----*/
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
} }
else else
...@@ -951,11 +951,11 @@ void Key_Operation_Menu(Key_Event_en_t enKeyEvent) ...@@ -951,11 +951,11 @@ void Key_Operation_Menu(Key_Event_en_t enKeyEvent)
/*----有车速,无报警----*/ /*----有车速,无报警----*/
if (enKeyEvent == KEY_EVENT_SHORT_PRESS) if (enKeyEvent == KEY_EVENT_SHORT_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
else if (enKeyEvent == KEY_EVENT_LONG_PRESS) else if (enKeyEvent == KEY_EVENT_LONG_PRESS)
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
} }
} }
...@@ -970,29 +970,28 @@ Key_Real_Status_en_t Key_Real_Status_Read_Enter(void); ...@@ -970,29 +970,28 @@ 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_Return(void);
Key_Real_Status_en_t Key_Real_Status_Read_Up(void); Key_Real_Status_en_t Key_Real_Status_Read_Up(void);
Key_Real_Status_en_t Key_Real_Status_Read_Down(void); Key_Real_Status_en_t Key_Real_Status_Read_Down(void);
Key_Real_Status_en_t Key_Real_Status_Read_Menu(void) ; Key_Real_Status_en_t Key_Real_Status_Read_Menu(void);
/*-------------------------------------------------*/ /*-------------------------------------------------*/
//Menu_R = 24000*470 / (24000 + 470) = 460.97Ω // Menu_R = 24000*470 / (24000 + 470) = 460.97Ω
//Enter_R = 24000*6800 / (24000 + 6800) = 5298.7Ω // Enter_R = 24000*6800 / (24000 + 6800) = 5298.7Ω
//Return_R = 24000*15000 / (24000 + 15000) = 9230.77Ω // Return_R = 24000*15000 / (24000 + 15000) = 9230.77Ω
//Up_R = 24000*1200 / (24000 + 1200) = 1142.86Ω // Up_R = 24000*1200 / (24000 + 1200) = 1142.86Ω
//Down_R = 24000*3300 / (24000 + 3300) = 2901.1Ω // Down_R = 24000*3300 / (24000 + 3300) = 2901.1Ω
//Menu_R = 16000*470 / (16000 + 470) = 456.59Ω // Menu_R = 16000*470 / (16000 + 470) = 456.59Ω
//Enter_R = 16000*6800 / (16000 + 6800) = 4771.9Ω // Enter_R = 16000*6800 / (16000 + 6800) = 4771.9Ω
//Return_R = 16000*15000 / (16000 + 15000) = 7741.94Ω // Return_R = 16000*15000 / (16000 + 15000) = 7741.94Ω
//Up_R = 16000*1200 / (16000 + 1200) = 1116.28Ω // Up_R = 16000*1200 / (16000 + 1200) = 1116.28Ω
//Down_R = 16000*3300 / (16000 + 3300) = 2736Ω // Down_R = 16000*3300 / (16000 + 3300) = 2736Ω
//实际按键测试 //实际按键测试
//无操作 21000~24000Ω //无操作 21000~24000Ω
//Menu_R 640~680Ω // Menu_R 640~680Ω
//Enter_R 5300~5700Ω // Enter_R 5300~5700Ω
//Return_R 9000~9500Ω // Return_R 9000~9500Ω
//Up_R 1300~1400Ω // Up_R 1300~1400Ω
//Down_R 3000~3200Ω // Down_R 3000~3200Ω
/*上*/ /*上*/
Key_Real_Status_en_t Key_Real_Status_Read_Up(void) Key_Real_Status_en_t Key_Real_Status_Read_Up(void)
...@@ -1130,12 +1129,12 @@ Key_Real_Status_en_t Key_Real_Status_Read_Menu(void) ...@@ -1130,12 +1129,12 @@ Key_Real_Status_en_t Key_Real_Status_Read_Menu(void)
/*---------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------*/
const Key_Attribute_st_t stKeyAttribute[KEY_NUM_MAX] = const Key_Attribute_st_t stKeyAttribute[KEY_NUM_MAX] =
{ {
{KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_Up, Key_Operation_Up}, {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_Down, Key_Operation_Down},
{KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_Enter, Key_Operation_Enter}, {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_Return, Key_Operation_Return},
{KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_Menu, Key_Operation_Menu}, {KEY_NEED_DEBOUNCE_NORMAL, Key_Real_Status_Read_Menu, Key_Operation_Menu},
}; };
Key_IGN_en_t Key_Get_IGN_Status(void) Key_IGN_en_t Key_Get_IGN_Status(void)
......
...@@ -6,59 +6,59 @@ ...@@ -6,59 +6,59 @@
#include "Key.h" #include "Key.h"
#include "CAN_Lib.h" #include "CAN_Lib.h"
#include "GUI.h" #include "GUI.h"
#include "Services_ODO_User.h" /*清空总计里程函数*/ #include "Services_ODO_User.h" /*清空总计里程函数*/
#include "Menu.h" #include "Menu.h"
#include "jcua.h" #include "jcua.h"
uint32_t EnterTimer [ 10 ]; uint32_t EnterTimer[10];
uint8_t UE_EN [ Display_MAX ]; uint8_t UE_EN[Display_MAX];
#pragma alignvar(8) #pragma alignvar(8)
#pragma ghs section bss = default #pragma ghs section bss = default
uint8_t Mem [ 32 ]; uint8_t Mem[32];
#pragma ghs section bss = default #pragma ghs section bss = default
#pragma ghs section bss = ".myNonInitArea" #pragma ghs section bss = ".myNonInitArea"
UE_CtrlInfo_Struct_t UE_CtrlInfo; UE_CtrlInfo_Struct_t UE_CtrlInfo;
uint8_t BG_display_flag; uint8_t BG_display_flag;
#pragma ghs section bss = default #pragma ghs section bss = default
uint32_t HMI_StartAnimationFrameCnt; uint32_t HMI_StartAnimationFrameCnt;
static void switch_branch(void); static void switch_branch(void);
uint8_t Get_Pwr(void) uint8_t Get_Pwr(void)
{ {
return Common_Get_IG_Sts( ); return Common_Get_IG_Sts();
} }
uint32_t Get_IG_ON(void) uint32_t Get_IG_ON(void)
{ {
return Common_GetIgnOnTime( ); return Common_GetIgnOnTime();
} }
uint32_t Get_IG_Off(void) uint32_t Get_IG_Off(void)
{ {
return Common_GetIgnOffTime( ); return Common_GetIgnOffTime();
} }
static const DispSch_Attr_st loc [] = static const DispSch_Attr_st loc[] =
{ {
{&UE_EN [ Display_StartAnimation ], UE_IGN_ON, Display_StartAnimation, (( void * )0), Display_StartAnimationEnter, Display_StartAnimationService, Display_StartAnimationExit}, {&UE_EN[Display_StartAnimation], UE_IGN_ON, Display_StartAnimation, ((void *)0), Display_StartAnimationEnter, Display_StartAnimationService, Display_StartAnimationExit},
{&UE_EN [ Display_Menu ], UE_IGN_ON, Display_Menu, (( void * )0), (( void * )0), Display_MenuService, (( void * )0)}, {&UE_EN[Display_Menu], UE_IGN_ON, Display_Menu, ((void *)0), ((void *)0), Display_MenuService, ((void *)0)},
{&UE_EN [ Display_Alarm ], UE_IGN_ON, Display_Alarm, (( void * )0), (( void * )0), Display_AlarmService, (( void * )0)}, {&UE_EN[Display_Alarm], UE_IGN_ON, Display_Alarm, ((void *)0), ((void *)0), Display_AlarmService, ((void *)0)},
}; };
void DispSch_TotalInit(void) void DispSch_TotalInit(void)
{ {
uint8_t i; uint8_t i;
DispSch_Ext_st m_st; DispSch_Ext_st m_st;
m_st.Get_Power = Get_Pwr; m_st.Get_Power = Get_Pwr;
m_st.Get_IG_ON_Timer = Get_IG_ON; m_st.Get_IG_ON_Timer = Get_IG_ON;
m_st.Get_IG_OFF_Timer = Get_IG_Off; m_st.Get_IG_OFF_Timer = Get_IG_Off;
m_st.Get_IG_OFF_Timer = Get_IG_Off; m_st.Get_IG_OFF_Timer = Get_IG_Off;
m_st.TotalSize = Display_MAX; m_st.TotalSize = Display_MAX;
DispSch_Init(Mem, loc, &m_st, 0u); DispSch_Init(Mem, loc, &m_st, 0u);
for ( i = 0u; i < Display_MAX; i++ ) for (i = 0u; i < Display_MAX; i++)
{ {
UE_EN [ i ] = UE_Disable; UE_EN[i] = UE_Disable;
} }
} }
...@@ -66,85 +66,99 @@ void DisplayServices(void) ...@@ -66,85 +66,99 @@ void DisplayServices(void)
{ {
uint32_t PowerOnTimer; uint32_t PowerOnTimer;
uint32_t PowerOFFTimer; uint32_t PowerOFFTimer;
uint8_t PowerStatus; uint8_t PowerStatus;
uint16_t popupID = 0xFFFFu; uint16_t popupID = 0xFFFFu;
uint16_t DispVSpeed = 0u;
PowerStatus = Common_Get_IG_Sts( ); PowerStatus = Common_Get_IG_Sts();
PowerOnTimer = Common_GetIgnOnTime( ); PowerOnTimer = Common_GetIgnOnTime();
PowerOFFTimer = Common_GetIgnOffTime( ); PowerOFFTimer = Common_GetIgnOffTime();
DispVSpeed = Common_Get_Disp_V_Speed();
if ( (PowerOnTimer <= StartAnimationEnd) && (PowerOnTimer >= StartAnimationStart) ) if ((PowerOnTimer <= StartAnimationEnd) && (PowerOnTimer >= StartAnimationStart))
{ {
UE_EN [ Display_StartAnimation ] = UE_Enable; UE_EN[Display_StartAnimation] = UE_Enable;
UE_EN [ Display_Menu ] = UE_Disable; UE_EN[Display_Menu] = UE_Disable;
UE_EN [ Display_Alarm ] = UE_Disable; UE_EN[Display_Alarm] = UE_Disable;
} }
else else
{ {
popupID = Popup_Get_Current_Message( ); popupID = Popup_Get_Current_Message();
if ((popupID != 0xffffu ) && (MenuFlag.Key_Menu_Popup_time == 0x00u)) if ((popupID != 0xffffu) && (MenuFlag.Key_Menu_Popup_time == 0x00u))
{ {
UE_EN [ Display_Alarm ] = UE_Enable; UE_EN[Display_Alarm] = UE_Enable;
} }
else else
{ {
if (MenuFlag.Key_Menu_Popup_time != 0x00u) if (MenuFlag.Key_Menu_Popup_time != 0x00u)
{ {
MenuFlag.Key_Menu_Popup_time --; MenuFlag.Key_Menu_Popup_time--;
} }
else else
{ {
;/*Do Nothing!*/ ; /*Do Nothing!*/
} }
UE_EN [ Display_Alarm ] = UE_Disable; UE_EN[Display_Alarm] = UE_Disable;
if ( PowerStatus == COMMON_POWER_ON ) if (PowerStatus == COMMON_POWER_ON)
{ {
UE_EN [ Display_Menu ] = UE_Enable; UE_EN[Display_Menu] = UE_Enable;
} }
else else
{ {
UE_EN [ Display_Menu ] = UE_Disable; UE_EN[Display_Menu] = UE_Disable;
}
}
if (DispVSpeed > 66u)
{
if ((bCurMenuIDX >= _MN_DSP_LEVEL2MENU_1) && (bCurMenuIDX <= _MN_DSP_LEVEL3_5_MENU_4))
{
NextMenu(MenuFlag.Menu_Flag);
} }
} }
else
{
; /*Do Nothing!*/
}
} }
DispSch_xxxMs_Logic(10u); DispSch_xxxMs_Logic(10u);
/*上短*/ /*上短*/
if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_UP == KEY_EVENT_SHORT_PRESS ) if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_UP == KEY_EVENT_SHORT_PRESS)
{ {
HMI_Clear_KEY_UP(); HMI_Clear_KEY_UP();
} }
/*上长*/ /*上长*/
else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_UP == KEY_EVENT_LONG_PRESS ) else if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_UP == KEY_EVENT_LONG_PRESS)
{ {
HMI_Clear_KEY_UP(); HMI_Clear_KEY_UP();
} }
/*下短*/ /*下短*/
else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_DOWN == KEY_EVENT_SHORT_PRESS ) else if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_DOWN == KEY_EVENT_SHORT_PRESS)
{ {
HMI_Clear_KEY_DOWN(); HMI_Clear_KEY_DOWN();
} }
/*下长*/ /*下长*/
else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_DOWN == KEY_EVENT_LONG_PRESS ) else if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_DOWN == KEY_EVENT_LONG_PRESS)
{ {
HMI_Clear_KEY_DOWN(); HMI_Clear_KEY_DOWN();
} }
/*确认短*/ /*确认短*/
else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM == KEY_EVENT_SHORT_PRESS ) else if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM == KEY_EVENT_SHORT_PRESS)
{ {
HMI_Clear_KEY_CONFIRM(); HMI_Clear_KEY_CONFIRM();
} }
/*确认长*/ /*确认长*/
else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM == KEY_EVENT_LONG_PRESS ) else if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM == KEY_EVENT_LONG_PRESS)
{ {
HMI_Clear_KEY_CONFIRM(); HMI_Clear_KEY_CONFIRM();
} }
/*确认超长 30 S*/ /*确认超长 30 S*/
else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM == KEY_EVENT_SUPER_LONG_PRESS ) else if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM == KEY_EVENT_SUPER_LONG_PRESS)
{ {
HMI_Clear_KEY_CONFIRM(); HMI_Clear_KEY_CONFIRM();
...@@ -152,28 +166,28 @@ void DisplayServices(void) ...@@ -152,28 +166,28 @@ void DisplayServices(void)
TYW_Data_ODO_Clear(); TYW_Data_ODO_Clear();
} }
/*返回短*/ /*返回短*/
else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_CANCEL == KEY_EVENT_SHORT_PRESS ) else if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_CANCEL == KEY_EVENT_SHORT_PRESS)
{ {
HMI_Clear_KEY_CANCEL(); HMI_Clear_KEY_CANCEL();
} }
/*返回长*/ /*返回长*/
else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_CANCEL == KEY_EVENT_LONG_PRESS ) else if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_CANCEL == KEY_EVENT_LONG_PRESS)
{ {
HMI_Clear_KEY_CANCEL(); HMI_Clear_KEY_CANCEL();
} }
/*MENU短*/ /*MENU短*/
else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_MENU == KEY_EVENT_SHORT_PRESS ) else if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_MENU == KEY_EVENT_SHORT_PRESS)
{ {
HMI_Clear_KEY_MENU(); HMI_Clear_KEY_MENU();
} }
/*MENU长*/ /*MENU长*/
else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_MENU == KEY_EVENT_LONG_PRESS ) else if (UE_CtrlInfo.HMI_KEYInfo.u8KEY_MENU == KEY_EVENT_LONG_PRESS)
{ {
HMI_Clear_KEY_MENU(); HMI_Clear_KEY_MENU();
} }
else else
{ {
;/*do nothing*/ ; /*do nothing*/
} }
} }
...@@ -188,31 +202,29 @@ void Display_StartAnimationService(void) ...@@ -188,31 +202,29 @@ void Display_StartAnimationService(void)
HMI_StartAnimationFrameCnt++; HMI_StartAnimationFrameCnt++;
m16_FrameCnt = HMI_StartAnimationFrameCnt; m16_FrameCnt = HMI_StartAnimationFrameCnt;
if ( (m16_FrameCnt % 3) == 0 ) if ((m16_FrameCnt % 3) == 0)
{ {
loc_Disable_Window_App( ); loc_Disable_Window_App();
//GUI_Display_Animation_Frame(m16_FrameCnt / 3u); // GUI_Display_Animation_Frame(m16_FrameCnt / 3u);
GUI_Display_background(); GUI_Display_background();
} }
} }
void Display_StartAnimationExit(void) void Display_StartAnimationExit(void)
{ {
loc_Enable_Window_App( ); loc_Enable_Window_App();
} }
void Display_MenuService(void) void Display_MenuService(void)
{ {
} }
void Display_AlarmService(void) void Display_AlarmService(void)
{ {
} }
void GUI_DisplayServices(void) void GUI_DisplayServices(void)
{ {
UElib_uint16_t HMI_MENU_Sta = 0u; UElib_uint16_t HMI_MENU_Sta = 0u;
HMI_MENU_Sta = Get_Cur_HMI(); HMI_MENU_Sta = Get_Cur_HMI();
...@@ -255,7 +267,7 @@ void GUI_DisplayServices(void) ...@@ -255,7 +267,7 @@ void GUI_DisplayServices(void)
} }
MenuManage(); MenuManage();
//BG_display_flag = 0; // BG_display_flag = 0;
} }
} }
} }
...@@ -281,7 +293,6 @@ void HMI_Set_KEY_MENU(uint8_t u8KeyVal) ...@@ -281,7 +293,6 @@ void HMI_Set_KEY_MENU(uint8_t u8KeyVal)
UE_CtrlInfo.HMI_KEYInfo.u8KEY_MENU = u8KeyVal; UE_CtrlInfo.HMI_KEYInfo.u8KEY_MENU = u8KeyVal;
} }
void HMI_Clear_KEY_UP(void) void HMI_Clear_KEY_UP(void)
{ {
UE_CtrlInfo.HMI_KEYInfo.u8KEY_UP = 0u; UE_CtrlInfo.HMI_KEYInfo.u8KEY_UP = 0u;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment