Menu_Interface.c 16.6 KB
Newer Older
时昊's avatar
时昊 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

#include "g_includes.h"

#pragma ghs section bss = ".myNonInitArea"

Menu_TimeSetData_Struct MenuData;
Menu_uint8_t u8MenuRamData[MENU_RAM_DATA_LEN];

#pragma ghs section bss = default
void Menu_Logic_Operation_ECU_TRIP(Menu_Key_en_t enKeyType);
void Menu_Logic_Operation_ECU_RANGE(Menu_Key_en_t enKeyType);
void Menu_Logic_Operation_ECU_INS_FUEL(Menu_Key_en_t enKeyType);
void Menu_Logic_Operation_ECU_AVER_FUEL(Menu_Key_en_t enKeyType);
void Menu_Logic_Operation_ECU_AVER_SPEED(Menu_Key_en_t enKeyType);
void Menu_Logic_Operation_ECU_MAINTAIN(Menu_Key_en_t enKeyType);
void Menu_Logic_Operation_ECU_TPMS(Menu_Key_en_t enKeyType);
void Menu_Logic_Operation_SET_Backlight(Menu_Key_en_t enKeyType);
void Menu_Logic_Operation_SET_Sound(Menu_Key_en_t enKeyType);
void Menu_Logic_Operation_SET_TimeHour(Menu_Key_en_t enKeyType);
void Menu_Logic_Operation_SET_TimeMin(Menu_Key_en_t enKeyType);
21
void Menu_Logic_Operation_SET_LDWS(Menu_Key_en_t enKeyType);
时昊's avatar
时昊 committed
22 23 24 25 26 27 28 29
void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datMin, uint8_t datStep, uint8_t *dat);
void Menu_u16Data_Updata_Process(uint8_t updateDir , uint16_t datMax, uint8_t datMin, uint16_t datStep, uint16_t *dat);
void Menu_User_Init(PoMa_Reset_en_t PowerType);


extern uint16_t LocalMinOfs_TBOX;
extern uint16_t LocalHrOfs_TBOX;
RTITimingStruct RealTimeClock;
30
//Menu_Error_Information_en_t aaa;
时昊's avatar
时昊 committed
31 32
void Menu_User_Init(PoMa_Reset_en_t PowerType)
{
33

时昊's avatar
时昊 committed
34 35 36 37 38 39 40 41 42 43
	Menu_Init_st_t Menu_Init_st;
	Menu_Init_st.enMenuBranchLen = MENU_BRANCH_MAX;
	Menu_Init_st.enMenuInterfaceLen = MENU_INTERFACE_MAX;
	Menu_Init_st.enMenuItemLen = MENU_ITEM_MAX;
	Menu_Init_st.uintMenuConfig = 0x0001;
	Menu_Init_st.uintMenuCursorMemoryDepth = 0;
	if(PowerType == POMA_RESET_KL30)
	{
		Menu_Init((uint8_t *)u8MenuRamData, (Menu_Item_Attribute_st_t *)stMenuItemAttribute, (Menu_Init_st_t *)&Menu_Init_st);
		Menu_Change_Branch_To_Item(MENU_BRANCH_ECU, MENU_ITEM_ECU_TRIP);
44
		//aaa = Menu_Attribute_Error_Check((uint8_t *) u8MenuRamData,(Menu_Item_Attribute_st_t *) stMenuItemAttribute,(Menu_Init_st_t *)&Menu_Init_st);
时昊's avatar
时昊 committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
	}
	else if(PowerType == POMA_RESET_WAKEUP)
	{
		Menu_Wake_Up_Init((uint8_t *)u8MenuRamData, (Menu_Item_Attribute_st_t *)stMenuItemAttribute, (Menu_Init_st_t *)&Menu_Init_st);
	}
	else
	{

	}
}

void Menu_Hide_Service(void)
{
	if((Get_NodeConfig_TPMS() == 1)||(Get_NodeConfig_TPMS() == 2))
	{
		Menu_Item_Exist_Condition_Set(MENU_ITEM_ECU_TPMS, 1);
	}
	else
	{
		Menu_Item_Exist_Condition_Set(MENU_ITEM_ECU_TPMS, 0);
	}
66 67 68 69 70 71 72 73
	if(Get_NodeConfig_LWDS() == 1)
	{
		Menu_Item_Exist_Condition_Set(MENU_ITEM_SET_Ldws, 1);
	}
	else
	{
		Menu_Item_Exist_Condition_Set(MENU_ITEM_SET_Ldws, 0);
	}
时昊's avatar
时昊 committed
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
	if((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_can18FF9CF1_Msg_Count) == CAN_SIG_LOST)||(CanReceive.Can_18FF9CF1 != 1))
	{
		Menu_Item_Exist_Condition_Set(MENU_ITEM_SET_TimeHour, 1);
		Menu_Item_Exist_Condition_Set(MENU_ITEM_SET_TimeMin, 1);
	}
	else
	{
		if((Get_CAN_CH0_ID_18FF9CF1_Sig_TBOXFILSts() == 1)||
		   ((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_can18FF9DF1_Msg_Count) == CAN_SIG_LOST)||
	   	   (CanReceive.Can_18FF9DF1 != 1)||
	   	   (Get_CAN_CH0_ID_18FF9DF1_Sig_Sec_TBOX() > 0XEC) || 
	   	   (Get_CAN_CH0_ID_18FF9DF1_Sig_Min_TBOX() > 0X3B) || 
	   	   (Get_CAN_CH0_ID_18FF9DF1_Sig_Hr_TBOX() > 0X17) || 
	   	   (Get_CAN_CH0_ID_18FF9DF1_Sig_Month_TBOX() > 0x0C)||
	   	   (Get_CAN_CH0_ID_18FF9DF1_Sig_Month_TBOX() < 1)|| 
	   	   (Get_CAN_CH0_ID_18FF9DF1_Sig_Day_TBOX() > 0x7C)||
	   	   (Get_CAN_CH0_ID_18FF9DF1_Sig_Day_TBOX() < 1)|| 
	   	   (Get_CAN_CH0_ID_18FF9DF1_Sig_Yr_TBOX() > 0xFA))||
		   (LocalMinOfs_TBOX > 0xb8)||(LocalMinOfs_TBOX < 0x42)||
		   (LocalHrOfs_TBOX > 0x94)||(LocalHrOfs_TBOX < 0x66))
		{
			Menu_Item_Exist_Condition_Set(MENU_ITEM_SET_TimeHour, 1);
			Menu_Item_Exist_Condition_Set(MENU_ITEM_SET_TimeMin, 1);
		}
		else
		{
			Menu_Item_Exist_Condition_Set(MENU_ITEM_SET_TimeHour, 0);
			Menu_Item_Exist_Condition_Set(MENU_ITEM_SET_TimeMin, 0);
		}
	}
}


const Menu_Item_Attribute_st_t stMenuItemAttribute[MENU_ITEM_MAX] =
{	 					   
/*MENU_ITEM_ECU_TRIP */     	{MENU_BRANCH_ECU,  MENU_INTF_ECU, MENU_ITEM_MAX, 0U, 7U, 1U, 0U, 7U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_ECU_TRIP},
/*MENU_ITEM_ECU_RANGE */    	{MENU_BRANCH_ECU,  MENU_INTF_ECU, MENU_ITEM_MAX, 1U, 7U, 1U, 1U, 7U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_ECU_RANGE},
/*MENU_ITEM_ECU_INS_FUEL */ 	{MENU_BRANCH_ECU,  MENU_INTF_ECU, MENU_ITEM_MAX, 2U, 7U, 1U, 2U, 7U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_ECU_INS_FUEL},
/*MENU_ITEM_ECU_AVER_FUEL */	{MENU_BRANCH_ECU,  MENU_INTF_ECU, MENU_ITEM_MAX, 3U, 7U, 1U, 3U, 7U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_ECU_AVER_FUEL},
/*MENU_ITEM_ECU_AVER_SPEED */	{MENU_BRANCH_ECU,  MENU_INTF_ECU, MENU_ITEM_MAX, 4U, 7U, 1U, 4U, 7U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_ECU_AVER_SPEED},
/*MENU_ITEM_ECU_MAINTAIN */ 	{MENU_BRANCH_ECU,  MENU_INTF_ECU, MENU_ITEM_MAX, 5U, 7U, 1U, 5U, 7U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_ECU_MAINTAIN},
/*MENU_ITEM_ECU_TPMS */     	{MENU_BRANCH_ECU,  MENU_INTF_ECU, MENU_ITEM_MAX, 6U, 7U, 1U, 6U, 7U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_ECU_TPMS},

117 118 119 120 121
/*MENU_ITEM_SET_Backlight */	{MENU_BRANCH_SET,  MENU_INTF_SET, MENU_ITEM_MAX, 0U, 5U, 1U, 0U, 5U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_SET_Backlight},
/*MENU_ITEM_SET_Sound */    	{MENU_BRANCH_SET,  MENU_INTF_SET, MENU_ITEM_MAX, 1U, 5U, 1U, 1U, 5U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_SET_Sound},
/*MENU_ITEM_SET_TimeHour */ 	{MENU_BRANCH_SET,  MENU_INTF_SET, MENU_ITEM_MAX, 2U, 5U, 1U, 2U, 5U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_SET_TimeHour},
/*MENU_ITEM_SET_TimeMin */  	{MENU_BRANCH_SET,  MENU_INTF_SET, MENU_ITEM_MAX, 3U, 5U, 1U, 3U, 5U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_SET_TimeMin},
								{MENU_BRANCH_SET,  MENU_INTF_SET, MENU_ITEM_MAX, 4U, 5U, 1U, 4U, 5U, MENU_DIRECTION_LONGITUDINAL, 0XFFU, MENU_INTERFACE_MAX, MENU_JUMP_FIRST, 0xFFFF, MENU_JUMP_FIRST, 	MENU_INTERFACE_MAX, MENU_JUMP_FIRST,Menu_Logic_Operation_SET_LDWS},
时昊's avatar
时昊 committed
122 123 124 125 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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 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 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
};

void Menu_Logic_Operation_ECU_TRIP(Menu_Key_en_t enKeyType)
{
	if(Pop_Alarm_Get_Current() < POP_ALARM_MAX)
	{
		return;
	}
	else
	{
		if(enKeyType == MENU_KEY_RIGHT_SHORT)
		{  
			Menu_Change_Branch_To_Item(MENU_BRANCH_ECU, MENU_ITEM_ECU_RANGE);
		}
		else if(enKeyType == MENU_KEY_LEFT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_Backlight);
		}
		else
		{
			;
		}
	}
}
void Menu_Logic_Operation_ECU_RANGE(Menu_Key_en_t enKeyType)
{
	if(Pop_Alarm_Get_Current() < POP_ALARM_MAX)	
	{
		return;
	}
	else
	{
		if(enKeyType == MENU_KEY_RIGHT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_ECU, MENU_ITEM_ECU_INS_FUEL);
		}
		else if(enKeyType == MENU_KEY_LEFT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_Backlight);
		}
		else
		{
			;
		}
	}
}
void Menu_Logic_Operation_ECU_INS_FUEL(Menu_Key_en_t enKeyType)
{
	if(Pop_Alarm_Get_Current() < POP_ALARM_MAX)	
	{
		return;
	}
	else
	{
		if(enKeyType == MENU_KEY_RIGHT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_ECU, MENU_ITEM_ECU_AVER_FUEL);
		}
		else if(enKeyType == MENU_KEY_LEFT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_Backlight);
		}
		else
		{
			;
		}
	}
}
void Menu_Logic_Operation_ECU_AVER_FUEL(Menu_Key_en_t enKeyType)
{
	if(Pop_Alarm_Get_Current() < POP_ALARM_MAX)
	{
		return;
	}
	else
	{
		if(enKeyType == MENU_KEY_RIGHT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_ECU, MENU_ITEM_ECU_AVER_SPEED);
		}
		else if(enKeyType == MENU_KEY_LEFT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_Backlight);
		}
		else
		{
			;
		}
	}
}
void Menu_Logic_Operation_ECU_AVER_SPEED(Menu_Key_en_t enKeyType)
{
	if(Pop_Alarm_Get_Current() < POP_ALARM_MAX)
	{
		return;
	}
	else
	{
		if(enKeyType == MENU_KEY_RIGHT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_ECU, MENU_ITEM_ECU_MAINTAIN);
		}
		else if(enKeyType == MENU_KEY_LEFT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_Backlight);
		}
		else
		{
			;
		}
	}
}
void Menu_Logic_Operation_ECU_MAINTAIN(Menu_Key_en_t enKeyType)
{
	if(Pop_Alarm_Get_Current() < POP_ALARM_MAX)	
	{
		return;
	}
	else
	{
		if(enKeyType == MENU_KEY_RIGHT_SHORT)
		{
			if((Get_NodeConfig_TPMS() == 1)||(Get_NodeConfig_TPMS() == 2))
			{
				Menu_Change_Branch_To_Item(MENU_BRANCH_ECU, MENU_ITEM_ECU_TPMS);
			}
			else
			{
				Menu_Change_Branch_To_Item(MENU_BRANCH_ECU, MENU_ITEM_ECU_TRIP);
			}
		}
		else if(enKeyType == MENU_KEY_LEFT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_Backlight);
		}
		else
		{
			;
		}
	}
}
void Menu_Logic_Operation_ECU_TPMS(Menu_Key_en_t enKeyType)
{
	if(Pop_Alarm_Get_Current() < POP_ALARM_MAX)
	{
		return;
	}
	else
	{
		if(enKeyType == MENU_KEY_RIGHT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_ECU, MENU_ITEM_ECU_TRIP);
		}
		else if(enKeyType == MENU_KEY_LEFT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_Backlight);
		}
		else
		{
			;
		}
	}
}

//-----------------------------SET----------------------------------------------//
void Menu_Logic_Operation_SET_Backlight(Menu_Key_en_t enKeyType)
{
	uint8_t updataDir = 0u;
	uint16_t datmax = 0u;
	uint8_t datmin = 0u;

	//if(Pop_Alarm_Get_Current() < POP_ALARM_MAX)
	//{
	//	return;
	//}
	//else
	//{
		if(enKeyType == MENU_KEY_LEFT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_Sound);
		}
		else if (enKeyType == MENU_KEY_RIGHT_SHORT)
		{
			updataDir = 1;
			datmax = 500u;
    	    datmin = 150u; 
			Menu_u16Data_Updata_Process(updataDir, datmax, datmin, 50u, (uint16_t*)&(g_Light.Duty));
		}
		else if(enKeyType == MENU_KEY_TIMEOUT)
		{
			Menu_Change_Branch(MENU_BRANCH_ECU, MENU_CHANGE_HOLD);
		}
		else
		{
			;
		}
	//}
}
void Menu_Logic_Operation_SET_Sound(Menu_Key_en_t enKeyType)
{
	uint8_t updataDir = 0u;
	uint8_t datmax = 0u;
	uint8_t datmin = 0u;

	//if(Pop_Alarm_Get_Current() < POP_ALARM_MAX)
	//{
	//	return;
	//}
	//else
	//{
		if(enKeyType == MENU_KEY_LEFT_SHORT)
		{
			if((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_can18FF9CF1_Msg_Count) == CAN_SIG_LOST)||
		   	(CanReceive.Can_18FF9CF1 != 1)||(Get_CAN_CH0_ID_18FF9CF1_Sig_TBOXFILSts() == 1)||
		   	(Get_CAN_CH0_ID_18FF9DF1_Sig_Sec_TBOX() > 0XEC) || 
		   	(Get_CAN_CH0_ID_18FF9DF1_Sig_Min_TBOX() > 0X3B) || 
		   	(Get_CAN_CH0_ID_18FF9DF1_Sig_Hr_TBOX() > 0X17) || 
		   	(Get_CAN_CH0_ID_18FF9DF1_Sig_Month_TBOX() > 0x0C) || 
			(Get_CAN_CH0_ID_18FF9DF1_Sig_Month_TBOX() < 1)|| 
		   	(Get_CAN_CH0_ID_18FF9DF1_Sig_Day_TBOX() > 0x7C) || 
			(Get_CAN_CH0_ID_18FF9DF1_Sig_Day_TBOX() < 1)|| 
		   	(Get_CAN_CH0_ID_18FF9DF1_Sig_Yr_TBOX() > 0xFA)||
			(LocalMinOfs_TBOX > 0xb8)||(LocalMinOfs_TBOX < 0x42)||
	   		(LocalHrOfs_TBOX > 0x94)||(LocalHrOfs_TBOX < 0x66))
		   	{
				Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_TimeHour);
		   	}
349
		   	else 
时昊's avatar
时昊 committed
350
		   	{
351 352 353 354 355 356 357 358
				if(Get_NodeConfig_LWDS() == 1)
				{
					Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_Ldws);
				}
				else
				{
					Menu_Change_Branch(MENU_BRANCH_ECU, MENU_CHANGE_HOLD);
				}
时昊's avatar
时昊 committed
359
		   	}
360
			
时昊's avatar
时昊 committed
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
		}
		else if (enKeyType == MENU_KEY_RIGHT_SHORT)
		{
			updataDir = 1;
			datmax = 3u;
    	    datmin = 1u; 
			Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(MenuData.Sound));
		 	Buzzer_Volume_Set(MenuData.Sound);
			Sound_Alarm_Trigger_Volume();
		}
		else if(enKeyType == MENU_KEY_TIMEOUT)
		{
			Menu_Change_Branch(MENU_BRANCH_ECU, MENU_CHANGE_HOLD);
		}
		else
		{
			;
		}
	//}
}

void Menu_Logic_Operation_SET_TimeHour(Menu_Key_en_t enKeyType)
{
	uint8_t updataDir = 0u;
	uint8_t datmax = 0u;
	uint8_t datmin = 0u;

	//if(Pop_Alarm_Get_Current() < POP_ALARM_MAX)
	//{
	//	return;
	//}
	//else
	//{
		if(enKeyType == MENU_KEY_LEFT_SHORT)
		{
			Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_TimeMin);
		}
		else if (enKeyType == MENU_KEY_RIGHT_SHORT)
		{
			updataDir = 1;
			datmax = 23u;
    	    datmin = 0u;  
			Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(MenuData.Hour));
			RTC_Set_Time((uint8_t*)&g_stRTCInformation);
		}
		else 
		{
			if(enKeyType == MENU_KEY_TIMEOUT)
			{
				Menu_Change_Branch(MENU_BRANCH_ECU, MENU_CHANGE_HOLD);
				MenuData.Hour = RTC_HOUR;
			}
		}
	//}
}
void Menu_Logic_Operation_SET_TimeMin(Menu_Key_en_t enKeyType)
{
	uint8_t updataDir = 0u;
	uint8_t datmax = 0u;
	uint8_t datmin = 0u;

422 423 424
	if(enKeyType == MENU_KEY_LEFT_SHORT)
	{
		if(Get_NodeConfig_LWDS() == 1)
时昊's avatar
时昊 committed
425
		{
426
			Menu_Change_Branch_To_Item(MENU_BRANCH_SET, MENU_ITEM_SET_Ldws);
时昊's avatar
时昊 committed
427
		}
428
		else
时昊's avatar
时昊 committed
429
		{
430
			Menu_Change_Branch(MENU_BRANCH_ECU, MENU_CHANGE_HOLD);
时昊's avatar
时昊 committed
431
		}
432 433 434 435 436 437 438 439 440 441 442 443 444 445
		RTC_HOUR = MenuData.Hour;
		RTC_MINUTE = MenuData.Minute;
		RTC_Set_Time((uint8_t*)&g_stRTCInformation);
	}
	else if (enKeyType == MENU_KEY_RIGHT_SHORT)
	{
		updataDir = 1;
		datmax = 59u;
	 	datmin = 0u;
		Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(MenuData.Minute));
	}
	else 
	{
		if(enKeyType == MENU_KEY_TIMEOUT)
时昊's avatar
时昊 committed
446
		{
447 448 449
			Menu_Change_Branch(MENU_BRANCH_ECU, MENU_CHANGE_HOLD);
			MenuData.Hour = RTC_HOUR;
		    MenuData.Minute = RTC_MINUTE;
时昊's avatar
时昊 committed
450
		}
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473
	}
}
void Menu_Logic_Operation_SET_LDWS(Menu_Key_en_t enKeyType)
{
	uint8_t updataDir = 0u;
	uint8_t datmax = 0u;
	uint8_t datmin = 0u;

	if(enKeyType == MENU_KEY_LEFT_SHORT)
	{
		Menu_Change_Branch(MENU_BRANCH_ECU, MENU_CHANGE_HOLD);
	}
	else if (enKeyType == MENU_KEY_RIGHT_SHORT)
	{
		updataDir = 1;
		datmax = 2u;
    	datmin = 1u; 
		Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(MenuData.Ldws));//1关,2开
	}
	else
	{
		;
	}
时昊's avatar
时昊 committed
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601
}



/*static void Menu_Cursor_Preprocess(Menu_Key_en_t enMenuKey);
static void Menu_Cursor_Postprocess(Menu_Key_en_t enMenuKey);



static void Menu_Cursor_Preprocess(Menu_Key_en_t enMenuKey)
{
}

static void Menu_Cursor_Postprocess(Menu_Key_en_t enMenuKey)
{
}*/


void Menu_Service(Menu_Key_en_t enMenuKey)
{
	if(SYS_OPR_STAT_IGN_ON)
	{
		Menu_Logic_Process(enMenuKey);
	}
	
	//Menu_Cursor_Preprocess(enMenuKey);
	//Menu_Cursor_Process(enMenuKey);
	//Menu_Cursor_Postprocess(enMenuKey);
	
}




void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datMin, uint8_t datStep, uint8_t *dat)
{
	uint8_t temp = *dat;
    if(datMax > datMin)
    {
        if(updateDir == 1u)
        {
            if(temp < datMax)
            {
                if((temp) <= (255u-datStep))
                {
                    temp += datStep;
                }
            } 
            else
            {
                temp = datMin;
            }        
        }
        else if(updateDir == 2u)
        {
            if(temp > datMin)
            {
                if(temp >= datStep)
                {
                    temp -= datStep;
                }
            } 
            else
            {
                temp = datMax;
            }
        }
        else
        {
        }
    }
    else
    {
    }

	*dat = temp;
}

void Menu_u16Data_Updata_Process(uint8_t updateDir , uint16_t datMax, uint8_t datMin, uint16_t datStep, uint16_t *dat)
{
	uint16_t temp = *dat;
    if(datMax > datMin)
    {
        if(updateDir == 1u)
        {
            if(temp < datMax)
            {
                if((temp) <= (65535u-datStep))
                {
                    temp += datStep;
                }
            } 
            else
            {
				//if(temp == (datMax + 1))
				//{
				//	temp = temp - 1;
				//}
				//else
				{
					temp = datMin;
				}
            }        
        }
        else if(updateDir == 2u)
        {
            if(temp > datMin)
            {
                if(temp >= datStep)
                {
                    temp -= datStep;
                }
            } 
            else
            {
                temp = datMax;
            }
        }
        else
        {
        }
    }
    else
    {
    }

	*dat = temp;
}