Skip to content

Commit

Permalink
update function call according to pymodbus API changes, tested with p…
Browse files Browse the repository at this point in the history
…ymodbus v3.2.2
  • Loading branch information
gavinying committed Mar 27, 2023
1 parent 0217fa8 commit 184ab3a
Show file tree
Hide file tree
Showing 4 changed files with 338 additions and 253 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG PYTHON_TAG="3.8-slim"
FROM python:$PYTHON_TAG
ARG APP_TAG="0.5.1"
ARG APP_TAG="0.5.2"
WORKDIR /app

RUN pip3 install modpoll==$APP_TAG
Expand Down
8 changes: 4 additions & 4 deletions modpoll/modbus_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,28 @@ def poll(self):
if "BE_BE" == self.endian.upper():
if self.fc == 1 or self.fc == 2:
decoder = BinaryPayloadDecoder.fromCoils(
data, byteorder=Endian.Big, wordorder=Endian.Big)
data, byteorder=Endian.Big)
else:
decoder = BinaryPayloadDecoder.fromRegisters(
data, byteorder=Endian.Big, wordorder=Endian.Big)
elif "LE_BE" == self.endian.upper():
if self.fc == 1 or self.fc == 2:
decoder = BinaryPayloadDecoder.fromCoils(
data, byteorder=Endian.Little, wordorder=Endian.Big)
data, byteorder=Endian.Little)
else:
decoder = BinaryPayloadDecoder.fromRegisters(
data, byteorder=Endian.Little, wordorder=Endian.Big)
elif "LE_LE" == self.endian.upper():
if self.fc == 1 or self.fc == 2:
decoder = BinaryPayloadDecoder.fromCoils(
data, byteorder=Endian.Little, wordorder=Endian.Little)
data, byteorder=Endian.Little)
else:
decoder = BinaryPayloadDecoder.fromRegisters(
data, byteorder=Endian.Little, wordorder=Endian.Little)
else:
if self.fc == 1 or self.fc == 2:
decoder = BinaryPayloadDecoder.fromCoils(
data, byteorder=Endian.Big, wordorder=Endian.Little)
data, byteorder=Endian.Big)
else:
decoder = BinaryPayloadDecoder.fromRegisters(
data, byteorder=Endian.Big, wordorder=Endian.Little)
Expand Down
Loading

0 comments on commit 184ab3a

Please sign in to comment.