|
@@ -49,9 +49,9 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
private static final int CLEAR_MESSAGE= 2;
|
|
|
private static final int LOG2_MESSAGE = 3;
|
|
|
private static final int DEBUG_MESSAGE_ERROR = 4;
|
|
|
- private static final int UPDATE_FW= 5;
|
|
|
- private static final int DIFF_MESSAGE = 6;
|
|
|
- private static final int MANUALDIFF_MESSAGE = 7;
|
|
|
+ private static final int DIFF_MESSAGE = 5;
|
|
|
+ private static final int MANUALDIFF_MESSAGE = 6;
|
|
|
+ private static final int TEST_DATA_MESSAGE = 7;
|
|
|
|
|
|
private static final String USB_ACTION = "com.host2device";
|
|
|
private static final String ACTION_USB_PERMISSION = "com.host2device.USB_PERMISSION";
|
|
@@ -75,6 +75,9 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
|
|
|
private EditText edt_RowNum;
|
|
|
private EditText edt_ColNum;
|
|
|
+ private EditText edt_Maximum;
|
|
|
+ private EditText edt_Minimum;
|
|
|
+ private EditText edt_TestiInformation; //显示测试过程信息
|
|
|
|
|
|
private boolean isReceiverMessage = true;
|
|
|
|
|
@@ -87,11 +90,23 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
|
|
|
private int colnum;
|
|
|
private int rownum;
|
|
|
+ private int iMaximum; //存放外部输入的最大值测试阈值
|
|
|
+ private int iMinimum; //存放外部输入的最小值测试阈值
|
|
|
+ private byte byMaximumOverCount; //最大值超过阈值的次数
|
|
|
+ private byte byMinimumOverCount; //最小值超过阈值的次数
|
|
|
+ private byte byTestCount; //统计测试的帧数
|
|
|
+ private byte byReTestCount; //重新测试的测试,最多测试4次输出判定结果
|
|
|
+ private boolean bTestMaxResult,bTestMinResult; //测试结果pass或者fail;
|
|
|
private TextView tvMaximum; //显示最大值
|
|
|
private TextView tvMinimum; //显示最小值
|
|
|
private TextView tvDataContent; //显示当前处于何种数值模式:原始值、差值、基准……
|
|
|
private TextView tvMAD; //显示最大相邻偏差
|
|
|
|
|
|
+ public String stTestLog; //测试信息存放字符串
|
|
|
+ String stTestLogShow= ""; //测试信息合并起来存放字符串
|
|
|
+
|
|
|
+ private byte showFlag = 0; //
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
@@ -154,6 +169,9 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
private void InitEditText(){
|
|
|
edt_RowNum = (EditText) findViewById(R.id.inputrownum);
|
|
|
edt_ColNum = (EditText) findViewById(R.id.inputcolnum);
|
|
|
+ edt_Maximum = (EditText) findViewById(R.id.inputmaximum);
|
|
|
+ edt_Minimum = (EditText) findViewById(R.id.inputminimum);
|
|
|
+ edt_TestiInformation = (EditText) findViewById(R.id.testinformation); //显示测试过程信息
|
|
|
}
|
|
|
|
|
|
private void InitListener(){
|
|
@@ -678,7 +696,7 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
mHandler.sendEmptyMessage(MANUALDIFF_MESSAGE);
|
|
|
// mHandler.sendEmptyMessage(RAWDATA_MESSAGE);
|
|
|
break;
|
|
|
- case 3://
|
|
|
+ case 3://diffdata
|
|
|
mHandler.sendEmptyMessage(DIFF_MESSAGE);
|
|
|
break;
|
|
|
case 5: //stop
|
|
@@ -686,6 +704,9 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
count = 1000;
|
|
|
changeToNormalMode();
|
|
|
break;
|
|
|
+ case 6: //test
|
|
|
+ mHandler.sendEmptyMessage(TEST_DATA_MESSAGE);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -832,10 +853,8 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
|
|
|
mrawlog.setText("0x814E_SYNC read success,count == 0");
|
|
|
break;
|
|
|
- case DEBUG_MESSAGE_ERROR://成功发送数据
|
|
|
- break;
|
|
|
|
|
|
- case UPDATE_FW:
|
|
|
+ case DEBUG_MESSAGE_ERROR://成功发送数据
|
|
|
break;
|
|
|
|
|
|
case DIFF_MESSAGE://
|
|
@@ -1032,13 +1051,131 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
tvMinimum.setText(Integer.toString(mindata));
|
|
|
break;
|
|
|
|
|
|
+ case TEST_DATA_MESSAGE: //
|
|
|
+ maxdata = 0;
|
|
|
+ mindata = 65535;
|
|
|
+ //控制行数
|
|
|
+ for (int row = 0; row < rownum; row++) {
|
|
|
+ //控制列数
|
|
|
+ for (int col = 0; col < colnum; col++) {
|
|
|
+
|
|
|
+ idtemp = row + col * rownum;
|
|
|
+ datatemp[i] = ((mRawdataBytes[idtemp * 2] & 0xFF) << 8) + (mRawdataBytes[idtemp * 2 + 1] & 0xFF);
|
|
|
+
|
|
|
+ //获取最大值
|
|
|
+ if (datatemp[i] > maxdata){
|
|
|
+ maxdata = datatemp[i];
|
|
|
+ }
|
|
|
+ //获取最小值
|
|
|
+ if (datatemp[i] < mindata){
|
|
|
+ mindata = datatemp[i];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (maxdata > iMaximum) //统计最大值大于阈值的次数
|
|
|
+ {
|
|
|
+ byMaximumOverCount++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mindata < iMinimum) //统计最小值小于阈值的次数
|
|
|
+ {
|
|
|
+ byMinimumOverCount++;
|
|
|
+ }
|
|
|
+
|
|
|
+ byTestCount++;
|
|
|
+ stTestLog = "采样第" + Integer.toString(byTestCount) + "帧";
|
|
|
+ //stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ //stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+
|
|
|
+ if (byTestCount >= 16)
|
|
|
+ {
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+
|
|
|
+ stTestLog = "测试完成!!";
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+
|
|
|
+ stTestLog = "最大值超过阈值的次数:" + Integer.toString(byMaximumOverCount);
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+
|
|
|
+ stTestLog = "最小值超过阈值的次数:" + Integer.toString(byMinimumOverCount);
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+
|
|
|
+ if (byMaximumOverCount >= 15)
|
|
|
+ {
|
|
|
+ bTestMaxResult = false;
|
|
|
+ stTestLog = "最大值超限!!";
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+ }
|
|
|
+ else if(byMaximumOverCount < 2)
|
|
|
+ {
|
|
|
+ bTestMaxResult = true;
|
|
|
+ stTestLog = "最大值测试pass";
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bTestMaxResult = false;
|
|
|
+ stTestLog = "最大值在临界范围,存在风险!!";
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (byMinimumOverCount >= 15)
|
|
|
+ {
|
|
|
+ bTestMinResult = false;
|
|
|
+ stTestLog = "最小值超限!!";
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+ }
|
|
|
+ else if (byMinimumOverCount < 2)
|
|
|
+ {
|
|
|
+ bTestMinResult = true;
|
|
|
+ stTestLog = "最小值测试pass";
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bTestMinResult = false;
|
|
|
+ stTestLog = "最小值在临界范围,存在风险!!";
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((bTestMaxResult == true) && (bTestMinResult == true))
|
|
|
+ {
|
|
|
+ stTestLog = "测 试 Pass !!";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ stTestLog = "测 试 NG !!";
|
|
|
+ }
|
|
|
+
|
|
|
+ showFlag = 5; //stop
|
|
|
+ btn_RawdataShow.setEnabled(true);
|
|
|
+ btn_DiffdataShow.setEnabled(true);
|
|
|
+ btn_ReffdataShow.setEnabled(true);
|
|
|
+ btn_ManualdiffdataShow.setEnabled(true);
|
|
|
+ btn_Manualreff.setEnabled(false);
|
|
|
+ btn_Test.setEnabled(true);
|
|
|
+ }
|
|
|
+ edt_TestiInformation.setText(stTestLogShow + stTestLog);
|
|
|
+ edt_TestiInformation.setSelection(edt_TestiInformation.getText().length());
|
|
|
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- byte showFlag = 0;
|
|
|
-
|
|
|
@Override
|
|
|
public void onClick(final View view) {
|
|
|
|
|
@@ -1151,11 +1288,61 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
break;
|
|
|
|
|
|
case R.id.testting:
|
|
|
+ if (edt_Maximum.getText().length()==0)
|
|
|
+ {
|
|
|
+ edt_Maximum.setText(Integer.toString(3500));
|
|
|
+ iMaximum = 3500;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ iMaximum = Integer.parseInt(edt_Maximum.getText().toString(),10);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (edt_Minimum.getText().length()==0)
|
|
|
+ {
|
|
|
+ edt_Minimum.setText(Integer.toString(1750));
|
|
|
+ iMinimum = 1800;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ iMinimum = Integer.parseInt(edt_Minimum.getText().toString(),10);
|
|
|
+ }
|
|
|
+
|
|
|
+ if((iMinimum < (iMaximum / 2)) || (iMinimum > iMaximum))
|
|
|
+ {
|
|
|
+ Toast.makeText(this,"最小值阈值不能大于最大值阈值或小于最大值阈值的1/2",Toast.LENGTH_SHORT).show();
|
|
|
+ btn_RawdataShow.setEnabled(true);
|
|
|
+ btn_DiffdataShow.setEnabled(true);
|
|
|
+ btn_ReffdataShow.setEnabled(true);
|
|
|
+ btn_ManualdiffdataShow.setEnabled(true);
|
|
|
+ //btn_Manualreff.setEnabled(false);
|
|
|
+ btn_Test.setEnabled(true);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ showFlag = 6;
|
|
|
+ byTestCount = 0;
|
|
|
+ byMaximumOverCount = 0;
|
|
|
+ byMinimumOverCount = 0;
|
|
|
+ byReTestCount = 0;
|
|
|
+ changeToDebugMode();
|
|
|
+ //count = 1000;
|
|
|
+ showAddressHigh = (byte)0x8b;
|
|
|
+ showAddressLow = (byte)0x98;
|
|
|
+ if(count == 1000){
|
|
|
+ //tvDataContent.setText("["+getResources().getString(R.string.rawdata)+"]");
|
|
|
+ stTestLogShow = "";
|
|
|
+
|
|
|
+ stTestLog = "开始测试!";
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ stTestLogShow = stTestLogShow.concat("\n");
|
|
|
+ showRawdata();
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
|
|
|
case R.id.stop: //back
|
|
|
- showFlag =5;
|
|
|
+ showFlag = 5;
|
|
|
|
|
|
btn_RawdataShow.setEnabled(true);
|
|
|
btn_DiffdataShow.setEnabled(true);
|