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
80cc03c1
Commit
80cc03c1
authored
Feb 10, 2025
by
李冠华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🦄
refactor:添加零件号宏定义,将SOC数据处理相关逻辑从显示函数中独立出来
parent
e5472f5d
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
801 additions
and
368 deletions
+801
-368
RMR42E.uvguix.Administrator
...t/Cmsemicon/BAT32A239/MDK_ARM/RMR42E.uvguix.Administrator
+90
-126
RMR42E.uvprojx
Firmware/Project/Cmsemicon/BAT32A239/MDK_ARM/RMR42E.uvprojx
+13
-3
Application.h
Firmware/Source/Application/Application.h
+1
-0
CAN_CH0_CAN_Communication_Matrix.c
...ce/Application/CAN_APP/CAN_CH0_CAN_Communication_Matrix.c
+0
-1
Can_RX_User.c
Firmware/Source/Application/CAN_User/Can_RX_User.c
+32
-24
CommonInterface.h
...ware/Source/Application/CommonInterface/CommonInterface.h
+5
-0
Data_Soc.c
Firmware/Source/Application/Data_Soc/Data_Soc.c
+590
-0
Data_Soc.h
Firmware/Source/Application/Data_Soc/Data_Soc.h
+56
-0
GUI_Display.c
Firmware/Source/Application/GUI_Display/GUI_Display.c
+12
-213
GUI_Display.h
Firmware/Source/Application/GUI_Display/GUI_Display.h
+0
-1
PowerManag_user.c
Firmware/Source/Component/PowerManagement/PowerManag_user.c
+1
-0
Sys_Task_List.c
Firmware/Source/System/Sys_Task_List.c
+1
-0
No files found.
Firmware/Project/Cmsemicon/BAT32A239/MDK_ARM/RMR42E.uvguix.Administrator
View file @
80cc03c1
This diff is collapsed.
Click to expand it.
Firmware/Project/Cmsemicon/BAT32A239/MDK_ARM/RMR42E.uvprojx
View file @
80cc03c1
...
...
@@ -275,7 +275,7 @@
</OCR_RVCT3>
<OCR_RVCT4>
<Type>
1
</Type>
<StartAddress>
0x
800
0
</StartAddress>
<StartAddress>
0x0
</StartAddress>
<Size>
0x40000
</Size>
</OCR_RVCT4>
<OCR_RVCT5>
...
...
@@ -361,7 +361,7 @@
</VariousControls>
</Aads>
<LDads>
<umfTarg>
1
</umfTarg>
<umfTarg>
0
</umfTarg>
<Ropi>
0
</Ropi>
<Rwpi>
0
</Rwpi>
<noStLib>
0
</noStLib>
...
...
@@ -370,7 +370,7 @@
<TextAddressRange>
0x00000000
</TextAddressRange>
<DataAddressRange>
0x20000000
</DataAddressRange>
<pXoBase></pXoBase>
<ScatterFile></ScatterFile>
<ScatterFile>
.\Objects\RMR42E.sct
</ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<Misc></Misc>
...
...
@@ -478,6 +478,16 @@
<FileType>
1
</FileType>
<FilePath>
..\..\..\..\Source\Application\CAN_User\Can_RX_User.c
</FilePath>
</File>
<File>
<FileName>
Data_Soc.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
..\..\..\..\Source\Application\Data_Soc\Data_Soc.c
</FilePath>
</File>
<File>
<FileName>
Data_Soc.h
</FileName>
<FileType>
5
</FileType>
<FilePath>
..\..\..\..\Source\Application\Data_Soc\Data_Soc.h
</FilePath>
</File>
</Files>
</Group>
<Group>
...
...
Firmware/Source/Application/Application.h
View file @
80cc03c1
...
...
@@ -11,6 +11,7 @@
#include "Can_User/Can_User.h"
#include "Can_User/Can_App.h"
#include "Can_User/Can_RX_User.h"
#include "Data_Soc\Data_Soc.h"
...
...
Firmware/Source/Application/CAN_APP/CAN_CH0_CAN_Communication_Matrix.c
View file @
80cc03c1
...
...
@@ -145,7 +145,6 @@ void System_Indicator_OFF_callback(canlib_uint8_t CopyData[])
System_Indicator_CANFlag
=
1
;
uint8_t
i
=
0
;
BUZZER_Init
();
poweroff_time
=
0
;
Clear_Bu98
();
for
(
i
=
0
;
i
<
LampCh0_MAX
;
i
++
)
{
...
...
Firmware/Source/Application/CAN_User/Can_RX_User.c
View file @
80cc03c1
...
...
@@ -218,32 +218,40 @@ uint8_t Get_CAN_Power_State(void)
{
uint8_t
state
=
0
;
uint8_t
Power_State
=
Get_CAN_Num_MMCU_PowerMode
();
switch
(
Power_State
)
if
((
Common_Get_IG_Sts
()
==
COMMON_POWER_ON
)
&&
(
System_Indicator_CANFlag
!=
1
))
{
switch
(
Power_State
)
{
case
0x0
:
state
=
KEY_OFF
;
break
;
case
0x1
:
state
=
PKEY_ON
;
break
;
case
0x2
:
state
=
KEY_ACC
;
break
;
case
0x3
:
state
=
READY
;
break
;
case
0x4
:
state
=
CHRG_PLUGIN
;
break
;
case
0x5
:
state
=
CHRGING
;
break
;
case
0x6
:
state
=
CHRGEND
;
break
;
default:
state
=
POWER_CHECK_NULL
;
break
;
}
}
else
{
case
0x0
:
state
=
KEY_OFF
;
break
;
case
0x1
:
state
=
PKEY_ON
;
break
;
case
0x2
:
state
=
KEY_ACC
;
break
;
case
0x3
:
state
=
READY
;
break
;
case
0x4
:
state
=
CHRG_PLUGIN
;
break
;
case
0x5
:
state
=
CHRGING
;
break
;
case
0x6
:
state
=
CHRGEND
;
break
;
default:
state
=
POWER_CHECK_NULL
;
break
;
}
return
state
;
}
Firmware/Source/Application/CommonInterface/CommonInterface.h
View file @
80cc03c1
...
...
@@ -4,6 +4,11 @@
#include "Components.h"
#define RMR42E_60 (0U)
/*纯电动零件号*/
#define G54_A01 (1U)
/*混动零件号*/
#define PART_NUMBER RMR42E_60
/*当前程序零件号*/
/*COMMON INTERFACE*/
typedef
enum
...
...
Firmware/Source/Application/Data_Soc/Data_Soc.c
0 → 100644
View file @
80cc03c1
This diff is collapsed.
Click to expand it.
Firmware/Source/Application/Data_Soc/Data_Soc.h
0 → 100644
View file @
80cc03c1
#ifndef DATA_SOC_H__
#define DATA_SOC_H__
#include "Application.h"
#include "Components.h"
#define SocUpdateTime 10
typedef
enum
{
Soc_Blue
,
Soc_Red
,
Soc_Yellow
,
Soc_Max
,
}
_Soc_Color
;
typedef
struct
//__attribute__((aligned(4)))
{
uint8_t
Value1
;
//电量1实际值
uint8_t
Value2
;
//电量2实际值
uint8_t
Valid1
;
//电量1状态
uint8_t
Valid2
;
//电量2状态
uint8_t
Act_Seg1
;
/*电量1实际格数*/
uint8_t
Act_Seg2
;
/*电量2实际格数*/
uint8_t
Dis_Seg1
;
/*电量1显示格数*/
uint8_t
Dis_Seg2
;
/*电量2显示格数*/
uint8_t
Battery1Icon
;
/*电池1小图标状态*/
uint8_t
Battery2Icon
;
/*电池2小图标状态*/
uint8_t
AllSocValue
;
/*总SOC值*/
uint8_t
AllSocValid
;
/*总SOC状态*/
}
SocStruct_st_t
;
extern
void
Data_Soc_KL30_Init
(
void
);
extern
void
Data_Soc_KL15_Init
(
void
);
extern
void
Data_Soc_Service
(
void
);
extern
uint8_t
Get_Soc1Num_Display
(
void
);
extern
uint8_t
Get_Soc2Num_Display
(
void
);
extern
uint8_t
Get_Soc1_Valid
(
void
);
extern
uint8_t
Get_Soc2_Valid
(
void
);
extern
uint8_t
Get_CAN_Num_MBMS_Soc_1_Grid
(
void
);
extern
uint8_t
Get_CAN_Num_SBMS_Soc_2_Grid
(
void
);
extern
uint8_t
Get_Soc1_Battery_Icon
(
void
);
extern
uint8_t
Get_Soc2_Battery_Icon
(
void
);
extern
uint8_t
Get_AllSocValue
(
void
);
extern
uint8_t
Get_AllSocValid
(
void
);
extern
uint8_t
Get_EleDial_AllSOC_lenth
(
void
);
#endif
Firmware/Source/Application/GUI_Display/GUI_Display.c
View file @
80cc03c1
...
...
@@ -2,9 +2,7 @@
#include "SEG_DISPLAY\SEG_DISPLAY.h"
#include "Application.h"
#define DISPLAY_OPEN ((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))
uint16_t
poweroff_time
=
0
;
uint8_t
SOC_Count_Time
=
0
;
uint8_t
BUZZER_ON
=
0
;
uint8_t
Charge_OFF_Flag
=
0
;
...
...
@@ -44,19 +42,13 @@ void TYW_Clear_Eeprom_Service(void)
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
)
&&
(
Get_CAN_Power_State
()
!=
KEY_OFF
)
&&
(
Get_CAN_Power_State
()
!=
PKEY_ON
)
&&
(
System_Indicator_CANFlag
!=
1
))
{
uint8_t
Current_1_Grid
=
Get_CAN_Num_MBMS_Soc_1_Grid
();
uint8_t
Current_2_Grid
=
Get_CAN_Num_SBMS_Soc_2_Grid
();
SEG_SET_EleDial_1SOC
(
1
,
Current_1_Grid
);
SEG_SET_EleDial_2SOC
(
1
,
Current_2_Grid
);
}
else
{
SEG_SET_EleDial_1SOC
(
0
,
0
);
SEG_SET_EleDial_2SOC
(
0
,
0
);
}
uint8_t
u8Soc1Seg
=
Get_CAN_Num_MBMS_Soc_1_Grid
();
uint8_t
u8Soc2Seg
=
Get_CAN_Num_SBMS_Soc_2_Grid
();
uint8_t
u8Soc1Valid
=
Get_Soc1_Valid
();
uint8_t
u8Soc2Valid
=
Get_Soc2_Valid
();
SEG_SET_EleDial_1SOC
(
u8Soc1Valid
,
u8Soc1Seg
);
SEG_SET_EleDial_2SOC
(
u8Soc2Valid
,
u8Soc2Seg
);
}
void
Gauge_Cutterhead_Gear_Display
(
void
)
...
...
@@ -121,174 +113,13 @@ void Gauge_Gears_Display(void)
}
}
uint8_t
Get_CAN_Num_MBMS_Soc_1_Grid
(
void
)
{
uint8_t
num
=
0
;
uint8_t
Current_SOC_1_Num
=
Get_CAN_Num_MBMS_Soc
();
num
=
(
Current_SOC_1_Num
/
10
);
if
((
Current_SOC_1_Num
%
10
)
!=
0
)
{
num
++
;
}
if
(
num
>
10
)
{
num
=
10
;
}
return
num
;
}
uint8_t
Get_CAN_Num_SBMS_Soc_2_Grid
(
void
)
{
uint8_t
num
=
0
;
uint8_t
Current_SOC_2_Num
=
Get_CAN_Num_SBMS_Soc
();
num
=
(
Current_SOC_2_Num
/
10
);
if
((
Current_SOC_2_Num
%
10
)
!=
0
)
{
num
++
;
}
if
(
num
>
10
)
{
num
=
10
;
}
return
num
;
}
uint8_t
SOC1_Count
=
0
;
uint8_t
SOC2_Count
=
0
;
void
Gauge_Power_SOC_CHAGING_Display
(
void
)
{
uint8_t
MBMS_TOTALSigAcc
=
Get_CAN_Num_MBMS_TOTALSigAcc
();
uint8_t
MBMS_TOTALSigCharge
=
Get_CAN_Num_MBMS_TOTALSigCharge
();
uint8_t
MBMS_StatBattWorkState
=
Get_CAN_Num_MBMS_StatBattWorkState
();
// uint8_t MBMS_StatBattWorkState = Get_CAN_CH0_ID_18203220_Sig_MBMS_StatBattWorkState();
if
((
Common_Get_IG_Sts
()
==
COMMON_POWER_ON
)
&&
(
System_Indicator_CANFlag
!=
1
))
{
uint8_t
Current_1_Grid
=
Get_CAN_Num_MBMS_Soc_1_Grid
();
uint8_t
Current_2_Grid
=
Get_CAN_Num_SBMS_Soc_2_Grid
();
if
(((
MBMS_TOTALSigAcc
==
0x1
)
&&
(
MBMS_TOTALSigCharge
==
0x1
))
||
((
MBMS_TOTALSigAcc
==
0x0
)
&&
(
MBMS_TOTALSigCharge
==
0x1
)))
// 上电充电
{
if
(
MBMS_StatBattWorkState
==
0x1
)
// 主电池
{
if
(
++
SOC_Count_Time
>
10
)
{
SOC_Count_Time
=
0
;
SEG_SET_EleDial_1SOC
(
1
,
SOC1_Count
);
SOC1_Count
++
;
if
(
SOC1_Count
>
Current_1_Grid
)
{
SOC1_Count
=
0
;
}
}
SEG_SET_EleDial_2SOC
(
1
,
Current_2_Grid
);
}
else
if
(
MBMS_StatBattWorkState
==
0x4
)
// 副电池
{
if
(
++
SOC_Count_Time
>
10
)
{
SOC_Count_Time
=
0
;
SEG_SET_EleDial_2SOC
(
1
,
SOC2_Count
);
SOC2_Count
++
;
if
(
SOC2_Count
>
Current_2_Grid
)
{
SOC2_Count
=
0
;
}
}
SEG_SET_EleDial_1SOC
(
1
,
Current_1_Grid
);
}
else
if
(
MBMS_StatBattWorkState
==
0x7
)
// 主副电池
{
if
(
++
SOC_Count_Time
>
10
)
{
SOC_Count_Time
=
0
;
SEG_SET_EleDial_1SOC
(
1
,
SOC1_Count
);
SEG_SET_EleDial_2SOC
(
1
,
SOC2_Count
);
SOC1_Count
++
;
SOC2_Count
++
;
if
(
Current_1_Grid
>
Current_2_Grid
)
{
if
(
SOC2_Count
>
Current_2_Grid
)
{
SOC2_Count
--
;
if
(
SOC1_Count
>
Current_1_Grid
)
{
SOC1_Count
=
0
;
SOC2_Count
=
0
;
}
}
}
else
{
if
(
SOC1_Count
>
Current_1_Grid
)
{
SOC1_Count
--
;
if
(
SOC2_Count
>
Current_2_Grid
)
{
SOC1_Count
=
0
;
SOC2_Count
=
0
;
}
}
}
}
}
else
{
SOC1_Count
=
0
;
SOC2_Count
=
0
;
SEG_SET_EleDial_1SOC
(
1
,
Current_1_Grid
);
SEG_SET_EleDial_2SOC
(
1
,
Current_2_Grid
);
}
}
if
((
MBMS_TOTALSigAcc
==
0x0
)
&&
(
MBMS_TOTALSigCharge
==
0x1
))
// 下电充电
{
poweroff_time
++
;
}
else
{
poweroff_time
=
0
;
}
}
else
{
SEG_SET_EleDial_1SOC
(
0
,
0
);
SEG_SET_EleDial_2SOC
(
0
,
0
);
}
}
uint8_t
AllSOC_DIS
=
0
;
void
Gauge_EleDial_AllSOC_Display
(
void
)
{
if
((
Common_Get_IG_Sts
()
==
COMMON_POWER_ON
)
&&
(
Get_CAN_Power_State
()
!=
KEY_OFF
)
&&
(
Get_CAN_Power_State
()
!=
PKEY_ON
)
&&
(
System_Indicator_CANFlag
!=
1
))
{
AllSOC_DIS
=
Get_CAN_Num_MBMS_StatSoc
();
if
(
AllSOC_DIS
>
100
)
{
AllSOC_DIS
=
100
;
}
SEG_SET_EleDial_AllSOC
(
1
,
AllSOC_DIS
);
}
else
{
SEG_SET_EleDial_AllSOC
(
0
,
0
);
}
uint8_t
u8AllSocValid
=
Get_AllSocValid
();
uint8_t
u8AllSocValue
=
Get_AllSocValue
();
SEG_SET_EleDial_AllSOC
(
u8AllSocValid
,
u8AllSocValue
);
}
uint8_t
Get_EleDial_AllSOC_lenth
(
void
)
{
uint8_t
num
=
0
;
if
(
AllSOC_DIS
>
99
)
{
num
=
2
;
}
else
if
(
AllSOC_DIS
>
9
)
{
num
=
1
;
}
return
num
;
}
uint8_t
Clockonetime_flag
=
0
;
void
Gauge_Clock_Display
(
void
)
{
...
...
@@ -454,7 +285,6 @@ void Gauge_Service(void)
}
else
if
(
Get_CAN_Power_State
()
==
PKEY_ON
)
{
poweroff_time
=
0
;
if
(
Buzzer_time
==
0
)
{
Clear_Bu98
();
...
...
@@ -494,7 +324,7 @@ void Gauge_Service(void)
if
(
CAN_MSG_Status
(
&
CAN_CH0_CanMsgOp
,
Co_Can_ConvertSubID_CAN_CH0
(
CAN_CH0_ID_CAN_0x125_Msg
))
==
CAN_SIG_NORMAL
)
{
BUZZER_Init
();
poweroff_time
=
0
;
//
poweroff_time = 0;
Clear_Bu98
();
interact_PWM_Low_Duty
=
100
;
for
(
i
=
0
;
i
<
LampCh0_MAX
;
i
++
)
...
...
@@ -507,7 +337,6 @@ void Gauge_Service(void)
else
{
BUZZER_Init
();
poweroff_time
=
0
;
Clear_Bu98
();
interact_PWM_Low_Duty
=
100
;
for
(
i
=
0
;
i
<
LampCh0_MAX
;
i
++
)
...
...
@@ -530,50 +359,24 @@ void Gauge_CAN_setup_Service(void)
Gauge_Gears_Display
();
uint8_t
MBMS_TOTALSigAcc
=
Get_CAN_Num_MBMS_TOTALSigAcc
();
uint8_t
MBMS_TOTALSigCharge
=
Get_CAN_Num_MBMS_TOTALSigCharge
();
Gauge_Power_SOC_pull_Display
();
switch
(
state
)
{
case
KEY_ACC
:
{
poweroff_time
=
0
;
Charge_OFF_Flag
=
0
;
interact_PWM_Low_Duty
=
0
;
Gauge_Power_SOC_pull_Display
();
}
break
;
case
READY
:
{
poweroff_time
=
0
;
Charge_OFF_Flag
=
0
;
interact_PWM_Low_Duty
=
30
;
Gauge_Power_SOC_pull_Display
();
}
break
;
case
CHRGING
:
{
SOC_charge_seg_Flag
=
1
;
if
(
poweroff_time
<
3600
)
{
Gauge_Power_SOC_CHAGING_Display
();
if
((
MBMS_TOTALSigAcc
==
0x0
)
&&
(
MBMS_TOTALSigCharge
==
0x1
))
// 下电充电)
{
Charge_OFF_Flag
=
1
;
}
else
{
Charge_OFF_Flag
=
0
;
}
}
else
{
Charge_OFF_Flag
=
2
;
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
;
case
CHRG_PLUGIN
:
...
...
@@ -587,10 +390,6 @@ void Gauge_CAN_setup_Service(void)
{
Charge_OFF_Flag
=
0
;
}
Gauge_Power_SOC_pull_Display
();
SOC1_Count
=
0
;
SOC2_Count
=
0
;
poweroff_time
=
0
;
}
break
;
...
...
Firmware/Source/Application/GUI_Display/GUI_Display.h
View file @
80cc03c1
...
...
@@ -70,7 +70,6 @@ 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_EleDial_AllSOC_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
);
...
...
Firmware/Source/Component/PowerManagement/PowerManag_user.c
View file @
80cc03c1
...
...
@@ -70,6 +70,7 @@ static void Power_KL30_Init(void)
g_stRTCInformation
.
u8RTCYear
=
20
;
RTE_RTC_Init
(
g_stRTCInformation
);
RTE_DEEPSLEEP_GPIO_Interrupt_Enable
(
KL15_AD_IN
,
Trigger_Rising
);
Data_Soc_KL30_Init
();
}
extern
uint32_t
PowerIgnOffTimeLine
;
...
...
Firmware/Source/System/Sys_Task_List.c
View file @
80cc03c1
...
...
@@ -46,6 +46,7 @@ void Sys_50ms_Tasks(void)
Telltales_Management
();
Set_CAN_ALL_Signal
();
Gauge_Service
();
Data_Soc_Service
();
}
void
Sys_15ms_Tasks
(
void
)
...
...
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