Commit 9668a503 authored by 郑萍's avatar 郑萍

feat:累计时间更改计数最大值

parent 4a812f7b
......@@ -266,7 +266,8 @@ uint8_t Get_Clockonetime_lenth(void)
uint32_t u32Data_read[1] = {0};
uint32_t CumulativeWorkHours_Writeback = 0;
uint8_t CumulativeWorkHours_readDiffer = 0;
uint32_t CumulativeWorkHours_readDiffer = 0;
uint8_t CumulativeWorkHours_MAX_flag = 0;
void Data_CumulativeWorkHours_EEPROM_Write(void)
{
uint32_t CurrentData = 0;
......@@ -274,29 +275,53 @@ void Data_CumulativeWorkHours_EEPROM_Write(void)
if (DISPLAY_OPEN)
{
CurrentData = Get_CAN_Num_MMCU_AccumulatedWorkHours();
if (CurrentData > CumulativeWorkHours_Writeback)
if (CumulativeWorkHours_MAX_flag == 0)
{
CumulativeWorkHours_readDiffer = CurrentData - CumulativeWorkHours_Writeback;
eeprom_ReadRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data_read, 4);
u32Data[0] = u32Data_read[0] + CumulativeWorkHours_readDiffer;
eeprom_WriteRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data, 4);
CumulativeWorkHours_Writeback = CurrentData;
if (CurrentData > CumulativeWorkHours_Writeback)
{
CumulativeWorkHours_readDiffer = CurrentData - CumulativeWorkHours_Writeback;
eeprom_ReadRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data_read, 4);
u32Data[0] = u32Data_read[0] + CumulativeWorkHours_readDiffer;
eeprom_WriteRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data, 4);
CumulativeWorkHours_Writeback = CurrentData;
}
else if (CurrentData < CumulativeWorkHours_Writeback)
{
CumulativeWorkHours_readDiffer = CumulativeWorkHours_Writeback - CurrentData;
eeprom_ReadRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data_read, 4);
u32Data[0] = u32Data_read[0] - CumulativeWorkHours_readDiffer;
eeprom_WriteRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data, 4);
CumulativeWorkHours_Writeback = CurrentData;
}
}
else if (CurrentData < CumulativeWorkHours_Writeback)
else if(CumulativeWorkHours_Writeback != 0)
{
CumulativeWorkHours_readDiffer = CumulativeWorkHours_Writeback - CurrentData;
eeprom_ReadRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data_read, 4);
u32Data[0] = u32Data_read[0] - CumulativeWorkHours_readDiffer;
eeprom_WriteRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data, 4);
CumulativeWorkHours_Writeback = CurrentData;
if (CurrentData < CumulativeWorkHours_Writeback)
{
CumulativeWorkHours_readDiffer = CumulativeWorkHours_Writeback - CurrentData;
eeprom_ReadRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data_read, 4);
u32Data[0] = u32Data_read[0] - CumulativeWorkHours_readDiffer;
eeprom_WriteRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data, 4);
CumulativeWorkHours_Writeback = CurrentData;
}
}
}
}
void Gauge_Clock_All_Display(void)
{
uint32_t u32Data[1] = {0};
eeprom_ReadRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data_read, 4);
if (u32Data_read[0] > 99999)
{
u32Data[0] = 99999;
eeprom_WriteRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data, 4);
CumulativeWorkHours_MAX_flag = 1;
}
else
{
CumulativeWorkHours_MAX_flag = 0;
}
if (DISPLAY_OPEN)
{
SEG_SET_Clock_ALL(1, u32Data_read[0]);
......@@ -354,17 +379,17 @@ void Gauge_Service(void)
{
SOC_charge_seg_Flag = 0;
Checkself_Init();
Gauge_CAN_setup_Service();
}
else
{
checkself_seg_Flag = 1;
if(Get_CAN_Power_State() == KEY_ACC)
if (Get_CAN_Power_State() == KEY_ACC)
{
interact_PWM_Low_Duty = 0;
}
Checkself_LED_Display();
// Checkself_SEG_Display();
}
......
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