Commit ca47e7a3 authored by 李俭双's avatar 李俭双

Merge branch 'lijianshuang' into 'dev'

Lijianshuang

See merge request ty/tianying_ty100!25
parents 6a7302aa b519e533
......@@ -19,7 +19,7 @@ void BackLight_Process(void)
{
if (SYS_OPR_STAT_IGN_ON)
{
if ( HighBeam_Timer.LED_Turnon == 5 )
if ( HighBeam_Timer.LED_Turnon == 10 )
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_NIGHT);
}
......
......@@ -123,10 +123,14 @@ void Data_TPMS_Processing_Service ( void )
}
uint32_t Data_Bar_To_Psi (uint32_t bar)
{
bar *= 145;
bar /= 10;
bar += 5;
return bar;
uint32_t Bar = 0;
Bar = bar * 145;
Bar /= 10;
Bar += 5;
// bar *= 145;
// bar /= 10;
// bar += 5;
return Bar;
}
uint8_t Get_Led_TPMS_Waring (void)
{
......@@ -146,7 +150,7 @@ uint16_t Get_Front_TPMS_Sig_Value (void)
uint16_t value = 0;
if (TPMS.TPMS_Unit == 1)
{
value = Data_Bar_To_Psi(TPMS.Front_Press_Value) / 100;
value = (Data_Bar_To_Psi(TPMS.Front_Press_Value) + 50) / 100;
if(value > 99)
{
value = 99;
......@@ -164,7 +168,7 @@ uint16_t Get_Rear_TPMS_Sig_Value (void)
uint16_t value = 0;
if (TPMS.TPMS_Unit == 1)
{
value = Data_Bar_To_Psi(TPMS.Rear_Press_Value) / 100;
value = (Data_Bar_To_Psi(TPMS.Rear_Press_Value) + 50) / 100;
if(value > 99)
{
value = 99;
......
......@@ -125,27 +125,25 @@ void Fuel_R_Cal(uint8_t deltaTime)
void Fuel_State_Check(uint8_t deltaTime)
{
// if (FuelR < 20)
//{ /*短路 1*/
// FuelSensorOpenTime = 0;
// FuelSensorNormalTime = 0;
// if ((FuelSensorShortTime > 3000) || ((FuelStateInitFlag) && (FuelSensorShortTime > 3000)))
// {
// FuelSensorState = FuelSensorShortCircuit;
// DesFuelSetp = 0;
// CurFuelSetp = 0;
// FuelStateInitFlag = 0;
// FuelInitFlag = 1;
// FuelDir = FUEL_SEG_UP;
// }
// else
// {
// FuelSensorShortTime += deltaTime;
// }
// }
// else
if (FuelR >= 10000)
if (FuelR < 30)
{ /*短路 1*/
FuelSensorOpenTime = 0;
FuelSensorNormalTime = 0;
if ((FuelSensorShortTime > 3000) || ((FuelStateInitFlag) && (FuelSensorShortTime > 3000)))
{
FuelSensorState = FuelSensorShortCircuit;
DesFuelSetp = 0;
CurFuelSetp = 0;
FuelStateInitFlag = 0;
FuelInitFlag = 1;
FuelDir = FUEL_SEG_UP;
}
else
{
FuelSensorShortTime += deltaTime;
}
}
else if (FuelR >= 3100)
{ /*断路 320*/
FuelSensorShortTime = 0;
FuelSensorNormalTime = 0;
......@@ -184,7 +182,7 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
{
static uint32_t time = 0;
if ((FuelSensorState == FuelSensorNormal) && (FuelR < 10000))
if ((FuelSensorState == FuelSensorNormal) && (FuelR < 3100))
{ // 32000 //FuelR >10 change FuelR >20
/*采集完第一组数据后,开始计算燃油格数*/
if (FuelADCompleteFlg)
......@@ -383,6 +381,18 @@ FuelSensorSts_t Get_Fuel_Sensor_State(void)
uint16_t Get_Fuel_RES(void)
{
uint16_t Fuel_Res = 0;
Fuel_Res = FuelR / 10;
if(Get_Fuel_Sensor_State() == FuelSensorShortCircuit)
{
Fuel_Res = 3;
}
else if (Get_Fuel_Sensor_State() == FuelSensorOpenCircuit)
{
Fuel_Res = 310;
}
else
{
Fuel_Res = FuelR / 10;
}
return Fuel_Res;
}
......@@ -354,13 +354,13 @@ void SEG_SET_Navigation_STS(uint8_t m_Flag, uint8_t m_Code, uint32_t m_Mileage)
IC2_SEG162 = IC_SEG_ON;
IC2_SEG161 = IC_SEG_ON;
IC2_SEG160 = IC_SEG_ON;
LED_Driver_Channel_Set(LampChannel_0, LampCh0_10_Navigator1, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_19_Navigator2, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_17_Length2, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_18_Length1, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_14_ARRIVED_SERVICE_AREA, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_15_ARRIVED_TOLLGATE, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_16_ARRIVED_TUNNEL, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_10_Navigator1, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_19_Navigator2, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_17_Length2, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_18_Length1, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_14_ARRIVED_SERVICE_AREA, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_15_ARRIVED_TOLLGATE, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_16_ARRIVED_TUNNEL, LED_ON);
}
else
{
......@@ -979,7 +979,7 @@ void SEG_SET_FuelDial(uint8_t m_Flag, uint8_t m_SEG)
IC2_SEG102 = IC_SEG_GREY;
IC2_SEG101 = IC_SEG_GREY;
if ((Get_Fuel_Sensor_State() == 2) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
if (((Get_Fuel_Sensor_State() == 2) || (Get_Fuel_Sensor_State() == 1))&& (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
{
if (FLASH_SYNC_1Hz)
{
......@@ -3118,7 +3118,7 @@ void SEG_SET_ODO_TRIP_FAULTCODE_TCS_DIS(uint8_t m_Uint, uint32_t m_NUM_ODO, uint
IC1_SEG074 = IC_SEG_ON;
IC1_SEG073 = IC_SEG_ON;
IC1_SEG069 = IC_SEG_ON;
if(FaultCode_Number == 0)
if((FaultCode_Number == 0) && (FaultCode_Data[0] == 0))
{
SEG_SET_DTC_NUM(0);
DTC_DISTimer = 0;
......@@ -3149,7 +3149,7 @@ void SEG_SET_ODO_TRIP_FAULTCODE_TCS_DIS(uint8_t m_Uint, uint32_t m_NUM_ODO, uint
}
Current_DTC_CODE = FaultCode_Data[DTC_DISCount] ;
DTC_DISTimer = 0;
if(Current_DTC_CODE == Current_DTC_CODE_BACK)
if((Current_DTC_CODE == Current_DTC_CODE_BACK) && (DTC_DISCount < (FaultCode_Number - 1)))
{
DTC_DISCount ++ ;
Current_DTC_CODE = FaultCode_Data[DTC_DISCount] ;
......
......@@ -34,7 +34,7 @@ typedef enum
#define NaviIconType_RIGHT_FRONT 0x05
#define NaviIconType_LEFT_BACK 0x06
#define NaviIconType_RIGHT_BACK 0x07
#define NaviIconType_STRAIGHT 0x08
#define NaviIconType_STRAIGHT 0x09
#define NaviIconType_ARRIVED_SERVICE_AREA 0x0D
#define NaviIconType_ARRIVED_TOLLGATE 0x0E
#define NaviIconType_ARRIVED_TUNNEL 0x10
......
......@@ -9,7 +9,8 @@ _Menu_Infor MenuInfor;
_Menu_Data MenuData;
uint8_t PageType = 0;
uint8_t PageMenu = 0;
uint8_t Hour_Set = 0;
uint8_t Minute_Set = 0;
RTC_TimeTypeDef RTC_TimeStruct;
RTC_DateTypeDef RTC_DateStruct;
......@@ -20,10 +21,18 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
switch (enKeyEvent)
{
case KEY_EVENT_SHORT_PRESS_1://1s
Key_Left_Short_Press();
if (Common_GetIgnOnTime() >= 3000)
{
Key_Left_Short_Press();
}
break;
case KEY_EVENT_SHORT_PRESS_2://3-5s
Key_Left_Long_Press();
if (Common_GetIgnOnTime() >= 3000)
{
Key_Left_Long_Press();
}
break;
case KEY_EVENT_LONG_PRESS_1: //7
break;
......@@ -32,26 +41,30 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
case KEY_EVENT_LONG_PRESS_3: //9s
break;
case KEY_EVENT_LONG_PRESS_4: //10s
Maintain_Reset_Service();
if((PageMenu == Page_TCS) && (PageType == Page_Menu))
if (Common_GetIgnOnTime() >= 3000)
{
if(Get_Dis_Tcs_Val() == 0)
Maintain_Reset_Service();
if((PageMenu == Page_TCS) && (PageType == Page_Menu))
{
MenuData.Tcs_Val = 1;//on
if(Get_Dis_Tcs_Val() == 0)
{
MenuData.Tcs_Val = 1;//on
}
else
{
MenuData.Tcs_Val = 0;//off
}
}
else
if((PageMenu == Page_Trip) && (PageType == Page_Menu))
{
MenuData.Tcs_Val = 0;//off
Data_Clear_Trip_All();
}
TYW_RESET_ODO();
}
if((PageMenu == Page_Trip) && (PageType == Page_Menu))
{
Data_Clear_Trip_All();
}
TYW_RESET_ODO();
break;
case KEY_EVENT_OFF_TO_ON:
break;
......@@ -235,7 +248,8 @@ void Key_Left_Short_Press(void)
datmax = 23u;
datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(counter_val.time.RTC_Hours));
RTC_SetTime(&counter_val.time);
Hour_Set = 1;
//RTC_SetTime(&counter_val.time);
}
else if(PageType == Page_Time_Minute)
{
......@@ -243,8 +257,8 @@ void Key_Left_Short_Press(void)
datmax = 59u;
datmin = 0u;
Menu_u8Data_Updata_Process(updataDir, datmax, datmin, 1u, (uint8_t*)&(counter_val.time.RTC_Minutes));
RTC_SetTime(&counter_val.time);
//RTC_SetTime(&counter_val.time);
Minute_Set = 1;
}
else if(PageType == Page_Km_Unit)
{
......@@ -283,12 +297,23 @@ void Key_Auto_Save(void)
{
if(PageType == Page_Time_Hour)
{
RTC_SetTime(&counter_val.time);
if (Hour_Set == 1)
{
counter_val.time.RTC_Seconds = 0;
RTC_SetTime(&counter_val.time);
Hour_Set = 0;
}
}
if(PageType == Page_Time_Minute)
{
RTC_SetTime(&counter_val.time);
if(Minute_Set == 1)
{
counter_val.time.RTC_Seconds = 0;
RTC_SetTime(&counter_val.time);
Minute_Set = 0;
}
}
PageType = Page_Menu ;
}
......@@ -303,10 +328,22 @@ void Key_Left_Long_Press(void)
}
else if(PageType == Page_Time_Hour)
{
if (Hour_Set == 1)
{
counter_val.time.RTC_Seconds = 0;
RTC_SetTime(&counter_val.time);
Hour_Set = 0;
}
PageType = Page_Time_Minute;
}
else if(PageType == Page_Time_Minute)
{
if (Minute_Set == 1)
{
counter_val.time.RTC_Seconds = 0;
RTC_SetTime(&counter_val.time);
Minute_Set = 0;
}
PageType = Page_Km_Unit;
}
else if(PageType == Page_Km_Unit)
......@@ -382,6 +419,8 @@ void MenuData_TCS_Init(void)
{
MenuData.Tcs_Val = 1;
PageType = Page_Menu;
Hour_Set = 0;
Minute_Set = 0;
}
uint8_t ClearODO_Flag = 0;
......
......@@ -3,7 +3,7 @@
/*-----------------------------------------------------------*/
#define LED_ON 100
#define LED_ON 186
#define LED_OFF 0
#define LED_LINEOUT_Low 0
#define LED_LINEOUT_High 1
......
......@@ -64,16 +64,17 @@ static void Power_KL30_Init(void)
Key_KL30_Init_EXample();
//Light_Sensor_Init_Example();//注意顺序1
LED_Driver_Init_Example();//注意顺序2
LED_Driver_Service_Immediate();
Data_User_Mileage_KL30Init();
Fuel_KL30_Init();
Data_Voltage_Init();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHB, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHC, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High);
// TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHB, ActiveLevel_High);
// TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHC, ActiveLevel_High);
// TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
Telltales_Init();
......@@ -94,6 +95,7 @@ extern uint32_t PowerIgnOffTimeLine;
static void Power_Wakeup_Init(void)
{
PowerIgnOffTimeLine = 0;
//RTE_CLOCK_Select_Start();
Simulated_IIC_2_Init();
Gpio_Init(Gpio_WakeUp_Init);
Can_Init();
......@@ -112,18 +114,19 @@ static void Power_Wakeup_Init(void)
MenuData_TCS_Init();
//Light_Sensor_Init_Example();//注意顺序1
LED_Driver_Init_Example();//注意顺序2
LED_Driver_Service_Immediate();
Protocol_KL30_Wakeup_Init();
Uart0_Init(115200);
BlueTooth_KL30_KL15_Wakeup_Init();
Fuel_KL30_Init();
Data_Voltage_Init();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHB, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHC, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High);
// TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHB, ActiveLevel_High);
// TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHC, ActiveLevel_High);
// TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
Telltales_Init();
Telltales_UserInit();
......@@ -162,8 +165,8 @@ static void Power_IG_ON_Init(void)
static void Power_Sleep_Init(void)
{
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 0);
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 0);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 0);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 0);
//TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHB, ActiveLevel_High);
//TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHC, ActiveLevel_High);
//TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High);
......@@ -182,6 +185,7 @@ static void Power_Sleep_Init(void)
LED_Driver_Init_Sleep();
LED_Driver_Service();
Analog_Signal_Conv_Stop();
UART_DeInit(UART0);
RTE_DEEPSLEEP_Enable();
}
......
......@@ -90,13 +90,13 @@ static Tellib_uint16_t LED_High_Beam_Judgement(void)
if (Line_In_Get_Status(LINE_IN_HighBeam))
{
LED_STATE = 1;
if(HighBeam_Timer.LED_Turnon < 5 )
if(HighBeam_Timer.LED_Turnon < 10 )
{
HighBeam_Timer.LED_Turnon ++;
}
else
{
HighBeam_Timer.LED_Turnon = 5;
HighBeam_Timer.LED_Turnon = 10;
HighBeam_Timer.LED_Turnoff = 0;
}
......@@ -104,13 +104,13 @@ static Tellib_uint16_t LED_High_Beam_Judgement(void)
else
{
LED_STATE = 0;
if(HighBeam_Timer.LED_Turnoff < 5 )
if(HighBeam_Timer.LED_Turnoff < 10 )
{
HighBeam_Timer.LED_Turnoff ++;
}
else
{
HighBeam_Timer.LED_Turnoff = 5;
HighBeam_Timer.LED_Turnoff = 10;
HighBeam_Timer.LED_Turnon = 0;
}
......
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