Commit 78f9927d authored by 郑萍's avatar 郑萍

feat:增加档位显示函数

parent 824aa2f5
......@@ -13,7 +13,7 @@ void BackLight_Process(void)
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_DAY);
//电量
if (Get_EleDial_AllSOC_lenth() == 2)
if (Get_EleDial_AllSOC_lenth() == 2 || checkself_seg_Flag == 1)
{
RTE_GPIO_Config(RTE_GPIO_PORT03_PIN00, GpioOut_High);//百位
RTE_GPIO_Config(RTE_GPIO_PORT02_PIN04, GpioOut_High);
......@@ -43,7 +43,7 @@ void BackLight_Clock_All_Process(void)
if (Get_CAN_Power_State() != PKEY_ON && Get_CAN_Power_State() != KEY_OFF && Charge_OFF_Flag == 0)
{
//总计时间
if (Get_Clock_All_lenth() == 2)
if (Get_Clock_All_lenth() == 2|| checkself_seg_Flag == 1)
{
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN05, GpioOut_High); //总计工作时长统计千位_MCU_OUT
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN06, GpioOut_High); //总计工作时长统计百十位_MCU_OUT
......
......@@ -25,20 +25,20 @@ void Gpio_Init(_GpioUser_Enum InitMode)
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN02, GpioOut_High); //TXD-ESP-IN-MCU
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN03, GpioOut_Low); //空
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN04, GpioOut_Low); //空
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN05, GpioOut_Low); //总计工作时长统计千位_MCU_OUT
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN06, GpioOut_Low); //总计工作时长统计百十位_MCU_OUT
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN05, GpioOut_High); //总计工作时长统计千位_MCU_OUT
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN06, GpioOut_High); //总计工作时长统计百十位_MCU_OUT
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN07, GpioOut_High); //交互指示灯_PWM_MCU_OUT
RTE_GPIO_Config(RTE_GPIO_PORT02_PIN00, RTE_GPIO_DIR_IN); //AVDD
RTE_GPIO_Config(RTE_GPIO_PORT02_PIN01, RTE_GPIO_DIR_IN); //GND
RTE_GPIO_Config(RTE_GPIO_PORT02_PIN02, RTE_GPIO_DIR_IN); //KL30-AD
RTE_GPIO_Config(RTE_GPIO_PORT02_PIN03, RTE_GPIO_DIR_IN); //KL15-AD
RTE_GPIO_Config(RTE_GPIO_PORT02_PIN04, GpioOut_Low); //电量十位_MCU_OUT
RTE_GPIO_Config(RTE_GPIO_PORT02_PIN04, GpioOut_High); //电量十位_MCU_OUT
RTE_GPIO_Config(RTE_GPIO_PORT02_PIN05, GpioOut_Low); //空
RTE_GPIO_Config(RTE_GPIO_PORT02_PIN06, GpioOut_Low); //空
RTE_GPIO_Config(RTE_GPIO_PORT02_PIN07, GpioOut_Low); //空
RTE_GPIO_Config(RTE_GPIO_PORT03_PIN00, GpioOut_Low); //电量百位_MCU_OUT
RTE_GPIO_Config(RTE_GPIO_PORT03_PIN00, GpioOut_High); //电量百位_MCU_OUT
RTE_GPIO_Config(RTE_GPIO_PORT03_PIN01, GpioOut_Low); //SDB_LED_DRIVER
RTE_GPIO_Config(RTE_GPIO_PORT04_PIN00, GpioOut_Low); //SEDIO-编程
......
......@@ -26,16 +26,24 @@ void Gauge_Power_SOC_pull_Display(void)
// uint8_t MBMS_StatBattWorkState = Get_CAN_CH0_ID_18203220_Sig_MBMS_StatBattWorkState();
if (Common_Get_IG_Sts() == COMMON_POWER_ON && Charge_OFF_Flag == 0)
{
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x18200A20_Msg)) == CAN_ERR_OK || CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x18200A21_Msg)) == CAN_ERR_OK)
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x18200A20_Msg)) == CAN_ERR_OK )
{
uint8_t SOC_1_Count = Get_CAN_CH0_ID_18200A20_Sig_MBMS_Soc();
uint8_t SOC_2_Count = Get_CAN_CH0_ID_18200A21_Sig_SBMS_Soc();
SEG_SET_EleDial_1SOC(1, SOC_1_Count);
SEG_SET_EleDial_2SOC(1, SOC_2_Count);
}
else
{
SEG_SET_EleDial_1SOC(0, 0);
}
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x18200A21_Msg)) == CAN_ERR_OK)
{
uint8_t SOC_2_Count = Get_CAN_CH0_ID_18200A21_Sig_SBMS_Soc();
SEG_SET_EleDial_2SOC(1, SOC_2_Count);
}
else
{
SEG_SET_EleDial_2SOC(0, 0);
}
}
......@@ -46,13 +54,67 @@ void Gauge_Power_SOC_pull_Display(void)
}
}
void Gauge_Cutterhead_Gear_Display(void)
{
uint8_t Signal1 = Get_CAN_CH0_ID_157_Sig_BMCU_BladeSpeedGear();
uint8_t Signal2 = Get_CAN_CH0_ID_157_Sig_BMCU_ErrorGrage();
// uint8_t MBMS_StatBattWorkState = Get_CAN_CH0_ID_18203220_Sig_MBMS_StatBattWorkState();
if (Common_Get_IG_Sts() == COMMON_POWER_ON && Charge_OFF_Flag == 0 && CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x157_Msg)) == CAN_ERR_OK)
{
if (Signal2 == 0x1 || Signal2 == 0x2 || Signal2 == 0x3 || Signal2 == 0x4)
{
if (FLASH_SYNC_1Hz)
{
SEG_SET_Cutterhead(1, Signal1, 0);
}
else
{
SEG_SET_Cutterhead(1, 4, 0);
}
}
else if (Signal2 == 0x0)
{
SEG_SET_Cutterhead(1, Signal1, 0);
}
}
else
{
SEG_SET_Cutterhead(0, Signal1, 0);
}
}
void Gauge_Gears_Display(void)
{
uint8_t Signal1 = Get_CAN_CH0_ID_125_Sig_MMCU_TravelSpeedGear();
uint8_t Signal2 = Get_CAN_CH0_ID_125_Sig_MMCU_ParkingGearState();
// uint8_t MBMS_StatBattWorkState = Get_CAN_CH0_ID_18203220_Sig_MBMS_StatBattWorkState();
if (Common_Get_IG_Sts() == COMMON_POWER_ON && Charge_OFF_Flag == 0)
{
if (Signal2 != 0x1)
{
if (Signal1 == 0x1 || Signal1 == 0x2)
{
SEG_SET_GEAR(1, Signal1, 0);
}
}
else
{
SEG_SET_GEAR(1, Gear_P, 0);
}
}
else
{
SEG_SET_GEAR(0, Signal1, 0);
}
}
uint8_t SOC1_Count = 0;
uint8_t SOC2_Count = 0;
void Gauge_Power_SOC_CHAGING_Display(void)
{
uint8_t MBMS_TOTALSigAcc = Get_CAN_CH0_ID_18202922_Sig_MBMS_TOTALSigAcc();
uint8_t MBMS_TOTALSigCharge = Get_CAN_CH0_ID_18202922_Sig_MBMS_TOTALSigCharge();
uint8_t MBMS_StatBattWorkState = Get_CAN_CH0_ID_18203220_Sig_MBMS_StatBattWorkState();
static uint8_t SOC1_Count = 0;
static uint8_t SOC2_Count = 0;
// uint8_t MBMS_StatBattWorkState = Get_CAN_CH0_ID_18203220_Sig_MBMS_StatBattWorkState();
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
......@@ -75,8 +137,15 @@ void Gauge_Power_SOC_CHAGING_Display(void)
SOC1_Count = 0;
}
}
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x18200A21_Msg)))
{
SEG_SET_EleDial_2SOC(0, 0);
}
else
{
SEG_SET_EleDial_2SOC(1, SOC_2_Count);
}
}
else if (MBMS_StatBattWorkState == 0x4) // 副电池
{
if (++SOC_Count_Time > 10)
......@@ -90,8 +159,15 @@ void Gauge_Power_SOC_CHAGING_Display(void)
SOC2_Count = 0;
}
}
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x18200A20_Msg)))
{
SEG_SET_EleDial_1SOC(0, 0);
}
else
{
SEG_SET_EleDial_1SOC(1, SOC_1_Count);
}
}
else if (MBMS_StatBattWorkState == 0x7) // 主副电池
{
if (++SOC_Count_Time > 10)
......@@ -128,6 +204,11 @@ void Gauge_Power_SOC_CHAGING_Display(void)
}
}
}
else
{
SEG_SET_EleDial_1SOC(1, SOC_1_Count);
SEG_SET_EleDial_2SOC(1, SOC_2_Count);
}
}
if (MBMS_TOTALSigAcc == 0x0 && MBMS_TOTALSigCharge == 0x1) // 下电充电
{
......@@ -150,7 +231,7 @@ void Gauge_Power_SOC_CHAGING_Display(void)
SEG_SET_EleDial_2SOC(0, 0);
}
}
static uint8_t AllSOC_DIS = 0;
uint8_t AllSOC_DIS = 0;
void Gauge_EleDial_AllSOC_Display(void)
{
......@@ -175,22 +256,22 @@ void Gauge_EleDial_AllSOC_Display(void)
uint8_t Get_EleDial_AllSOC_lenth(void)
{
uint8_t num = 0;
if(AllSOC_DIS > 99)
if (AllSOC_DIS > 99)
{
num = 2;
}
else if(AllSOC_DIS > 9)
else if (AllSOC_DIS > 9)
{
num = 1;
}
return num;
}
uint8_t Clockonetime_flag = 0;
uint8_t Clock_seconds = 0;
uint8_t Clock_hours = 0;
void Gauge_Clock_Display(void)
{
uint32_t Clock_all = 0;
static uint8_t Clock_seconds = 0;
static uint8_t Clock_hours = 0;
if (Common_Get_IG_Sts() == COMMON_POWER_ON && Charge_OFF_Flag == 0)
{
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x339_Msg)) == CAN_ERR_OK)
......@@ -203,7 +284,7 @@ void Gauge_Clock_Display(void)
}
else
{
SEG_SET_Clock(Clock_hours, Clock_seconds, 1, 1, 1);
SEG_SET_Clock(Clock_hours, Clock_seconds, 0, 0, 0);
}
}
else
......@@ -217,7 +298,8 @@ uint8_t Get_Clockonetime_lenth(void)
return Clockonetime_flag;
}
static uint16_t EEPROM_Write_Time = 0;
uint16_t EEPROM_Write_Time = 0;
uint8_t EEPROM_Cumulativee_clean = 0;
void Data_CumulativeWorkHours_EEPROM_Write(void)
{
uint32_t u32Data[1] = {0};
......@@ -225,6 +307,12 @@ void Data_CumulativeWorkHours_EEPROM_Write(void)
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x339_Msg)) == CAN_ERR_OK)
{
u32Data[0] = Get_CAN_CH0_ID_339_Sig_MMCU_AccumulatedWorkHours();
if(u32Data[0] > 0XFFFA && EEPROM_Cumulativee_clean == 0)
{
EEPROM_Cumulativee_clean = 1;
eeprom_WriteRecord(EEPROM_BLOCK_00, (uint8_t *)eeprom_back, 4);
u32Data[0] = 0;
}
eeprom_ReadRecord(EEPROM_BLOCK_00, (uint8_t *)eeprom_back, 4);
if (EEPROM_Write_Time == 0)
{
......@@ -260,11 +348,11 @@ void Gauge_Clock_All_Display(void)
uint8_t Get_Clock_All_lenth(void)
{
uint8_t num = 0;
if(u32Data_read[0] > 999)
if (u32Data_read[0] > 999)
{
num = 2;
}
else if(u32Data_read[0] > 9)
else if (u32Data_read[0] > 9)
{
num = 1;
}
......@@ -374,6 +462,8 @@ void Gauge_CAN_setup_Service(void)
// SEG_SET_GEAR(1, 1);
// SEG_SET_Cutterhead(1, 2);
Gauge_Frame_Display();
Gauge_Cutterhead_Gear_Display();
Gauge_Gears_Display();
switch (state)
{
case KEY_ACC:
......@@ -382,7 +472,6 @@ 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:
......@@ -411,9 +500,16 @@ void Gauge_CAN_setup_Service(void)
else
{
Charge_OFF_Flag = 2;
uint8_t MBMS_TOTALSigAcc = Get_CAN_CH0_ID_18202922_Sig_MBMS_TOTALSigAcc();
uint8_t MBMS_TOTALSigCharge = Get_CAN_CH0_ID_18202922_Sig_MBMS_TOTALSigCharge();
SEG_SET_EleDial_AllSOC(0, 0);
SEG_SET_EleDial_1SOC(0, 0);
SEG_SET_EleDial_2SOC(0, 0);
if (MBMS_TOTALSigAcc == 0x1 && MBMS_TOTALSigCharge == 0x1) // 下电充电)
{
Charge_OFF_Flag = 0;
poweroff_time = 0;
}
}
}
break;
......
......@@ -38,7 +38,7 @@ typedef struct
#define POWERON_SCAN_TIMER 3000ul
extern uint8_t BUZZER_ON;
extern uint8_t Charge_OFF_Flag;
extern uint8_t EEPROM_Cumulativee_clean;
void Gauge_Power_SOC_pull_Display(void);
// void Gauge_Power_2_SOC_Display(void);
......@@ -55,6 +55,8 @@ void Gauge_MaintenanceMileage_Display(void);
void Gauge_EnergyRecoveryLevel_Display(void);
void Gauge_EleDial_AllSOC_Display(void);
void Data_CumulativeWorkHours_EEPROM_Write(void);
void Gauge_Cutterhead_Gear_Display(void);
void Gauge_Gears_Display(void);
void Gauge_KL30_Init(void);
void Gauge_KL15_Init(void);
void Gauge_Service(void);
......
......@@ -209,11 +209,11 @@ _Fun_Res SEG_SET_Cutterhead(uint8_t m_Flag, uint8_t LED_NUM, uint8_t checkself)
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;
if (LED_NUM == 1)
{
IC1_SEG117 = IC_SEG_ON;
IC1_SEG075 = IC_SEG_OFF;
IC1_SEG082 = IC_SEG_ON;
IC1_SEG081 = IC_SEG_ON;
......@@ -224,6 +224,7 @@ _Fun_Res SEG_SET_Cutterhead(uint8_t m_Flag, uint8_t LED_NUM, uint8_t checkself)
}
else if (LED_NUM == 2)
{
IC1_SEG117 = IC_SEG_ON;
IC1_SEG075 = IC_SEG_ON;
IC1_SEG082 = IC_SEG_ON;
IC1_SEG081 = IC_SEG_OFF;
......@@ -234,6 +235,7 @@ _Fun_Res SEG_SET_Cutterhead(uint8_t m_Flag, uint8_t LED_NUM, uint8_t checkself)
}
else if (LED_NUM == 3)
{
IC1_SEG117 = IC_SEG_ON;
IC1_SEG075 = IC_SEG_ON;
IC1_SEG082 = IC_SEG_ON;
IC1_SEG081 = IC_SEG_ON;
......@@ -244,6 +246,7 @@ _Fun_Res SEG_SET_Cutterhead(uint8_t m_Flag, uint8_t LED_NUM, uint8_t checkself)
}
else
{
IC1_SEG117 = IC_SEG_OFF;
IC1_SEG075 = IC_SEG_OFF;
IC1_SEG082 = IC_SEG_OFF;
IC1_SEG081 = IC_SEG_OFF;
......@@ -251,6 +254,13 @@ _Fun_Res SEG_SET_Cutterhead(uint8_t m_Flag, uint8_t LED_NUM, uint8_t checkself)
IC1_SEG078 = IC_SEG_OFF;
IC1_SEG076 = IC_SEG_OFF;
IC1_SEG077 = IC_SEG_OFF;
IC1_SEG118 = IC_SEG_OFF;
IC1_SEG073 = IC_SEG_OFF;
IC1_SEG074 = IC_SEG_OFF;
IC1_SEG079 = IC_SEG_OFF;
IC1_SEG083 = IC_SEG_OFF;
IC1_SEG116 = IC_SEG_OFF;
}
}
}
......@@ -269,6 +279,7 @@ _Fun_Res SEG_SET_Cutterhead(uint8_t m_Flag, uint8_t LED_NUM, uint8_t checkself)
IC1_SEG079 = IC_SEG_OFF;
IC1_SEG117 = IC_SEG_OFF;
IC1_SEG083 = IC_SEG_OFF;
IC1_SEG116 = IC_SEG_OFF;
}
m_Res = EX_OK;
......
......@@ -476,7 +476,20 @@ static void LED_Cutterhead_Switch_Execution(Tellib_uint16_t led_statu
static Tellib_uint16_t LED_GEAR_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if(Get_CAN_Power_State() != KEY_OFF && Charge_OFF_Flag == 0)
Tellib_uint8_t Signal1 = Get_CAN_CH0_ID_125_Sig_MMCU_TravelSpeedGear();
Tellib_uint8_t Signal2 = Get_CAN_CH0_ID_125_Sig_MMCU_ParkingGearState();
if(Signal2 != 0x1 && Charge_OFF_Flag == 0)
{
if (Signal1 == 0x1 || Signal1 == 0x2)
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
}
else if(Charge_OFF_Flag == 0)
{
LED_STATE = 1;
}
......@@ -688,6 +701,10 @@ static Tellib_uint16_t LED_Gears_Judgement(void)
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
}
else
{
......@@ -713,20 +730,27 @@ static Tellib_uint16_t LED_Cutterhead_Gear_Judgement(void)
Tellib_uint16_t LED_STATE = 0u;
Tellib_uint8_t Signal1 = Get_CAN_CH0_ID_157_Sig_BMCU_BladeSpeedGear();
Tellib_uint8_t Signal2 = Get_CAN_CH0_ID_157_Sig_BMCU_ErrorGrage();
if (Signal2 == 0x0 && openLED_flag)
if((Signal2 == 0x1 || Signal2 == 0x2 || Signal2 == 0x3 || Signal2 == 0x4) && openLED_flag)
{
if(Signal1 == 0x1 || Signal1 == 0x2 || Signal1 == 0x3)
{
LED_STATE = 1;
LED_STATE = 2;
}
else
{
LED_STATE = 0;
}
}
else if((Signal2 == 0x1 || Signal2 == 0x2 || Signal2 == 0x3 || Signal2 == 0x4) && openLED_flag)
else if (Signal2 == 0x0 && openLED_flag)
{
LED_STATE = 2;
if(Signal1 == 0x1 || Signal1 == 0x2 || Signal1 == 0x3)
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
}
return LED_STATE;
}
......@@ -908,7 +932,7 @@ static Tellib_uint16_t LED_Charging_Connection_R_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
Tellib_uint8_t Signal1 = Get_CAN_CH0_ID_18203220_Sig_MBMS_StatBattChargeState();
if ((Signal1 == 0x1 || Signal1 == 0x2 ||Signal1 == 0x3) && (Get_CAN_Power_State() != PKEY_ON && Get_CAN_Power_State() != KEY_OFF))
if ((Signal1 == 0x1 || Signal1 == 0x2 ||Signal1 == 0x3) && openLED_flag)
{
LED_STATE = 1;
}
......
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