Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
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
潘栩锋
Thick-Common
Commits
e4483cf2
Commit
e4483cf2
authored
Mar 21, 2023
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修复 modbusRTU 校验的大小端问题
2.优化 flyad2021b2 不需要触发 TimeGridAdv2Event 事件时,不调用处理器
parent
110b0a18
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
ModbusRTUAsync.cs
GeneralGommunication/ModbusRTUAsync.cs
+2
-2
ModbusRtuServer.cs
GeneralGommunication/ModbusRtuServer.cs
+4
-4
FlyAd2021B2Adv.cs
Project.FLY.FlyADBase/FlyAd2021.B2/FlyAd2021B2Adv.cs
+3
-0
No files found.
GeneralGommunication/ModbusRTUAsync.cs
View file @
e4483cf2
...
...
@@ -302,7 +302,7 @@ namespace GeneralGommunication
UInt16
crc
=
currPack
.
CRC16
(
0
,
currTran
.
expRecBytes
-
2
);
UInt16
rec_crc
=
currPack
.
ToUInt16_
Big
_Endian
(
currTran
.
expRecBytes
-
2
);
UInt16
rec_crc
=
currPack
.
ToUInt16_
Little
_Endian
(
currTran
.
expRecBytes
-
2
);
if
(
crc
!=
rec_crc
)
{
logger
.
Error
(
$"ACK 指令码:
{
currTran
.
func
:
X2
}
CRC 校验出错 接收:
{
rec_crc
:
X4
}
计算:
{
crc
:
X4
}
"
);
...
...
@@ -428,7 +428,7 @@ namespace GeneralGommunication
data
.
Add
(
tran
.
func
);
data
.
AddRange
(
tran
.
funcData
);
UInt16
crc
=
data
.
CRC16
(
0
,
data
.
Count
());
data
.
AddRange
(
crc
.
GetBytes_
Big_e
ndian
());
data
.
AddRange
(
crc
.
GetBytes_
Little_E
ndian
());
tran
.
funcData
.
Clear
();
}
/// <summary>
...
...
GeneralGommunication/ModbusRtuServer.cs
View file @
e4483cf2
...
...
@@ -106,7 +106,7 @@ namespace GeneralGommunication
int
adu_len
=
req_len
-
2
;
//去除crc后的数据包长
UInt16
crc
=
buf
.
CRC16
(
startIndex
,
req_len
-
2
);
UInt16
rec_crc
=
buf
.
ToUInt16_
Big_Endian
(
startIndex
+
req_len
-
2
);
UInt16
rec_crc
=
buf
.
ToUInt16_
Little_Endian
(
startIndex
+
req_len
-
2
);
//CRC 是 小端模式
if
(
crc
!=
rec_crc
)
{
...
...
@@ -203,7 +203,7 @@ namespace GeneralGommunication
int
adu_len
=
req_len
-
2
;
//去除crc后的数据包长
UInt16
crc
=
buf
.
CRC16
(
startIndex
,
req_len
-
2
);
UInt16
rec_crc
=
buf
.
ToUInt16_
Big
_Endian
(
startIndex
+
req_len
-
2
);
UInt16
rec_crc
=
buf
.
ToUInt16_
Little
_Endian
(
startIndex
+
req_len
-
2
);
if
(
crc
!=
rec_crc
)
{
...
...
@@ -304,7 +304,7 @@ namespace GeneralGommunication
int
adu_len
=
req_len
-
2
;
//去除crc后的数据包长
UInt16
crc
=
buf
.
CRC16
(
startIndex
,
req_len
-
2
);
UInt16
rec_crc
=
buf
.
ToUInt16_
Big_Endian
(
startIndex
+
req_len
-
2
);
UInt16
rec_crc
=
buf
.
ToUInt16_
Little_Endian
(
startIndex
+
req_len
-
2
);
//CRC 是 小端模式
if
(
crc
!=
rec_crc
)
{
...
...
@@ -468,7 +468,7 @@ namespace GeneralGommunication
List
<
byte
>
sendBuf
=
new
List
<
byte
>();
sendBuf
.
AddRange
(
buf
);
sendBuf
.
AddRange
(
crc
.
GetBytes_
Big_e
ndian
());
sendBuf
.
AddRange
(
crc
.
GetBytes_
Little_E
ndian
());
if
(
logger
.
IsDebugEnabled
)
{
...
...
Project.FLY.FlyADBase/FlyAd2021.B2/FlyAd2021B2Adv.cs
View file @
e4483cf2
...
...
@@ -398,6 +398,9 @@ namespace FlyADBase
IsTimeToPushTimeGridAdv
=
false
;
if
(
TimeGridAdv2Event
==
null
)
return
;
//触发全部高级版的 timegrid
bool
ret
=
mTimeGridAdvHelper
.
GetLastRunningTime
(
out
DateTime
beginTime
,
out
DateTime
endTime
,
out
DRIVE_MAN_ORDER
order
);
if
(!
ret
)
...
...
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