Key_user.c 16.8 KB
Newer Older
时昊's avatar
时昊 committed
1 2 3

#include "Key_user.h"
#include "Components.h"
4
#include "UDS_ISO14229_Services.h"
时昊's avatar
时昊 committed
5 6 7

__align(4)

8
#define BACK_MENU_TIME		800
时昊's avatar
时昊 committed
9 10 11 12 13
_Menu_Data MenuData;
RTC_TimeTypeDef RTC_TimeStruct;
RTC_DateTypeDef RTC_DateStruct;
RTC_CounterTypeDef counter_val;

14
void Key_Operation_Left(Key_Event_en_t enKeyEvent)//选择
时昊's avatar
时昊 committed
15 16 17 18
{
	switch (enKeyEvent)
	{
	case KEY_EVENT_SHORT_PRESS_1:
19
		Key_Event_Short_Press_Left();
20
		Key_Clear_Time();
时昊's avatar
时昊 committed
21 22 23 24
		break;
	case KEY_EVENT_SHORT_PRESS_2:	
		break;
	case KEY_EVENT_LONG_PRESS_1:	//2
25
	if((Get_Dis_OdoAndTrip() == 1) && (Get_ActualVechileSpeed() == 0))
26
	{
27
		Data_Clear_Trip(EM_TRIP_A);
28
	}
29
	Key_Clear_Time();
时昊's avatar
时昊 committed
30 31 32 33 34 35
		break;
	case KEY_EVENT_LONG_PRESS_2:	//3
		break;
	case KEY_EVENT_LONG_PRESS_3:	//5s
		break;
	case KEY_EVENT_LONG_PRESS_4:	//10s
36
        /* 进入630H升级MCU模式 */
37
        // Get_Into_630H_Update_MCU_Mode();
时昊's avatar
时昊 committed
38 39 40 41 42 43
		break;
	case KEY_EVENT_OFF_TO_ON:		
		break;
	case KEY_EVENT_ON_TO_OFF:
		break;
	case KEY_EVENT_NONE:
44
		KEY_LEFT_EVENT_NONE_Service();
时昊's avatar
时昊 committed
45 46 47 48 49
		break;
	default:
		break;
	}
}
50
void Key_Operation_Right(Key_Event_en_t enKeyEvent)//确认
时昊's avatar
时昊 committed
51 52 53 54
{
	switch (enKeyEvent)
	{
	case KEY_EVENT_SHORT_PRESS_1:	
55
	/* 在数字闪烁界面的时候,按确认键保存时间 */
56
	if 	(((Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_TENB_SET) || 
57 58
		(Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_BIT_SET ) ||
		(Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_TENB_SET ) ||
59
		(Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_BIT_SET  )  ) && (Get_ActualVechileSpeed() == 0))
60 61 62 63
		{
			// Menu_Logic_Operation_Clock_Hour_Tenb_Set(MENU_KEY_CONFIRM_SHORT);
			counter_val.time.RTC_Hours   = (MenuData.Dis_Hour_Tenb*10 + MenuData.Dis_Hour_Bit);
    		counter_val.time.RTC_Minutes = (MenuData.Dis_Minute_Tenb*10 + MenuData.Dis_Minute_Bit);
64
			counter_val.time.RTC_Seconds = 0U; 
65 66
			RTC_SetTime(&counter_val.time);
		}	
67
		Key_Event_Short_Press_Right();
68
		Key_Clear_Time();
时昊's avatar
时昊 committed
69 70 71 72
		break;
	case KEY_EVENT_SHORT_PRESS_2:
		break;
	case KEY_EVENT_LONG_PRESS_1:	//2s
73 74
		Key_Event_LONG_PRESS_1_Right();
		Key_Clear_Time();
时昊's avatar
时昊 committed
75 76 77 78 79 80
		break;
	case KEY_EVENT_LONG_PRESS_2:	//3s
		break;
	case KEY_EVENT_LONG_PRESS_3:	//5s
		break;
	case KEY_EVENT_LONG_PRESS_4:	//10s
81
		TYW_RESET_ODO();
82
		Get_Into_OTA_Update_Mode();
83
		Key_Clear_Time();
时昊's avatar
时昊 committed
84 85 86 87 88 89
		break;
	case KEY_EVENT_OFF_TO_ON:		
		break;
	case KEY_EVENT_ON_TO_OFF:
		break;
	case KEY_EVENT_NONE:
90
		KEY_RIGHT_EVENT_NONE_Service();
时昊's avatar
时昊 committed
91 92 93 94 95 96 97 98 99 100 101
		break;
	default:		
		break;
	}
}


/*---------------------------------------------------------------------------------------*/
Key_Status_en_t Key_Status_Read_Left(void)
{
	Key_Status_en_t enKeyReal = KEY_REALTIME_LOOSEN;
102 103 104 105 106
	if (RTE_GPIO_Get_Level(KEY_SELECT_MCU))//选择
	{
		enKeyReal = KEY_REALTIME_PRESS;
	}
	else
时昊's avatar
时昊 committed
107
	{
108
		enKeyReal = KEY_REALTIME_LOOSEN;
时昊's avatar
时昊 committed
109 110 111
	}
	return enKeyReal;
}
112

时昊's avatar
时昊 committed
113 114 115
Key_Status_en_t Key_Status_Read_Right(void)
{
	Key_Status_en_t enKeyReal = KEY_REALTIME_LOOSEN;
116 117

	if (RTE_GPIO_Get_Level(KEY_OK_MCU))//确认
时昊's avatar
时昊 committed
118
	{
119
		enKeyReal = KEY_REALTIME_PRESS;
时昊's avatar
时昊 committed
120
	}
121 122 123 124 125
	else
	{
		enKeyReal = KEY_REALTIME_LOOSEN;
	}
	
时昊's avatar
时昊 committed
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
	return enKeyReal;
}


/*---------------------------------------------------------------------------------------*/
const Key_Attribute_st_t stKeyAttribute[KEY_NUM_MAX] =
{
	{KEY_NEED_DEBOUNCE_NORMAL, Key_Status_Read_Left, Key_Operation_Left},
	{KEY_NEED_DEBOUNCE_NORMAL, Key_Status_Read_Right, Key_Operation_Right},
};

/*---------------------------------------------------------------------------------------*/

Key_uint8_t u8KeyRamData[KEY_RAM_DATA_LEN];
void Key_KL30_Init_EXample(void)
{
	Key_Init_st_t stKeyInitTem;
	Key_uint16_t i;
	for (i = 0; i < KEY_RAM_DATA_LEN; i++)
	{
		u8KeyRamData[i] = 0;
	}

	stKeyInitTem.u8KeyNum = KEY_NUM_MAX;
	stKeyInitTem.enKeyIGNRealStatus = KEY_IG_OFF;
	Key_KL30_Init(&u8KeyRamData[0], stKeyAttribute, &stKeyInitTem);

张金硕's avatar
张金硕 committed
153 154
	Key_Parameter_Set_Short_Press_2_Time(2100U,5000U);
	Key_Parameter_Set_Short_Press_1_Time(50U,2000U);
时昊's avatar
时昊 committed
155

156
	Key_Parameter_Set_Long_Press_1_Time(2000U);
157 158 159
	Key_Parameter_Set_Long_Press_2_Time(8000U);
	Key_Parameter_Set_Long_Press_3_Time(9000U);
	Key_Parameter_Set_Long_Press_4_Time(10000U);
时昊's avatar
时昊 committed
160 161 162 163 164 165 166 167 168
}
void Key_Wakeup_Init_EXample(void)
{
	Key_Init_st_t stKeyInitTem;

	stKeyInitTem.u8KeyNum = KEY_NUM_MAX;
	stKeyInitTem.enKeyIGNRealStatus = KEY_IG_OFF; 
	Key_Wakeup_Init(&u8KeyRamData[0], stKeyAttribute, &stKeyInitTem);

张金硕's avatar
张金硕 committed
169 170
	Key_Parameter_Set_Short_Press_2_Time(2100U,5000U);
	Key_Parameter_Set_Short_Press_1_Time(50U,2000U);
时昊's avatar
时昊 committed
171

172
	Key_Parameter_Set_Long_Press_1_Time(2000U);
173 174 175
	Key_Parameter_Set_Long_Press_2_Time(8000U);
	Key_Parameter_Set_Long_Press_3_Time(9000U);
	Key_Parameter_Set_Long_Press_4_Time(10000U);
时昊's avatar
时昊 committed
176 177
}

178
void Key_TimeOut_Service(void)
时昊's avatar
时昊 committed
179
{
180 181 182 183 184 185
	if(OTA_Update_Flag == 0)
	{
		if((MenuData.Back_Time_Left_Flag == 1)&&(MenuData.Back_Time_Right_Flag == 1))
		{
			Menu_Service(MENU_KEY_TIMEOUT);
		}
186 187 188 189
		else
		{
			;
		}
190 191
	}
	else
192
	{
193
		;
194
	}
时昊's avatar
时昊 committed
195 196 197 198
}

void Key_Auto_Save(void)
{
199
	
200 201 202
	// {
	// 	RTC_SetTime(&counter_val.time);
	// }
203 204


205 206 207
	// {
	// 	RTC_SetTime(&counter_val.time);
	// }
208 209 210 211 212

}

void Key_Event_Short_Press_Left(void)//选择
{		
213
	if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_MAIN_ITEM)//接电话,切换大小计
214
	{
215
		if(BlueToothPhoneData.BlueToothPhoneSate == Phone_Incoming)
216 217 218 219 220 221 222 223 224 225 226 227 228 229
    	{
    	    PackedTransfer_BlueTooth_DataSet(Phone_Pick_Up);
    	}
		else if(Get_ActualVechileSpeed() == 0)
		{
			Menu_Service(MENU_KEY_FUNCTION_1_SHORT);
		}	
		else
		{
			;
		}
	}
	else if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_PHONE_CONNECT_APP)
	{
230
		if(BlueToothPhoneData.BlueToothPhoneSate == Phone_Incoming)
231 232 233
    	{
    	    PackedTransfer_BlueTooth_DataSet(Phone_Pick_Up);
    	}
234 235 236 237
		else
		{
			;
		}
238 239
	}

240
	if(((Menu_Get_Current_Cursor_Information() == MENU_ITEM_DISPLAY_MODE)||
241 242 243 244 245 246 247
	   (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_CLOCK_SETTING)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_UNIT_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_PHONE_CONNECT)||
248
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_QUIT)) && (Get_ActualVechileSpeed() == 0))
249 250 251 252 253
	{
		Menu_Service(MENU_KEY_RIGHT_SHORT);
	}
	else
	{
254
		if(((Menu_Get_Current_Cursor_Information() == MENU_ITEM_SELECT_DAYTIME)||
255 256 257 258 259 260 261 262
		   (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_BACKLIGHT_5)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_4)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_3)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_2)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_1)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_AUTO)||
263
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BLUETOOTH_OPEN_CLOSE)||
264 265 266 267 268 269 270
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BLUETOOTH_SYNC)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BLUETOOTH_BACK)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_TENB)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_BIT)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_TENB)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_BIT)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_BACK)||
271 272 273 274
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_TENB_SET)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_BIT_SET)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_TENB_SET)||
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_BIT_SET)||
275 276 277
		   (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_LANGUAGE_CHINESE)||
278
		   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_ENGLISH)) && (Get_ActualVechileSpeed() == 0))
279 280
		{
			Menu_Service(MENU_KEY_DOWN_SHORT);
281
			Key_Event_BackLight_Press_Left();
282 283
		}
	}
284
	
285 286 287 288
}

void Key_Event_Short_Press_Right(void)//确认
{
289
	if(((Menu_Get_Current_Cursor_Information() == MENU_ITEM_DISPLAY_MODE)||
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
	   (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_CLOCK_SETTING)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_UNIT_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_PHONE_CONNECT)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_QUIT)||
	   (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_AUTO)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_5)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_4)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_3)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_2)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_1)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_AUTO)||
307
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BLUETOOTH_OPEN_CLOSE)||
308 309 310 311 312 313 314
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BLUETOOTH_SYNC)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_BLUETOOTH_BACK)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_TENB)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_BIT)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_TENB)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_BIT)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_BACK)||
315 316 317 318
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_TENB_SET)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_BIT_SET)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_TENB_SET)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_BIT_SET)||
319 320 321 322
	   (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_LANGUAGE_CHINESE)||
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_LANGUAGE_ENGLISH)||
323
	   (Menu_Get_Current_Cursor_Information() == MENU_ITEM_PHONE_CONNECT_SET)) && (Get_ActualVechileSpeed() == 0))
时昊's avatar
时昊 committed
324
	{
325
		Menu_Service(MENU_KEY_CONFIRM_SHORT);
时昊's avatar
时昊 committed
326
	}
327 328 329 330 331 332
	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);
		}
333 334
		else if((Menu_Get_Current_Cursor_Information() == MENU_ITEM_PHONE_CONNECT_APP)||
	    	   ((Menu_Get_Current_Cursor_Information() == MENU_ITEM_MAIN_ITEM) && (Get_ActualVechileSpeed() == 0)))
335 336 337 338 339 340 341 342 343 344 345 346 347 348
		{
			Menu_Service(MENU_KEY_CONFIRM_SHORT);
		}
		else
		{
			;
		}
	}
	else
	{
		;
	}
}

349
void Key_Event_LONG_PRESS_1_Right(void)
350
{
351
	if((Get_DispVechileSpeed() >= 1990)&&(Get_DispEngineSpeed() >= 12000))
352
	{
353 354 355 356 357 358 359 360 361 362 363 364
		;
	}
	else
	{
		if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_MAIN_ITEM)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_ANIMATION,MENU_ITEM_PHONE_CONNECT_APP);
		}
		else
		{
			;
		}
365 366
	}
	
367
}
时昊's avatar
时昊 committed
368

369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
void Key_Event_BackLight_Press_Left(void)
{
	if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_5)
	{
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_5, 1);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_4, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_3, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_2, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_1, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_AUTO, 0);
	}
	else if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_4)
	{
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_5, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_4, 1);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_3, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_2, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_1, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_AUTO, 0);
	}
	else if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_3)
	{
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_5, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_4, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_3, 1);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_2, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_1, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_AUTO, 0);
	}
	else if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_2)
	{
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_5, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_4, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_3, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_2, 1);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_1, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_AUTO, 0);
	}
	else if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_1)
	{
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_5, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_4, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_3, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_2, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_1, 1);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_AUTO, 0);
	}
	else if(Menu_Get_Current_Cursor_Information() == MENU_ITEM_BACKLIGHT_AUTO)
	{
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_5, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_4, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_3, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_2, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_1, 0);
		Menu_Item_Select_Set(MENU_ITEM_BACKLIGHT_AUTO, 1);
	}
}

427 428 429
uint8_t OTA_Update_Flag = 0;
void Get_Into_OTA_Update_Mode(void)
{
430
	if((Menu_Get_Current_Cursor_Information() == MENU_ITEM_FAULT_INFORMATION) && (Get_ActualVechileSpeed() == 0))
431
	{
432
		OTA_Update_Flag = 1U;
433 434
	}
}
435 436 437 438
void KEY_LEFT_EVENT_NONE_Service(void)	
{
	MenuData.Back_Time_Left++;
	if(MenuData.Back_Time_Left > BACK_MENU_TIME)
时昊's avatar
时昊 committed
439
	{
440 441
		MenuData.Back_Time_Left = BACK_MENU_TIME;
		MenuData.Back_Time_Left_Flag = 1;
时昊's avatar
时昊 committed
442 443 444
	}
}

445 446 447 448 449 450 451 452 453
void KEY_RIGHT_EVENT_NONE_Service(void)	
{
	MenuData.Back_Time_Right++;
	if(MenuData.Back_Time_Right > BACK_MENU_TIME)
	{
		MenuData.Back_Time_Right = BACK_MENU_TIME;
		MenuData.Back_Time_Right_Flag = 1;
	}
}
454

455 456
void Key_Clear_Time(void)
{
457 458
	// if(Key_Status_Read_Left() == KEY_REALTIME_PRESS)
	// {
459
		MenuData.Back_Time_Left = 0;
460 461 462 463 464
		// MenuData.Back_Time_Left_Flag = 0;
		// MenuData.Back_Time_Right_Flag = 0;
	// }
	// if(Key_Status_Read_Right() == KEY_REALTIME_PRESS)
	// {
465 466 467
		MenuData.Back_Time_Right = 0;
		MenuData.Back_Time_Left_Flag = 0;
		MenuData.Back_Time_Right_Flag = 0;
468
	// }
469
}
时昊's avatar
时昊 committed
470 471 472 473 474

uint8_t ClearODO_Flag = 0;
void TYW_RESET_ODO(void)
{
	if(SYS_OPR_STAT_IGN_ON)
475 476 477
    {
        if(ClearODO_Flag < 1)
        {
478
            if((Get_DispVechileSpeed() >= 1990)&&(Get_DispEngineSpeed() >= 12000)&&((Menu_Get_Current_Cursor_Information() == MENU_ITEM_MAIN_ITEM)))
479 480
            {
                ClearODO_Flag = 1;
481
                Data_Mileage_Clear();
482 483 484 485 486 487 488
            }
        }
    }
    else
    {
        ClearODO_Flag = 0;
    }
时昊's avatar
时昊 committed
489 490
}

491 492
void Get_DisTime_Service(void)
{
493 494 495
	if ((Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_TENB_SET) || 
		(Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_HOUR_BIT_SET ) ||
		(Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_TENB_SET ) ||
496
		(Menu_Get_Current_Cursor_Information() == MENU_ITEM_CLOCK_MIN_BIT_SET  )  )
497 498 499 500 501 502 503 504 505 506 507
	    {
	    }
		else
		{
			/* 由于需要不保存时间,需要另外一套计时的方式 */
			RTE_RTC_Get_CounterValue(&counter_val);
	        counter_val.time.RTC_Hours = RTC_Bcd2ToByte(counter_val.time.RTC_Hours);
			MenuData.u8Dis_Hour = counter_val.time.RTC_Hours;
			counter_val.time.RTC_Minutes = RTC_Bcd2ToByte(counter_val.time.RTC_Minutes);
			MenuData.u8Dis_Minute = counter_val.time.RTC_Minutes;
		}
508
}
509 510


511 512
void My_Key_Service(void)
{
513 514
	/* 自检和OTA界面时不可操作按键 */
	if((g_u8SelfCheck) && (OTA_Update_Flag == 0))
515
    {
516
			Key_Service();
517
    }
518 519 520 521
	else
	{
		;
	}
522 523
}

时昊's avatar
时昊 committed
524 525
uint8_t Get_Dis_Hour_Time(void)
{
526
	return MenuData.u8Dis_Hour;
时昊's avatar
时昊 committed
527 528 529 530
}

uint8_t Get_Dis_Minute_Time(void)
{
531
	return MenuData.u8Dis_Minute;
时昊's avatar
时昊 committed
532 533 534 535 536 537
}

uint8_t Get_Dis_Unit(void)
{
	return MenuData.Unit; //0km,1mile
}
538 539 540 541 542 543 544 545 546 547 548 549 550 551

uint8_t Get_Dis_OdoAndTrip(void)
{
	return MenuData.OdoAndTrip; //0Odo,1Trip
}

uint8_t Get_Dis_Bluetooth_Open_Close(void)
{
	return MenuData.Bluetooth_Open_Close; //0开,1关
}

uint8_t Get_Dis_Language(void)
{
	return MenuData.Language; //0中文,1英文
552
}