Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pazzarpj/aiomodbus
Browse files Browse the repository at this point in the history
  • Loading branch information
pazzarpj committed Jul 12, 2021
2 parents f881529 + 01f959f commit 4167d23
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aiomodbus/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ async def read_coils(
0x01,
address,
count,
decode_packing=">BBB" + "B" * (count // 8 + 1) + "H",
packet_length=5 + 1 * (count // 8 + 1),
decode_packing=">BBB" + "B" * ((count - 1) // 8 + 1) + "H",
packet_length=5 + 1 * ((count - 1) // 8 + 1),
timeout=timeout,
)
return self._upack_bits(*resp[1:])[:count]
Expand All @@ -178,8 +178,8 @@ async def read_discrete_inputs(
0x02,
address,
count,
decode_packing=">BBB" + "B" * (count // 8 + 1) + "H",
packet_length=5 + 1 * (count // 8 + 1),
decode_packing=">BBB" + "B" * ((count - 1) // 8 + 1) + "H",
packet_length=5 + 1 * ((count - 1) // 8 + 1),
timeout=timeout,
)
return self._upack_bits(*resp[1:])[:count]
Expand Down

0 comments on commit 4167d23

Please sign in to comment.