Commit ab5a58eb authored by 郑萍's avatar 郑萍

feat:电源模式切换到Key_ACC自检

parent a438ed2b
......@@ -9,7 +9,7 @@
uint8_t interact_PWM_Low_Duty = 0;
void BackLight_Process(void)
{
if (SYS_OPR_STAT_IGN_ON)
if (Get_CAN_Power_State() != PKEY_ON && Get_CAN_Power_State() != KEY_OFF )
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_DAY);
}
......@@ -21,7 +21,7 @@ void BackLight_Process(void)
void Interact_Light_Process(void)
{
if (SYS_OPR_STAT_IGN_ON)
if (Get_CAN_Power_State() != PKEY_ON && Get_CAN_Power_State() != KEY_OFF )
{
TimerM_PWM_set_duty(TIMERM_COUNTER0, TIMERM_CHD, interact_PWM_Low_Duty * 10);
}
......
......@@ -173,6 +173,38 @@ void System_Indicator_OFF_callback(void)
{
System_Indicator_CANFlag = 1;
}
uint8_t Get_CAN_Power_State(void)
{
uint8_t state = 0;
uint8_t Signal1 = Get_CAN_CH0_ID_125_Sig_MMCU_PowerMode();
switch (Signal1)
{
case 0x0:
state = KEY_OFF;
break;
case 0x1:
state = PKEY_ON;
break;
case 0x2:
state = KEY_ACC;
break;
case 0x3:
state = READY;
break;
case 0x4:
state = CHRG_PLUGIN;
break;
case 0x5:
state = CHRGING;
break;
case 0x6:
state = CHRGEND;
break;
default:
break;
}
return state;
}
uint8_t Get_CAN_CH0_ID_393_Sig_ICU_ProtoSubVer(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x393_Msg_Count, 6u) >> 0u) & 0xFFu));
......
......@@ -30,6 +30,18 @@ typedef enum
CAN_CH0_ID_TOTAL_MAX,
} CAN_CH0_CAN_MSG_ID_t;
typedef enum
{
KEY_OFF = 0,
PKEY_ON,
KEY_ACC,
READY,
CHRG_PLUGIN,
CHRGING,
CHRGEND,
} POWER_CHECK_STATE_t;
typedef enum
{
......@@ -125,5 +137,6 @@ extern uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID);
extern uint8_t System_Indicator_CANFlag;
void System_Indicator_ON_callback(void);
void System_Indicator_OFF_callback(void);
extern uint8_t Get_CAN_Power_State(void);
#endif
#include "CommonInterface\CommonInterface.h"
#include "CAN_APP\CAN_CH0_CAN_Communication_Matrix.h"
static uint32_t PowerIgnOnTimeLine;
uint32_t PowerIgnOffTimeLine;
uint32_t PowerIgnOffTimeLine;
uint8_t Power_CheckSelf = 0;
static uint32_t PowerSocTimeLine;
static COMMON_PowerStatus_t PowerSts; /*1 ON ; 0 OFF*/
......@@ -50,7 +51,7 @@ uint16_t Common_Get_Act_V_Speed_ODO(void)
// uint16_t Common_Get_Disp_V_Speed(void)
// {
// return Disp_V_Speed;
// }
// }
uint16_t Common_Get_TireSize(void)
{
......@@ -106,27 +107,31 @@ void Common_Input_Para(void)
{
if (SYS_OPR_STAT_IGN_ON)
{
Common_Set_IG_Sts(COMMON_POWER_ON);
Common_Set_IG_Sts_Valid(COMMON_Valid);
if ((Get_CAN_Power_State() != KEY_OFF))
{
Common_Set_IG_Sts(COMMON_POWER_ON);
Common_Set_IG_Sts_Valid(COMMON_Valid);
// Common_Set_Act_V_Speed(Get_ActualVechileSpeed());
// Common_Set_Disp_V_Speed(Get_DispVechileSpeed());
// if (Get_VechileSpeedValid() == COMMON_Valid)
// {
// Common_Set_Act_V_Speed_Valid(COMMON_Valid);
// Common_Set_Disp_V_Speed_Valid(COMMON_Valid);
// }
// else
// {
// Common_Set_Act_V_Speed_Valid(COMMON_InValid);
// Common_Set_Disp_V_Speed_Valid(COMMON_InValid);
// }
PowerIgnOffTimeLine = 0ul;
if (PowerIgnOnTimeLine < 0x7ffffffful)
PowerIgnOffTimeLine = 0ul;
if (PowerIgnOnTimeLine < 0x7ffffffful)
{
PowerIgnOnTimeLine += 2u;
}
}
else
{
PowerIgnOnTimeLine = 0ul;
if (PowerIgnOffTimeLine < 0x7ffffffful)
{
PowerIgnOffTimeLine += 2u;
}
Common_Set_IG_Sts(COMMON_POWER_OFF);
Common_Set_IG_Sts_Valid(COMMON_Valid);
}
if ((Get_CAN_Power_State() == PKEY_ON))
{
PowerIgnOnTimeLine += 2u;
PowerIgnOnTimeLine = 0ul;
}
}
else
......@@ -138,10 +143,6 @@ void Common_Input_Para(void)
}
Common_Set_IG_Sts(COMMON_POWER_OFF);
Common_Set_IG_Sts_Valid(COMMON_Valid);
// /*车转真实值OFF为0*/
// Common_Set_Act_V_Speed(0u);
// Common_Set_Disp_V_Speed(0u);
}
}
......@@ -160,16 +161,14 @@ uint32_t Common_GetSocTime(void)
return PowerSocTimeLine;
}
/**
* @brief 公里转换英里
* @return 公里
*/
uint32_t Data_Km_To_Mile(uint32_t Km)
{
//Km *= 621;
//Km /= 1000;
{
// Km *= 621;
// Km /= 1000;
Km *= 100;
Km /= 161;
return Km;
......@@ -184,5 +183,3 @@ uint32_t Data_Mile_To_Km(uint32_t Mile)
Mile /= 100;
return Mile;
}
#include "GUI_Display\GUI_Display.h"
#include "SEG_DISPLAY\SEG_DISPLAY.h"
#include "SEG_DISPLAY\SEG_DISPLAY.h"
#include "Application.h"
uint8_t SOC_1_Flag_Count = 0;
......@@ -49,7 +49,7 @@ uint8_t SOC_2_Count = 0;
// }
// }
// }
// }
// void Gauge_Power_2_SOC_Display(void)
// {
......@@ -103,7 +103,7 @@ uint8_t SOC_2_Count = 0;
// VSpeedDisplayValue = 0u;
// SEG_SET_VSpeed_NUM(0u, 0u);
// }
// }
void Gauge_Clock_Display(void)
{
......@@ -111,7 +111,7 @@ void Gauge_Clock_Display(void)
// if (Common_Get_IG_Sts( ) == COMMON_POWER_ON)
// {
// // PageType_DIS = Get_Current_PageType();
// if ( PageType_DIS == 1 )
// {
// if(FLASH_SYNC_1Hz)
......@@ -122,7 +122,7 @@ void Gauge_Clock_Display(void)
// {
// SEG_SET_Clock(Get_Dis_Hour_Time(), Get_Dis_Minute_Time(), 1, 0, 1);
// }
// }
// else if ( PageType_DIS == 2 )
// {
......@@ -135,7 +135,7 @@ void Gauge_Clock_Display(void)
// SEG_SET_Clock(Get_Dis_Hour_Time(), Get_Dis_Minute_Time(), 1, 1, 0);
// }
// }
// else
// else
// {
// SEG_SET_Clock(Get_Dis_Hour_Time(), Get_Dis_Minute_Time(), FLASH_SYNC_1Hz, 1, 1);
// }
......@@ -148,9 +148,9 @@ void Gauge_Clock_Display(void)
void Gauge_Trip_Display(void)
{
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
{
SEG_SET_TRIP_NUM(1u, Get_Trip_Value());
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
SEG_SET_TRIP_NUM(1u, Get_Trip_Value());
}
else
{
......@@ -160,7 +160,7 @@ void Gauge_Trip_Display(void)
void Gauge_ODO_Display(void)
{
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
SEG_SET_ODO_NUM(1u, Get_ODO_Value() / 10u);
}
......@@ -171,7 +171,7 @@ void Gauge_ODO_Display(void)
}
void Gauge_EspeedDial_Display(void)
{
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
// SEG_SET_EspeedDial(1, Get_DispEngineSpeed()/1000, Get_DispEngineSpeed());
}
......@@ -181,8 +181,8 @@ void Gauge_EspeedDial_Display(void)
}
}
void Gauge_Frame_Display(void)
{
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
{
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
SEG_SET_Frame(1);
}
......@@ -192,98 +192,78 @@ void Gauge_Frame_Display(void)
}
}
void Clear_Bu98(void)
{
uint8_t i = 0;
for(i = 0; i < BU98R10_DDRAM_SIZE; i ++)
for (i = 0; i < BU98R10_DDRAM_SIZE; i++)
{
BU98R10Chip0DDRAM.Byte[i] = 0;
BU98R10Chip1DDRAM.Byte[i] = 0;
}
}
void Gauge_Service(void)
{
static uint16_t VSpeed_Count = 0u;
Gauge_Frame_Display();
uint8_t i = 0;
Gauge_Frame_Display();
if (0)
{
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
Check_SEG_Display();
Check_SEG_Display();
}
else
{
Clear_Bu98();
// RTE_GPIO_Set_Level(VSPEED_TEN_OUT, 0);
// RTE_GPIO_Set_Level(VSPEED_HUNDREDS_OUT, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_29_MPH, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_30_KM_H, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Key_ISTOP, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_02_Normal_Voltage, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_High_Low_Voltage, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_06_Screen_Time, 0);
}
}
else
{
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
if (Common_Get_IG_Sts() == COMMON_POWER_ON && ADC_Read_Signal(ADC_CH_KL30_VOLTAGE) <= 16000 && ADC_Read_Signal(ADC_CH_KL30_VOLTAGE) >= 9000)
{
if (Common_GetIgnOnTime() >= 3000)
if (Get_CAN_Power_State() != PKEY_ON )
{
// Gauge_Power_1_SOC_Display();
// Gauge_Power_2_SOC_Display();
Gauge_ODO_Display();
Gauge_Clock_Display();
Gauge_Trip_Display();
Gauge_EspeedDial_Display();
SEG_SET_Clock(22,22,1,1,1);
SEG_SET_Fault_Code(1,2222);
SEG_SET_EleDial(1,10,22);
SEG_SET_FuelDial(1,8);
SEG_SET_GEAR(1,1);
SEG_SET_Cutterhead(1,2);
SEG_SET_LED_STS(0,1);
SEG_SET_LED_STS(1,1);
SEG_SET_LED_STS(2,1);
SEG_SET_LED_STS(3,1);
SEG_SET_LED_STS(4,1);
SEG_SET_LED_STS(5,1);
SEG_SET_LED_STS(6,1);
SEG_SET_LED_STS(7,1);
SEG_SET_LED_STS(8,1);
SEG_SET_LED_STS(9,1);
SEG_SET_LED_STS(10,1);
SEG_SET_LED_STS(11,1);
SEG_SET_LED_STS(12,1);
SEG_SET_LED_STS(13,1);
SEG_SET_LED_STS(14,1);
SEG_SET_LED_STS(15,1);
SEG_SET_LED_STS(16,1);
SEG_SET_LED_STS(17,1);
SEG_SET_LED_STS(18,1);
SEG_SET_Frame(1);
if (Common_GetIgnOnTime() >= 3000)
{
// Gauge_Power_1_SOC_Display();
// Gauge_Power_2_SOC_Display();
Checkself_Init();
Gauge_ODO_Display();
Gauge_Clock_Display();
Gauge_Trip_Display();
Gauge_EspeedDial_Display();
SEG_SET_Clock(22, 22, 1, 1, 1);
SEG_SET_Fault_Code(0, 2222);
SEG_SET_EleDial(1, 10, 22);
SEG_SET_FuelDial(0, 8);
SEG_SET_GEAR(1, 1);
SEG_SET_Cutterhead(1, 2);
SEG_SET_Frame(1);
interact_PWM_Low_Duty = 0;
}
else
{
Checkself_SEG_Display();
}
}
else
{
Checkself_SEG_Display();
{
// Clear_Bu98();
// for (i = 0; i < LampCh0_MAX; i++)
// {
// LED_Driver_Channel_Set(LampChannel_0, i, LED_OFF);
// }
interact_PWM_Low_Duty = 50;
//蜂鸣器
}
}
else
{
Clear_Bu98();
// RTE_GPIO_Set_Level(VSPEED_TEN_OUT, 0);
// RTE_GPIO_Set_Level(VSPEED_HUNDREDS_OUT, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_29_MPH, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_30_KM_H, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Key_ISTOP, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_02_Normal_Voltage, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_High_Low_Voltage, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_06_Screen_Time, 0);
for (i = 0; i < LampCh0_MAX; i++)
{
LED_Driver_Channel_Set(LampChannel_0, i, LED_OFF);
}
}
}
}
}
......@@ -53,6 +53,7 @@ static void Power_KL30_Init(void)
Checkself_Init();
LINE_IN_Init();
LED_Driver_Init_Example();//注意顺序2
LED_Driver_Service_Immediate();
Data_User_Mileage_KL30Init();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
......
......@@ -21,15 +21,6 @@ void Sys_2ms_Tasks(void)
Sys_Status_Update_Service();
Analog_Signal_Conv_Service();
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp,2u);
// if (RTE_GPIO_Get_Level(VSPEED_TEN_OUT))
// {
// RTE_GPIO_Config(VSPEED_TEN_OUT, RTE_GPIO_DIR_OUT|RTE_GPIO_LEVEL_LOW);
// }
// else
// {
// RTE_GPIO_Config(VSPEED_TEN_OUT, RTE_GPIO_DIR_OUT|RTE_GPIO_LEVEL_HIGH);
// }
}
void Sys_5ms_Tasks(void)
......@@ -66,15 +57,9 @@ void Sys_50ms_Tasks(void)
uint8_t u8LEDDriverCheckCount = 0U;
void Sys_100ms_Tasks(void)
{
// if(PageType == Page_Time)
// {
// RTE_RTC_Get_CounterValue(&counter_val);
// counter_val.time.RTC_Hours = RTC_Bcd2ToByte(counter_val.time.RTC_Hours);
// counter_val.time.RTC_Minutes = RTC_Bcd2ToByte(counter_val.time.RTC_Minutes);
// }
BackLight_Process();
Interact_Light_Process();
// Services_Mileage_Callback();
S3_ServerCNTT();
if (u8LEDDriverCheckCount >= 10U)
......
......@@ -40,7 +40,7 @@
#include "cgc.h"
#include "userdefine.h"
#include "Components.h"
/**
* @brief Main program.
*/
......
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