Commit 3b0dc027 authored by Miroslav Ondra's avatar Miroslav Ondra

Fix handling Modbus stream to be comptible with Framer

parent bdcfe0f4
Pipeline #1081 passed with stages
in 47 seconds
......@@ -75,7 +75,7 @@ class ModbusConnection(object):
def start_run(self, delegate):
self.stream.set_close_callback(lambda : self._on_close(delegate))
self.stream.read_bytes(1,callback=self._on_data)
self.stream.read_bytes(256,callback=self._on_data, partial=True)
def _on_close(self, delegate):
''' deregister itself from ModbusServer '''
......@@ -90,8 +90,8 @@ class ModbusConnection(object):
'''
if _logger.isEnabledFor(logging.DEBUG):
_logger.debug(" ".join([hex(ord(x)) for x in data]))
self.framer.processIncomingPacket(data, self.execute)
self.stream.read_bytes(1,callback=self._on_data)
self.framer.processIncomingPacket(data, self.execute, unit=0)
self.stream.read_bytes(256,callback=self._on_data, partial=True)
def send(self, message):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment