diff --git a/model/ProjectModel/DeviceManage.py b/model/ProjectModel/DeviceManage.py index ec346d3..e9008e6 100644 --- a/model/ProjectModel/DeviceManage.py +++ b/model/ProjectModel/DeviceManage.py @@ -142,7 +142,7 @@ class DevicesManange(): self.paSlaveDevices = collections.OrderedDict() self.dpSlaveModbus = TcpMaster(host = '192.168.2.10', port = 502) self.paSlaveModbus = TcpMaster(host = '192.168.4.10', port = 502) - self.dpMasterModbus = TcpMaster(host = '192.168.1.10', port = 502) + self.dpMasterModbus = TcpMaster(host = '192.168.0.40', port = 502) self.paMasterModbus = TcpMaster(host = '192.168.3.10', port = 502) @@ -226,7 +226,9 @@ class DevicesManange(): # print(values) for area, value in zip(areas, values): area.forceValue = value - if area.type in ['DI', 'DO']: + if area.type in ['DO', 'DI'] and device.type == 'PA': + area.forceValue = value[8:] + value[:8] + elif area.type in ['DO', 'DI'] and device.type == 'DP' and device.masterOrSlave == "主站": area.forceValue = value[8:] + value[:8] for device in curProDict.values(): @@ -296,7 +298,10 @@ class DevicesManange(): area.currentValue[i] = round(struct.unpack('!f', reorderBytes(byte, area.order))[0], 4) # print(round(struct.unpack('!f', reorderBytes(byte, area.order))[0], 4)) elif area.type in ['DI', 'DO']: - bytes = bytes[::-1] + if device.masterOrSlave == '主站' and device.type == 'DP': + bytes = bytes + else: + bytes = bytes[::-1] area.currentValue = bytesToCoils(bytes) # print(area.currentValue) @classmethod