0912更新

main
“zcw” 2 years ago
parent aa29723c64
commit dd8f12cea0

@ -43,7 +43,7 @@ class Device():
self.outputAreas.append(area) self.outputAreas.append(area)
# print(self.inputAreas) # print(self.inputAreas)
# print(area.addressList, area.startAddress, self.inputEndAddress) # print(area.addressList, area.startAddress, area.endAddress, self.outputAreas)
def delArea(self, index, type): def delArea(self, index, type):
if type in ["DI", "AI"]: if type in ["DI", "AI"]:
@ -61,7 +61,7 @@ class Device():
elif index == 0 and inputOrOutput == 1: elif index == 0 and inputOrOutput == 1:
area.startAddress = self.outputStartAddress area.startAddress = self.outputStartAddress
else: else:
area.startAddress = areas[index - 1].endAddress area.startAddress = areas[index - 1].endAddress + 1
area.endAddress = area.startAddress + area.length area.endAddress = area.startAddress + area.length
area.addressList = np.arange(area.startAddress, area.endAddress + 1, area.bytes).tolist() area.addressList = np.arange(area.startAddress, area.endAddress + 1, area.bytes).tolist()
endAddress = area.endAddress endAddress = area.endAddress
@ -70,6 +70,7 @@ class Device():
self.inputEndAddress = endAddress self.inputEndAddress = endAddress
elif inputOrOutput == 1: elif inputOrOutput == 1:
self.outputEndAddress = endAddress self.outputEndAddress = endAddress
endAddress = 0
def editArea(self, index, type, order, bytes): def editArea(self, index, type, order, bytes):
@ -89,8 +90,8 @@ class Device():
def getLength(self, nums, bytes): def getLength(self, nums, bytes):
length = int(nums) * int(bytes) length = int(nums) * int(bytes)
length = length / 2 # length = length / 2
return length return length - 1

Loading…
Cancel
Save