Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiancetai
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
陈家乐
jiancetai
Commits
b0b15f8a
Commit
b0b15f8a
authored
Nov 08, 2025
by
何锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:完成菜单控制
parent
2a845a0a
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
995 additions
and
17 deletions
+995
-17
settings.json
.vscode/settings.json
+2
-1
Barcode_Scanner.c
YueJin_test_bench/source/Appliciation/Barcode_Scanner.c
+64
-0
Check_Ctrl.c
YueJin_test_bench/source/Appliciation/Check_Ctrl.c
+2
-2
Display_Info.c
YueJin_test_bench/source/Appliciation/Display_Info.c
+802
-1
Display_Info.h
YueJin_test_bench/source/Appliciation/Display_Info.h
+1
-0
Key_user.c
YueJin_test_bench/source/Appliciation/Key_user.c
+9
-1
R485_Communication_Matrix.c
...est_bench/source/Appliciation/R485_Communication_Matrix.c
+77
-8
R485_Communication_Matrix.h
...est_bench/source/Appliciation/R485_Communication_Matrix.h
+34
-4
api_RS485.c
YueJin_test_bench/source/Appliciation/api_RS485.c
+3
-0
init.c
YueJin_test_bench/source/System/init.c
+1
-0
No files found.
.vscode/settings.json
View file @
b0b15f8a
...
...
@@ -57,6 +57,7 @@
"C_Cpp_Runner.useLinkTimeOptimization"
:
false
,
"C_Cpp_Runner.msvcSecureNoWarnings"
:
false
,
"files.associations"
:
{
"string.h"
:
"c"
"string.h"
:
"c"
,
"can_communication_matrix.h"
:
"c"
}
}
\ No newline at end of file
YueJin_test_bench/source/Appliciation/Barcode_Scanner.c
View file @
b0b15f8a
...
...
@@ -68,6 +68,63 @@ uint8_t recvflag111 = 0;
uint8_t
xierucishu
=
0
;
uint8_t
waittimer
;
uint8_t
saomafinish
;
uint8_t
Autoheadlightstatustime
;
uint8_t
Autoheadlightstatuslast
;
uint8_t
RampStopSettime
;
uint8_t
RampStopSetlast
;
uint8_t
TCSSettime
;
uint8_t
TCSSetlast
;
uint8_t
Sendcontinuouslytime
;
uint8_t
Sendcontinuouslylast
;
uint8_t
steepslopetime
;
uint8_t
steepslopelast
;
void
ProcessVehicleStatus
(
void
)
{
typedef
struct
{
uint8_t
currentValue
;
uint8_t
*
lastValue
;
uint8_t
*
counter
;
uint8_t
*
flag
;
}
StatusCheck_t
;
StatusCheck_t
statusChecks
[]
=
{
{
R485_IDD4h
.
Sig
.
SideStaySenseSetInstructTX
,
&
Sendcontinuouslylast
,
&
Sendcontinuouslytime
,
&
SideStayflag
},
{
R485_IDD4h
.
Sig
.
SlopeDropSetInstructTX
,
&
steepslopelast
,
&
steepslopetime
,
&
SlopeDescentflag
},
{
R485_IDD4h
.
Sig
.
RampStopSetInstructTX
,
&
RampStopSetlast
,
&
RampStopSettime
,
&
RampParkflag
},
{
R485_IDD4h
.
Sig
.
TCSSetInstructTX
,
&
TCSSetlast
,
&
TCSSettime
,
&
TCSflag
},
{
R485_IDD4h
.
Sig
.
Autoheadlightstatus
,
&
Autoheadlightstatuslast
,
&
Autoheadlightstatustime
,
&
Autoheadlightflag
}
};
for
(
int
i
=
0
;
i
<
sizeof
(
statusChecks
)
/
sizeof
(
statusChecks
[
0
]);
i
++
)
{
StatusCheck_t
check
=
statusChecks
[
i
];
if
(
check
.
currentValue
==
1
||
check
.
currentValue
==
0
)
{
if
(
*
check
.
lastValue
==
check
.
currentValue
)
{
(
*
check
.
counter
)
++
;
}
else
{
if
(
*
check
.
counter
==
1
)
{
*
check
.
counter
=
1
;
}
*
check
.
counter
=
1
;
*
check
.
lastValue
=
check
.
currentValue
;
}
}
if
(
*
check
.
counter
>=
3
)
{
*
check
.
counter
=
0
;
*
check
.
flag
=
(
*
check
.
lastValue
==
1
)
?
1
:
0
;
}
}
}
void
datacheck
(
void
)
{
uint16_t
checksum
=
0
;
...
...
@@ -91,6 +148,11 @@ void datacheck(void)
}
switch
(
BarCode
[
2
])
//ID
{
case
0xD4
:
memcpy
(
R485_IDD4h
.
Msg
,
RS485_data
,
RS485_RX_ID0XD4_DATA_LEN
);
ProcessVehicleStatus
();
break
;
case
0xB4
:
memcpy
(
R485_IDB4h
.
Msg
,
RS485_data
,
RS485_RX_ID0XB4_DATA_LEN
);
checksum
=
Yadi_CAL_Data_Sum
(
&
BarCode
[
2
],
64
+
2
);
...
...
@@ -98,6 +160,8 @@ void datacheck(void)
{
;
}
break
;
case
0x81
:
//81接收mac地址
{
if
((
BarCode
[
72
]
==
0x4A
)
&&
(
BarCode
[
71
]
==
0x4B
))
...
...
YueJin_test_bench/source/Appliciation/Check_Ctrl.c
View file @
b0b15f8a
...
...
@@ -398,12 +398,12 @@ uint8_t yibiaoshuju[34];
// // Function_Check_Ctrl(1); //Excel表格发报文。硬线信号
// //FUEL_UDS__Display(3);
// Buzzer_Warning();
//
break;
break
;
// case 4:
//
break;
//
break;
...
...
YueJin_test_bench/source/Appliciation/Display_Info.c
View file @
b0b15f8a
This diff is collapsed.
Click to expand it.
YueJin_test_bench/source/Appliciation/Display_Info.h
View file @
b0b15f8a
...
...
@@ -94,6 +94,7 @@ extern const uint8_t *Num_30[];
extern
const
uint8_t
*
Letter_Num_11
[];
extern
uint32_t
loc_Current_0
;
extern
uint8_t
menumondel
;
extern
void
Get_static_Current
(
void
);
extern
uint32_t
Get_Display_Type
(
void
);
extern
uint8_t
guangganflag
;
...
...
YueJin_test_bench/source/Appliciation/Key_user.c
View file @
b0b15f8a
...
...
@@ -210,7 +210,15 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
}
else
if
(
enKeyEvent
==
KEY_EVENT_LONG_PRESS
)
{
if
(
menumondel
==
0
)
{
menumondel
=
1
;
Display_TFT_Clear
();
}
else
{
menumondel
=
0
;
}
}
else
if
(
enKeyEvent
==
KEY_EVENT_SUPER_LONG_PRESS
)
{
...
...
YueJin_test_bench/source/Appliciation/R485_Communication_Matrix.c
View file @
b0b15f8a
...
...
@@ -2,6 +2,7 @@
#include "Barcode_Scanner.h"
#include "string.h"
#include "Key.h"
#include "Display_Info.h"
uint8_t
barcode_Msg
[
64
];
uint8_t
barcode_Msg1
[
64
];
uint8_t
name1
=
0
;
...
...
@@ -182,6 +183,19 @@ uint32_t R485_Send_0xD1(void)
uint8_t
RampParkedStatecounter
=
0
;
//红色闪烁两次
uint8_t
SideStayflag
;
uint8_t
TCSflag
;
uint8_t
SlopeDescentflag
;
uint8_t
RampParkflag
;
uint8_t
Autoheadlightflag
;
void
menuFeedbackinit
(
void
)
{
SideStayflag
=
0
;
TCSflag
=
0
;
SlopeDescentflag
=
0
;
RampParkflag
=
0
;
Autoheadlightflag
=
0
;
}
uint32_t
R485_Send_0xD2
(
void
)
{
memset
(
R485_IDD2h
.
Msg
,
0xFF
,
36
);
...
...
@@ -191,6 +205,42 @@ uint32_t R485_Send_0xD2(void)
R485_IDD2h
.
Sig
.
BrakeSwitchFeedback
=
0x00
;
//ready灯熄灭
if
(
SideStayflag
==
0
)
{
R485_IDD2h
.
Sig
.
SideStaySenseSetFeedback
=
0x00
;
//菜单边撑感应功能设置反馈功能
}
else
if
(
SideStayflag
==
1
)
{
R485_IDD2h
.
Sig
.
SideStaySenseSetFeedback
=
0x01
;
//菜单边撑感应功能设置反馈功能
}
if
(
TCSflag
==
0
)
{
R485_IDD2h
.
Sig
.
TCSDefined
=
0x00
;
//菜单TCS功能设置反馈功能
}
else
if
(
TCSflag
==
1
)
{
R485_IDD2h
.
Sig
.
TCSDefined
=
0x01
;
//菜单TCS功能设置反馈功能
}
if
(
SlopeDescentflag
==
0
)
{
R485_IDD2h
.
Sig
.
SlopeDescentFunctionStatus
=
0x00
;
//菜单陡坡缓降功能设置反馈功能
}
else
if
(
SlopeDescentflag
==
1
)
{
R485_IDD2h
.
Sig
.
SlopeDescentFunctionStatus
=
0x01
;
//菜单陡坡缓降功能设置反馈功能
}
if
(
RampParkflag
==
0
)
{
R485_IDD2h
.
Sig
.
RampParkedSetFeedback
=
0x00
;
//菜单边撑感应功能设置反馈功能
}
else
if
(
RampParkflag
==
1
)
{
R485_IDD2h
.
Sig
.
RampParkedSetFeedback
=
0x01
;
//菜单边撑感应功能设置反馈功能
}
if
(
clearOdoFlag
==
0
)
{
switch
(
MENU_CHECK_STEP
)
...
...
@@ -447,7 +497,7 @@ uint32_t R485_Send_0xD3(void)
memset
(
R485_IDD3h
.
Msg
,
0xFF
,
26
);
uint32_t
u32sendendflag
=
0
;
R485_IDD3h
.
Sig
.
AutoheadLightSetting
=
0x00
;
//自动大灯
//
R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
R485_IDD3h
.
Sig
.
BlueToothPair
=
0x00
;
//经典蓝牙配对指令
...
...
@@ -475,12 +525,12 @@ uint32_t R485_Send_0xD3(void)
switch
(
MENU_CHECK_STEP
)
{
case
2
:
R485_IDD3h
.
Sig
.
AutoheadLightSetting
=
0x00
;
//自动大灯
//
R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
R485_IDD3h
.
Sig
.
ElectronicCushionStatus
=
0x01
;
//座桶开启灯
break
;
case
3
:
R485_IDD3h
.
Sig
.
AutoheadLightSetting
=
0x00
;
//自动大灯
//
R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
R485_IDD3h
.
Sig
.
RemainingMileageDisSetting
=
0
;
//续航里程
R485_IDD3h
.
Sig
.
SupportSwitchState
=
0x01
;
//边撑状态
...
...
@@ -488,7 +538,7 @@ uint32_t R485_Send_0xD3(void)
break
;
case
4
:
R485_IDD3h
.
Sig
.
AutoheadLightSetting
=
0x00
;
//自动大灯
//
R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
R485_IDD3h
.
Sig
.
RemainingMileageDisSetting
=
1
;
//续航里程
...
...
@@ -502,7 +552,7 @@ uint32_t R485_Send_0xD3(void)
break
;
case
6
:
R485_IDD3h
.
Sig
.
AutoheadLightSetting
=
0x01
;
//自动大灯
//
R485_IDD3h.Sig.AutoheadLightSetting = 0x01; //自动大灯
if
(
KeyStep
==
3
)
{
...
...
@@ -523,7 +573,7 @@ uint32_t R485_Send_0xD3(void)
case
9
:
R485_IDD3h
.
Sig
.
SupportSwitchState
=
0x01
;
//边撑状态
R485_IDD3h
.
Sig
.
AutoheadLightSetting
=
0x01
;
//自动大灯
//
R485_IDD3h.Sig.AutoheadLightSetting = 0x01; //自动大灯
R485_IDD3h
.
Sig
.
ElectronicCushionStatus
=
0x01
;
//座桶开启灯
break
;
...
...
@@ -534,7 +584,7 @@ uint32_t R485_Send_0xD3(void)
R485_IDD3h
.
Sig
.
SupportSwitchState
=
0x00
;
//边撑状态
R485_IDD3h
.
Sig
.
ElectronicCushionStatus
=
0x00
;
//座桶开启灯
R485_IDD3h
.
Sig
.
AutoheadLightSetting
=
0x00
;
//自动大灯
//
R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
break
;
}
}
...
...
@@ -640,10 +690,29 @@ uint32_t R485_Send_0xA4(void)
R485_IDA4h
.
Sig
.
Invalid_characters
=
0x01
;
uint32_t
u32sendendflag
=
0
;
u32sendendflag
=
R485_Send
(
0xA4
,
R485_IDA4h
.
Msg
,
sizeof
(
R485_IDA4h
.
Msg
));
if
(
menumondel
==
0
)
{
u32sendendflag
=
R485_Send
(
0xA4
,
R485_IDA4h
.
Msg
,
sizeof
(
R485_IDA4h
.
Msg
));
}
else
if
(
menumondel
==
1
)
{
u32sendendflag
=
R485_Send
(
0xC4
,
R485_IDA4h
.
Msg
,
sizeof
(
R485_IDA4h
.
Msg
));
}
return
u32sendendflag
;
}
uint32_t
R485_Send_0xC4
(
void
)
//菜单设置收发
{
memset
(
R485_IDC4h
.
Msg
,
0xFF
,
1
);
R485_IDC4h
.
Sig
.
Invalid_characterssecond
=
0x01
;
uint32_t
u32sendendflag
=
0
;
u32sendendflag
=
R485_Send
(
0xC4
,
R485_IDC4h
.
Msg
,
sizeof
(
R485_IDC4h
.
Msg
));
return
u32sendendflag
;
}
uint32_t
R485_Send_0x41
(
void
)
{
/**************0.437*********** */
...
...
YueJin_test_bench/source/Appliciation/R485_Communication_Matrix.h
View file @
b0b15f8a
...
...
@@ -16,10 +16,10 @@
#define RS485_RX_ID0XB6_DATA_LEN 86
#define RS485_RX_ID0XD6_DATA_LEN 111
#define RS485_RX_ID0XA4_DATA_LEN 1
#define RS485_RX_ID0XC4_DATA_LEN
4
#define RS485_RX_ID0XC4_DATA_LEN
1
#define RS485_RX_ID0XB4_DATA_LEN 75
#define RS485_RX_ID0XD4_DATA_LEN 1
4
#define RS485_RX_ID0XD4_DATA_LEN 1
7
typedef
union
{
uint8_t
Msg
[
64
];
...
...
@@ -1244,8 +1244,19 @@ typedef union __attribute__((packed))
uint8_t
ABSOLStatus
:
1
;
// ABS在线状态
uint8_t
:
5
;
uint8_t
UserPasswordL
:
8
;
// 用户输入密码值_L
uint8_t
UserPasswordH
:
8
;
// 用户输入密码值_H
uint16_t
UserPassword
:
16
;
// 用户输入密码值
/*--byte14--*/
uint8_t
:
8
;
uint8_t
SideStaySenseSetInstructTX
:
2
;
/*边撑感应功能设置指令*/
uint8_t
SlopeDropSetInstructTX
:
2
;
/*陡坡缓降功能设置指令*/
uint8_t
RampStopSetInstructTX
:
2
;
/*坡道驻停功能设置指令*/
uint8_t
TCSSetInstructTX
:
2
;
/*TCS功能设置指令*/
uint8_t
CushionSenseSetInstructTX
:
2
;
/*座垫感应功能设置指令*/
uint8_t
:
6
;
}
Sig
;
}
_ID0XD4h_Data
;
...
...
@@ -1263,6 +1274,15 @@ typedef union __attribute__((packed))
}
Sig
;
}
_ID0XA4h_Data
;
typedef
union
__attribute__
((
packed
))
{
uint8_t
Msg
[
RS485_RX_ID0XC4_DATA_LEN
];
struct
{
uint8_t
Invalid_characterssecond
:
8
;
}
Sig
;
}
_ID0XC4h_Data
;
typedef
union
__attribute__
((
packed
))
{
uint8_t
Msg
[
RS485_RX_ID0XD0_DATA_LEN
];
...
...
@@ -1917,6 +1937,7 @@ extern _ID0XD6h_Data R485_IDD6h;
extern
_ID0XB4h_Data
R485_IDB4h
;
extern
_ID0XD4h_Data
R485_IDD4h
;
extern
_ID0XA4h_Data
R485_IDA4h
;
extern
_ID0XC4h_Data
R485_IDC4h
;
extern
uint8_t
zhenduansendStep
;
extern
uint32_t
R485_Send_0x40
(
void
);
...
...
@@ -1943,13 +1964,22 @@ extern uint32_t R485_Send_0xD1(void);
extern
uint32_t
R485_Send_0xD2
(
void
);
extern
uint32_t
R485_Send_0xD3
(
void
);
extern
uint32_t
R485_Send_0xA4
(
void
);
extern
uint32_t
R485_Send_0xC4
(
void
);
// extern uint32_t R485_Send_0x80(void);
extern
uint32_t
R485_Send_0x04
(
void
);
extern
void
menuFeedbackinit
(
void
);
extern
uint8_t
barcode_Msg
[
64
];
extern
uint8_t
barcode_Msg1
[
64
];
extern
uint8_t
name1
;
extern
uint8_t
name2
;
extern
uint8_t
R485_0x80_msg
[
64
];
extern
uint8_t
SideStayflag
;
extern
uint8_t
TCSflag
;
extern
uint8_t
SlopeDescentflag
;
extern
uint8_t
RampParkflag
;
extern
uint8_t
Autoheadlightflag
;
extern
uint8_t
mimayanzhengjieguo
;
#endif
YueJin_test_bench/source/Appliciation/api_RS485.c
View file @
b0b15f8a
...
...
@@ -56,6 +56,7 @@ LineSta LineGetSta;
_ID0XB4h_Data
R485_IDB4h
;
_ID0XD4h_Data
R485_IDD4h
;
_ID0XA4h_Data
R485_IDA4h
;
_ID0XC4h_Data
R485_IDC4h
;
void
R485_TX_Init
(
void
)
{
...
...
@@ -424,6 +425,8 @@ uint8_t RS485_User_Tx_Data(void)
}
break
;
case
RS485_Tx_IDD0_Idx
:
sendfinishflag
=
R485_Send_0xD0
();
RS485_TX_finish
=
1
;
...
...
YueJin_test_bench/source/System/init.c
View file @
b0b15f8a
...
...
@@ -83,6 +83,7 @@ void Sys_Startup_Init(void)
Key_Init
(
);
Buzzer_Init
();
Fre_In_KL30_Wakeup_Init
();
menuFeedbackinit
();
UART_Channel_Config_st_t
loc_config
;
loc_config
.
enUARTLINMode
=
MODE_UART
;
loc_config
.
u32UARTbps
=
115200
;
...
...
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