Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 1 addition & 4 deletions pymodbus/client/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ def __init__(self, framer, **kwargs):
:param framer: The modbus framer implementation to use
"""
self.framer = framer
if isinstance(self.framer, ModbusSocketFramer):
self.transaction = DictTransactionManager(self, **kwargs)
else:
self.transaction = FifoTransactionManager(self, **kwargs)
self.transaction = DictTransactionManager(self, **kwargs)
self._debug = False
self._debugfd = None

Expand Down
5 changes: 5 additions & 0 deletions pymodbus/framer/rtu_framer.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def populateResult(self, result):
:param result: The response packet
"""
result.unit_id = self._header['uid']
result.transaction_id = self._header['uid']

# ----------------------------------------------------------------------- #
# Public Member Functions
Expand Down Expand Up @@ -221,6 +222,9 @@ def processIncomingPacket(self, data, callback, unit, **kwargs):
_logger.debug("Not a valid unit id - {}, "
"ignoring!!".format(self._header['uid']))
self.resetFrame()
else:
_logger.debug("Frame check failed, ignoring!!")
self.resetFrame()
else:
_logger.debug("Frame - [{}] not ready".format(data))

Expand All @@ -235,6 +239,7 @@ def buildPacket(self, message):
message.unit_id,
message.function_code) + data
packet += struct.pack(">H", computeCRC(packet))
message.transaction_id = message.unit_id # Ensure that transaction is actually the unit id for serial comms
return packet

def sendPacket(self, message):
Expand Down