From dd8f12cea0d4c9e9579b165ddad09883d2b5eb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Czcw=E2=80=9D?= Date: Tue, 12 Sep 2023 16:26:10 +0800 Subject: [PATCH] =?UTF-8?q?0912=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/ProjectModel/DeviceManage.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/model/ProjectModel/DeviceManage.py b/model/ProjectModel/DeviceManage.py index ca0b03f..f8d33ad 100644 --- a/model/ProjectModel/DeviceManage.py +++ b/model/ProjectModel/DeviceManage.py @@ -43,7 +43,7 @@ class Device(): self.outputAreas.append(area) # print(self.inputAreas) - # print(area.addressList, area.startAddress, self.inputEndAddress) + # print(area.addressList, area.startAddress, area.endAddress, self.outputAreas) def delArea(self, index, type): if type in ["DI", "AI"]: @@ -61,7 +61,7 @@ class Device(): elif index == 0 and inputOrOutput == 1: area.startAddress = self.outputStartAddress else: - area.startAddress = areas[index - 1].endAddress + area.startAddress = areas[index - 1].endAddress + 1 area.endAddress = area.startAddress + area.length area.addressList = np.arange(area.startAddress, area.endAddress + 1, area.bytes).tolist() endAddress = area.endAddress @@ -70,6 +70,7 @@ class Device(): self.inputEndAddress = endAddress elif inputOrOutput == 1: self.outputEndAddress = endAddress + endAddress = 0 def editArea(self, index, type, order, bytes): @@ -89,8 +90,8 @@ class Device(): def getLength(self, nums, bytes): length = int(nums) * int(bytes) - length = length / 2 - return length + # length = length / 2 + return length - 1