File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -102,12 +102,13 @@ def handle(self):
102
102
if data :
103
103
if _logger .isEnabledFor (logging .DEBUG ):
104
104
_logger .debug ("recv: " + " " .join ([hex (byte2int (x )) for x in data ]))
105
- if isinstance (self .framer , ModbusRtuFramer ):
106
- unit_address = byte2int (data [0 ])
107
- elif isinstance (self .framer , ModbusAsciiFramer ):
105
+ if isinstance (self .framer , ModbusAsciiFramer ):
108
106
unit_address = int (data [1 :3 ], 16 )
109
- if isinstance (self .framer , ModbusBinaryFramer ):
107
+ elif isinstance (self .framer , ModbusBinaryFramer ):
110
108
unit_address = byte2int (data [1 ])
109
+ else :
110
+ unit_address = byte2int (data [0 ])
111
+
111
112
if unit_address in self .server .context :
112
113
self .framer .processIncomingPacket (data , self .execute )
113
114
except Exception as msg :
@@ -116,7 +117,6 @@ def handle(self):
116
117
self .framer .resetFrame ()
117
118
_logger .error ("Socket error occurred %s" % msg )
118
119
119
-
120
120
def send (self , message ):
121
121
''' Send a request (string) to the network
122
122
You can’t perform that action at this time.
0 commit comments