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
875f7566
Commit
875f7566
authored
Nov 09, 2024
by
梁百峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:扫码枪读取以及外发检验值对比
parent
9f0bd79e
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
384 additions
and
44 deletions
+384
-44
R485_Communication_Matrix.c
source/R485_Communication_Matrix.c
+1
-1
R485_Communication_Matrix.h
source/R485_Communication_Matrix.h
+156
-1
api_RS485.h
source/api_RS485.h
+1
-0
app_tft.c
source/app/app_tft/app_tft.c
+22
-4
app_tft.h
source/app/app_tft/app_tft.h
+3
-0
bsp_button.c
source/bsp_source/bsp_button/bsp_button.c
+29
-5
bsp_button.h
source/bsp_source/bsp_button/bsp_button.h
+1
-0
main.c
source/main.c
+170
-33
main.h
source/main.h
+1
-0
No files found.
source/R485_Communication_Matrix.c
View file @
875f7566
...
@@ -603,7 +603,7 @@ uint32_t R485_Send_0x41(void)
...
@@ -603,7 +603,7 @@ uint32_t R485_Send_0x41(void)
R485_ID41h
.
Sig
.
RotorLocked
=
0
;
R485_ID41h
.
Sig
.
RotorLocked
=
0
;
break
;
break
;
}
}
u32sendendflag
=
R485_Send
(
0x4
1
,
R485_ID41h
.
Msg
,
sizeof
(
R485_ID41h
.
Msg
));
u32sendendflag
=
R485_Send
(
0x4
8
,
R485_ID41h
.
Msg
,
sizeof
(
R485_ID41h
.
Msg
));
return
u32sendendflag
;
return
u32sendendflag
;
}
}
...
...
source/R485_Communication_Matrix.h
View file @
875f7566
...
@@ -1097,7 +1097,162 @@ typedef union
...
@@ -1097,7 +1097,162 @@ typedef union
}
_ID0X4Dh_Data
;
}
_ID0X4Dh_Data
;
typedef
union
{
uint8_t
Msg
[
64
];
struct
{
/* Byte 0*/
uint8_t
Clear
:
1
;
/*清零信号*/
/* Byte 1 */
uint8_t
:
8
;
/* Vin号1位 */
/* Byte 2 */
uint8_t
:
8
;
/* Vin号2位 */
/* Byte 3 */
uint8_t
:
8
;
/* Vin号3位 */
/* Byte 4 */
uint8_t
:
8
;
/* Vin号4位 */
/* Byte 5 */
uint8_t
:
8
;
/* Vin号5位 */
/* Byte 6 */
uint8_t
:
8
;
/* Vin号6位 */
/* Byte 7 */
uint8_t
:
8
;
/* Vin号7位 */
/* Byte 8 */
uint8_t
:
8
;
/* Vin号8位 */
/* Byte 9 */
uint8_t
:
8
;
/* Vin号9位 */
/* Byte 10 */
uint8_t
:
8
;
/* Vin号10位 */
/* Byte 11 */
uint8_t
:
8
;
/* Vin号11位 */
/* Byte 12 */
uint8_t
:
8
;
/* Vin号12 */
/* Byte 13 */
uint8_t
:
8
;
/* Vin号13 */
/* Byte 14 */
uint8_t
:
8
;
/* Vin号14 */
/* Byte 15 */
uint8_t
:
8
;
/* Vin号15 */
/* Byte 16 */
uint8_t
:
8
;
/* Vin号16 */
/* Byte 17 */
uint8_t
:
8
;
/* Vin号17 */
/* Byte 18 */
uint8_t
:
2
;
/* 转向优先开关设置指令 */
uint8_t
:
6
;
/* 预留 */
/* Byte 19 */
uint8_t
:
8
;
/* 预警天气类型 */
/* Byte 20 */
uint8_t
:
8
;
/* 当前天气类型 */
/* Byte 21 */
uint8_t
:
8
;
/* 当前天气温度 */
/* Byte 22 */
uint8_t
:
8
;
/* 恶劣天气类型 */
/* Byte 23*/
uint8_t
:
3
;
/* 天气预警等级 */
uint8_t
:
5
;
/* 恶劣天气发生时间 */
/* Byte 24 */
uint8_t
:
2
;
/* 仪表密码解锁唤醒指令 */
uint8_t
:
2
;
/* 密码认证结果 */
uint8_t
:
3
;
/* 密码可输入剩余次数 */
uint8_t
:
1
;
/* 故障修复模式 */
/* Byte 25 - 26*/
uint8_t
:
8
;
/* 总电池电量剩余充满时间L 与通信协议出入 */
uint8_t
:
8
;
/* 总电池电量剩余充满时间H 与通信协议出入 */
/* Byte 27*/
uint8_t
:
2
;
/* 故障修复模式 */
uint8_t
:
2
;
/* 边撑功能设置反馈 */
uint8_t
:
2
;
/* 座垫感应功能设置反馈 */
uint8_t
:
2
;
/* 预留 */
/* Byte 28-63*/
uint8_t
:
8
;
/* 28预留 */
/* Byte 29*/
uint8_t
:
8
;
/* 母线电流 */
/* Byte 30-35*/
uint8_t
:
8
;
/* BLEMAC地址 */
uint8_t
:
8
;
/* BLEMAC地址 */
uint8_t
:
8
;
/* BLEMAC地址 */
uint8_t
:
8
;
/* BLEMAC地址 */
uint8_t
:
8
;
/* BLEMAC地址 */
uint8_t
:
8
;
/* BLEMAC地址 */
/* Byte 36*/
uint8_t
:
5
;
/* 36预留 */
uint8_t
:
2
;
/* 超级T动力状态 */
uint8_t
:
1
;
/* 36预留 */
uint8_t
:
8
;
/* 37预留 */
uint8_t
:
4
;
/* 38预留 */
uint8_t
:
2
;
/*导购模式*/
uint8_t
:
2
;
/* 38预留 */
uint8_t
:
8
;
/* 39预留 */
uint8_t
:
8
;
/* 40预留 */
uint8_t
:
8
;
/* 41预留 */
uint8_t
:
8
;
/* 42预留 */
uint8_t
:
8
;
/* 43预留 */
uint8_t
:
8
;
/* 44预留 */
uint8_t
:
8
;
/* 45预留 */
uint8_t
:
8
;
/* 46预留 */
uint8_t
:
8
;
/* 47预留 */
uint8_t
:
8
;
/* 48预留 */
uint8_t
:
8
;
/* 49预留 */
uint8_t
:
8
;
/* 50预留 */
uint8_t
:
8
;
/* 51预留 */
uint8_t
:
8
;
/* 52预留 */
uint8_t
:
8
;
/* 53预留 */
uint8_t
:
8
;
/* 54预留 */
uint8_t
:
8
;
/* 55预留 */
uint8_t
:
8
;
/* 56预留 */
uint8_t
:
8
;
/* 57预留 */
uint8_t
:
8
;
/* 58预留 */
uint8_t
:
8
;
/* 59预留 */
/* Byte 60*/
uint8_t
:
6
;
/* 60预留 */
uint8_t
:
2
;
uint8_t
:
8
;
/* 61预留 */
uint8_t
:
8
;
/* 62预留 */
uint8_t
:
8
;
/* 63预留 */
}
Sig
;
}
_ID0X80h_Data
;
extern
_ID0X40h_Data
R485_ID40h
;
extern
_ID0X40h_Data
R485_ID40h
;
extern
_ID0X48h_Data
R485_ID48h
;
extern
_ID0X48h_Data
R485_ID48h
;
extern
_ID0X41h_Data
R485_ID41h
;
extern
_ID0X41h_Data
R485_ID41h
;
...
@@ -1105,7 +1260,7 @@ extern _ID0X49h_Data R485_ID49h;
...
@@ -1105,7 +1260,7 @@ extern _ID0X49h_Data R485_ID49h;
extern
_ID0X42h_Data
R485_ID42h
;
extern
_ID0X42h_Data
R485_ID42h
;
extern
_ID0X4Ah_Data
R485_ID4Ah
;
extern
_ID0X4Ah_Data
R485_ID4Ah
;
extern
_ID0X4Dh_Data
R485_ID4Dh
;
extern
_ID0X4Dh_Data
R485_ID4Dh
;
extern
_ID0X80h_Data
R485_ID80h
;
extern
uint32_t
R485_Send_0x40
(
void
);
extern
uint32_t
R485_Send_0x40
(
void
);
...
...
source/api_RS485.h
View file @
875f7566
...
@@ -55,4 +55,5 @@ extern uint32_t RS485_send_time;
...
@@ -55,4 +55,5 @@ extern uint32_t RS485_send_time;
extern
uint8_t
RS485_TX_finish
;
extern
uint8_t
RS485_TX_finish
;
extern
uint32_t
RS485_send_num
;
extern
uint32_t
RS485_send_num
;
extern
uint32_t
R485_Send
(
const
uint16_t
cmdID
,
const
uint8_t
*
pData
,
uint8_t
len
);
extern
uint32_t
R485_Send
(
const
uint16_t
cmdID
,
const
uint8_t
*
pData
,
uint8_t
len
);
extern
uint8_t
Yadi_CAL_Data_Sum
(
uint8_t
*
pu8LinData
,
uint16_t
u8LinLen
);
#endif
/* API_ADC_H_ */
#endif
/* API_ADC_H_ */
source/app/app_tft/app_tft.c
View file @
875f7566
...
@@ -100,6 +100,9 @@ unsigned int g_RPM_Val;
...
@@ -100,6 +100,9 @@ unsigned int g_RPM_Val;
#define CHECK_VERSION_X 1
#define CHECK_VERSION_X 1
#define CHECK_VERSION_Y 295
#define CHECK_VERSION_Y 295
uint8_t
corenum
[
100
];
uint8_t
corenum1
[
100
];
uint8_t
corenum2
[
100
];
...
@@ -2092,13 +2095,15 @@ void AUTO_Step1(void)
...
@@ -2092,13 +2095,15 @@ void AUTO_Step1(void)
SetDisplayStaticItemW2
(
YD_ruanjian
,
2
,
SW_HJHW_Y
,
DRAW_LUMIN_ICOM_WINDOW
);
SetDisplayStaticItemW2
(
YD_ruanjian
,
2
,
SW_HJHW_Y
,
DRAW_LUMIN_ICOM_WINDOW
);
uint8_t
uiDspInfo_NUM5
[
16
+
1
];
uint8_t
uiDspInfo_NUM5
[
16
+
1
];
uiDspInfo_NUM5
[
0
]
=
0
;
uiDspInfo_NUM5
[
0
]
=
0
;
sprintf
(
uiDspInfo_NUM5
,
":%2d.%2d"
,
0x01
,
0x0c
);
//软件版本号
// sprintf(uiDspInfo_NUM5,":%2d.%2d",0x01,0x0c);//软件版本号
sprintf
(
uiDspInfo_NUM5
,
":%2d.%2d"
,
R485_ID48h
.
Sig
.
MCUMainSoftwareVer
,
R485_ID48h
.
Sig
.
MCUSecSoftwareVer
);
DspOneLineDynamicStr
(
uiDspInfo_NUM5
,
120
,
SW_HJHW_Y
+
2
);
DspOneLineDynamicStr
(
uiDspInfo_NUM5
,
120
,
SW_HJHW_Y
+
2
);
SetDisplayStaticItemW2
(
YD_yingjian
,
2
,
SW_HJHW_Y
+
25
,
DRAW_LUMIN_ICOM_WINDOW
);
SetDisplayStaticItemW2
(
YD_yingjian
,
2
,
SW_HJHW_Y
+
25
,
DRAW_LUMIN_ICOM_WINDOW
);
uint8_t
uiDspInfo_NUM6
[
16
+
1
];
uint8_t
uiDspInfo_NUM6
[
16
+
1
];
uiDspInfo_NUM6
[
0
]
=
0
;
uiDspInfo_NUM6
[
0
]
=
0
;
sprintf
(
uiDspInfo_NUM6
,
": %3d"
,
0x8C
);
sprintf
(
uiDspInfo_NUM6
,
": %3d"
,
R485_ID48h
.
Sig
.
HardwareVer
);
DspOneLineDynamicStr
(
uiDspInfo_NUM6
,
120
,
SW_HJHW_Y
+
25
+
2
);
DspOneLineDynamicStr
(
uiDspInfo_NUM6
,
120
,
SW_HJHW_Y
+
25
+
2
);
SetDisplayStaticItemW2
(
YD_yingxianwaifan
,
2
,
SW_HJHW_Y
+
25
+
25
,
DRAW_LUMIN_ICOM_WINDOW
);
SetDisplayStaticItemW2
(
YD_yingxianwaifan
,
2
,
SW_HJHW_Y
+
25
+
25
,
DRAW_LUMIN_ICOM_WINDOW
);
...
@@ -2109,8 +2114,18 @@ void AUTO_Step1(void)
...
@@ -2109,8 +2114,18 @@ void AUTO_Step1(void)
SetDisplayStaticItemW2
(
YD_yibiao
,
2
,
SW_HJHW_Y
+
25
+
25
+
20
,
DRAW_LUMIN_ICOM_WINDOW
);
SetDisplayStaticItemW2
(
YD_yibiao
,
2
,
SW_HJHW_Y
+
25
+
25
+
20
,
DRAW_LUMIN_ICOM_WINDOW
);
DspOneLineDynamicStr
(
uiDspInfo_NUM2
,
120
,
SW_HJHW_Y
+
25
+
25
+
20
);
DspOneLineDynamicStr
(
uiDspInfo_NUM2
,
120
,
SW_HJHW_Y
+
25
+
25
+
20
);
SetDisplayStaticItemW2
(
YD_zhichisaom
,
2
,
SW_HJHW_Y
+
25
+
25
+
20
+
20
,
DRAW_LUMIN_ICOM_WINDOW
);
// SetDisplayStaticItemW2(YD_zhichisaom , 2, SW_HJHW_Y+25+25+20+20, DRAW_LUMIN_ICOM_WINDOW);//支持扫码功能
uint8_t
uiDspInfo_NUM4
[
16
+
1
];
uiDspInfo_NUM4
[
0
]
=
0
;
sprintf
(
uiDspInfo_NUM4
,
": NO"
,
SW_Data
);
if
(
checknumwrong
)
{
DspOneLineDynamicStr
(
uiDspInfo_NUM4
,
120
,
SW_HJHW_Y
+
25
+
25
+
20
);
}
else
{
DspOneLineDynamicStr
(
uiDspInfo_NUM2
,
120
,
SW_HJHW_Y
+
25
+
25
+
20
);
}
SetDisplayStaticItemW2
(
YD_dianyuanwaifa
,
2
,
SW_HJHW_Y
+
25
+
25
+
20
+
20
+
25
,
DRAW_LUMIN_ICOM_WINDOW
);
SetDisplayStaticItemW2
(
YD_dianyuanwaifa
,
2
,
SW_HJHW_Y
+
25
+
25
+
20
+
20
+
25
,
DRAW_LUMIN_ICOM_WINDOW
);
DspOneLineDynamicStr
(
uiDspInfo_NUM2
,
120
,
SW_HJHW_Y
+
25
+
25
+
20
+
20
+
25
+
15
);
DspOneLineDynamicStr
(
uiDspInfo_NUM2
,
120
,
SW_HJHW_Y
+
25
+
25
+
20
+
20
+
25
+
15
);
SetDisplayStaticItemW2
(
YD_jiancetai
,
2
,
SW_HJHW_Y
+
25
+
25
+
20
+
20
+
25
+
45
,
DRAW_LUMIN_ICOM_WINDOW
);
//�����:����
SetDisplayStaticItemW2
(
YD_jiancetai
,
2
,
SW_HJHW_Y
+
25
+
25
+
20
+
20
+
25
+
45
,
DRAW_LUMIN_ICOM_WINDOW
);
//�����:����
...
@@ -3199,6 +3214,9 @@ void UpdateCenterTripC(void)
...
@@ -3199,6 +3214,9 @@ void UpdateCenterTripC(void)
break
;
break
;
case
STAGE_AutoCheck
:
//�Լ�
case
STAGE_AutoCheck
:
//�Լ�
// AUTO_Display();
// AUTO_Display();
DspOneLineDynamicStr
(
corenum
,
0
,
70
);
DspOneLineDynamicStr
(
corenum1
,
0
,
90
);
DspOneLineDynamicStr
(
corenum2
,
0
,
110
);
break
;
break
;
case
STAGE_Led_Telltale_Check
:
//双闪
case
STAGE_Led_Telltale_Check
:
//双闪
...
...
source/app/app_tft/app_tft.h
View file @
875f7566
...
@@ -345,6 +345,9 @@ extern uint8_t NUM8Flag;
...
@@ -345,6 +345,9 @@ extern uint8_t NUM8Flag;
extern
uint8_t
HJ_HJYBStateFlag
;
extern
uint8_t
HJ_HJYBStateFlag
;
extern
uint8_t
HJ_DAYFlag
;
extern
uint8_t
HJ_DAYFlag
;
extern
uint16_t
FuelResTest
;
extern
uint16_t
FuelResTest
;
extern
uint8_t
corenum
[
100
];
extern
uint8_t
corenum1
[
100
];
extern
uint8_t
corenum2
[
100
];
enum
enum
{
{
HJ_UDSStateSuc
=
1
,
HJ_UDSStateSuc
=
1
,
...
...
source/bsp_source/bsp_button/bsp_button.c
View file @
875f7566
...
@@ -28,6 +28,8 @@ uint8_t GetPartNumFinish = 0;
...
@@ -28,6 +28,8 @@ uint8_t GetPartNumFinish = 0;
uint16_t
GetPartNumTimerCnts
=
0
;
uint16_t
GetPartNumTimerCnts
=
0
;
uint8_t
Freque_Flag
;
uint8_t
Freque_Flag
;
uint8_t
g_uiCuntDownFlag
=
0
;
uint8_t
g_uiCuntDownFlag
=
0
;
uint8_t
Auto_add_flag
=
0
;
uint8_t
Auto_reducte_flag
=
0
;
#if (SEMI_AUTOMATIC_STAGE)
#if (SEMI_AUTOMATIC_STAGE)
#define STAGE_COUNT_EOL 4
#define STAGE_COUNT_EOL 4
...
@@ -223,6 +225,12 @@ void Get_Button_Value()//��ȡ����AD
...
@@ -223,6 +225,12 @@ void Get_Button_Value()//��ȡ����AD
else
else
Botton
.
FuelWaterDown
.
Flag
=
0
;
Botton
.
FuelWaterDown
.
Flag
=
0
;
#endif
#endif
GET_BUTTON_IOL_UP_LEVEL
;
GET_BUTTON_SPEED_DOWN_LEVEL
;
if
(
BUTTON_IOL_UP_IN
==
0
&&
BUTTON_SPEED_DOWN_IN
==
0
)
Botton
.
Auto_AddBegin
.
Flag
=
1
;
else
Botton
.
Auto_AddBegin
.
Flag
=
0
;
#if (FUNCTION_KEY_TFT_UP)
#if (FUNCTION_KEY_TFT_UP)
GET_BUTTON_TFT_UP_LEVEL
;
GET_BUTTON_TFT_UP_LEVEL
;
if
(
BUTTON_TFT_UP_IN
==
0
)
if
(
BUTTON_TFT_UP_IN
==
0
)
...
@@ -687,7 +695,7 @@ void Button_Statu_Manage(void)
...
@@ -687,7 +695,7 @@ void Button_Statu_Manage(void)
}
}
if
(
Botton
.
Other
.
Flag
==
1
){
//ELSE
if
(
Botton
.
Other
.
Flag
==
1
){
//ELSE
if
(
Botton
.
Other
.
Time
<
3
000
)
if
(
Botton
.
Other
.
Time
<
6
000
)
Botton
.
Other
.
Time
+=
IntervalTimerDelta
;
Botton
.
Other
.
Time
+=
IntervalTimerDelta
;
if
(
Botton
.
Other
.
Time
>=
1000
&&
CheckClusterValid
==
0u
){
if
(
Botton
.
Other
.
Time
>=
1000
&&
CheckClusterValid
==
0u
){
...
@@ -696,12 +704,14 @@ void Button_Statu_Manage(void)
...
@@ -696,12 +704,14 @@ void Button_Statu_Manage(void)
// }
// }
Button_Press
=
1
;
Button_Press
=
1
;
Err_Flag
=
1
;
Err_Flag
=
1
;
}
}
}
else
{
}
else
{
if
(
Botton
.
Other
.
Time
>
100
&&
Botton
.
Other
.
Time
<
1000
){
if
(
Botton
.
Other
.
Time
>
3000
){
Botton
.
Other
.
Statu
=
1
;
Botton
.
Other
.
Statu
=
1
;
Button_Press
=
1
;
Button_Press
=
1
;
Button_Value
=
11
;
Button_Value
=
11
;
//ElseCurrent.enable = 1;
//ElseCurrent.enable = 1;
}
}
Botton
.
Other
.
Time
=
0
;
Botton
.
Other
.
Time
=
0
;
...
@@ -2588,7 +2598,18 @@ void Stage_Manage()
...
@@ -2588,7 +2598,18 @@ void Stage_Manage()
// }
// }
#endif
#endif
}
}
if
((
Botton
.
SpeedDown
.
Statu
==
1
)
&&
(
Botton
.
FuelWaterUp
.
Statu
==
1
))
{
if
(
Auto_add_flag
==
1
)
{
Auto_add_flag
=
0
;
}
else
{
Auto_add_flag
=
1
;
}
}
if
(
Botton
.
FuelWaterDown
.
Statu
==
1
){
if
(
Botton
.
FuelWaterDown
.
Statu
==
1
){
Botton
.
FuelWaterDown
.
Statu
=
0
;
Botton
.
FuelWaterDown
.
Statu
=
0
;
#if (SEMI_AUTOMATIC_STAGE)
#if (SEMI_AUTOMATIC_STAGE)
...
@@ -2722,8 +2743,11 @@ void Stage_Manage()
...
@@ -2722,8 +2743,11 @@ void Stage_Manage()
#if ((PRO_CN7C) || (PRO_QYC) || (PRO_BDC_PE) || (PRO_SQFL) || (PRO_DL3C))
#if ((PRO_CN7C) || (PRO_QYC) || (PRO_BDC_PE) || (PRO_SQFL) || (PRO_DL3C))
ACU14
.
msg
.
bits
.
CF_SWL_Ind
=
0x1
;
ACU14
.
msg
.
bits
.
CF_SWL_Ind
=
0x1
;
#endif
#endif
Port_SetPortPinLevel
(
2
,
3
,
PortGpioLow
);
//��ȫ��
// Port_SetPortPinLevel(2, 3, PortGpioLow);//��ȫ��
Port_SetPortPinLevel
(
2
,
20
,
PortGpioLow
);
//����ѹ��
// Port_SetPortPinLevel(2, 20, PortGpioLow);//����ѹ��
//Port_SetPortPinLevel(0, 0, PortGpioLow);//���ر���
//Port_SetPortPinLevel(0, 0, PortGpioLow);//���ر���
// Port_SetPortPinLevel(2, 1, PortGpioLow);//WaterSeparator
// Port_SetPortPinLevel(2, 1, PortGpioLow);//WaterSeparator
#if (CAN_2ND)
#if (CAN_2ND)
...
...
source/bsp_source/bsp_button/bsp_button.h
View file @
875f7566
...
@@ -100,6 +100,7 @@ typedef struct//union
...
@@ -100,6 +100,7 @@ typedef struct//union
Class
Down
;
// ��
Class
Down
;
// ��
Class
OK
;
// OK
Class
OK
;
// OK
Class
EOLClear
;
// EOL����ȫ0
Class
EOLClear
;
// EOL����ȫ0
Class
Auto_AddBegin
;
}
_BUTTON
;
}
_BUTTON
;
extern
_BUTTON
Botton
;
extern
_BUTTON
Botton
;
...
...
source/main.c
View file @
875f7566
...
@@ -44,8 +44,9 @@ uint8_t ADFlag;
...
@@ -44,8 +44,9 @@ uint8_t ADFlag;
/*add for 3360*/
/*add for 3360*/
uint8_t
Test_array
[
1000
];
uint8_t
Test_array
[
1000
];
uint8_t
Test_array_Uart9
[
10000
];
uint8_t
Test_array_Uart0
[
1000
];
uint8_t
Test_array_Uart11
[
10000
];
uint8_t
Test_array_Uart9
[
1000
];
uint8_t
Test_array_Uart11
[
1000
];
#define SAMPLE_UART_TX_BUFFSIZE (1024)
#define SAMPLE_UART_TX_BUFFSIZE (1024)
#define SAMPLE_UART_RX_BUFFSIZE (1024)
#define SAMPLE_UART_RX_BUFFSIZE (1024)
...
@@ -53,15 +54,22 @@ static uint8_t au8UartTxBuf[SAMPLE_UART_TX_BUFFSIZE]; // TX buffer
...
@@ -53,15 +54,22 @@ static uint8_t au8UartTxBuf[SAMPLE_UART_TX_BUFFSIZE]; // TX buffer
static
uint8_t
au8UartRxBuf
[
SAMPLE_UART_RX_BUFFSIZE
];
// RX buffer
static
uint8_t
au8UartRxBuf
[
SAMPLE_UART_RX_BUFFSIZE
];
// RX buffer
static
uint8_t
au8UartTxBuf1
[
SAMPLE_UART_TX_BUFFSIZE
];
// TX buffer
static
uint8_t
au8UartRxBuf1
[
SAMPLE_UART_RX_BUFFSIZE
];
// RX buffer
uint32_t
WriteCount
=
0
;;
uint32_t
WriteCount
=
0
;;
uint32_t
Time_100us
=
0
;
uint32_t
Time_100us
=
0
;
uint8_t
Uart_Pro_Flag
=
0
;
uint8_t
Uart_Pro_Flag
=
0
;
uint32_t
WriteCount_Uart9
=
0
;
uint32_t
WriteCount_Uart9
=
0
;
uint32_t
WriteCount_Uart0
=
0
;
uint32_t
WriteCount_Uart11
=
0
;
uint32_t
WriteCount_Uart11
=
0
;
uint32_t
Time_100us_Uart9
=
0
;
uint32_t
Time_100us_Uart9
=
0
;
uint8_t
Uart_Pro_Flag_Uart9
=
0
;
uint8_t
Uart_Pro_Flag_Uart9
=
0
;
uint8_t
Uart_Pro_Flag_Uart11
=
0
;
uint8_t
Uart_Pro_Flag_Uart11
=
0
;
uint8_t
RS485_data
[
64
];
// extern uint8_t corenum[100];
// extern uint8_t corenum1[100];
// extern uint8_t corenum2[100];
uint8_t
BarcodePartNumOffect
=
0
;
uint8_t
BarcodePartNumOffect
=
0
;
uint8_t
Flag_CheckBarcode
=
0
;
uint8_t
Flag_CheckBarcode
=
0
;
...
@@ -159,24 +167,113 @@ uint8_t Get_RS485_TR_Status(void)
...
@@ -159,24 +167,113 @@ uint8_t Get_RS485_TR_Status(void)
return
0
;
return
0
;
}
}
}
}
uint8_t
checknumwrong
=
0
;
void
check_getdata
(
void
)
void
check_getdata
(
void
)
{
{
if
(
Test_array_Uart11
[
0
]
==
0x59
||
Test_array_Uart11
[
1
]
==
0x59
)
uint16_t
checksum
;
if
(
Test_array_Uart11
[
0
]
==
0x59
&&
Test_array_Uart11
[
1
]
==
0x44
)
{
{
if
(((
Test_array_Uart11
[
WriteCount_Uart11
-
1
])
==
0x4A
)
&&
((
Test_array_Uart11
[
WriteCount_Uart11
-
2
])
==
0x4B
))
if
(((
Test_array_Uart11
[
WriteCount_Uart11
-
1
])
==
0x4A
)
&&
((
Test_array_Uart11
[
WriteCount_Uart11
-
2
])
==
0x4B
))
{
{
for
(
int
i
=
0
;
i
<
64
;
i
++
)
{
RS485_data
[
i
]
=
Test_array_Uart11
[
3
+
i
];
}
switch
(
Test_array_Uart11
[
2
])
{
case
0x48
:
memset
(
R485_ID48h
.
Msg
,
0
,
64
);
memcpy
(
R485_ID48h
.
Msg
,
RS485_data
,
64
);
checksum
=
Yadi_CAL_Data_Sum
(
&
Test_array_Uart11
[
2
],
64
+
2
);
if
(
checksum
!=
Test_array_Uart11
[
68
])
{
wrong
=
1
;
}
break
;
case
0x49
:
memset
(
R485_ID48h
.
Msg
,
0
,
64
);
memcpy
(
R485_ID49h
.
Msg
,
RS485_data
,
64
);
checksum
=
Yadi_CAL_Data_Sum
(
&
Test_array_Uart11
[
2
],
64
+
2
);
if
(
checksum
!=
Test_array_Uart11
[
68
])
{
wrong
=
1
;
}
break
;
case
0x4A
:
memset
(
R485_ID48h
.
Msg
,
0
,
64
);
memcpy
(
R485_ID4Ah
.
Msg
,
RS485_data
,
64
);
checksum
=
Yadi_CAL_Data_Sum
(
&
Test_array_Uart11
[
2
],
64
+
2
);
if
(
checksum
!=
Test_array_Uart11
[
68
])
{
wrong
=
1
;
}
break
;
default:
break
;
}
memset
(
RS485_data
,
0
,
64
);
// Delay(100);
// Delay(100);
RS485_TX_finish
=
0
;
RS485_TX_finish
=
0
;
WriteCount_Uart11
=
0
;
WriteCount_Uart11
=
0
;
if
(
HJ_OtherKeyCurrent
.
count
>=
10
)
// memset(Test_array_Uart11,0,10000);
if
(
WriteCount_Uart11
>=
100
)
{
{
HJ_OtherKeyCurrent
.
count
=
1
;
WriteCount_Uart11
=
0
;
}
// WriteCount_Uart11 = 0;
}
}
else
else
{
{
HJ_OtherKeyCurrent
.
count
++
;
memset
(
Test_array_Uart11
,
0
,
1000
);
RS485_send_num
--
;
RS485_TX_finish
=
0
;
}
}
}
if
(
Test_array_Uart11
[
1
]
==
0x59
&&
Test_array_Uart11
[
2
]
==
0x44
)
{
if
(((
Test_array_Uart11
[
WriteCount_Uart11
-
1
])
==
0x4A
)
&&
((
Test_array_Uart11
[
WriteCount_Uart11
-
2
])
==
0x4B
))
{
for
(
int
i
=
0
;
i
<
64
;
i
++
)
{
RS485_data
[
i
]
=
Test_array_Uart11
[
4
+
i
];
}
switch
(
Test_array_Uart11
[
3
])
{
case
0x48
:
// memset(R485_ID48h.Msg,0,64);
memcpy
(
R485_ID48h
.
Msg
,
RS485_data
,
64
);
checksum
=
Yadi_CAL_Data_Sum
(
&
Test_array_Uart11
[
3
],
64
+
2
);
if
(
checksum
!=
Test_array_Uart11
[
69
])
{
wrong
=
1
;
}
break
;
case
0x49
:
// memset(R485_ID48h.Msg,0,64);
memcpy
(
R485_ID49h
.
Msg
,
RS485_data
,
64
);
checksum
=
Yadi_CAL_Data_Sum
(
&
Test_array_Uart11
[
3
],
64
+
2
);
if
(
checksum
!=
Test_array_Uart11
[
69
])
{
wrong
=
1
;
}
break
;
case
0x4A
:
// memset(R485_ID48h.Msg,0,64);
memcpy
(
R485_ID4Ah
.
Msg
,
RS485_data
,
64
);
checksum
=
Yadi_CAL_Data_Sum
(
&
Test_array_Uart11
[
3
],
64
+
2
);
if
(
checksum
!=
Test_array_Uart11
[
69
])
{
wrong
=
1
;
}
break
;
default:
break
;
}
memset
(
RS485_data
,
0
,
64
);
// Delay(100);
RS485_TX_finish
=
0
;
WriteCount_Uart11
=
0
;
// memset(Test_array_Uart11,0,10000);
// memset(Test_array_Uart11,0,10000);
if
(
WriteCount_Uart11
>=
100
)
if
(
WriteCount_Uart11
>=
100
)
{
{
...
@@ -186,7 +283,7 @@ void check_getdata(void)
...
@@ -186,7 +283,7 @@ void check_getdata(void)
}
}
else
else
{
{
memset
(
Test_array_Uart11
,
0
,
1000
0
);
memset
(
Test_array_Uart11
,
0
,
1000
);
RS485_send_num
--
;
RS485_send_num
--
;
RS485_TX_finish
=
0
;
RS485_TX_finish
=
0
;
}
}
...
@@ -217,7 +314,7 @@ uint8_t getYDnum(void)
...
@@ -217,7 +314,7 @@ uint8_t getYDnum(void)
}
}
}
}
// static void Uart0_RX_Callback(uint16_t u16FillCnt)
// static void Uart0_RX_Callback(uint16_t u16FillCnt)
void
Uart
0
_RX_Callback
(
uint16_t
u16FillCnt
)
void
Uart
11
_RX_Callback
(
uint16_t
u16FillCnt
)
{
{
uint32_t
u32ReadCnt
;
uint32_t
u32ReadCnt
;
uint8_t
TR_Flag
=
0
;
uint8_t
TR_Flag
=
0
;
...
@@ -226,8 +323,8 @@ void Uart0_RX_Callback(uint16_t u16FillCnt)
...
@@ -226,8 +323,8 @@ void Uart0_RX_Callback(uint16_t u16FillCnt)
Delay
(
100
);
Delay
(
100
);
if
(
TR_Flag
==
1
)
if
(
TR_Flag
==
1
)
{
{
memset
(
Test_array_Uart11
,
0
,
1000
0
);
memset
(
Test_array_Uart11
,
0
,
1000
);
WriteCount_Uart11
;
//
WriteCount_Uart11;
if
(
RS485_TX_finish
==
1
)
if
(
RS485_TX_finish
==
1
)
{
{
// memset(Test_array_Uart11,0,10000);
// memset(Test_array_Uart11,0,10000);
...
@@ -267,6 +364,46 @@ static void Uart9_RX_Callback(uint16_t u16FillCnt)
...
@@ -267,6 +364,46 @@ static void Uart9_RX_Callback(uint16_t u16FillCnt)
WriteCount_Uart9
+=
u16ReadCnt
;
WriteCount_Uart9
+=
u16ReadCnt
;
}
}
static
void
Uart0_RX_Callback
(
uint16_t
u16FillCnt
)
{
uint32_t
u32ReadCnt
;
// memset(Test_array_Uart0,0,1000);
uint8_t
num
;
Mfs_Uart_Read
(
UART0_Type
,
Test_array_Uart0
+
WriteCount_Uart0
,
&
u32ReadCnt
,
SAMPLE_UART_RX_BUFFSIZE
,
FALSE
);
// num = Test_array_Uart0[20];
// for(int i = 0;Test_array_Uart0!='\0';i++)
// {
// corenum[i] = Test_array_Uart0[i];
// }
WriteCount_Uart0
+=
u32ReadCnt
;
if
(
Time_100us
>=
10000
)
{
memcpy
(
corenum
,
Test_array_Uart0
,
17
);
memcpy
(
corenum1
,
Test_array_Uart0
+
17
,
19
);
memcpy
(
corenum2
,
Test_array_Uart0
+
36
,
15
);
WriteCount_Uart0
=
0
;
Time_100us
=
0
;
}
else
{
memcpy
(
corenum
,
Test_array_Uart0
,
17
);
memcpy
(
corenum1
,
Test_array_Uart0
+
17
,
19
);
memcpy
(
corenum2
,
Test_array_Uart0
+
36
,
15
);
}
// if(WriteCount_Uart0>=60)
// {
// WriteCount_Uart0 = 0;
// memset(Test_array_Uart0,0,1000);
// }
g_Stage
=
1
;
// Time_100us_Uart9 = 0;
// Uart_Pro_Flag_Uart9 = 1;
// WriteCount_Uart0 += u32ReadCnt;
// memset(Test_array_Uart0,0,1000);
// WriteCount_Uart0 = 0;
}
static
void
UART_PORT_init
(
void
)
static
void
UART_PORT_init
(
void
)
{
{
stc_port_pin_config_t
PpcConf
=
{
PortOutputResourceGPIO
};
stc_port_pin_config_t
PpcConf
=
{
PortOutputResourceGPIO
};
...
@@ -318,9 +455,9 @@ static void UART_PORT_init(void)
...
@@ -318,9 +455,9 @@ static void UART_PORT_init(void)
PpcConf
.
enInputLevel
=
PortInputLevelCmosA
;
PpcConf
.
enInputLevel
=
PortInputLevelCmosA
;
PpcConf
.
enOutputDrive
=
PortOutputDriveA
;
PpcConf
.
enOutputDrive
=
PortOutputDriveA
;
PpcConf
.
enOutputFunction
=
PortOutputResourceGPIO
;
PpcConf
.
enOutputFunction
=
PortOutputResourceGPIO
;
PpcConf
.
enPullResistor
=
PortPullResistor
Up
;
PpcConf
.
enPullResistor
=
PortPullResistor
Down
;
PpcConf
.
enGpioInitOutputLevel
=
PortGpioHigh
;
PpcConf
.
enGpioInitOutputLevel
=
PortGpioHigh
;
Port_SetPinConfig
(
0
,
15
,
&
PpcConf
);
Port_SetPinConfig
(
1
,
14
,
&
PpcConf
);
// SOT2 (P19)
// SOT2 (P19)
PpcConf
.
bInputEnable
=
FALSE
;
PpcConf
.
bInputEnable
=
FALSE
;
...
@@ -331,7 +468,7 @@ static void UART_PORT_init(void)
...
@@ -331,7 +468,7 @@ static void UART_PORT_init(void)
PpcConf
.
enOutputFunction
=
PortOutputResourceF
;
PpcConf
.
enOutputFunction
=
PortOutputResourceF
;
PpcConf
.
enPullResistor
=
PortPullResistorNone
;
PpcConf
.
enPullResistor
=
PortPullResistorNone
;
PpcConf
.
enGpioInitOutputLevel
=
PortGpioHigh
;
PpcConf
.
enGpioInitOutputLevel
=
PortGpioHigh
;
Port_SetPinConfig
(
0
,
13
,
&
PpcConf
);
Port_SetPinConfig
(
1
,
12
,
&
PpcConf
);
}
}
static
void
UART_init
(
void
)
static
void
UART_init
(
void
)
...
@@ -351,7 +488,7 @@ static void UART_init(void)
...
@@ -351,7 +488,7 @@ static void UART_init(void)
stcUartConf
.
pu8RxBuf
=
au8UartRxBuf
;
// Set buffer pointer
stcUartConf
.
pu8RxBuf
=
au8UartRxBuf
;
// Set buffer pointer
stcUartConf
.
bFifoUsage
=
TRUE
;
// use HW FIFO
stcUartConf
.
bFifoUsage
=
TRUE
;
// use HW FIFO
stcUartConf
.
u16RxCbFillLevel
=
10
;
// Unread counts of data buffer to call RX Callback function
stcUartConf
.
u16RxCbFillLevel
=
10
;
// Unread counts of data buffer to call RX Callback function
stcUartConf
.
pfnRxCb
=
Uart
0
_RX_Callback
;
// Rx callback not used
stcUartConf
.
pfnRxCb
=
Uart
11
_RX_Callback
;
// Rx callback not used
stcUartConf
.
pfnTxCb
=
NULL
;
// Tx callback not used
stcUartConf
.
pfnTxCb
=
NULL
;
// Tx callback not used
Mfs_Uart_Init
(
UART11_Type
,
&
stcUartConf
);
Mfs_Uart_Init
(
UART11_Type
,
&
stcUartConf
);
// Uart configuration
// Uart configuration
...
@@ -363,14 +500,14 @@ static void UART_init(void)
...
@@ -363,14 +500,14 @@ static void UART_init(void)
stcUartConf
.
enParity
=
UartParityNone
;
// No parity
stcUartConf
.
enParity
=
UartParityNone
;
// No parity
stcUartConf
.
enStopBit
=
UartOneStopBit
;
// 1 stop bit
stcUartConf
.
enStopBit
=
UartOneStopBit
;
// 1 stop bit
stcUartConf
.
u16TxBufSize
=
SAMPLE_UART_TX_BUFFSIZE
;
// Set buffer size
stcUartConf
.
u16TxBufSize
=
SAMPLE_UART_TX_BUFFSIZE
;
// Set buffer size
stcUartConf
.
pu8TxBuf
=
au8UartTxBuf
;
// Set buffer pointer
stcUartConf
.
pu8TxBuf
=
au8UartTxBuf
1
;
// Set buffer pointer
stcUartConf
.
u16RxBufSize
=
SAMPLE_UART_RX_BUFFSIZE
;
// Set buffer size
stcUartConf
.
u16RxBufSize
=
SAMPLE_UART_RX_BUFFSIZE
;
// Set buffer size
stcUartConf
.
pu8RxBuf
=
au8UartRxBuf
;
// Set buffer pointer
stcUartConf
.
pu8RxBuf
=
au8UartRxBuf
1
;
// Set buffer pointer
stcUartConf
.
bFifoUsage
=
TRUE
;
// use HW FIFO
stcUartConf
.
bFifoUsage
=
TRUE
;
// use HW FIFO
stcUartConf
.
u16RxCbFillLevel
=
1
;
// Unread counts of data buffer to call RX Callback function
stcUartConf
.
u16RxCbFillLevel
=
1
;
// Unread counts of data buffer to call RX Callback function
stcUartConf
.
pfnRxCb
=
Uart
9
_RX_Callback
;
// Rx callback not used
stcUartConf
.
pfnRxCb
=
Uart
0
_RX_Callback
;
// Rx callback not used
stcUartConf
.
pfnTxCb
=
NULL
;
// Tx callback not used
stcUartConf
.
pfnTxCb
=
NULL
;
// Tx callback not used
Mfs_Uart_Init
(
UART
9
_Type
,
&
stcUartConf
);
Mfs_Uart_Init
(
UART
0
_Type
,
&
stcUartConf
);
}
}
static
uint32_t
StringToUintHex
(
uint8_t
*
date
,
uint8_t
length
)
static
uint32_t
StringToUintHex
(
uint8_t
*
date
,
uint8_t
length
)
...
@@ -888,12 +1025,12 @@ void main(void)
...
@@ -888,12 +1025,12 @@ void main(void)
TIMER_10ms_Init
();
TIMER_10ms_Init
();
ADCInit
();
ADCInit
();
ICU_IO_Initialize
();
ICU_IO_Initialize
();
CANInit
();
//
CANInit();
Init_Pwm
();
Init_Pwm
();
#if (PRO_JAPE2)
#if (PRO_JAPE2)
#endif
#endif
InitDiagnostic
();
//UDS
//
InitDiagnostic();//UDS
Port_EnableInput
();
Port_EnableInput
();
bsp_BD8379_Init
();
bsp_BD8379_Init
();
LCD_BUS_Init
();
LCD_BUS_Init
();
...
@@ -903,7 +1040,7 @@ void main(void)
...
@@ -903,7 +1040,7 @@ void main(void)
ReadDataFormWorkFlash
();
ReadDataFormWorkFlash
();
BenchTpInit
(
0x002
);
BenchTpInit
(
0x002
);
CANSendEnable
=
ON
;
//
CANSendEnable = ON;
// MC1413_IGNON;
// MC1413_IGNON;
// MC1413_BON;
// MC1413_BON;
//MC1413_B_OFF;
//MC1413_B_OFF;
...
@@ -954,10 +1091,10 @@ void main(void)
...
@@ -954,10 +1091,10 @@ void main(void)
}
}
bsp_HDOG_Feed
();
bsp_HDOG_Feed
();
SaveDataByWorkFlash
();
SaveDataByWorkFlash
();
CanFD_Busoff_Recover
(
0
);
//
CanFD_Busoff_Recover(0);
CanFD_Busoff_Recover
(
1
);
//
CanFD_Busoff_Recover(1);
CanFD_Busoff_Recover
(
2
);
//
CanFD_Busoff_Recover(2);
SendCan2Message
();
// SendCan2Message();s
if
(
CheckClusterValid
==
0u
)
if
(
CheckClusterValid
==
0u
)
{
{
g_uiLedNum
=
0
;
g_uiLedNum
=
0
;
...
@@ -1047,17 +1184,17 @@ void main(void)
...
@@ -1047,17 +1184,17 @@ void main(void)
if
(
CANSendEnable
==
ON
)
{
if
(
CANSendEnable
==
ON
)
{
if
(
EOL_Flag
!=
1
)
{
if
(
EOL_Flag
!=
1
)
{
SendCan0Message
();
//
SendCan0Message();
}
}
}
}
if
(
CheckBarcode
==
1
)
if
(
CheckBarcode
==
1
)
{
{
if
(
main_board_flag
)
{
if
(
main_board_flag
)
{
handle_receive_uart
();
//
handle_receive_uart();
handle_receive_uart9
();
//
handle_receive_uart9();
}
else
{
}
else
{
handle_receive_uart_slave
();
//
handle_receive_uart_slave();
handle_receive_uart9_slave
();
//
handle_receive_uart9_slave();
}
}
}
}
...
...
source/main.h
View file @
875f7566
...
@@ -124,4 +124,5 @@ extern uint32_t CluClusterID;
...
@@ -124,4 +124,5 @@ extern uint32_t CluClusterID;
extern
uint32_t
CluBarcodeDate
;
extern
uint32_t
CluBarcodeDate
;
extern
uint8_t
CluSerialNumber
[
4
];
extern
uint8_t
CluSerialNumber
[
4
];
extern
uint8_t
CluWriteCompleteFlag
[
8
];
extern
uint8_t
CluWriteCompleteFlag
[
8
];
extern
uint8_t
checknumwrong
;
#endif
/* __MAIN_H__ */
#endif
/* __MAIN_H__ */
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