Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions clickplc/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ async def _get_x(self, start: int, end: int | None) -> dict:
a number of addresses not divisible by 8, it will have extra data. The
extra data here is discarded before returning.
"""
if start % 100 == 0 or start % 100 > 16:
if (start % 100 == 0 or start % 100 > 16) and start not in range(21, 37):
raise ValueError('X start address must be *01-*16.')
if start < 1 or start > 816:
raise ValueError('X start address must be in [001, 816].')
Expand All @@ -180,7 +180,7 @@ async def _get_x(self, start: int, end: int | None) -> dict:
coils = await self.read_coils(start_coil, 1)
return coils.bits[0]

if end % 100 == 0 or end % 100 > 16:
if end % 100 == 0 or end % 100 > 16 and start not in range(21, 37):
raise ValueError('X end address must be *01-*16.')
if end < 1 or end > 816:
raise ValueError('X end address must be in [001, 816].')
Expand Down Expand Up @@ -219,7 +219,7 @@ async def _get_y(self, start: int, end: int | None) -> dict:
a number of addresses not divisible by 8, it will have extra data. The
extra data here is discarded before returning.
"""
if start % 100 == 0 or start % 100 > 16:
if start % 100 == 0 or start % 100 > 16 and start not in range(21, 37):
raise ValueError('Y start address must be *01-*16.')
if start < 1 or start > 816:
raise ValueError('Y start address must be in [001, 816].')
Expand All @@ -229,7 +229,7 @@ async def _get_y(self, start: int, end: int | None) -> dict:
coils = await self.read_coils(start_coil, 1)
return coils.bits[0]

if end % 100 == 0 or end % 100 > 16:
if end % 100 == 0 or end % 100 > 16 and start not in range(21, 37):
raise ValueError('Y end address must be *01-*16.')
if end < 1 or end > 816:
raise ValueError('Y end address must be in [001, 816].')
Expand Down
Loading