Commit 84e404cd authored by 张金硕's avatar 张金硕

feat:增加有车速时可以接听挂断电话和主页长按确认键2s进入手机互联界面,修改按键逻辑防止冲突

parent c79a1201
...@@ -21,7 +21,7 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//选择 ...@@ -21,7 +21,7 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//选择
case KEY_EVENT_SHORT_PRESS_2: case KEY_EVENT_SHORT_PRESS_2:
break; break;
case KEY_EVENT_LONG_PRESS_1: //2 case KEY_EVENT_LONG_PRESS_1: //2
if(Get_Dis_OdoAndTrip() == 1) if((Get_Dis_OdoAndTrip() == 1) && (Get_ActualVechileSpeed() == 0))
{ {
Data_Clear_Trip(1); Data_Clear_Trip(1);
} }
...@@ -65,6 +65,7 @@ void Key_Operation_Right(Key_Event_en_t enKeyEvent)//确认 ...@@ -65,6 +65,7 @@ void Key_Operation_Right(Key_Event_en_t enKeyEvent)//确认
Key_Event_Short_Press_Right(); Key_Event_Short_Press_Right();
break; break;
case KEY_EVENT_SHORT_PRESS_2: case KEY_EVENT_SHORT_PRESS_2:
Key_Event_SHORT_PRESS_2_Right();
break; break;
case KEY_EVENT_LONG_PRESS_1: //2s case KEY_EVENT_LONG_PRESS_1: //2s
break; break;
...@@ -145,7 +146,7 @@ void Key_KL30_Init_EXample(void) ...@@ -145,7 +146,7 @@ void Key_KL30_Init_EXample(void)
Key_KL30_Init(&u8KeyRamData[0], stKeyAttribute, &stKeyInitTem); Key_KL30_Init(&u8KeyRamData[0], stKeyAttribute, &stKeyInitTem);
Key_Parameter_Set_Short_Press_1_Time(50U,2000U); Key_Parameter_Set_Short_Press_1_Time(50U,2000U);
Key_Parameter_Set_Short_Press_2_Time(3000U,6000U); Key_Parameter_Set_Short_Press_2_Time(2000U,5000U);
Key_Parameter_Set_Long_Press_1_Time(2000U); Key_Parameter_Set_Long_Press_1_Time(2000U);
Key_Parameter_Set_Long_Press_2_Time(8000U); Key_Parameter_Set_Long_Press_2_Time(8000U);
...@@ -161,7 +162,7 @@ void Key_Wakeup_Init_EXample(void) ...@@ -161,7 +162,7 @@ void Key_Wakeup_Init_EXample(void)
Key_Wakeup_Init(&u8KeyRamData[0], stKeyAttribute, &stKeyInitTem); Key_Wakeup_Init(&u8KeyRamData[0], stKeyAttribute, &stKeyInitTem);
Key_Parameter_Set_Short_Press_1_Time(50U,2000U); Key_Parameter_Set_Short_Press_1_Time(50U,2000U);
Key_Parameter_Set_Short_Press_2_Time(3000U,6000U); Key_Parameter_Set_Short_Press_2_Time(2000U,5000U);
Key_Parameter_Set_Long_Press_1_Time(2000U); Key_Parameter_Set_Long_Press_1_Time(2000U);
Key_Parameter_Set_Long_Press_2_Time(8000U); Key_Parameter_Set_Long_Press_2_Time(8000U);
...@@ -200,11 +201,29 @@ void Key_Auto_Save(void) ...@@ -200,11 +201,29 @@ void Key_Auto_Save(void)
void Key_Event_Short_Press_Left(void)//选择 void Key_Event_Short_Press_Left(void)//选择
{ {
if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_MAIN_ITEM)//切换大小计 if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_MAIN_ITEM)//切换大小计
{
if ((BlueToothPhoneData.BlueToothPhoneSate == Phone_Incoming) || (BlueToothPhoneData.BlueToothPhoneSate == Phone_Talking))
{
PackedTransfer_BlueTooth_DataSet(Phone_Pick_Up);
}
else if(Get_ActualVechileSpeed() == 0)
{ {
Menu_Service(MENU_KEY_FUNCTION_1_SHORT); Menu_Service(MENU_KEY_FUNCTION_1_SHORT);
} }
else
{
;
}
}
else if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_PHONE_CONNECT_APP)
{
if ((BlueToothPhoneData.BlueToothPhoneSate == Phone_Incoming) || (BlueToothPhoneData.BlueToothPhoneSate == Phone_Talking))
{
PackedTransfer_BlueTooth_DataSet(Phone_Pick_Up);
}
}
if((Menu_Get_Current_Cursor_Information() == MENU_ITEM_DISPLAY_MODE)|| if(((Menu_Get_Current_Cursor_Information() == MENU_ITEM_DISPLAY_MODE)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_SETTING)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_SETTING)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BLUETOOTH_CONNECT)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BLUETOOTH_CONNECT)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_SETTING)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_SETTING)||
...@@ -212,13 +231,13 @@ void Key_Event_Short_Press_Left(void)//选择 ...@@ -212,13 +231,13 @@ void Key_Event_Short_Press_Left(void)//选择
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_SETTING)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_SETTING)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_FAULT_INFORMATION)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_FAULT_INFORMATION)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_PHONE_CONNECT)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_PHONE_CONNECT)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_QUIT)) (Menu_Get_Current_Cursor_Information() == MENU_ITEM_QUIT)) && (Get_ActualVechileSpeed() == 0))
{ {
Menu_Service(MENU_KEY_RIGHT_SHORT); Menu_Service(MENU_KEY_RIGHT_SHORT);
} }
else else
{ {
if((Menu_Get_Current_Cursor_Information() == MENU_ITEM_SELECT_DAYTIME)|| if(((Menu_Get_Current_Cursor_Information() == MENU_ITEM_SELECT_DAYTIME)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_SELECT_NIGHTTIME)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_SELECT_NIGHTTIME)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_SELECT_AUTO)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_SELECT_AUTO)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_5)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_5)||
...@@ -242,21 +261,17 @@ void Key_Event_Short_Press_Left(void)//选择 ...@@ -242,21 +261,17 @@ void Key_Event_Short_Press_Left(void)//选择
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_UNIT_KM)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_UNIT_KM)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_UNIT_MILE)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_UNIT_MILE)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_CHINESE)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_CHINESE)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_ENGLISH)) (Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_ENGLISH)) && (Get_ActualVechileSpeed() == 0))
{ {
Menu_Service(MENU_KEY_DOWN_SHORT); Menu_Service(MENU_KEY_DOWN_SHORT);
} }
} }
if ((BlueToothPhoneData.BlueToothPhoneSate == Phone_Outgoing) || (BlueToothPhoneData.BlueToothPhoneSate == Phone_Incoming) || (BlueToothPhoneData.BlueToothPhoneSate == Phone_Talking))
{
PackedTransfer_BlueTooth_DataSet(Phone_Pick_Up);
}
} }
void Key_Event_Short_Press_Right(void)//确认 void Key_Event_Short_Press_Right(void)//确认
{ {
if((Menu_Get_Current_Cursor_Information() == MENU_ITEM_MAIN_ITEM)|| if(((Menu_Get_Current_Cursor_Information() == MENU_ITEM_DISPLAY_MODE)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_DISPLAY_MODE)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_SETTING)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_SETTING)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BLUETOOTH_CONNECT)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BLUETOOTH_CONNECT)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_SETTING)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_SETTING)||
...@@ -290,15 +305,38 @@ void Key_Event_Short_Press_Right(void)//确认 ...@@ -290,15 +305,38 @@ void Key_Event_Short_Press_Right(void)//确认
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_UNIT_MILE)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_UNIT_MILE)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_CHINESE)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_CHINESE)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_ENGLISH)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_ENGLISH)||
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_PHONE_CONNECT_SET)|| (Menu_Get_Current_Cursor_Information() == MENU_ITEM_PHONE_CONNECT_SET)) && (Get_ActualVechileSpeed() == 0))
(Menu_Get_Current_Cursor_Information() == MENU_ITEM_PHONE_CONNECT_APP))
{ {
Menu_Service(MENU_KEY_CONFIRM_SHORT); Menu_Service(MENU_KEY_CONFIRM_SHORT);
} }
if ((BlueToothPhoneData.BlueToothPhoneSate == Phone_Outgoing) || (BlueToothPhoneData.BlueToothPhoneSate == Phone_Incoming) || (BlueToothPhoneData.BlueToothPhoneSate == Phone_Talking)) else if((Menu_Get_Current_Cursor_Information() == MENU_ITEM_MAIN_ITEM) || (Menu_Get_Current_Cursor_Information() == MENU_ITEM_PHONE_CONNECT_APP))
{
if((BlueToothPhoneData.BlueToothPhoneSate == Phone_Outgoing) || (BlueToothPhoneData.BlueToothPhoneSate == Phone_Incoming) || (BlueToothPhoneData.BlueToothPhoneSate == Phone_Talking))
{ {
PackedTransfer_BlueTooth_DataSet(Phone_Hangup_Out); PackedTransfer_BlueTooth_DataSet(Phone_Hangup_Out);
} }
else if(Get_ActualVechileSpeed() == 0)
{
Menu_Service(MENU_KEY_CONFIRM_SHORT);
}
else
{
;
}
}
else
{
;
}
}
void Key_Event_SHORT_PRESS_2_Right(void)
{
if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_MAIN_ITEM)
{
Menu_Change_Branch_To_Item(MENU_BRANCH_ANIMATION,MENU_ITEM_PHONE_CONNECT_APP);
}
} }
uint8_t OTA_Update_Flag = 0; uint8_t OTA_Update_Flag = 0;
...@@ -390,7 +428,10 @@ void My_Key_Service(void) ...@@ -390,7 +428,10 @@ void My_Key_Service(void)
/* 自检和OTA界面时不可操作按键 */ /* 自检和OTA界面时不可操作按键 */
if((g_u8SelfCheck) && (OTA_Update_Flag == 0)) if((g_u8SelfCheck) && (OTA_Update_Flag == 0))
{ {
if((Get_ActualVechileSpeed() == 0) ||((Get_DispVechileSpeed() >= 1990) && (Get_DispEngineSpeed() >= 12000))) if((Get_ActualVechileSpeed() == 0) ||
((Get_DispVechileSpeed() >= 1990) && (Get_DispEngineSpeed() >= 12000)) ||
(BlueToothPhoneData.BlueToothPhoneSate >= Phone_Outgoing) && (BlueToothPhoneData.BlueToothPhoneSate <= Phone_Talking) ||
((Menu_Get_Current_Cursor_Information() == MENU_ITEM_MAIN_ITEM)))
{ {
Key_Service(); Key_Service();
} }
......
...@@ -62,6 +62,7 @@ Key_Status_en_t Key_Status_Read_Left(void); ...@@ -62,6 +62,7 @@ Key_Status_en_t Key_Status_Read_Left(void);
Key_Status_en_t Key_Status_Read_Right(void); Key_Status_en_t Key_Status_Read_Right(void);
void Key_Event_Short_Press_Left(void); void Key_Event_Short_Press_Left(void);
void Key_Event_Short_Press_Right(void); void Key_Event_Short_Press_Right(void);
void Key_Event_SHORT_PRESS_2_Right(void);
void Get_Into_OTA_Update_Mode(void); void Get_Into_OTA_Update_Mode(void);
void KEY_RIGHT_EVENT_NONE_Service(void); void KEY_RIGHT_EVENT_NONE_Service(void);
void KEY_LEFT_EVENT_NONE_Service(void); void KEY_LEFT_EVENT_NONE_Service(void);
......
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