Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gass-device-report
Project
Project
Details
Activity
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
耿迪迪
gass-device-report
Commits
bc0ee344
Commit
bc0ee344
authored
Oct 15, 2021
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
校验问题修改 gengdidi
parent
c1dfa26a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
CrcUtil.java
src/main/java/com/zehong/gassdevicereport/utils/CrcUtil.java
+2
-1
No files found.
src/main/java/com/zehong/gassdevicereport/utils/CrcUtil.java
View file @
bc0ee344
...
...
@@ -43,9 +43,10 @@ public class CrcUtil {
int
CRC
=
getCRC
(
bytes
);
//高低位转换,看情况使用(譬如本人这次对led彩屏的通讯开发就规定校验码高位在前低位在后,也就不需要转换高低位)
if
(
reverse
){
//高低位互换,输出符合相关工具对Modbus CRC16的运算
CRC
=
(
(
CRC
&
0x0000FF00
)
>>
8
)
|
(
(
CRC
&
0x000000FF
)
<<
8
);
}
return
Integer
.
toHexString
(
CRC
);
return
String
.
format
(
"%04x"
,
CRC
);
}
}
...
...
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