From 6ac8b83088cc2766069257df9a6841f436446fd9 Mon Sep 17 00:00:00 2001 From: Alex <52292902+alexrudd2@users.noreply.github.com> Date: Thu, 2 May 2024 23:45:46 -0500 Subject: [PATCH] Fix offset for CTD which are 32 bits (#112) --- clickplc/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clickplc/driver.py b/clickplc/driver.py index b543580..701f755 100644 --- a/clickplc/driver.py +++ b/clickplc/driver.py @@ -355,7 +355,7 @@ async def _get_ctd(self, start: int, end: int) -> dict: if end is not None and (end < 1 or end > 250): raise ValueError('CTD end must be in [1, 250]') - address = 49152 + start - 1 + address = 49152 + 2 * (start - 1) # 32-bit count = 1 if end is None else (end - start + 1) registers = await self.read_registers(address, count * 2) bigendian = Endian.BIG if self.pymodbus35plus else Endian.Big # type:ignore[attr-defined]