Commit 5c9b274e 顾剑亮

WriteDO直接发送

1 个父辈 1040b75b
此文件类型无法预览
......@@ -34,7 +34,7 @@ namespace Asa.IOModule
private int[] _valueAI; //AI模拟量
private int[] _valueAO; //AO模拟量
private List<byte> _receive;
private System.Collections.Concurrent.ConcurrentQueue<byte[]> _writeDO;
//private System.Collections.Concurrent.ConcurrentQueue<byte[]> _writeDO;
private log4net.ILog log;
private readonly Box_Type _typeInput; //输入类型
......@@ -123,7 +123,7 @@ namespace Asa.IOModule
_uid = 0;
IsConn = false;
_receive = new List<byte>();
_writeDO = new System.Collections.Concurrent.ConcurrentQueue<byte[]>();
//_writeDO = new System.Collections.Concurrent.ConcurrentQueue<byte[]>();
//test
......@@ -300,7 +300,12 @@ namespace Asa.IOModule
buff[7] = 5; //功能码
buff[9] = _addressOutput[add]; //地址
buff[10] = (byte)sta; //写入值
_writeDO.Enqueue(buff);
//_writeDO.Enqueue(buff);
//return true;
_client.Send(buff);
log.Debug("Send: " + HexBuff(buff));
return true;
}
catch (Exception ex)
......@@ -339,14 +344,17 @@ namespace Asa.IOModule
}
else
{
if (_writeDO.TryDequeue(out buff))
{
}
else
{
continue;
}
//2020年5月25日
time += SEND_SLEEP;
continue;
// if (_writeDO.TryDequeue(out buff))
// {
// }
//else
// {
// continue;
// }
//2020年5月23日
// if (writeTimer >= 3) //连续发送WriteDO3次,强制发送DO
......@@ -367,17 +375,20 @@ namespace Asa.IOModule
// }
// }
}
time += SEND_SLEEP;
}
else
{
if (_writeDO.TryDequeue(out buff))
{
}
else
{
buff = GetReadDI_Command();
}
//2020年5月25日
buff = GetReadDI_Command();
//if (_writeDO.TryDequeue(out buff))
//{
//}
//else
//{
// buff = GetReadDI_Command();
//}
//2020年5月23日
//if (writeTimer >= 3) //连续发送WriteDO3次,强制发送DI和DO
......@@ -415,7 +426,6 @@ namespace Asa.IOModule
try
{
//test
_client.Send(buff);
log.Debug("Send: " + HexBuff(buff));
}
......
......@@ -6,3 +6,4 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\obj\Debug\Asa.IOM
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\bin\Debug\log4net.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\obj\Debug\AIOBOX.csproj.CopyComplete
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\obj\Debug\AIOBOX.csprojAssemblyReference.cache
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!