From 04cea6ec858be6ddef3982dcecabf6b3205a1f8b Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 22 八月 2023 19:23:01 +0800
Subject: [PATCH] fix

---
 pkg/plc/plc4x.go |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/pkg/plc/plc4x.go b/pkg/plc/plc4x.go
index 8afb487..3e6c4a6 100644
--- a/pkg/plc/plc4x.go
+++ b/pkg/plc/plc4x.go
@@ -98,6 +98,14 @@
 	return result, nil
 }
 
+func ReadHoldingRegister(connection plc4go.PlcConnection, address, length int) ([]byte, error) {
+	if length > 1 {
+		return ReadHoldingRegisterList(connection, address, length)
+	}
+
+	return ReadHoldingRegisterSingle(connection, address)
+}
+
 func WriteHoldingRegister(connection plc4go.PlcConnection, address int, value any) (string, error) {
 	tagAddress := fmt.Sprintf("holding-register:%d:UINT", address)
 

--
Gitblit v1.8.0