From 4918c372d8673acd22f342d5ea1dd222448f1e27 Mon Sep 17 00:00:00 2001
From: "LAPTOPNUM\\lapto" <1141383048@qq.com>
Date: Tue, 31 Mar 2026 09:52:51 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8E=8B=E5=8A=9B=E9=99=90?=
=?UTF-8?q?=E4=BD=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/bsp_Error.proto | 1 +
app/src/main/java/bsp_PV.proto | 1 +
.../roughapp2_0bbwiredrpm/MainActivity.java | 51 +++++-
.../models/BspError.java | 17 +-
.../roughapp2_0bbwiredrpm/models/BspPV.java | 83 ++++++++-
.../models/DisplayPV.java | 42 +++--
.../services/ErrorDeocdeHelper.java | 4 +
.../services/MyDataHelper.java | 17 +-
.../services/PVModify.java | 17 ++
.../services/PopupHelper.java | 13 +-
.../services/ReceiivedIVHandler.java | 4 +
app/src/main/res/layout/activity_main.xml | 166 +++++++++++++++---
12 files changed, 362 insertions(+), 54 deletions(-)
diff --git a/app/src/main/java/bsp_Error.proto b/app/src/main/java/bsp_Error.proto
index 1ed66bf..1d3a531 100644
--- a/app/src/main/java/bsp_Error.proto
+++ b/app/src/main/java/bsp_Error.proto
@@ -21,6 +21,7 @@ enum ComError //枚举消息类型 Error Bit Define
Strain_Gauge = 5;
Android_485 = 6;
DMAKE_1 = 7;
+ Pressure_Detect_Alert = 8;
}
diff --git a/app/src/main/java/bsp_PV.proto b/app/src/main/java/bsp_PV.proto
index 89fa77a..68f6c5a 100644
--- a/app/src/main/java/bsp_PV.proto
+++ b/app/src/main/java/bsp_PV.proto
@@ -19,4 +19,5 @@ message PV_struct_define{
int64 TimeStamp=11;//
int32 DmkSpeed= 12;//RPM
int32 ToolRotationDirection=13;// 1正向 2反向
+ double Horizontal_Calibration=14;
};
diff --git a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/MainActivity.java b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/MainActivity.java
index 33b3853..182b2d4 100644
--- a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/MainActivity.java
+++ b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/MainActivity.java
@@ -67,7 +67,8 @@ public class MainActivity extends AppCompatActivity {
mainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);
mainBinding.roughEditVerticalAdjustTo32.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); //竖直微调一位小数限制
-
+ // 新增,水平微调 Horizontal
+ mainBinding.roughEditHorizontalAdjustTo32.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); //竖直微调一位小数限制
myDataHelper.IntializeDataBaseRough();
@@ -83,6 +84,8 @@ public class MainActivity extends AppCompatActivity {
mainBinding.roughEditLaneChangeDistanceTo32.setText(String.valueOf(pvList.get(0).getLaneChangeDistance()));
mainBinding.roughEditPressTo32.setText(String.valueOf(pvList.get(0).getPressSet()));
mainBinding.roughEditVerticalAdjustTo32.setText(String.valueOf(pvList.get(0).getVerticalAdjust()));
+ // 新增,水平微调 Horizontal
+ mainBinding.roughEditHorizontalAdjustTo32.setText(String.valueOf(pvList.get(0).getHorizontalAdjust()));
HorizontalDistance = String.valueOf(pvList.get(0).getHorizontalDistance());
VerticalDistance = String.valueOf(pvList.get(0).getVerticalDistance());
@@ -280,6 +283,52 @@ public class MainActivity extends AppCompatActivity {
});
+ //新增:水平微调
+ mainBinding.roughEditHorizontalAdjustTo32.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+ }
+
+ @Override
+ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ String input = s.toString().trim();
+
+ // 1. 允许空输入(用户正在删除)
+ if (TextUtils.isEmpty(input)) {
+ return;
+ }
+
+ // 2. 允许合法的中间状态(如"-10.")
+ if (input.matches("^-?\\d*(\\.\\d*)?$")) {
+ // 合法格式:整数、负数、小数、小数点开头
+ try {
+
+ double value = Double.parseDouble(input);
+ // 检查输入值是否在 -50 到 100 范围内
+ if (value < -10 || value > 10) {
+ showToast("请输入 -10 到 10 之间的数字");
+ // 可以选择清除输入或限制在范围内
+ mainBinding.roughEditHorizontalAdjustTo32.setText("");
+ } else {
+ showToast("输入有效: " + value);
+ }
+ // 尝试转换为double(处理小数)
+ //lastValidValue = Double.parseDouble(input);
+ } catch (NumberFormatException e) {
+ // 中间状态,忽略
+ }
+ }
+
+ }
+
+ });
+
mainBinding.roughSetCallParametersBtn.setOnClickListener(new View.OnClickListener() {
@Override
diff --git a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/BspError.java b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/BspError.java
index 8b684c8..9ecfa6c 100644
--- a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/BspError.java
+++ b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/BspError.java
@@ -62,6 +62,10 @@ public final class BspError {
* DMAKE_1 = 7;
*/
DMAKE_1(7),
+ /**
+ * Pressure_Detect_Alert = 8;
+ */
+ Pressure_Detect_Alert(8),
UNRECOGNIZED(-1),
;
@@ -106,6 +110,10 @@ public final class BspError {
* DMAKE_1 = 7;
*/
public static final int DMAKE_1_VALUE = 7;
+ /**
+ * Pressure_Detect_Alert = 8;
+ */
+ public static final int Pressure_Detect_Alert_VALUE = 8;
public final int getNumber() {
@@ -140,6 +148,7 @@ public final class BspError {
case 5: return Strain_Gauge;
case 6: return Android_485;
case 7: return DMAKE_1;
+ case 8: return Pressure_Detect_Alert;
default: return null;
}
}
@@ -790,13 +799,13 @@ public final class BspError {
java.lang.String[] descriptorData = {
"\n\017bsp_Error.proto\"b\n\tErrorData\022\026\n\016Com_Er" +
"ror_Code\030\001 \001(\005\022\035\n\025Left_Motor_Error_Code\030" +
- "\002 \001(\005\022\036\n\026Right_Motor_Error_Code\030\003 \001(\005*\231\001" +
+ "\002 \001(\005\022\036\n\026Right_Motor_Error_Code\030\003 \001(\005*\264\001" +
"\n\010ComError\022\r\n\tMK32_SBus\020\000\022\n\n\006TL720D\020\001\022\020\n" +
"\014ZQ_LeftMotor\020\002\022\021\n\rZQ_RightMotor\020\003\022\035\n\031Re" +
"mote_Button_Reset_State\020\004\022\020\n\014Strain_Gaug" +
- "e\020\005\022\017\n\013Android_485\020\006\022\013\n\007DMAKE_1\020\007B,\n(com" +
- ".example.roughapp2_0bbwiredrpm.modelsP\000b" +
- "\006proto3"
+ "e\020\005\022\017\n\013Android_485\020\006\022\013\n\007DMAKE_1\020\007\022\031\n\025Pre" +
+ "ssure_Detect_Alert\020\010B,\n(com.example.roug" +
+ "happ2_0bbwiredrpm.modelsP\000b\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
diff --git a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/BspPV.java b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/BspPV.java
index ec6a4ef..26f0513 100644
--- a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/BspPV.java
+++ b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/BspPV.java
@@ -153,6 +153,12 @@ public final class BspPV {
* @return The toolRotationDirection.
*/
int getToolRotationDirection();
+
+ /**
+ * double Horizontal_Calibration = 14;
+ * @return The horizontalCalibration.
+ */
+ double getHorizontalCalibration();
}
/**
* Protobuf type {@code PV_struct_define}
@@ -381,6 +387,17 @@ public final class BspPV {
return toolRotationDirection_;
}
+ public static final int HORIZONTAL_CALIBRATION_FIELD_NUMBER = 14;
+ private double horizontalCalibration_ = 0D;
+ /**
+ * double Horizontal_Calibration = 14;
+ * @return The horizontalCalibration.
+ */
+ @java.lang.Override
+ public double getHorizontalCalibration() {
+ return horizontalCalibration_;
+ }
+
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
@@ -434,6 +451,9 @@ public final class BspPV {
if (toolRotationDirection_ != 0) {
output.writeInt32(13, toolRotationDirection_);
}
+ if (java.lang.Double.doubleToRawLongBits(horizontalCalibration_) != 0) {
+ output.writeDouble(14, horizontalCalibration_);
+ }
getUnknownFields().writeTo(output);
}
@@ -495,6 +515,10 @@ public final class BspPV {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(13, toolRotationDirection_);
}
+ if (java.lang.Double.doubleToRawLongBits(horizontalCalibration_) != 0) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeDoubleSize(14, horizontalCalibration_);
+ }
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
@@ -539,6 +563,9 @@ public final class BspPV {
!= other.getDmkSpeed()) return false;
if (getToolRotationDirection()
!= other.getToolRotationDirection()) return false;
+ if (java.lang.Double.doubleToLongBits(getHorizontalCalibration())
+ != java.lang.Double.doubleToLongBits(
+ other.getHorizontalCalibration())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@@ -580,6 +607,9 @@ public final class BspPV {
hash = (53 * hash) + getDmkSpeed();
hash = (37 * hash) + TOOLROTATIONDIRECTION_FIELD_NUMBER;
hash = (53 * hash) + getToolRotationDirection();
+ hash = (37 * hash) + HORIZONTAL_CALIBRATION_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
+ java.lang.Double.doubleToLongBits(getHorizontalCalibration()));
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@@ -724,6 +754,7 @@ public final class BspPV {
timeStamp_ = 0L;
dmkSpeed_ = 0;
toolRotationDirection_ = 0;
+ horizontalCalibration_ = 0D;
return this;
}
@@ -796,6 +827,9 @@ public final class BspPV {
if (((from_bitField0_ & 0x00001000) != 0)) {
result.toolRotationDirection_ = toolRotationDirection_;
}
+ if (((from_bitField0_ & 0x00002000) != 0)) {
+ result.horizontalCalibration_ = horizontalCalibration_;
+ }
}
@java.lang.Override
@@ -849,6 +883,9 @@ public final class BspPV {
if (other.getToolRotationDirection() != 0) {
setToolRotationDirection(other.getToolRotationDirection());
}
+ if (other.getHorizontalCalibration() != 0D) {
+ setHorizontalCalibration(other.getHorizontalCalibration());
+ }
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
@@ -940,6 +977,11 @@ public final class BspPV {
bitField0_ |= 0x00001000;
break;
} // case 104
+ case 113: {
+ horizontalCalibration_ = input.readDouble();
+ bitField0_ |= 0x00002000;
+ break;
+ } // case 113
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
@@ -1514,6 +1556,38 @@ public final class BspPV {
return this;
}
+ private double horizontalCalibration_ ;
+ /**
+ * double Horizontal_Calibration = 14;
+ * @return The horizontalCalibration.
+ */
+ @java.lang.Override
+ public double getHorizontalCalibration() {
+ return horizontalCalibration_;
+ }
+ /**
+ * double Horizontal_Calibration = 14;
+ * @param value The horizontalCalibration to set.
+ * @return This builder for chaining.
+ */
+ public Builder setHorizontalCalibration(double value) {
+
+ horizontalCalibration_ = value;
+ bitField0_ |= 0x00002000;
+ onChanged();
+ return this;
+ }
+ /**
+ * double Horizontal_Calibration = 14;
+ * @return This builder for chaining.
+ */
+ public Builder clearHorizontalCalibration() {
+ bitField0_ = (bitField0_ & ~0x00002000);
+ horizontalCalibration_ = 0D;
+ onChanged();
+ return this;
+ }
+
// @@protoc_insertion_point(builder_scope:PV_struct_define)
}
@@ -1579,7 +1653,7 @@ public final class BspPV {
descriptor;
static {
java.lang.String[] descriptorData = {
- "\n\014bsp_PV.proto\"\334\002\n\020PV_struct_define\022\022\n\nR" +
+ "\n\014bsp_PV.proto\"\374\002\n\020PV_struct_define\022\022\n\nR" +
"obotSpeed\030\001 \001(\005\022\017\n\007RunMode\030\002 \001(\005\022\032\n\022Lane" +
"ChangeDistance\030\003 \001(\005\022 \n\030HorizontalDistan" +
"ceMeters\030\004 \001(\001\022\036\n\026VerticalDistanceMeters" +
@@ -1588,8 +1662,9 @@ public final class BspPV {
"\024Vertical_Calibration\030\t \001(\001\022\034\n\024RobotRest" +
"artAccepted\030\n \001(\005\022\021\n\tTimeStamp\030\013 \001(\003\022\020\n\010" +
"DmkSpeed\030\014 \001(\005\022\035\n\025ToolRotationDirection\030" +
- "\r \001(\005B,\n(com.example.roughapp2_0bbwiredr" +
- "pm.modelsP\000b\006proto3"
+ "\r \001(\005\022\036\n\026Horizontal_Calibration\030\016 \001(\001B,\n" +
+ "(com.example.roughapp2_0bbwiredrpm.model" +
+ "sP\000b\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
@@ -1600,7 +1675,7 @@ public final class BspPV {
internal_static_PV_struct_define_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_PV_struct_define_descriptor,
- new java.lang.String[] { "RobotSpeed", "RunMode", "LaneChangeDistance", "HorizontalDistanceMeters", "VerticalDistanceMeters", "PressSet", "LeftCompensation", "RightCompensation", "VerticalCalibration", "RobotRestartAccepted", "TimeStamp", "DmkSpeed", "ToolRotationDirection", });
+ new java.lang.String[] { "RobotSpeed", "RunMode", "LaneChangeDistance", "HorizontalDistanceMeters", "VerticalDistanceMeters", "PressSet", "LeftCompensation", "RightCompensation", "VerticalCalibration", "RobotRestartAccepted", "TimeStamp", "DmkSpeed", "ToolRotationDirection", "HorizontalCalibration", });
descriptor.resolveAllFeaturesImmutable();
}
diff --git a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/DisplayPV.java b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/DisplayPV.java
index ed20ba5..f001cf7 100644
--- a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/DisplayPV.java
+++ b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/models/DisplayPV.java
@@ -10,21 +10,35 @@ public class DisplayPV extends BaseObservable {
private double horizontalDistance;
private double verticalDistance;
private double verticalAdjust;
+ // 新增,水平微调
+ private double horizontalAdjust;
private double leftCompensation;
private double rightCompensation;
private int pressSet;
- public DisplayPV(int id, int laneChangeDistance, double horizontalDistance, double verticalDistance, double verticalAdjust, double leftCompensation, double rightCompensation ,int pressSet) {
- this.id = id;
- this.laneChangeDistance=laneChangeDistance;
- this.horizontalDistance = horizontalDistance;
- this.verticalDistance = verticalDistance;
- this.verticalAdjust=verticalAdjust;
- this.leftCompensation = leftCompensation;
- this.rightCompensation=rightCompensation;
- this.pressSet=pressSet;
+// public DisplayPV(int id, int laneChangeDistance, double horizontalDistance, double verticalDistance, double verticalAdjust, double leftCompensation, double rightCompensation ,int pressSet) {
+// this.id = id;
+// this.laneChangeDistance=laneChangeDistance;
+// this.horizontalDistance = horizontalDistance;
+// this.verticalDistance = verticalDistance;
+// this.verticalAdjust=verticalAdjust;
+// this.leftCompensation = leftCompensation;
+// this.rightCompensation=rightCompensation;
+// this.pressSet=pressSet;
+//
+// }
+public DisplayPV(int id, int laneChangeDistance, double horizontalDistance, double verticalDistance, double verticalAdjust, double horizontalAdjust, double leftCompensation, double rightCompensation ,int pressSet) {
+ this.id = id;
+ this.laneChangeDistance=laneChangeDistance;
+ this.horizontalDistance = horizontalDistance;
+ this.verticalDistance = verticalDistance;
+ this.verticalAdjust=verticalAdjust;
+ this.horizontalAdjust=horizontalAdjust;
+ this.leftCompensation = leftCompensation;
+ this.rightCompensation=rightCompensation;
+ this.pressSet=pressSet;
- }
+}
public int getId() { return id; }
@@ -58,6 +72,14 @@ public class DisplayPV extends BaseObservable {
this.verticalAdjust = verticalAdjust;
}
+ //新增:水平微调
+ public double getHorizontalAdjust(){
+ return horizontalAdjust;
+ }
+ public void setHorizontalAdjust(double verticalAdjust) {
+ this.horizontalAdjust = horizontalAdjust;
+ }
+
public double getLeftCompensation() {
return leftCompensation;
diff --git a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/ErrorDeocdeHelper.java b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/ErrorDeocdeHelper.java
index ffe4ba1..b778438 100644
--- a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/ErrorDeocdeHelper.java
+++ b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/ErrorDeocdeHelper.java
@@ -45,6 +45,10 @@ public class ErrorDeocdeHelper {
{
ErrorResult = "未复位" ;
}
+ if (err.toString().equals("Pressure_Detect_Alert"))
+ {
+ ErrorResult = "压力过载" ;
+ }
// else
// {
// ErrorResult += err.toString()+addErrorResult+"\t";
diff --git a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/MyDataHelper.java b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/MyDataHelper.java
index 2a1242e..c3a2742 100644
--- a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/MyDataHelper.java
+++ b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/MyDataHelper.java
@@ -31,6 +31,8 @@ public class MyDataHelper extends SQLiteOpenHelper {
public static final String COLUMN_LEFT_COMPENSATION = "leftCompensation"; /*左补偿*/
public static final String COLUMN_RIGHT_COMPENSATION = "rightCompensation"; /*右补偿*/
public static final String COLUMN_VERTICAL_ADJUST = "verticalAdjust";//Maintv_VerticalAdjustTo32 竖直微调
+ // 新增:水平微调
+ public static final String COLUMN_HORIZONTAL_ADJUST = "horizontalAdjust";
public static final String COLUMN_LANE_CHANGE_DISTANCE = "laneChangeDistance";//换道距离
public static final String Error_TABLE_NAME_ROUGH = "error";
public static final String Error_COLUMN_TimeStamp = "timeID";
@@ -45,7 +47,7 @@ public class MyDataHelper extends SQLiteOpenHelper {
@SuppressLint("SQLiteString")
@Override
public void onCreate(SQLiteDatabase db) {
-
+// 新增:水平微调
String sql = "CREATE TABLE " + TABLE_NAME_ROUGH + " (" +
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_LEFT_COMPENSATION + " DOUBLE, " +
@@ -53,6 +55,7 @@ public class MyDataHelper extends SQLiteOpenHelper {
COLUMN_HORIZONTAL_DISTANCE + " DOUBLE, " +
COLUMN_VERTICAL_DISTANCE + " DOUBLE, " +
COLUMN_VERTICAL_ADJUST + " DOUBLE, " +
+ COLUMN_HORIZONTAL_ADJUST + " DOUBLE, " +
COLUMN_PRESS_SET + " INTEGER, " +
COLUMN_LANE_CHANGE_DISTANCE + " INTEGER);" ;
db.execSQL(sql); //执行sql语句 拉毛表
@@ -81,7 +84,8 @@ public class MyDataHelper extends SQLiteOpenHelper {
cv.put(COLUMN_HORIZONTAL_DISTANCE, pv.getHorizontalDistance());
cv.put(COLUMN_VERTICAL_DISTANCE, pv.getVerticalDistance());
cv.put(COLUMN_VERTICAL_ADJUST, pv.getVerticalAdjust());
-
+ // 新增:水平微调COLUMN_HORIZONTAL_ADJUST
+ cv.put(COLUMN_HORIZONTAL_ADJUST, pv.getHorizontalAdjust());
cv.put(COLUMN_LEFT_COMPENSATION, pv.getLeftCompensation());
cv.put(COLUMN_RIGHT_COMPENSATION, pv.getRightCompensation());
cv.put(COLUMN_PRESS_SET, pv.getPressSet());
@@ -104,7 +108,7 @@ public class MyDataHelper extends SQLiteOpenHelper {
for (int i = 1; i < 6; i++) {
List list = getDisplayDataRough(i); //从数据库中读
if (list.size() == 0) {
- DisplayPV pv = new DisplayPV(i, 0, 0, 0, 0, 0, 0,0);
+ DisplayPV pv = new DisplayPV(i, 0, 0, 0, 0, 0, 0,0, 0);
addOrUpdateDisplayDataRough(pv);//一行一行添加
}
}
@@ -119,6 +123,9 @@ public class MyDataHelper extends SQLiteOpenHelper {
int idIndex = cursor.getColumnIndex(COLUMN_ID);
int _laneChangeDistanceIndex = cursor.getColumnIndex(COLUMN_LANE_CHANGE_DISTANCE);
int _verticalAdjustIndex = cursor.getColumnIndex(COLUMN_VERTICAL_ADJUST);
+ // 新增:水平微调
+ int _horizontalAdjustIndex = cursor.getColumnIndex(COLUMN_HORIZONTAL_ADJUST);
+
int _pressSetIndex = cursor.getColumnIndex(COLUMN_PRESS_SET);
int _leftCompensationIndex=cursor.getColumnIndex(COLUMN_LEFT_COMPENSATION);
int _rightCompensationIndex=cursor.getColumnIndex(COLUMN_RIGHT_COMPENSATION);
@@ -126,9 +133,9 @@ public class MyDataHelper extends SQLiteOpenHelper {
int _verticalDistanceIndex=cursor.getColumnIndex(COLUMN_VERTICAL_DISTANCE);
while (cursor.moveToNext()) {
-
+// 新增:水平微调
DisplayPV pv = new DisplayPV(cursor.getInt(idIndex), cursor.getInt(_laneChangeDistanceIndex),
- cursor.getDouble(_horizontalDistanceIndex), cursor.getDouble(_verticalDistanceIndex), cursor.getDouble(_verticalAdjustIndex),cursor.getDouble(_leftCompensationIndex), cursor.getDouble(_rightCompensationIndex),
+ cursor.getDouble(_horizontalDistanceIndex), cursor.getDouble(_verticalDistanceIndex), cursor.getDouble(_verticalAdjustIndex), cursor.getDouble(_horizontalAdjustIndex),cursor.getDouble(_leftCompensationIndex), cursor.getDouble(_rightCompensationIndex),
cursor.getInt(_pressSetIndex)
);
diff --git a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/PVModify.java b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/PVModify.java
index c7d7ef3..eea005b 100644
--- a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/PVModify.java
+++ b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/PVModify.java
@@ -8,6 +8,8 @@ public class PVModify {
String ChangeLaneDistanceStr = roughActivity.mainBinding.roughEditLaneChangeDistanceTo32.getText().toString();
String PressStr = roughActivity.mainBinding.roughEditPressTo32.getText().toString();
String VeticalAdjustStr = roughActivity.mainBinding.roughEditVerticalAdjustTo32.getText().toString();
+ // 新增,水平微调
+ String HorizontalAdjustStr = roughActivity.mainBinding.roughEditHorizontalAdjustTo32.getText().toString();
String DMKSpeedStr = roughActivity.mainBinding.DMKSpeedTo32.getText().toString();
//前端转速
@@ -66,6 +68,21 @@ public class PVModify {
}
+ //增加:水平微调--小数*10
+ try {
+
+ if (HorizontalAdjustStr.isEmpty()) {
+ roughActivity._toSendPV = roughActivity._toSendPV.toBuilder().setHorizontalCalibration(0).build();
+ } else {
+ roughActivity._toSendPV = roughActivity._toSendPV.toBuilder()
+ .setHorizontalCalibration((Double.parseDouble(String.valueOf(roughActivity.mainBinding.roughEditHorizontalAdjustTo32.getText())) * 100)).build();
+
+ }
+
+ } catch (Exception e) {
+
+ }
+
//自动手动模式发送
if (roughActivity.rough_Manual_Mode_Call_Value.equals("未启用")) //手动模式未启用
{
diff --git a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/PopupHelper.java b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/PopupHelper.java
index 1c47d6c..9e86dba 100644
--- a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/PopupHelper.java
+++ b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/PopupHelper.java
@@ -335,13 +335,16 @@ public class PopupHelper {
int paraIndex = Integer.parseInt(mainActivity.mainBinding.roughTvParameterCallTo32.getText().toString());
int laneChangeDistance = Integer.parseInt(mainActivity.mainBinding.roughEditLaneChangeDistanceTo32.getText().toString());
double verticalAdjust = Double.parseDouble(mainActivity.mainBinding.roughEditVerticalAdjustTo32.getText().toString());
+ // 新增:水平微调
+ double horizontalAdjust = Double.parseDouble(mainActivity.mainBinding.roughEditHorizontalAdjustTo32.getText().toString());
+
double horizontalDistance = Double.parseDouble(mainActivity.HorizontalDistance);
double verticalDistance = Double.parseDouble(mainActivity.VerticalDistance);
double leftCompensation=Double.parseDouble(mainActivity.mainBinding.roughTvLCompensationFrom32.getText().toString());
double rightCompensation=Double.parseDouble(mainActivity.mainBinding.roughTvRCopmpensationFrom32.getText().toString());
int pressSet=Integer.parseInt(mainActivity.mainBinding.roughEditPressTo32.getText().toString());
//把界面中的值放进PV类的变量中
- DisplayPV displayPV = new DisplayPV(paraIndex, laneChangeDistance,horizontalDistance,verticalDistance,verticalAdjust ,leftCompensation,rightCompensation, pressSet );
+ DisplayPV displayPV = new DisplayPV(paraIndex, laneChangeDistance,horizontalDistance,verticalDistance,verticalAdjust,horizontalAdjust ,leftCompensation,rightCompensation, pressSet );
myDataHelper.addOrUpdateDisplayDataRough(displayPV); //创建数据库的实例在这里 PV传进去保存到数据库
Toast.makeText(dialog.getContext(), "保存成功", Toast.LENGTH_SHORT).show();
}
@@ -360,6 +363,8 @@ public class PopupHelper {
mainActivity.mainBinding.roughEditLaneChangeDistanceTo32.setText(String.valueOf(1));
mainActivity.mainBinding.roughEditVerticalAdjustTo32.setText(String.valueOf(0));
+ // 新增:水平微调
+ mainActivity.mainBinding.roughEditHorizontalAdjustTo32.setText(String.valueOf(0));
mainActivity.mainBinding.roughEditPressTo32.setText(String.valueOf(0));
mainActivity.mainBinding.roughTvLCompensationFrom32.setText(String.valueOf(0));
mainActivity.mainBinding.roughTvRCopmpensationFrom32.setText(String.valueOf(0));
@@ -369,6 +374,8 @@ public class PopupHelper {
int paraIndex = Integer.parseInt(mainActivity.mainBinding.roughTvParameterCallTo32.getText().toString());
int laneChangeDistance = Integer.parseInt(mainActivity.mainBinding.roughEditLaneChangeDistanceTo32.getText().toString());
double verticalAdjust = Double.parseDouble(mainActivity.mainBinding.roughEditVerticalAdjustTo32.getText().toString());
+ //新增:水平微调
+ double horizontalAdjust = Double.parseDouble(mainActivity.mainBinding.roughEditHorizontalAdjustTo32.getText().toString());
double horizontalDistance = Double.parseDouble(mainActivity.HorizontalDistance);
double verticalDistance = Double.parseDouble(mainActivity.VerticalDistance);
double leftCompensation=Double.parseDouble(mainActivity.mainBinding.roughTvLCompensationFrom32.getText().toString());
@@ -376,7 +383,7 @@ public class PopupHelper {
int pressSet=Integer.parseInt(mainActivity.mainBinding.roughEditPressTo32.getText().toString());
//把界面中的值放进PV类的变量中
- DisplayPV displayPV = new DisplayPV(paraIndex, laneChangeDistance,horizontalDistance,verticalDistance,verticalAdjust ,leftCompensation,rightCompensation, pressSet );
+ DisplayPV displayPV = new DisplayPV(paraIndex, laneChangeDistance,horizontalDistance,verticalDistance,verticalAdjust,horizontalAdjust ,leftCompensation,rightCompensation, pressSet );
myDataHelper.addOrUpdateDisplayDataRough(displayPV); //创建数据库的实例在这里 PV传进去保存到数据库
Toast.makeText(dialog.getContext(), "清除成功", Toast.LENGTH_SHORT).show();
}
@@ -401,6 +408,8 @@ public class PopupHelper {
mainActivity.mainBinding.roughEditLaneChangeDistanceTo32.setText(String.valueOf(pvList.get(0).getLaneChangeDistance()));
mainActivity.mainBinding.roughEditVerticalAdjustTo32.setText(String.valueOf(pvList.get(0).getVerticalAdjust()));
+ // 新增:水平微调
+ mainActivity.mainBinding.roughEditHorizontalAdjustTo32.setText(String.valueOf(pvList.get(0).getHorizontalAdjust()));
mainActivity.HorizontalDistance=String.valueOf(pvList.get(0).getHorizontalDistance());
mainActivity.VerticalDistance=String.valueOf(pvList.get(0).getVerticalDistance());
mainActivity.mainBinding.roughTvLCompensationFrom32.setText(String.valueOf(pvList.get(0).getLeftCompensation()));
diff --git a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/ReceiivedIVHandler.java b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/ReceiivedIVHandler.java
index 7fbd570..a935c24 100644
--- a/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/ReceiivedIVHandler.java
+++ b/app/src/main/java/com/example/roughapp2_0bbwiredrpm/services/ReceiivedIVHandler.java
@@ -122,6 +122,10 @@ public class ReceiivedIVHandler {
roughActivity.mainBinding.messageRounded.setBackgroundResource(R.drawable.message_rounded_rectangle_red);
roughActivity.mainBinding.mainViewErrMessageTxView.setText(String.valueOf(errorString2));
}
+ else if (Objects.equals(errorString2, "压力过载")) {
+ roughActivity.mainBinding.messageRounded.setBackgroundResource(R.drawable.message_rounded_rectangle_red);
+ roughActivity.mainBinding.mainViewErrMessageTxView.setText(String.valueOf(errorString2));
+ }
else
{
// if(Rough_485Flag==1)
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index f1155a5..da83d53 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -712,9 +712,10 @@
-
+
+
-
+ android:layout_gravity="fill"
+ android:orientation="horizontal">
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -796,6 +851,14 @@
android:textColor="@color/deepskyblue"
android:textSize="15sp" />
+
+
-
-
@@ -878,6 +933,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+