Merge remote-tracking branch 'origin/main'

main
zcwBit 2 years ago
commit a8367e57b6

@ -148,7 +148,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)
@ -249,7 +249,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():
@ -310,7 +312,10 @@ class DevicesManange():
continue
area.currentValue[i] = 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

Loading…
Cancel
Save