Commit 6841750c authored by 李俭双's avatar 李俭双

Merge branch 'dev' of http://tyw-server.synology.me:12345/ty/tianying_ty100 into lijianshuang

parents 3fa98a0d 3458d39c
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<TargetCommonOption> <TargetCommonOption>
<Device>BAT32A239KK64FB</Device> <Device>BAT32A239KK64FB</Device>
<Vendor>Cmsemicon</Vendor> <Vendor>Cmsemicon</Vendor>
<PackID>Cmsemicon.BAT32A239.1.0.3</PackID> <PackID>Cmsemicon.BAT32A239.1.0.5</PackID>
<PackURL>http://www.mcu.com.cn/pack/</PackURL> <PackURL>http://www.mcu.com.cn/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x08000) IROM(0x00000000,0x40000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE</Cpu> <Cpu>IRAM(0x20000000,0x08000) IROM(0x00000000,0x40000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec> <FlashUtilSpec></FlashUtilSpec>
...@@ -1156,7 +1156,7 @@ ...@@ -1156,7 +1156,7 @@
<file attr="config" category="source" name="Device\Source\isr_BAT32A239.c" version="1.0.0"> <file attr="config" category="source" name="Device\Source\isr_BAT32A239.c" version="1.0.0">
<instance index="0">RTE\Device\BAT32A239KK64FB\isr_BAT32A239.c</instance> <instance index="0">RTE\Device\BAT32A239KK64FB\isr_BAT32A239.c</instance>
<component Cclass="Device" Cgroup="ISR" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/> <component Cclass="Device" Cgroup="ISR" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/>
<package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.3"/> <package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.5"/>
<targetInfos> <targetInfos>
<targetInfo name="HaoJin232"/> <targetInfo name="HaoJin232"/>
</targetInfos> </targetInfos>
...@@ -1164,7 +1164,7 @@ ...@@ -1164,7 +1164,7 @@
<file attr="config" category="source" condition="Startup ARM" name="Device\Source\ARM\startup_BAT32A239.s" version="1.0.0"> <file attr="config" category="source" condition="Startup ARM" name="Device\Source\ARM\startup_BAT32A239.s" version="1.0.0">
<instance index="0">RTE\Device\BAT32A239KK64FB\startup_BAT32A239.s</instance> <instance index="0">RTE\Device\BAT32A239KK64FB\startup_BAT32A239.s</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/> <component Cclass="Device" Cgroup="Startup" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/>
<package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.3"/> <package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.5"/>
<targetInfos> <targetInfos>
<targetInfo name="HaoJin232"/> <targetInfo name="HaoJin232"/>
</targetInfos> </targetInfos>
...@@ -1172,7 +1172,7 @@ ...@@ -1172,7 +1172,7 @@
<file attr="config" category="source" name="Device\Source\system_BAT32A239.c" version="1.0.0"> <file attr="config" category="source" name="Device\Source\system_BAT32A239.c" version="1.0.0">
<instance index="0">RTE\Device\BAT32A239KK64FB\system_BAT32A239.c</instance> <instance index="0">RTE\Device\BAT32A239KK64FB\system_BAT32A239.c</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/> <component Cclass="Device" Cgroup="Startup" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/>
<package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.3"/> <package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.5"/>
<targetInfos> <targetInfos>
<targetInfo name="HaoJin232"/> <targetInfo name="HaoJin232"/>
</targetInfos> </targetInfos>
...@@ -1180,7 +1180,7 @@ ...@@ -1180,7 +1180,7 @@
<file attr="config" category="header" name="Device\Source\userdefine.h" version="1.0.0"> <file attr="config" category="header" name="Device\Source\userdefine.h" version="1.0.0">
<instance index="0">RTE\Device\BAT32A239KK64FB\userdefine.h</instance> <instance index="0">RTE\Device\BAT32A239KK64FB\userdefine.h</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/> <component Cclass="Device" Cgroup="Startup" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/>
<package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.3"/> <package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.5"/>
<targetInfos> <targetInfos>
<targetInfo name="HaoJin232"/> <targetInfo name="HaoJin232"/>
</targetInfos> </targetInfos>
......
...@@ -364,7 +364,7 @@ uint16_t Get_ActualVechileSpeed(void) ...@@ -364,7 +364,7 @@ uint16_t Get_ActualVechileSpeed(void)
uint16_t Get_DispVechileSpeed(void) uint16_t Get_DispVechileSpeed(void)
{ {
uint16_t Vspeed = 0; uint16_t Vspeed = 0;
if(Get_Dis_Unit() == 0) /* KM */ if(Get_Dis_KM_Unit() == 0) /* KM */
{ {
if ( DataVSpeedDisp >= 1200 ) if ( DataVSpeedDisp >= 1200 )
{ {
...@@ -372,7 +372,7 @@ uint16_t Get_DispVechileSpeed(void) ...@@ -372,7 +372,7 @@ uint16_t Get_DispVechileSpeed(void)
} }
Vspeed = DataVSpeedDisp; Vspeed = DataVSpeedDisp;
} }
else //if (Get_Dis_Unit() == 1) /* MILE */ else //if (Get_Dis_KM_Unit() == 1) /* MILE */
{ {
Vspeed = Data_Km_To_Mile(DataVSpeedDisp); Vspeed = Data_Km_To_Mile(DataVSpeedDisp);
if ( Vspeed >= 750 ) if ( Vspeed >= 750 )
......
...@@ -1660,7 +1660,7 @@ _Fun_Res SEG_SET_VSpeed_NUM(uint8_t m_Flag, uint16_t m_NUM) ...@@ -1660,7 +1660,7 @@ _Fun_Res SEG_SET_VSpeed_NUM(uint8_t m_Flag, uint16_t m_NUM)
} }
else else
{ {
if ((Get_Dis_Unit() == 1)) if ((Get_Dis_KM_Unit() == 1))
{ {
IC1_SEG059 = IC_SEG_OFF; IC1_SEG059 = IC_SEG_OFF;
IC1_SEG058 = IC_SEG_ON; IC1_SEG058 = IC_SEG_ON;
...@@ -1988,7 +1988,7 @@ _Fun_Res SEG_SET_ODO_NUM(uint8_t m_Flag, uint32_t m_NUM) ...@@ -1988,7 +1988,7 @@ _Fun_Res SEG_SET_ODO_NUM(uint8_t m_Flag, uint32_t m_NUM)
} }
else else
{ {
if (Get_Dis_Unit() == 1) if (Get_Dis_KM_Unit() == 1)
{ {
IC2_SEG103 = IC_SEG_OFF; IC2_SEG103 = IC_SEG_OFF;
IC2_SEG105 = IC_SEG_ON; IC2_SEG105 = IC_SEG_ON;
...@@ -2459,7 +2459,7 @@ _Fun_Res SEG_SET_TRIP_NUM(uint8_t m_Flag, uint16_t m_NUM) ...@@ -2459,7 +2459,7 @@ _Fun_Res SEG_SET_TRIP_NUM(uint8_t m_Flag, uint16_t m_NUM)
} }
else else
{ {
if (Get_Dis_Unit() == 1) if (Get_Dis_KM_Unit() == 1)
{ {
IC1_SEG114 = IC_SEG_OFF; IC1_SEG114 = IC_SEG_OFF;
IC1_SEG116 = IC_SEG_ON; IC1_SEG116 = IC_SEG_ON;
......
...@@ -17,7 +17,7 @@ typedef unsigned long long Key_uint64_t; ...@@ -17,7 +17,7 @@ typedef unsigned long long Key_uint64_t;
typedef enum typedef enum
{ {
KEY_LEFT = 0U, KEY_LEFT = 0U,
KEY_RIGHT, //KEY_RIGHT,
// KEY_UP, // KEY_UP,
// KEY_DOWN, // KEY_DOWN,
// KEY_ENTER, // KEY_ENTER,
......
...@@ -4,12 +4,10 @@ ...@@ -4,12 +4,10 @@
#include "Components.h" #include "Components.h"
__align(4) __align(4)
#define BACK_MENU_TIME 1000 #define BACK_MENU_TIME 1500
_Menu_Infor MenuInfor; _Menu_Infor MenuInfor;
_Menu_Data MenuData; _Menu_Data MenuData;
uint8_t PageType; uint8_t PageType = 0;
uint8_t Key_Right_Long_Press_Flag;
uint8_t Key_Left_Long_Press_Flag;
RTC_TimeTypeDef RTC_TimeStruct; RTC_TimeTypeDef RTC_TimeStruct;
RTC_DateTypeDef RTC_DateStruct; RTC_DateTypeDef RTC_DateStruct;
...@@ -19,20 +17,21 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode ...@@ -19,20 +17,21 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
{ {
switch (enKeyEvent) switch (enKeyEvent)
{ {
case KEY_EVENT_SHORT_PRESS_1: case KEY_EVENT_SHORT_PRESS_1://1s
Key_Left_Short_Press(); Key_Left_Short_Press();
break; break;
case KEY_EVENT_SHORT_PRESS_2: case KEY_EVENT_SHORT_PRESS_2://3-5s
break;
case KEY_EVENT_LONG_PRESS_1: //2
Key_Left_Long_Press(); Key_Left_Long_Press();
Key_Left_Long_Press_Flag = 1;
break; break;
case KEY_EVENT_LONG_PRESS_2: //3 case KEY_EVENT_LONG_PRESS_1: //7
break;
case KEY_EVENT_LONG_PRESS_2: //8
break; break;
case KEY_EVENT_LONG_PRESS_3: //5s case KEY_EVENT_LONG_PRESS_3: //9s
break; break;
case KEY_EVENT_LONG_PRESS_4: //10s case KEY_EVENT_LONG_PRESS_4: //10s
Maintain_Reset_Service();
TYW_RESET_ODO();
break; break;
case KEY_EVENT_OFF_TO_ON: case KEY_EVENT_OFF_TO_ON:
break; break;
...@@ -40,7 +39,6 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode ...@@ -40,7 +39,6 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
break; break;
case KEY_EVENT_NONE: case KEY_EVENT_NONE:
KEY_LEFT_EVENT_NONE_Service(); KEY_LEFT_EVENT_NONE_Service();
Key_Left_Long_Press_Flag = 0;
break; break;
default: default:
break; break;
...@@ -51,28 +49,22 @@ void Key_Operation_Right(Key_Event_en_t enKeyEvent)//Set ...@@ -51,28 +49,22 @@ void Key_Operation_Right(Key_Event_en_t enKeyEvent)//Set
switch (enKeyEvent) switch (enKeyEvent)
{ {
case KEY_EVENT_SHORT_PRESS_1: case KEY_EVENT_SHORT_PRESS_1:
Key_Right_Short_Press();
break; break;
case KEY_EVENT_SHORT_PRESS_2: case KEY_EVENT_SHORT_PRESS_2:
break; break;
case KEY_EVENT_LONG_PRESS_1: //2s case KEY_EVENT_LONG_PRESS_1:
Key_Right_Long_Press();
Key_Right_Long_Press_Flag = 1;
break; break;
case KEY_EVENT_LONG_PRESS_2: //3s case KEY_EVENT_LONG_PRESS_2:
break; break;
case KEY_EVENT_LONG_PRESS_3: //5s case KEY_EVENT_LONG_PRESS_3:
break; break;
case KEY_EVENT_LONG_PRESS_4: //10s case KEY_EVENT_LONG_PRESS_4:
TYW_RESET_ODO();
break; break;
case KEY_EVENT_OFF_TO_ON: case KEY_EVENT_OFF_TO_ON:
break; break;
case KEY_EVENT_ON_TO_OFF: case KEY_EVENT_ON_TO_OFF:
break; break;
case KEY_EVENT_NONE: case KEY_EVENT_NONE:
KEY_RIGHT_EVENT_NONE_Service();
Key_Right_Long_Press_Flag = 0;
break; break;
default: default:
break; break;
...@@ -84,33 +76,30 @@ void Key_Operation_Right(Key_Event_en_t enKeyEvent)//Set ...@@ -84,33 +76,30 @@ void Key_Operation_Right(Key_Event_en_t enKeyEvent)//Set
Key_Status_en_t Key_Status_Read_Left(void) Key_Status_en_t Key_Status_Read_Left(void)
{ {
Key_Status_en_t enKeyReal = KEY_REALTIME_LOOSEN; Key_Status_en_t enKeyReal = KEY_REALTIME_LOOSEN;
if (SYS_OPR_STAT_IGN_ON) if (RTE_GPIO_Get_Level(MODE_P_IN))
{ {
//if (RTE_GPIO_Get_Level(MODE_P_IN)) enKeyReal = KEY_REALTIME_LOOSEN;
//{ }
// enKeyReal = KEY_REALTIME_LOOSEN; else
//} {
//else enKeyReal = KEY_REALTIME_PRESS;
//{
// enKeyReal = KEY_REALTIME_PRESS;
//}
} }
return enKeyReal; return enKeyReal;
} }
Key_Status_en_t Key_Status_Read_Right(void) Key_Status_en_t Key_Status_Read_Right(void)
{ {
Key_Status_en_t enKeyReal = KEY_REALTIME_LOOSEN; Key_Status_en_t enKeyReal = KEY_REALTIME_LOOSEN;
if (SYS_OPR_STAT_IGN_ON) // if (SYS_OPR_STAT_IGN_ON)
{ // {
//if (RTE_GPIO_Get_Level(SET_P_IN)) // if (RTE_GPIO_Get_Level(SET_P_IN))
//{ // {
// enKeyReal = KEY_REALTIME_LOOSEN; // enKeyReal = KEY_REALTIME_LOOSEN;
//} // }
//else // else
//{ // {
// enKeyReal = KEY_REALTIME_PRESS; // enKeyReal = KEY_REALTIME_PRESS;
//} // }
} // }
return enKeyReal; return enKeyReal;
} }
...@@ -119,7 +108,7 @@ Key_Status_en_t Key_Status_Read_Right(void) ...@@ -119,7 +108,7 @@ Key_Status_en_t Key_Status_Read_Right(void)
const Key_Attribute_st_t stKeyAttribute[KEY_NUM_MAX] = 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_Left, Key_Operation_Left},
{KEY_NEED_DEBOUNCE_NORMAL, Key_Status_Read_Right, Key_Operation_Right}, //{KEY_NEED_DEBOUNCE_NORMAL, Key_Status_Read_Right, Key_Operation_Right},
//{KEY_NEED_DEBOUNCE_NORMAL, Key_Status_Read_FLIP, Key_Operation_FLIP}, //{KEY_NEED_DEBOUNCE_NORMAL, Key_Status_Read_FLIP, Key_Operation_FLIP},
//{KEY_NEED_DEBOUNCE_NORMAL, Key_Status_Read_ADJUST, Key_Operation_ADJUST}, //{KEY_NEED_DEBOUNCE_NORMAL, Key_Status_Read_ADJUST, Key_Operation_ADJUST},
}; };
...@@ -141,11 +130,11 @@ void Key_KL30_Init_EXample(void) ...@@ -141,11 +130,11 @@ 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,1000U); Key_Parameter_Set_Short_Press_1_Time(50U,1000U);
Key_Parameter_Set_Short_Press_2_Time(1500U,2000U); Key_Parameter_Set_Short_Press_2_Time(3000U,5000U);
Key_Parameter_Set_Long_Press_1_Time(2000U); Key_Parameter_Set_Long_Press_1_Time(7000U);
Key_Parameter_Set_Long_Press_2_Time(3000U); Key_Parameter_Set_Long_Press_2_Time(8000U);
Key_Parameter_Set_Long_Press_3_Time(5000U); Key_Parameter_Set_Long_Press_3_Time(9000U);
Key_Parameter_Set_Long_Press_4_Time(10000U); Key_Parameter_Set_Long_Press_4_Time(10000U);
} }
void Key_Wakeup_Init_EXample(void) void Key_Wakeup_Init_EXample(void)
...@@ -157,12 +146,12 @@ void Key_Wakeup_Init_EXample(void) ...@@ -157,12 +146,12 @@ 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,1000U); Key_Parameter_Set_Short_Press_1_Time(50U,1000U);
Key_Parameter_Set_Short_Press_2_Time(1500U,2000U); Key_Parameter_Set_Short_Press_2_Time(3000U,5000U);
Key_Parameter_Set_Long_Press_1_Time(2000U); Key_Parameter_Set_Long_Press_1_Time(7000U);
Key_Parameter_Set_Long_Press_2_Time(3000U); Key_Parameter_Set_Long_Press_2_Time(8000U);
Key_Parameter_Set_Long_Press_3_Time(5000U); Key_Parameter_Set_Long_Press_3_Time(9000U);
Key_Parameter_Set_Long_Press_4_Time(10000U); Key_Parameter_Set_Long_Press_4_Time(10000U);
} }
...@@ -176,15 +165,7 @@ void KEY_LEFT_EVENT_NONE_Service(void) ...@@ -176,15 +165,7 @@ void KEY_LEFT_EVENT_NONE_Service(void)
} }
} }
void KEY_RIGHT_EVENT_NONE_Service(void)
{
MenuInfor.Back_Time_Right++;
if(MenuInfor.Back_Time_Right > BACK_MENU_TIME)
{
MenuInfor.Back_Time_Right = BACK_MENU_TIME;
MenuInfor.Back_Time_Right_Flag = 1;
}
}
void Key_Clear_Time(void) void Key_Clear_Time(void)
{ {
...@@ -192,22 +173,12 @@ void Key_Clear_Time(void) ...@@ -192,22 +173,12 @@ void Key_Clear_Time(void)
{ {
MenuInfor.Back_Time_Left = 0; MenuInfor.Back_Time_Left = 0;
MenuInfor.Back_Time_Left_Flag = 0; MenuInfor.Back_Time_Left_Flag = 0;
MenuInfor.Back_Time_Right_Flag = 0;
}
if(Key_Status_Read_Right() == KEY_REALTIME_PRESS)
{
MenuInfor.Back_Time_Right = 0;
MenuInfor.Back_Time_Left_Flag = 0;
MenuInfor.Back_Time_Right_Flag = 0;
} }
} }
void Key_Check_Service(void) void Key_Check_Service(void)
{ {
if((Key_Right_Long_Press_Flag == 1)&&(Key_Left_Long_Press_Flag == 1)&&(PageType == Page_Time))
{
PageType = Page_Time_Set_Hour;
}
} }
void Key_Left_Short_Press(void) void Key_Left_Short_Press(void)
...@@ -216,104 +187,128 @@ void Key_Left_Short_Press(void) ...@@ -216,104 +187,128 @@ void Key_Left_Short_Press(void)
uint8_t datmax = 0u; uint8_t datmax = 0u;
uint8_t datmin = 0u; uint8_t datmin = 0u;
if(PageType == Page_Time_Set_Hour)
if(PageType == Page_Odo)
{
PageType = Page_Trip;
}
else if(PageType == Page_Trip)
{
PageType = Page_DTC;
}
else if(PageType == Page_DTC)
{
PageType = Page_TCS;
}
else if(PageType == Page_TCS)
{
PageType = Page_Odo;
}
if(PageType == Page_Time_Hour)
{ {
updataDir = 1; updataDir = 1;
datmax = 23u; datmax = 23u;
datmin = 0u; datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(counter_val.time.RTC_Hours)); Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(counter_val.time.RTC_Hours));
} }
else if(PageType == Page_Time_Set_Minute) else if(PageType == Page_Time_Minute)
{ {
updataDir = 1; updataDir = 1;
datmax = 59u; datmax = 59u;
datmin = 0u; datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(counter_val.time.RTC_Minutes)); Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(counter_val.time.RTC_Minutes));
} }
else else if(PageType == Page_Km_Unit)
{ {
if((PageType == Page_Time)&&(Key_Status_Read_Right() == KEY_REALTIME_LOOSEN)&&(Common_Get_IG_Sts( ) == COMMON_POWER_ON)) if(Get_Dis_KM_Unit() == 0)
{ {
if(Get_Dis_Unit() == 0) MenuData.KM_Unit = 1;//mile
{ }
MenuData.Unit = 1;//mile else
} {
else MenuData.KM_Unit = 0;//km
{ }
MenuData.Unit = 0;//km Unit_Convert_Service();
} }
else if(PageType == Page_Tpms_Unit)
{
if(Get_Dis_Tpms_Unit() == 0)
{
MenuData.Tpms_Unit = 1;//psi
}
else
{
MenuData.Tpms_Unit = 0;//bar
} }
Unit_Convert_Service(); Unit_Convert_Service();
} }
else
{
;
}
} }
void Key_Auto_Save(void) void Key_Auto_Save(void)
{ {
if((MenuInfor.Back_Time_Left_Flag == 1)&&(MenuInfor.Back_Time_Right_Flag == 1)) if((MenuInfor.Back_Time_Left_Flag == 1))
{ {
if(PageType == Page_Time_Set_Hour) if(PageType == Page_Time_Hour)
{ {
RTC_SetTime(&counter_val.time); RTC_SetTime(&counter_val.time);
} }
if(PageType == Page_Time_Set_Minute) if(PageType == Page_Time_Minute)
{ {
RTC_SetTime(&counter_val.time); RTC_SetTime(&counter_val.time);
} }
PageType = Page_Time; PageType = Page_Odo;
} }
} }
void Key_Right_Short_Press(void)
{
if(PageType == Page_Time_Set_Hour)
{
PageType = Page_Time_Set_Minute;
}
else if(PageType == Page_Time_Set_Minute)
{
PageType = Page_Time_Set_Hour;
}
else
{
;
}
}
void Key_Left_Long_Press(void) void Key_Left_Long_Press(void)
{ {
if((PageType == Page_Time)&&(Key_Status_Read_Right() == KEY_REALTIME_LOOSEN)) if(PageType == Page_Odo)
{ {
//Telltales_Auto_Start_Stop_Setting(); PageType = Page_Time_Hour;
} }
} else if(PageType == Page_Time_Hour)
void Key_Right_Long_Press(void)
{
if(PageType == Page_Time)
{ {
if(Key_Status_Read_Left() == KEY_REALTIME_LOOSEN) PageType = Page_Time_Minute;
{ }
Data_Clear_Trip_All(); else if(PageType == Page_Time_Minute)
} {
PageType = Page_Km_Unit;
} }
else if(PageType == Page_Time_Set_Hour) else if(PageType == Page_Km_Unit)
{ {
RTC_SetTime(&counter_val.time); PageType = Page_Tpms_Unit;
PageType = Page_Time;
} }
else if(PageType == Page_Time_Set_Minute) else if(PageType == Page_Tpms_Unit)
{ {
RTC_SetTime(&counter_val.time); PageType = Page_Odo;
PageType = Page_Time;
} }
else else
{ {
; ;
} }
if(PageType == Page_TCS)
{
if(Get_Dis_Tcs_Val() == 0)
{
MenuData.Tcs_Val = 1;//on
}
else
{
MenuData.Tcs_Val = 0;//off
}
}
} }
void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datMin, uint8_t datStep, uint8_t *dat) void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datMin, uint8_t datStep, uint8_t *dat)
{ {
uint8_t temp = *dat; uint8_t temp = *dat;
...@@ -360,7 +355,9 @@ void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datM ...@@ -360,7 +355,9 @@ void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datM
void MenuData_Unit_Init(void) void MenuData_Unit_Init(void)
{ {
MenuData.Unit = 0; MenuData.KM_Unit = 0;
MenuData.Tpms_Unit = 0;
MenuData.Tcs_Val = 1;
} }
uint8_t ClearODO_Flag = 0; uint8_t ClearODO_Flag = 0;
...@@ -383,6 +380,11 @@ void TYW_RESET_ODO(void) ...@@ -383,6 +380,11 @@ void TYW_RESET_ODO(void)
} }
} }
void Maintain_Reset_Service(void)
{
;
}
uint8_t Get_Dis_Hour_Time(void) uint8_t Get_Dis_Hour_Time(void)
{ {
return counter_val.time.RTC_Hours; return counter_val.time.RTC_Hours;
...@@ -398,7 +400,17 @@ uint8_t Get_Current_PageType(void) ...@@ -398,7 +400,17 @@ uint8_t Get_Current_PageType(void)
return PageType; return PageType;
} }
uint8_t Get_Dis_Unit(void) uint8_t Get_Dis_KM_Unit(void)
{ {
return MenuData.Unit; //0km,1mile return MenuData.KM_Unit; //0km,1mile
} }
uint8_t Get_Dis_Tpms_Unit(void)
{
return MenuData.Tpms_Unit; //0km,1mile
}
uint8_t Get_Dis_Tcs_Val(void)
{
return MenuData.Tcs_Val; // 0 off, 1 on
}
\ No newline at end of file
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
typedef struct typedef struct
{ {
uint16_t Back_Time_Left; uint16_t Back_Time_Left;
uint16_t Back_Time_Right;
uint8_t Back_Time_Right_Flag;
uint8_t Back_Time_Left_Flag; uint8_t Back_Time_Left_Flag;
}_Menu_Infor; }_Menu_Infor;
...@@ -19,27 +17,32 @@ typedef struct ...@@ -19,27 +17,32 @@ typedef struct
uint8_t Set_Minute; uint8_t Set_Minute;
uint8_t Dis_Hour; uint8_t Dis_Hour;
uint8_t Dis_Minute; uint8_t Dis_Minute;
uint8_t Unit; uint8_t KM_Unit; // 0 km, 1 mile
uint8_t Tpms_Unit;// 0 bar, 1 psi
uint8_t Tcs_Val; // 0 off, 1 on
}_Menu_Data; }_Menu_Data;
typedef enum typedef enum
{ {
Page_Time = 0, Page_Odo = 0,
Page_Time_Set_Hour, Page_Time_Hour,
Page_Time_Set_Minute, Page_Time_Minute,
Page_Km_Unit,
Page_Tpms_Unit,
Page_Trip,
Page_DTC,
Page_TCS,
Page_Max, Page_Max,
}_Page_Type; }_Page_Type;
extern uint8_t PageType; extern uint8_t PageType;
extern uint8_t Key_Right_Long_Press_Flag;
extern uint8_t Key_Left_Long_Press_Flag;
extern uint8_t ClearODO_Flag; extern uint8_t ClearODO_Flag;
extern RTC_CounterTypeDef counter_val; extern RTC_CounterTypeDef counter_val;
extern void Key_KL30_Init_EXample(void); extern void Key_KL30_Init_EXample(void);
extern void Key_Wakeup_Init_EXample(void); extern void Key_Wakeup_Init_EXample(void);
void KEY_RIGHT_EVENT_NONE_Service(void);
void KEY_LEFT_EVENT_NONE_Service(void); void KEY_LEFT_EVENT_NONE_Service(void);
void Key_Operation_Right(Key_Event_en_t enKeyEvent); void Key_Operation_Right(Key_Event_en_t enKeyEvent);
void Key_Operation_Left(Key_Event_en_t enKeyEvent); void Key_Operation_Left(Key_Event_en_t enKeyEvent);
...@@ -47,8 +50,6 @@ Key_Status_en_t Key_Status_Read_Left(void); ...@@ -47,8 +50,6 @@ 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_Clear_Time(void); void Key_Clear_Time(void);
void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datMin, uint8_t datStep, uint8_t *dat); void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datMin, uint8_t datStep, uint8_t *dat);
void Key_Right_Long_Press(void);
void Key_Right_Short_Press(void);
void Key_Left_Short_Press(void); void Key_Left_Short_Press(void);
void Key_Left_Long_Press(void); void Key_Left_Long_Press(void);
void Key_Auto_Save(void); void Key_Auto_Save(void);
...@@ -56,7 +57,10 @@ uint8_t Get_Dis_Hour_Time(void); ...@@ -56,7 +57,10 @@ uint8_t Get_Dis_Hour_Time(void);
uint8_t Get_Dis_Minute_Time(void); uint8_t Get_Dis_Minute_Time(void);
uint8_t Get_Current_PageType(void); uint8_t Get_Current_PageType(void);
void TYW_RESET_ODO(void); void TYW_RESET_ODO(void);
uint8_t Get_Dis_Unit(void); uint8_t Get_Dis_KM_Unit(void);
uint8_t Get_Dis_Tpms_Unit(void);
uint8_t Get_Dis_Tcs_Val(void);
void Key_Check_Service(void); void Key_Check_Service(void);
void MenuData_Unit_Init(void); void MenuData_Unit_Init(void);
void Maintain_Reset_Service(void);
#endif #endif
...@@ -201,11 +201,11 @@ void Services_Mileage_Callback(void) ...@@ -201,11 +201,11 @@ void Services_Mileage_Callback(void)
uint32_t Get_ODO_Value(void) uint32_t Get_ODO_Value(void)
{ {
uint32_t ODO = 0; uint32_t ODO = 0;
if (Get_Dis_Unit() == 0) /* 公制 */ if (Get_Dis_KM_Unit() == 0) /* 公制 */
{ {
ODO = Data_ODO_Read(); ODO = Data_ODO_Read();
} }
else if (Get_Dis_Unit() == 1) /* 英制 */ else if (Get_Dis_KM_Unit() == 1) /* 英制 */
{ {
ODO = Data_Km_To_Mile(Data_ODO_Read()); ODO = Data_Km_To_Mile(Data_ODO_Read());
} }
...@@ -223,11 +223,11 @@ uint32_t Get_ODO_Value(void) ...@@ -223,11 +223,11 @@ uint32_t Get_ODO_Value(void)
uint32_t Get_Trip_Value(void) uint32_t Get_Trip_Value(void)
{ {
uint32_t Trip = 0; uint32_t Trip = 0;
if (Get_Dis_Unit() == 0) /* 公制 */ if (Get_Dis_KM_Unit() == 0) /* 公制 */
{ {
Trip = Data_Read_Trip(EM_TRIP_A); Trip = Data_Read_Trip(EM_TRIP_A);
} }
else if (Get_Dis_Unit() == 1) /* 英制 */ else if (Get_Dis_KM_Unit() == 1) /* 英制 */
{ {
Trip = Data_Km_To_Mile(Data_Read_Trip(EM_TRIP_A)); Trip = Data_Km_To_Mile(Data_Read_Trip(EM_TRIP_A));
} }
...@@ -244,7 +244,7 @@ uint32_t testtrip = 0; ...@@ -244,7 +244,7 @@ uint32_t testtrip = 0;
*/ */
void Trip_Clear_Km_Service(void) void Trip_Clear_Km_Service(void)
{ {
if (Get_Dis_Unit() == 0) /* 公制 */ if (Get_Dis_KM_Unit() == 0) /* 公制 */
{ {
if (Data_Read_Trip(EM_TRIP_A) > 9999) /* 当前单位在KM时,里程大于999.9KM进行清零 */ if (Data_Read_Trip(EM_TRIP_A) > 9999) /* 当前单位在KM时,里程大于999.9KM进行清零 */
{ {
...@@ -261,13 +261,18 @@ void Trip_Clear_Km_Service(void) ...@@ -261,13 +261,18 @@ void Trip_Clear_Km_Service(void)
*/ */
void Unit_Convert_Service(void) void Unit_Convert_Service(void)
{ {
if (Get_Dis_Unit() == 0) /* 公制 */ if (Get_Dis_KM_Unit() == 0) /* 公制 */
{ {
if (Data_Read_Trip(EM_TRIP_A) > 9999) /* 当前单位在KM时,里程大于999.9KM进行清零 */ if (Data_Read_Trip(EM_TRIP_A) > 9999) /* 当前单位在KM时,里程大于999.9KM进行清零 */
{ {
Data_Write_Trip(EM_TRIP_A, 9999); Data_Write_Trip(EM_TRIP_A, 9999);
} }
} }
if (Get_Dis_Tpms_Unit() == 0) /* bar */
{
;
}
} }
......
...@@ -69,7 +69,7 @@ void Sys_50ms_Tasks(void) ...@@ -69,7 +69,7 @@ void Sys_50ms_Tasks(void)
uint8_t u8LEDDriverCheckCount = 0U; uint8_t u8LEDDriverCheckCount = 0U;
void Sys_100ms_Tasks(void) void Sys_100ms_Tasks(void)
{ {
if(PageType == Page_Time) if((PageType != Page_Time_Hour)&&(PageType != Page_Time_Minute))
{ {
RTE_RTC_Get_CounterValue(&counter_val); RTE_RTC_Get_CounterValue(&counter_val);
counter_val.time.RTC_Hours = RTC_Bcd2ToByte(counter_val.time.RTC_Hours); counter_val.time.RTC_Hours = RTC_Bcd2ToByte(counter_val.time.RTC_Hours);
......
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