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"/> + + +