Commit e4483cf2 authored by 潘栩锋's avatar 潘栩锋 🚴

1.修复 modbusRTU 校验的大小端问题

2.优化 flyad2021b2 不需要触发 TimeGridAdv2Event 事件时,不调用处理器
parent 110b0a18
......@@ -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_endian());
data.AddRange(crc.GetBytes_Little_Endian());
tran.funcData.Clear();
}
/// <summary>
......
......@@ -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_endian());
sendBuf.AddRange(crc.GetBytes_Little_Endian());
if (logger.IsDebugEnabled)
{
......
......@@ -397,6 +397,9 @@ namespace FlyADBase
return;
IsTimeToPushTimeGridAdv = false;
if (TimeGridAdv2Event == null)
return;
//触发全部高级版的 timegrid
bool ret = mTimeGridAdvHelper.GetLastRunningTime(out DateTime beginTime, out DateTime endTime, out DRIVE_MAN_ORDER order);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment