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

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

parent 4a812f7b
...@@ -266,7 +266,8 @@ uint8_t Get_Clockonetime_lenth(void) ...@@ -266,7 +266,8 @@ uint8_t Get_Clockonetime_lenth(void)
uint32_t u32Data_read[1] = {0}; uint32_t u32Data_read[1] = {0};
uint32_t CumulativeWorkHours_Writeback = 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) void Data_CumulativeWorkHours_EEPROM_Write(void)
{ {
uint32_t CurrentData = 0; uint32_t CurrentData = 0;
...@@ -274,6 +275,8 @@ void Data_CumulativeWorkHours_EEPROM_Write(void) ...@@ -274,6 +275,8 @@ void Data_CumulativeWorkHours_EEPROM_Write(void)
if (DISPLAY_OPEN) if (DISPLAY_OPEN)
{ {
CurrentData = Get_CAN_Num_MMCU_AccumulatedWorkHours(); CurrentData = Get_CAN_Num_MMCU_AccumulatedWorkHours();
if (CumulativeWorkHours_MAX_flag == 0)
{
if (CurrentData > CumulativeWorkHours_Writeback) if (CurrentData > CumulativeWorkHours_Writeback)
{ {
CumulativeWorkHours_readDiffer = CurrentData - CumulativeWorkHours_Writeback; CumulativeWorkHours_readDiffer = CurrentData - CumulativeWorkHours_Writeback;
...@@ -291,12 +294,34 @@ void Data_CumulativeWorkHours_EEPROM_Write(void) ...@@ -291,12 +294,34 @@ void Data_CumulativeWorkHours_EEPROM_Write(void)
CumulativeWorkHours_Writeback = CurrentData; CumulativeWorkHours_Writeback = CurrentData;
} }
} }
else if(CumulativeWorkHours_Writeback != 0)
{
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) void Gauge_Clock_All_Display(void)
{ {
uint32_t u32Data[1] = {0};
eeprom_ReadRecord(EEPROM_BLOCK_00, (uint8_t *)u32Data_read, 4); 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) if (DISPLAY_OPEN)
{ {
SEG_SET_Clock_ALL(1, u32Data_read[0]); SEG_SET_Clock_ALL(1, u32Data_read[0]);
...@@ -360,7 +385,7 @@ void Gauge_Service(void) ...@@ -360,7 +385,7 @@ void Gauge_Service(void)
else else
{ {
checkself_seg_Flag = 1; checkself_seg_Flag = 1;
if(Get_CAN_Power_State() == KEY_ACC) if (Get_CAN_Power_State() == KEY_ACC)
{ {
interact_PWM_Low_Duty = 0; interact_PWM_Low_Duty = 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