Commit 824aa2f5 authored by 郑萍's avatar 郑萍

feat:增加档位显示以及档位自检

parent d7b3317d
......@@ -84,8 +84,8 @@ void Can_Set_Buff_393(canlib_uint8_t CopyData[])
p393->Sig.ICU_SubSoftVer = 1;
p393->Sig.ICU_SoftPhaseVer = 1;
p393->Sig.Res0 = 0x0;
p393->Sig.ICU_ProtoVer = 1;
p393->Sig.ICU_ProtoSubVer = 1;
p393->Sig.ICU_ProtoVer = 0;
p393->Sig.ICU_ProtoSubVer = 7;
p393->Sig.Res1 = 0x00;
}
}
......@@ -329,7 +329,7 @@ void Gauge_Service(void)
interact_PWM_Low_Duty = 50;
if (FLASH_SYNC_05Hz)
{
SEG_SET_GEAR(1, 0);
SEG_SET_GEAR(1, Gear_P, 0);
if (Buzzer_time <= 6000)
{
RTE_GPIO_Config(RTE_GPIO_PORT04_PIN01, GpioOut_High); // OUT_EN_1
......@@ -343,7 +343,7 @@ void Gauge_Service(void)
}
else
{
SEG_SET_GEAR(0, 0);
SEG_SET_GEAR(1, Gear_OFF, 0);
RTE_GPIO_Config(RTE_GPIO_PORT04_PIN01, GpioOut_Low); // OUT_EN_1
BUZZER_ON = 0;
}
......@@ -382,6 +382,7 @@ void Gauge_CAN_setup_Service(void)
Charge_OFF_Flag = 0;
interact_PWM_Low_Duty = 0;
Gauge_Power_SOC_pull_Display();
SEG_SET_Cutterhead(1, 3, 1);
}
break;
case READY:
......
......@@ -130,10 +130,80 @@ _Fun_Res SEG_SET_LED_STS(uint8_t LED_NUM, uint8_t m_Flag)
* - EX_OK 上报成功
* - EX_ERR 上报失败
*/
_Fun_Res SEG_SET_Cutterhead(uint16_t LED_NUM, uint8_t m_Flag)
_Fun_Res SEG_SET_Cutterhead(uint8_t m_Flag, uint8_t LED_NUM, uint8_t checkself)
{
_Fun_Res m_Res;
uint8_t m8 = 0;
if (m_Flag)
{
if (checkself == 1)
{
IC1_SEG118 = IC_SEG_ON;
IC1_SEG073 = IC_SEG_ON;
IC1_SEG074 = IC_SEG_ON;
IC1_SEG079 = IC_SEG_ON;
IC1_SEG117 = IC_SEG_ON;
IC1_SEG083 = IC_SEG_ON;
IC1_SEG116 = IC_SEG_ON;
m8 = SEG_DISPLAY_NUMBER0[LED_NUM];
if (Bit_Is_Set(m8, 0))
{
IC1_SEG075 = IC_SEG_ON;
}
else
{
IC1_SEG075 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 1))
{
IC1_SEG082 = IC_SEG_ON;
}
else
{
IC1_SEG082 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 2))
{
IC1_SEG081 = IC_SEG_ON;
}
else
{
IC1_SEG081 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 3))
{
IC1_SEG080 = IC_SEG_ON;
}
else
{
IC1_SEG080 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 4))
{
IC1_SEG078 = IC_SEG_ON;
}
else
{
IC1_SEG078 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 5))
{
IC1_SEG076 = IC_SEG_ON;
}
else
{
IC1_SEG076 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 6))
{
IC1_SEG077 = IC_SEG_ON;
}
else
{
IC1_SEG077 = IC_SEG_OFF;
}
}
else
{
IC1_SEG118 = IC_SEG_ON;
IC1_SEG073 = IC_SEG_ON;
......@@ -141,6 +211,7 @@ _Fun_Res SEG_SET_Cutterhead(uint16_t LED_NUM, uint8_t m_Flag)
IC1_SEG079 = IC_SEG_ON;
IC1_SEG117 = IC_SEG_ON;
IC1_SEG083 = IC_SEG_ON;
IC1_SEG116 = IC_SEG_ON;
if (LED_NUM == 1)
{
IC1_SEG075 = IC_SEG_OFF;
......@@ -182,6 +253,7 @@ _Fun_Res SEG_SET_Cutterhead(uint16_t LED_NUM, uint8_t m_Flag)
IC1_SEG077 = IC_SEG_OFF;
}
}
}
else
{
IC1_SEG075 = IC_SEG_OFF;
......@@ -215,20 +287,12 @@ _Fun_Res SEG_SET_Cutterhead(uint16_t LED_NUM, uint8_t m_Flag)
* - EX_ERR 上报失败
*/
_Fun_Res SEG_SET_GEAR(uint8_t m_Gear_Flag, uint8_t m_Gear)
_Fun_Res SEG_SET_GEAR(uint8_t m_Gear_Flag, uint8_t m_Gear, uint8_t checkself)
{
/*挡位符号*/
uint8_t m8 = 0;
if (m_Gear_Flag == 1u)
{
if (m_Gear == Gear_P)
{
IC2_SEG100 = IC_SEG_ON;
IC2_SEG097 = IC_SEG_ON;
IC2_SEG148 = IC_SEG_ON;
IC2_SEG147 = IC_SEG_ON;
IC2_SEG146 = IC_SEG_ON;
IC2_SEG099 = IC_SEG_ON;
IC2_SEG101 = IC_SEG_ON;
IC2_SEG094 = IC_SEG_ON;
IC2_SEG095 = IC_SEG_ON;
IC2_SEG149 = IC_SEG_ON;
......@@ -238,6 +302,93 @@ _Fun_Res SEG_SET_GEAR(uint8_t m_Gear_Flag, uint8_t m_Gear)
IC2_SEG103 = IC_SEG_ON;
IC2_SEG098 = IC_SEG_ON;
IC2_SEG150 = IC_SEG_ON;
if (checkself == 1)
{
m8 = SEG_DISPLAY_NUMBER0[m_Gear];
if (m_Gear == 8)
{
IC2_SEG096 = IC_SEG_ON;
IC2_SEG142 = IC_SEG_ON;
}
else
{
IC2_SEG096 = IC_SEG_OFF;
IC2_SEG142 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 0))
{
IC2_SEG148 = IC_SEG_ON;
}
else
{
IC2_SEG148 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 1))
{
IC2_SEG147 = IC_SEG_ON;
}
else
{
IC2_SEG147 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 2))
{
IC2_SEG144 = IC_SEG_ON;
}
else
{
IC2_SEG144 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 3))
{
IC2_SEG143 = IC_SEG_ON;
IC2_SEG102 = IC_SEG_ON;
}
else
{
IC2_SEG143 = IC_SEG_OFF;
IC2_SEG102 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 4))
{
IC2_SEG100 = IC_SEG_ON;
}
else
{
IC2_SEG100 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 5))
{
IC2_SEG097 = IC_SEG_ON;
}
else
{
IC2_SEG097 = IC_SEG_OFF;
}
if (Bit_Is_Set(m8, 6))
{
IC2_SEG101 = IC_SEG_ON;
IC2_SEG099 = IC_SEG_ON;
IC2_SEG146 = IC_SEG_ON;
}
else
{
IC2_SEG101 = IC_SEG_OFF;
IC2_SEG099 = IC_SEG_OFF;
IC2_SEG146 = IC_SEG_OFF;
}
}
else
{
if (m_Gear == Gear_P)
{
IC2_SEG100 = IC_SEG_ON;
IC2_SEG097 = IC_SEG_ON;
IC2_SEG148 = IC_SEG_ON;
IC2_SEG147 = IC_SEG_ON;
IC2_SEG146 = IC_SEG_ON;
IC2_SEG099 = IC_SEG_ON;
IC2_SEG101 = IC_SEG_ON;
IC2_SEG096 = IC_SEG_OFF;
IC2_SEG142 = IC_SEG_OFF;
......@@ -245,7 +396,7 @@ _Fun_Res SEG_SET_GEAR(uint8_t m_Gear_Flag, uint8_t m_Gear)
IC2_SEG144 = IC_SEG_OFF;
IC2_SEG102 = IC_SEG_OFF;
}
else if (m_Gear == 1)
else if (m_Gear == Gear_1)
{
IC2_SEG097 = IC_SEG_OFF;
IC2_SEG148 = IC_SEG_OFF;
......@@ -257,21 +408,11 @@ _Fun_Res SEG_SET_GEAR(uint8_t m_Gear_Flag, uint8_t m_Gear)
IC2_SEG142 = IC_SEG_OFF;
IC2_SEG143 = IC_SEG_OFF;
IC2_SEG094 = IC_SEG_ON; // 圈
IC2_SEG095 = IC_SEG_ON;
IC2_SEG149 = IC_SEG_ON;
IC2_SEG145 = IC_SEG_ON;
IC2_SEG141 = IC_SEG_ON;
IC2_SEG104 = IC_SEG_ON;
IC2_SEG103 = IC_SEG_ON;
IC2_SEG098 = IC_SEG_ON;
IC2_SEG150 = IC_SEG_ON;
IC2_SEG096 = IC_SEG_OFF;
IC2_SEG144 = IC_SEG_ON;
IC2_SEG102 = IC_SEG_OFF;
}
else if (m_Gear == 2)
else if (m_Gear == Gear_2)
{
IC2_SEG097 = IC_SEG_OFF;
......@@ -287,20 +428,23 @@ _Fun_Res SEG_SET_GEAR(uint8_t m_Gear_Flag, uint8_t m_Gear)
IC2_SEG148 = IC_SEG_ON;
IC2_SEG102 = IC_SEG_ON;
IC2_SEG143 = IC_SEG_ON;
IC2_SEG094 = IC_SEG_ON; // 圈
IC2_SEG095 = IC_SEG_ON;
IC2_SEG149 = IC_SEG_ON;
IC2_SEG145 = IC_SEG_ON;
IC2_SEG141 = IC_SEG_ON;
IC2_SEG104 = IC_SEG_ON;
IC2_SEG103 = IC_SEG_ON;
IC2_SEG098 = IC_SEG_ON;
IC2_SEG150 = IC_SEG_ON;
}
else
else if (m_Gear == Gear_OFF)
{
;
IC2_SEG101 = IC_SEG_OFF;
IC2_SEG099 = IC_SEG_OFF;
IC2_SEG146 = IC_SEG_OFF;
IC2_SEG097 = IC_SEG_OFF;
IC2_SEG100 = IC_SEG_OFF;
IC2_SEG143 = IC_SEG_OFF;
IC2_SEG102 = IC_SEG_OFF;
IC2_SEG144 = IC_SEG_OFF;
IC2_SEG147 = IC_SEG_OFF;
IC2_SEG148 = IC_SEG_OFF;
IC2_SEG096 = IC_SEG_OFF;
IC2_SEG142 = IC_SEG_OFF;
}
}
}
else
......@@ -2449,7 +2593,6 @@ void Checkself_SEG_Display(void)
uint16_t Trip = 0;
uint16_t hour = 0;
uint16_t min = 0;
uint32_t ODO = 0;
soc_all = (Checkself_SEG_step / 1) * 11 + 100;
uint32_t allhour = (Checkself_SEG_step / 1) * 11111;
......@@ -2463,7 +2606,8 @@ void Checkself_SEG_Display(void)
hour = (Checkself_SEG_step / 1) * 11;
min = (Checkself_SEG_step / 1) * 11;
SEG_SET_Clock(hour, min, 1, 1, 1);
SEG_SET_GEAR(1, (Checkself_SEG_step / 1), 1);
SEG_SET_Cutterhead(1, (Checkself_SEG_step / 1), 1);
if (Checkself_SEG_step_count < 20)
{
Checkself_SEG_step_count++;
......
......@@ -35,16 +35,16 @@ typedef enum
enum
{
Gear_P = 0, //P
Gear_R, //R
Gear_N, //N
Gear_D, //D
Gear_1, //R
Gear_2, //N
Gear_OFF, //D
};
/**@brief 边框线显示函数*/
_Fun_Res SEG_SET_Frame(uint8_t m_Flag);
/**@brief 挡位显示函数*/
_Fun_Res SEG_SET_GEAR(uint8_t m_Gear_Flag,uint8_t m_Gear);
_Fun_Res SEG_SET_GEAR(uint8_t m_Gear_Flag,uint8_t m_Gear,uint8_t checkself);
/**@brief 电量表盘1SOC显示函数*/
_Fun_Res SEG_SET_EleDial_1SOC(uint8_t m_Flag,uint8_t m_SEG);
......@@ -100,7 +100,7 @@ _Fun_Res SEG_SET_Travel_Time_NUM(uint8_t m_Flag, uint32_t m_NUM);
_Fun_Res SEG_Scan_SET_EleDial(uint8_t m_SEG);
_Fun_Res SEG_Scan_SET_PowerDial(uint8_t m_SEG);
/**@brief 刀盘显示函数*/
_Fun_Res SEG_SET_Cutterhead(uint16_t LED_NUM, uint8_t m_Flag);
_Fun_Res SEG_SET_Cutterhead(uint8_t m_Flag, uint8_t LED_NUM, uint8_t checkself);
void SEG_Scan_SET_FuelDial(void);
void SEG_Scan_SET_EspeedDial(void);
......
......@@ -375,7 +375,7 @@ static Tellib_uint16_t LED_Battery_Charging_Judgement(void)
Tellib_uint8_t Signal3 = Get_CAN_Power_State();
if(ADC_Read_Signal(ADC_CH_KL30_VOLTAGE) >= 9000 && ADC_Read_Signal(ADC_CH_KL30_VOLTAGE) <= 16000 && (Get_CAN_Power_State() != PKEY_ON && Get_CAN_Power_State() != KEY_OFF))
{
if (Signal1 == 0x1 && Signal2 == 0X1)
if ((Signal1 == 0x1 || Signal1 == 0x0 ) && Signal2 == 0X1)
{
if(Signal3 == CHRG_PLUGIN || Signal3 == CHRGEND)
{
......@@ -475,22 +475,23 @@ static void LED_Cutterhead_Switch_Execution(Tellib_uint16_t led_statu
}
static Tellib_uint16_t LED_GEAR_Judgement(void)
{
Tellib_uint16_t LED_STATE = 1u;
Tellib_uint16_t LED_STATE = 0u;
if(Get_CAN_Power_State() != KEY_OFF && Charge_OFF_Flag == 0)
{
LED_STATE = 1;
}
return LED_STATE;
}
static void LED_GEAR_Execution(Tellib_uint16_t led_status)
{
// if ( led_status == 1u )
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_GEAR_W, LED_ON);
// SEG_SET_GEAR(1,Gear_N);
// }
// else
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_GEAR_W, LED_OFF);
// SEG_SET_GEAR(0,Gear_N);
// SEG_SET_LED_STS(SEG_LED_Cutter_Head_switch,0);
// }
if ( led_status == 1u )
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_GEAR_W, LED_ON);
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_GEAR_W, LED_OFF);
}
}
static Tellib_uint16_t LED_External_Discharge_Judgement(void)
......@@ -756,7 +757,7 @@ static void LED_Cutterhead_Gear_Execution(Tellib_uint16_t led_status)
static Tellib_uint16_t LED_Working_Hours_One_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if (Get_Clockonetime_lenth() == 1)
if (Get_Clockonetime_lenth() == 1 && openLED_flag)
{
LED_STATE = 1;
}
......@@ -839,11 +840,11 @@ static Tellib_uint16_t LED_P_GEAR_G_Judgement(void)
Tellib_uint16_t LED_STATE = 0u;
Tellib_uint8_t Signal1 = Get_CAN_CH0_ID_125_Sig_MMCU_ParkingGearState();
Tellib_uint8_t Signal2 = Get_CAN_Power_State();
if ( Signal1 == 0x1 && openLED_flag)
if ( Signal1 == 0x1 && openLED_flag && checkself_seg_Flag == 0)
{
LED_STATE = 1;
}
else if(Signal2 == PKEY_ON)
else if(Signal2 == PKEY_ON && checkself_seg_Flag == 0)
{
LED_STATE = 2;
}
......@@ -857,28 +858,24 @@ static void LED_P_GEAR_G_Execution(Tellib_uint16_t led_status)
{
if ( led_status == 1u )
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_GEAR_W, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_P_GEAR_G, LED_ON);
SEG_SET_GEAR(Gear_P, 1);
SEG_SET_GEAR(1, Gear_P, 0);
}
else if(led_status == 2u)
{
if(FLASH_SYNC_05Hz)
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_GEAR_W, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_P_GEAR_G, LED_ON);
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_GEAR_W, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_P_GEAR_G, LED_OFF);
}
}
else
else if(checkself_seg_Flag == 0)
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_GEAR_W, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_P_GEAR_G, LED_OFF);
SEG_SET_GEAR(Gear_P, 0);
SEG_SET_GEAR(0, Gear_P, 0);
}
}
static Tellib_uint16_t LED_Fuel_Alarm_W_Judgement(void)
......
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