Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RT_RMR42E
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
时昊
RT_RMR42E
Commits
b0cebb4e
Commit
b0cebb4e
authored
Feb 11, 2025
by
李冠华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🦄
refactor:将单次工作时长、累计工作时长处理逻辑从显示部分独立出来
parent
8acf7053
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
255 additions
and
117 deletions
+255
-117
RMR42E.uvguix.Administrator
...t/Cmsemicon/BAT32A239/MDK_ARM/RMR42E.uvguix.Administrator
+24
-15
RMR42E.uvprojx
Firmware/Project/Cmsemicon/BAT32A239/MDK_ARM/RMR42E.uvprojx
+10
-0
Application.h
Firmware/Source/Application/Application.h
+1
-1
Data_Time.c
Firmware/Source/Application/Driving_Information/Data_Time.c
+174
-0
Data_Time.h
Firmware/Source/Application/Driving_Information/Data_Time.h
+31
-0
GUI_Display.c
Firmware/Source/Application/GUI_Display/GUI_Display.c
+10
-85
GUI_Display.h
Firmware/Source/Application/GUI_Display/GUI_Display.h
+0
-15
PowerManag_user.c
Firmware/Source/Component/PowerManagement/PowerManag_user.c
+1
-0
Telltales_user.c
Firmware/Source/Component/Telltales/Telltales_user.c
+1
-1
Sys_Task_List.c
Firmware/Source/System/Sys_Task_List.c
+3
-0
No files found.
Firmware/Project/Cmsemicon/BAT32A239/MDK_ARM/RMR42E.uvguix.Administrator
View file @
b0cebb4e
This diff is collapsed.
Click to expand it.
Firmware/Project/Cmsemicon/BAT32A239/MDK_ARM/RMR42E.uvprojx
View file @
b0cebb4e
...
...
@@ -498,6 +498,16 @@
<FileType>
5
</FileType>
<FilePath>
..\..\..\..\Source\Application\Data_Fuel\Data_Fuel.h
</FilePath>
</File>
<File>
<FileName>
Data_Time.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
..\..\..\..\Source\Application\Driving_Information\Data_Time.c
</FilePath>
</File>
<File>
<FileName>
Data_Time.h
</FileName>
<FileType>
5
</FileType>
<FilePath>
..\..\..\..\Source\Application\Driving_Information\Data_Time.h
</FilePath>
</File>
</Files>
</Group>
<Group>
...
...
Firmware/Source/Application/Application.h
View file @
b0cebb4e
...
...
@@ -13,7 +13,7 @@
#include "Can_User/Can_RX_User.h"
#include "Data_Soc\Data_Soc.h"
#include "Data_Fuel\Data_Fuel.h"
#include "Driving_Information\Data_Time.h"
...
...
Firmware/Source/Application/Driving_Information/Data_Time.c
0 → 100644
View file @
b0cebb4e
#include "Components.h"
#include "Driving_Information\Data_Time.h"
DataTimeStruct_st_t
Time
;
void
Data_Time_KL30_Init
(
void
)
{
Time
.
SingleHour
=
0U
;
Time
.
SingleMin
=
0U
;
Time
.
TotalHour
=
0U
;
Time
.
SingleValid
=
0U
;
}
void
Data_Time_KL15_Init
(
void
)
{
}
void
Data_Time_Single_Working_Hours
(
void
)
{
uint8_t
Clock_all
=
0
;
if
((
Common_Get_IG_Sts
()
==
COMMON_POWER_ON
)
&&
(
Charge_OFF_Flag
==
0
)
&&
(
Get_CAN_Power_State
()
!=
KEY_OFF
)
&&
(
Get_CAN_Power_State
()
!=
PKEY_ON
)
&&
(
System_Indicator_CANFlag
!=
1
))
{
Clock_all
=
Get_CAN_Num_MMCU_SingleWorkingHours
();
Time
.
SingleHour
=
Clock_all
/
10U
;
Time
.
SingleMin
=
(
Clock_all
%
10U
)
*
6U
;
Time
.
SingleValid
=
1
;
}
else
{
Time
.
SingleValid
=
0
;
}
}
uint32_t
u32Data_read
[
1
]
=
{
0
};
uint32_t
CumulativeWorkHours_Writeback
=
0
;
uint32_t
CumulativeWorkHours_readDiffer
=
0
;
uint8_t
CumulativeWorkHours_MAX_flag
=
0
;
void
Data_Time_Total_Working_Hours
(
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
;
}
Time
.
TotalHour
=
u32Data_read
[
0
];
}
void
Data_CumulativeWorkHours_EEPROM_Write
(
void
)
{
uint32_t
CurrentData
=
0
;
uint32_t
u32Data
[
1
]
=
{
0
};
if
((
Common_Get_IG_Sts
()
==
COMMON_POWER_ON
)
&&
(
Charge_OFF_Flag
==
0
)
&&
(
Get_CAN_Power_State
()
!=
KEY_OFF
)
&&
(
Get_CAN_Power_State
()
!=
PKEY_ON
)
&&
(
System_Indicator_CANFlag
!=
1
))
{
CurrentData
=
Get_CAN_Num_MMCU_AccumulatedWorkHours
();
if
(
CumulativeWorkHours_MAX_flag
==
0
)
{
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
(
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
;
}
}
}
}
/******************************************************************************
函数名:Get_SingleHour_Display
功 能:获取单次工作时长小时数函数
参 数:无
返回值:Time.SingleHour x1
******************************************************************************
注 意:该函数必须每 ms被调用一次
******************************************************************************/
uint8_t
Get_SingleHour_Display
(
void
)
{
return
Time
.
SingleHour
;
}
/******************************************************************************
函数名:Get_SingleMin_Display
功 能:获取单次工作时长分钟数函数
参 数:无
返回值:Time.SingleMin x1
******************************************************************************
注 意:该函数必须每 ms被调用一次
******************************************************************************/
uint8_t
Get_SingleMin_Display
(
void
)
{
return
Time
.
SingleMin
;
}
/******************************************************************************
函数名:Get_Single_Working_Hours_Status
功 能:获取单次工作时长状态函数
参 数:无
返回值:Time.SingleValid 0--无效, 1--有效
******************************************************************************
注 意:该函数必须每 ms被调用一次
******************************************************************************/
uint8_t
Get_Single_Working_Hours_Status
(
void
)
{
return
Time
.
SingleValid
;
}
/******************************************************************************
函数名:Get_Total_Working_Hours
功 能:获取累计工作时长函数
参 数:无
返回值:Time.TotalHour x10
******************************************************************************
注 意:该函数必须每 ms被调用一次
******************************************************************************/
uint32_t
Get_Total_Working_Hours
(
void
)
{
return
Time
.
TotalHour
;
}
/******************************************************************************
函数名:Get_Clock_All_lenth
功 能:获取累计工作时长数值长度函数
参 数:无
返回值:num x1
******************************************************************************
注 意:该函数必须每 ms被调用一次
******************************************************************************/
uint8_t
Get_Clock_All_lenth
(
void
)
{
uint8_t
num
=
0
;
if
(
Time
.
TotalHour
>
999
)
{
num
=
2
;
}
else
if
(
Time
.
TotalHour
>
9
)
{
num
=
1
;
}
return
num
;
}
Firmware/Source/Application/Driving_Information/Data_Time.h
0 → 100644
View file @
b0cebb4e
#ifndef DATA_TIME_H__
#define DATA_TIME_H__
#include "Application.h"
#include "Components.h"
typedef
struct
//__attribute__((aligned(4)))
{
uint8_t
SingleHour
;
/*单次计时小时*/
uint8_t
SingleMin
;
/*单次计时分钟*/
uint8_t
SingleValid
;
/*单次工作时间有效状态*/
uint32_t
TotalHour
;
/*累计计时小时*/
}
DataTimeStruct_st_t
;
extern
void
Data_Time_KL30_Init
(
void
);
extern
void
Data_Time_KL15_Init
(
void
);
extern
void
Data_Time_Single_Working_Hours
(
void
);
extern
void
Data_Time_Total_Working_Hours
(
void
);
extern
void
Data_CumulativeWorkHours_EEPROM_Write
(
void
);
extern
uint8_t
Get_SingleHour_Display
(
void
);
extern
uint8_t
Get_SingleMin_Display
(
void
);
extern
uint8_t
Get_Single_Working_Hours_Status
(
void
);
extern
uint32_t
Get_Total_Working_Hours
(
void
);
extern
uint8_t
Get_Clock_All_lenth
(
void
);
#endif
Firmware/Source/Application/GUI_Display/GUI_Display.c
View file @
b0cebb4e
...
...
@@ -120,112 +120,37 @@ void Gauge_EleDial_AllSOC_Display(void)
SEG_SET_EleDial_AllSOC
(
u8AllSocValid
,
u8AllSocValue
);
}
uint8_t
Clockonetime_flag
=
0
;
/*单次工作时长显示函数*/
void
Gauge_Clock_Display
(
void
)
{
uint32_t
Clock_all
=
0
;
if
(
DISPLAY_OPEN
)
uint8_t
Clock_hours
=
Get_SingleHour_Display
();
uint8_t
Clock_min
=
Get_SingleMin_Display
();
if
(
Get_Single_Working_Hours_Status
()
==
1U
)
{
Clock_all
=
Get_CAN_Num_MMCU_SingleWorkingHours
();
uint8_t
Clock_hours
=
Clock_all
/
10
;
uint8_t
Clock_min
=
(
Clock_all
%
10
)
*
6
;
SEG_SET_Clock
(
Clock_hours
,
Clock_min
,
FLASH_SYNC_1Hz
,
1
,
1
);
Clockonetime_flag
=
1
;
}
else
{
SEG_SET_Clock
(
0
,
0
,
0
,
0
,
0
);
Clockonetime_flag
=
0
;
}
}
uint8_t
Get_Clockonetime_lenth
(
void
)
{
return
Clockonetime_flag
;
}
uint32_t
u32Data_read
[
1
]
=
{
0
};
uint32_t
CumulativeWorkHours_Writeback
=
0
;
uint32_t
CumulativeWorkHours_readDiffer
=
0
;
uint8_t
CumulativeWorkHours_MAX_flag
=
0
;
void
Data_CumulativeWorkHours_EEPROM_Write
(
void
)
{
uint32_t
CurrentData
=
0
;
uint32_t
u32Data
[
1
]
=
{
0
};
if
(
DISPLAY_OPEN
)
{
CurrentData
=
Get_CAN_Num_MMCU_AccumulatedWorkHours
();
if
(
CumulativeWorkHours_MAX_flag
==
0
)
{
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
(
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
)
{
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
;
}
uint32_t
TotalHours
=
Get_Total_Working_Hours
();
if
(
DISPLAY_OPEN
)
{
SEG_SET_Clock_ALL
(
1
,
u32Data_read
[
0
]
);
SEG_SET_Clock_ALL
(
1
,
TotalHours
);
}
else
{
SEG_SET_Clock_ALL
(
0
,
0
);
}
}
uint8_t
Get_Clock_All_lenth
(
void
)
{
uint8_t
num
=
0
;
if
(
u32Data_read
[
0
]
>
999
)
{
num
=
2
;
}
else
if
(
u32Data_read
[
0
]
>
9
)
{
num
=
1
;
}
return
num
;
}
void
Gauge_Frame_Display
(
void
)
{
if
(
DISPLAY_OPEN
)
...
...
Firmware/Source/Application/GUI_Display/GUI_Display.h
View file @
b0cebb4e
...
...
@@ -43,34 +43,19 @@ extern uint8_t EEPROM_Cumulativee_clean;
extern
uint16_t
poweroff_time
;
void
Gauge_Power_SOC_pull_Display
(
void
);
// void Gauge_Power_2_SOC_Display(void);
void
Gauge_Power_Display
(
void
);
void
Gauge_Battery_Display
(
void
);
void
Gauge_Clock_Display
(
void
);
// void Gauge_Gear_Display(void);
void
Gauge_Clock_All_Display
(
void
);
void
Gauge_DrivingRange_Display
(
void
);
//void Gauge_Gear_Display(void);
void
Gauge_Frame_Display
(
void
);
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
);
void
Temp_Calc_Init
(
void
);
void
Temp_Calc_Send
(
void
);
uint32_t
Get_Temp_Calc
(
void
);
void
Gauge_CAN_setup_Service
(
void
);
void
Checkself_LED_Display
(
void
);
void
BUZZER_Init
(
void
);
uint8_t
Get_Clock_All_lenth
(
void
);
uint8_t
Get_Clockonetime_lenth
(
void
);
uint8_t
Get_CAN_Num_SBMS_Soc_2_Grid
(
void
);
uint8_t
Get_CAN_Num_MBMS_Soc_1_Grid
(
void
);
void
TYW_Clear_Eeprom_Service
(
void
);
...
...
Firmware/Source/Component/PowerManagement/PowerManag_user.c
View file @
b0cebb4e
...
...
@@ -71,6 +71,7 @@ static void Power_KL30_Init(void)
RTE_RTC_Init
(
g_stRTCInformation
);
RTE_DEEPSLEEP_GPIO_Interrupt_Enable
(
KL15_AD_IN
,
Trigger_Rising
);
Data_Soc_KL30_Init
();
Data_Time_KL30_Init
();
}
extern
uint32_t
PowerIgnOffTimeLine
;
...
...
Firmware/Source/Component/Telltales/Telltales_user.c
View file @
b0cebb4e
...
...
@@ -710,7 +710,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
)
&&
openLED_flag
)
if
((
Get_
Single_Working_Hours_Status
()
==
1
)
&&
openLED_flag
)
{
LED_STATE
=
1
;
}
...
...
Firmware/Source/System/Sys_Task_List.c
View file @
b0cebb4e
...
...
@@ -77,6 +77,9 @@ void Sys_100ms_Tasks(void)
{
u8LEDDriverCheckCount
++
;
}
Data_Time_Single_Working_Hours
();
Data_Time_Total_Working_Hours
();
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment