From 006c98e5650b530e5220f279c1e803fefe69d40d Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期二, 25 十一月 2025 15:47:33 +0800
Subject: [PATCH] 优化一些东西;

---
 ModBusTcpController/ModBusTcpController.cs |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ModBusTcpController/ModBusTcpController.cs b/ModBusTcpController/ModBusTcpController.cs
index 9597de8..e431966 100644
--- a/ModBusTcpController/ModBusTcpController.cs
+++ b/ModBusTcpController/ModBusTcpController.cs
@@ -48,19 +48,19 @@
             return res?.IsSuccess == true;
         }
 
-        public bool ReadDIInt(string address, out int? res, out string msg)
+        public bool ReadDIInt(string address, out int res, out string msg)
         {
             var result = client?.ReadInt32($"x=2;{address}");
             msg = result?.Message;
-            res = result?.Content;
+            res = result?.Content ?? 0;
             return result?.IsSuccess == true;
         }
 
-        public bool ReadDOInt(string address, out int? res, out string msg)
+        public bool ReadDOInt(string address, out int res, out string msg)
         {
             var result = client?.ReadInt32(address);
             msg = result?.Message;
-            res = result?.Content;
+            res = result?.Content ?? 0;
             return result?.IsSuccess == true;
         }
 

--
Gitblit v1.9.1