From 4e1a97a785a4bca6a9ee9df4cd73a881cfa81f0e Mon Sep 17 00:00:00 2001 From: fyf <11621@LAPTOP-04QQU0AO> Date: Thu, 8 Jun 2023 15:18:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E8=B0=83=E8=AF=95=E6=94=B9?= =?UTF-8?q?=E5=8A=A8022200111?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/bpa/service/DeviceData.java | 12 ++++++++---- .../com/example/bpa/view/fragment/SsjkFragment.java | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/example/bpa/service/DeviceData.java b/app/src/main/java/com/example/bpa/service/DeviceData.java index 3b6aa4b..f3a54df 100644 --- a/app/src/main/java/com/example/bpa/service/DeviceData.java +++ b/app/src/main/java/com/example/bpa/service/DeviceData.java @@ -146,10 +146,14 @@ public class DeviceData { ModbusTcpServer.get().ReadStatus("VW382", 3, data -> { for (int i = 0; i < data.length; i++) { byte status=data[i];//0x92 - IoStatus.put(i*4+0, ByteHelper.getBit(status,0)==1); - IoStatus.put(i*4+1, ByteHelper.getBit(status,1)==1); - IoStatus.put(i*4+2, ByteHelper.getBit(status,2)==1); - IoStatus.put(i*4+3, ByteHelper.getBit(status,3)==1); + IoStatus.put(i*8+0, ByteHelper.getBit(status,0)==1); + IoStatus.put(i*8+1, ByteHelper.getBit(status,1)==1); + IoStatus.put(i*8+2, ByteHelper.getBit(status,2)==1); + IoStatus.put(i*8+3, ByteHelper.getBit(status,3)==1); + IoStatus.put(i*8+4, ByteHelper.getBit(status,4)==1); + IoStatus.put(i*8+5, ByteHelper.getBit(status,5)==1); + IoStatus.put(i*8+6, ByteHelper.getBit(status,6)==1); + IoStatus.put(i*8+7, ByteHelper.getBit(status,7)==1); } }); diff --git a/app/src/main/java/com/example/bpa/view/fragment/SsjkFragment.java b/app/src/main/java/com/example/bpa/view/fragment/SsjkFragment.java index e65b825..3c1acde 100644 --- a/app/src/main/java/com/example/bpa/view/fragment/SsjkFragment.java +++ b/app/src/main/java/com/example/bpa/view/fragment/SsjkFragment.java @@ -175,6 +175,9 @@ public class SsjkFragment extends Fragment implements View.OnClickListener { SetStatus(19,DeviceData.Get().getConcurrentHash(35)); SetStatus(20,DeviceData.Get().getConcurrentHash(36)); SetStatus(21,DeviceData.Get().getConcurrentHash(37)); + SetStatus(22,DeviceData.Get().getConcurrentHash(38)); + SetStatus(23,DeviceData.Get().getConcurrentHash(39)); + adapter.refresh(); } catch (Exception e) { MessageLog.ShowInfo("状态显示解析异常!"+e.getMessage());