Skip to content

Commit

Permalink
Modbus 串口驱动完善
Browse files Browse the repository at this point in the history
  • Loading branch information
cdy816 committed Apr 7, 2021
1 parent 2c4456f commit e7485ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Run/Driver/Cdy.Spider.ModbusDriver/ModbusSeriseDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class ModbusSeriseDriver:TimerDriverRunner
/// <summary>
///
/// </summary>
public override DriverData Data => base.Data;
public override DriverData Data => mData;

#endregion ...Properties...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public class SerisePortClientChannel : ChannelBase

#region ... Methods ...

public void TestOpen()
{
mClient = new System.IO.Ports.SerialPort("Com2", 9600);
}

/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -145,7 +150,7 @@ private void ThreadPro()
{
while (!mIsClosed)
{
if (mClient != null && mClient.BytesToRead > 0 && !mIsTransparentRead)
if (mClient.IsOpen && mClient != null && mClient.BytesToRead > 0 && !mIsTransparentRead)
{

var vdlen = mClient.BytesToRead;
Expand Down
2 changes: 1 addition & 1 deletion Spider.sln
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cdy.Spider.UdpClient.Develo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cdy.Spider.SerisePortClient.Develop", "Cdy.Spider.SerisePortClient.Develop\Cdy.Spider.SerisePortClient.Develop.csproj", "{CD41D8D2-741C-4CE2-A5BD-75A37E18A500}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cdy.Spider.ModbusDriver.Develop", "Develop\Drivers\Cdy.Spider.ModbusDriver.Develop\Cdy.Spider.ModbusDriver.Develop.csproj", "{C8842128-A394-4478-B823-5CBCB324F567}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cdy.Spider.ModbusDriver.Develop", "Develop\Drivers\Cdy.Spider.ModbusDriver.Develop\Cdy.Spider.ModbusDriver.Develop.csproj", "{C8842128-A394-4478-B823-5CBCB324F567}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down

0 comments on commit e7485ac

Please sign in to comment.