From a20f4e1021ab9067fb0606b11a5ccf5e14d9d369 Mon Sep 17 00:00:00 2001 From: fyf <11621@LAPTOP-04QQU0AO> Date: Mon, 4 Sep 2023 18:32:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=8155?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/example/bpa/service/DeviceData.java | 7 +++++++ .../java/com/example/bpa/view/from/dzcjy_activity.java | 10 +++++++--- app/src/main/res/layout/from/layout/activity_dzcjy.xml | 9 +++++++++ 3 files changed, 23 insertions(+), 3 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 dc46196..c8a1dd4 100644 --- a/app/src/main/java/com/example/bpa/service/DeviceData.java +++ b/app/src/main/java/com/example/bpa/service/DeviceData.java @@ -1146,4 +1146,11 @@ public class DeviceData { //endregion + + /** + * 关闭写保护 + */ + public void setCloseWrite(IWriteCallBack callback) { + ModbusTcpServer.get().WriteBool("M6.1", true, callback); + } } diff --git a/app/src/main/java/com/example/bpa/view/from/dzcjy_activity.java b/app/src/main/java/com/example/bpa/view/from/dzcjy_activity.java index 34dbb15..ee2783e 100644 --- a/app/src/main/java/com/example/bpa/view/from/dzcjy_activity.java +++ b/app/src/main/java/com/example/bpa/view/from/dzcjy_activity.java @@ -52,7 +52,7 @@ public class dzcjy_activity extends AppCompatActivity implements View.OnClickLis * zerocalibration_button:零点校准 * allcalibration_button:一键去皮 */ - Button mwSave_button, owSave_button, materilwrite_button, calibration_button, zeroweight_button, outWrite_button, zerocalibration_button, allcalibration_button; + Button mwSave_button, owSave_button, materilwrite_button, calibration_button, zeroweight_button, outWrite_button, zerocalibration_button, allcalibration_button,closewrite_bottom; EditText materialweight_edit, outweight_edit; @@ -106,6 +106,8 @@ public class dzcjy_activity extends AppCompatActivity implements View.OnClickLis values_spinner = this.findViewById(R.id.values_spinner); allcalibration_button = this.findViewById(R.id.allcalibration_button); + + closewrite_bottom = this.findViewById(R.id.closewrite_bottom); //edit mode_1_realvalue = this.findViewById(R.id.mode_1_realvalue); mode_2_realvalue = this.findViewById(R.id.mode_2_realvalue); @@ -150,7 +152,7 @@ public class dzcjy_activity extends AppCompatActivity implements View.OnClickLis allcalibration_button.setOnClickListener(this); out_switch.setOnCheckedChangeListener(this); marialmode_switch.setOnCheckedChangeListener(this); - + closewrite_bottom.setOnClickListener(this); } @@ -254,7 +256,9 @@ public class dzcjy_activity extends AppCompatActivity implements View.OnClickLis case R.id.allcalibration_button://一件去皮 DeviceData.Get().setOneClickPeeling(null); break; - + case R.id.closewrite_bottom://关闭写保护 + DeviceData.Get().setCloseWrite(null); + break; } }).start(); diff --git a/app/src/main/res/layout/from/layout/activity_dzcjy.xml b/app/src/main/res/layout/from/layout/activity_dzcjy.xml index e8414af..32e69a5 100644 --- a/app/src/main/res/layout/from/layout/activity_dzcjy.xml +++ b/app/src/main/res/layout/from/layout/activity_dzcjy.xml @@ -238,7 +238,16 @@ android:background="@drawable/btn_greenblue" android:text="零点校准" android:layout_margin="5dp"/> + + +