|
@@ -1,10 +1,13 @@
|
|
|
package com.example.administrator.wingcool_gt9_apk;
|
|
|
|
|
|
+import android.Manifest;
|
|
|
+import android.app.Activity;
|
|
|
import android.app.PendingIntent;
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.content.IntentFilter;
|
|
|
import android.content.pm.ActivityInfo;
|
|
|
+import android.content.pm.PackageManager;
|
|
|
import android.content.res.Configuration;
|
|
|
import android.content.res.Resources;
|
|
|
import android.graphics.Color;
|
|
@@ -15,10 +18,14 @@ import android.hardware.usb.UsbEndpoint;
|
|
|
import android.hardware.usb.UsbInterface;
|
|
|
import android.hardware.usb.UsbManager;
|
|
|
import android.hardware.usb.UsbRequest;
|
|
|
+import android.net.Uri;
|
|
|
import android.os.Bundle;
|
|
|
+import android.os.Environment;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
import android.os.SystemClock;
|
|
|
+import android.support.v4.app.ActivityCompat;
|
|
|
+import android.support.v4.content.ContextCompat;
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
import android.util.DisplayMetrics;
|
|
|
import android.view.Gravity;
|
|
@@ -35,6 +42,12 @@ import android.widget.Toast;
|
|
|
|
|
|
import org.w3c.dom.Text;
|
|
|
|
|
|
+import java.io.BufferedReader;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStreamReader;
|
|
|
+import java.io.Reader;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
import java.util.HashMap;
|
|
@@ -47,9 +60,15 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
private Context mAlertContext;
|
|
|
//MainActivity mMainAct = new MainActivity();
|
|
|
private byte[] mRawdataBytes = new byte[52 * 75 * 2 + 64 * 2];
|
|
|
- private int[] mManualRefInt = new int[52 * 75 * 2 + 64 * 2];
|
|
|
- private int[] datatemp = new int[52 * 75 * 2 + 64 * 2];
|
|
|
- private short[] iDataShow = new short[52 * 75 * 2 + 64 * 2];
|
|
|
+ private int[] mManualRefInt = new int[52 * 75 + 64];
|
|
|
+ private int[] datatemp = new int[52 * 75 + 64];
|
|
|
+ private short[] iDataShow = new short[52 * 75 + 64];
|
|
|
+ private int[] iRawDataMaxVal = new int[52 * 75 + 64];
|
|
|
+ private int[] iRawDataMinVal = new int[52 * 75 + 64];
|
|
|
+ private byte[] byOverMaxCount = new byte[52 * 75 + 64];
|
|
|
+ private byte[] byLessMinCount = new byte[52 * 75 + 64];
|
|
|
+ private byte[] byOverAdjCount = new byte[52 * 75 + 64];
|
|
|
+ private byte[] byConfigBak = new byte[2048];
|
|
|
private static final int RAWDATA_MESSAGE = 0;
|
|
|
private static final int LOG1_MESSAG = 1;
|
|
|
private static final int CLEAR_MESSAGE= 2;
|
|
@@ -81,9 +100,11 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
private Button btn_ManualdiffdataShow;
|
|
|
private Button btn_Manualreff;
|
|
|
private Button btn_StylusDataShow;
|
|
|
+ private Button btn_ImportFileButton;
|
|
|
private Button btn_Test;
|
|
|
private Button btn_Stop;
|
|
|
|
|
|
+
|
|
|
private byte[] mBytes = new byte[2048];
|
|
|
|
|
|
private EditText edt_RowNum;
|
|
@@ -114,6 +135,7 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
private TextView tvDataContent; //显示当前处于何种数值模式:原始值、差值、基准……
|
|
|
private TextView tvMAD; //显示最大相邻偏差
|
|
|
private TextView mtextView;
|
|
|
+ private TextView edit_search;
|
|
|
private byte byDisplayFrame = 0; //间隔显示帧数
|
|
|
private byte byDisplayFrameCount = 0; //用于间隔显示计数
|
|
|
|
|
@@ -608,6 +630,20 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
btn_Manualreff.setEnabled(false);
|
|
|
//btn_StylusDataShow.setEnabled(false);
|
|
|
//btn_Stop.setEnabled(false);
|
|
|
+
|
|
|
+ //选择本地文件
|
|
|
+ btn_ImportFileButton = (Button) findViewById(R.id.importtestpara);
|
|
|
+ btn_ImportFileButton.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ //ActivityCompat.requestPermissions( Config.this, new String[]{android
|
|
|
+ // .Manifest.permission.READ_EXTERNAL_STORAGE}, 2);
|
|
|
+ Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
|
+ intent.setType("*/*");//设置类型,我这里是任意类型,任意后缀的可以这样写。
|
|
|
+ intent.addCategory(Intent.CATEGORY_OPENABLE);
|
|
|
+ startActivityForResult(intent, 2);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private void InitEditText(){
|
|
@@ -645,6 +681,163 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
textGridLayout = (GridLayout)findViewById(R.id.AllGridLayout);
|
|
|
}
|
|
|
|
|
|
+ protected void onActivityResult ( int requestCode, int resultCode, Intent data){
|
|
|
+ if (resultCode == Activity.RESULT_OK) {
|
|
|
+
|
|
|
+ int permission_write = ContextCompat.checkSelfPermission(DataAnalysis.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
|
|
+ int permission_read = ContextCompat.checkSelfPermission(DataAnalysis.this, Manifest.permission.READ_EXTERNAL_STORAGE);
|
|
|
+
|
|
|
+ if ((permission_write != PackageManager.PERMISSION_GRANTED)
|
|
|
+ ||(permission_read != PackageManager.PERMISSION_GRANTED))
|
|
|
+ {
|
|
|
+
|
|
|
+ ActivityCompat.requestPermissions(DataAnalysis.this, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
|
|
+ android.Manifest.permission.READ_EXTERNAL_STORAGE}, 3);
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuffer buffer = new StringBuffer();
|
|
|
+ String configString = "";
|
|
|
+ Uri uri = data.getData();
|
|
|
+ String fileString = "";
|
|
|
+ if (requestCode == 1) { //U 盘 文 件
|
|
|
+
|
|
|
+ byte[] filebuffer;
|
|
|
+ int len;
|
|
|
+ try {
|
|
|
+
|
|
|
+ //String fileString = "";
|
|
|
+ File storage = new File("/storage");
|
|
|
+ File[] files = storage.listFiles();
|
|
|
+ for (final File file : files) {
|
|
|
+ if (file.canRead()) {
|
|
|
+ if (!file.getName().equals(Environment.getExternalStorageDirectory().getName())) {
|
|
|
+ //满足该条件的文件夹就是u盘在手机上的目录
|
|
|
+ fileString = (file.getPath()+"/GTxxxx_wingcool.tp");
|
|
|
+ fileString = fileString.replaceAll(":", "/"); //将:改为/,以防某些系统文件目录读出是:
|
|
|
+ edit_search.setText(fileString);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ buffer = new StringBuffer();
|
|
|
+ //String storageState = Environment.getExternalStorageState();
|
|
|
+ //if (storageState.equals(Environment.MEDIA_MOUNTED)) {
|
|
|
+ FileInputStream fileInputStream = new FileInputStream(fileString);
|
|
|
+ filebuffer = new byte[1024];
|
|
|
+ len = fileInputStream.read(filebuffer);
|
|
|
+ while (len > 0) {
|
|
|
+ buffer.append(new String(filebuffer, 0, len));
|
|
|
+ len = fileInputStream.read(filebuffer);
|
|
|
+ }
|
|
|
+ fileInputStream.close();
|
|
|
+ //}
|
|
|
+
|
|
|
+ configString = buffer.toString();
|
|
|
+
|
|
|
+ } catch (IOException ex) {
|
|
|
+ edit_search.setText(uri.getPath() + "——" + getResources().getString(R.string.invalidfile));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } //end of if (requestCode == 1)
|
|
|
+ else if (requestCode == 2) { //本 地 文 件
|
|
|
+
|
|
|
+ try {
|
|
|
+ File dir = Environment.getExternalStorageDirectory();
|
|
|
+ //Uri uri = data.getData();
|
|
|
+ File dataFile;
|
|
|
+
|
|
|
+ fileString = dir.getPath() + "/";
|
|
|
+
|
|
|
+ if (uri.getLastPathSegment().indexOf(":") > 0){
|
|
|
+ String[] stringFileNameArr = uri.getLastPathSegment().split(":");
|
|
|
+ fileString += stringFileNameArr[1];
|
|
|
+ }else{
|
|
|
+ fileString += uri.getLastPathSegment();
|
|
|
+ }
|
|
|
+
|
|
|
+ //fileString = dir.getPath() + "/" + uri.getLastPathSegment();
|
|
|
+ //edit_search.setText(dir.getPath() + "/GTxxxx_wingcool_config.cfg");
|
|
|
+
|
|
|
+
|
|
|
+ //fileString = fileString.replaceAll(":", "/"); //将:改为/,以防某些系统文件目录读出是:
|
|
|
+ edit_search.setText(fileString);
|
|
|
+
|
|
|
+ //File dir = Environment.getExternalStorageDirectory();
|
|
|
+ //dataFile = new File(dir.getPath(), "GTxxxx_wingcool_config.cfg");
|
|
|
+ dataFile = new File(fileString);
|
|
|
+
|
|
|
+ FileInputStream fis = new FileInputStream(dataFile);
|
|
|
+ //byte[] bytes = new byte[fis.available()];
|
|
|
+ //fis.read(bytes);
|
|
|
+ //fis.close();
|
|
|
+ //String str = new String(bytes,"utf-8");
|
|
|
+ //edit_search.setText(str);
|
|
|
+
|
|
|
+ //FileInputStream fis = new FileInputStream(uri.getPath().toString());
|
|
|
+ InputStreamReader isr = new InputStreamReader(fis, "UTF-8");//文件编码Unicode,UTF-8,ASCII,GB2312,Big5
|
|
|
+ Reader in = new BufferedReader(isr);
|
|
|
+ int ch;
|
|
|
+ while ((ch = in.read()) > -1) {
|
|
|
+ buffer.append((char) ch);
|
|
|
+ }
|
|
|
+ in.close();
|
|
|
+
|
|
|
+ configString = buffer.toString();
|
|
|
+
|
|
|
+ //edtShortCircuitInfo.setText(configString);
|
|
|
+
|
|
|
+ int i,j,k,l= 0;
|
|
|
+
|
|
|
+ String stringMaxVal,stringMinVal;
|
|
|
+
|
|
|
+ i = configString.indexOf("[Node threshold]");
|
|
|
+
|
|
|
+ j = configString.indexOf("Max=", i);
|
|
|
+
|
|
|
+ k = configString.indexOf("Min=", i);
|
|
|
+
|
|
|
+ l = configString.indexOf("[TEST]", i);
|
|
|
+
|
|
|
+ stringMaxVal = configString.substring(j + 4, k);
|
|
|
+ stringMinVal = configString.substring(k + 4, l);
|
|
|
+
|
|
|
+ //value = value.trim(); //去除空格
|
|
|
+ //configString = configString.replaceAll("0x", ""); //0x转换为没有
|
|
|
+ //editdetail.setText(configString.toString()); //buffer.toString())就是读出的内容字符
|
|
|
+
|
|
|
+ String[] stringMaxValArr = stringMaxVal.split(",");
|
|
|
+ String[] stringMinValArr = stringMinVal.split(",");
|
|
|
+
|
|
|
+ for (i = 0; i < stringMaxValArr.length - 1; i++){
|
|
|
+ iRawDataMaxVal[i] = Integer.parseInt(stringMaxValArr[i], 10);
|
|
|
+ iRawDataMinVal[i] = Integer.parseInt(stringMinValArr[i], 10);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ edt_TestiInformation.setText( Integer.toString(iRawDataMaxVal[0]) + "," +
|
|
|
+ Integer.toString(iRawDataMaxVal[1]) + "," +
|
|
|
+ Integer.toString(iRawDataMaxVal[2]) + "," +
|
|
|
+ Integer.toString(iRawDataMaxVal[3]) + "," +
|
|
|
+ Integer.toString(iRawDataMaxVal[4]) + "," +
|
|
|
+ Integer.toString(iRawDataMaxVal[stringMaxValArr.length - 3]) + "," +
|
|
|
+ Integer.toString(iRawDataMaxVal[stringMaxValArr.length - 2]) + ",\n" +
|
|
|
+ Integer.toString(iRawDataMinVal[0]) + "," +
|
|
|
+ Integer.toString(iRawDataMinVal[1]) + "," +
|
|
|
+ Integer.toString(iRawDataMinVal[2]) + "," +
|
|
|
+ Integer.toString(iRawDataMinVal[3]) + "," +
|
|
|
+ Integer.toString(iRawDataMinVal[4]) + "," +
|
|
|
+ Integer.toString(iRawDataMinVal[stringMaxValArr.length - 3]) + "," +
|
|
|
+ Integer.toString(iRawDataMinVal[stringMaxValArr.length - 2]) + ",\n" );
|
|
|
+ */
|
|
|
+ } catch (IOException c) {
|
|
|
+ edit_search.setText(uri.getPath() + "——" + getResources().getString(R.string.invalidfile));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } //end of else if (requestCode == 2)
|
|
|
+
|
|
|
+ } //end of if (resultCode == Activity.RESULT_OK)
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 打开设备 , 让车机和手机端连起来
|
|
|
*/
|
|
@@ -1220,6 +1413,7 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
|
|
|
switch (showFlag){
|
|
|
case 1: //rawdata
|
|
|
+ case 6: //test
|
|
|
if (!iicRead32Bits((byte)0x01, (byte)0xA6, (byte)0X7C, mRawdataBytes, ilength))
|
|
|
{
|
|
|
return false;
|
|
@@ -1285,6 +1479,8 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
tvMinimum = (TextView) findViewById(R.id.minimumshow);
|
|
|
tvDataContent = (TextView) findViewById(R.id.datacontentshow);
|
|
|
tvMAD = (TextView) findViewById(R.id.madshow);
|
|
|
+
|
|
|
+ edit_search = (TextView) findViewById(R.id.editsearch);
|
|
|
}
|
|
|
|
|
|
int count = 1000;
|
|
@@ -1309,29 +1505,22 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
{
|
|
|
btTestStep = 1; //
|
|
|
|
|
|
- if (byProductType == GT7)
|
|
|
- {
|
|
|
- GT7xxxShortTestProc();
|
|
|
- }else{
|
|
|
- //GT9xxxShortTestProc();
|
|
|
- GT29xxShortTestProc();
|
|
|
- }
|
|
|
+ //GT29xxShortTestProc();
|
|
|
|
|
|
- SystemClock.sleep(100);
|
|
|
+ //SystemClock.sleep(100);
|
|
|
|
|
|
//btTestStep = 2;
|
|
|
|
|
|
- //changeToDebugMode();
|
|
|
+ showFlag = 1; //先进入读原始值状态
|
|
|
|
|
|
- //stTestLogShow = "";
|
|
|
+ changeToDebugMode();
|
|
|
|
|
|
- //stTestLog = getResources().getString(R.string.startmaxmintest);
|
|
|
- //stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
+ showFlag = 6; //切回测试模式
|
|
|
|
|
|
- showFlag = 4;
|
|
|
- count = 1000;
|
|
|
- btTestStep = 0;
|
|
|
- SystemClock.sleep(10);
|
|
|
+ stTestLogShow = "";
|
|
|
+
|
|
|
+ stTestLog = getResources().getString(R.string.startmaxmintest);
|
|
|
+ stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
}
|
|
|
|
|
|
while(showFlag != 4) {
|
|
@@ -1411,7 +1600,102 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
SystemClock.sleep(10);
|
|
|
break;
|
|
|
case 6: //test
|
|
|
- mHandler.sendEmptyMessage(TEST_DATA_MESSAGE);
|
|
|
+ if (btTestStep == 1) {
|
|
|
+ mHandler.sendEmptyMessage(TEST_DATA_MESSAGE);
|
|
|
+ }
|
|
|
+ else if (btTestStep == 2)
|
|
|
+ {
|
|
|
+ changeToNormalMode();
|
|
|
+ SystemClock.sleep(20);
|
|
|
+
|
|
|
+ //send 0x00 to [0x10174],清除标志
|
|
|
+ mBytes[0] = 0x00;
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,1);
|
|
|
+ SystemClock.sleep(15);
|
|
|
+
|
|
|
+ //send 0x00 0x00 0x04 0x04 0x08 0x00 to [0x10174],通知GT29XX,send cfg
|
|
|
+ mBytes[0] = 0x00;
|
|
|
+ mBytes[1] = 0x00;
|
|
|
+ mBytes[2] = 0x04;
|
|
|
+ mBytes[3] = 0x04;
|
|
|
+ mBytes[4] = 0x08;
|
|
|
+ mBytes[5] = 0x00;
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
+
|
|
|
+ //30ms一次轮询[0x10174],如果是0x80,说明GT29XX已准备好,可以send cfg
|
|
|
+ do {
|
|
|
+ SystemClock.sleep(30);
|
|
|
+ iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1);
|
|
|
+ }while(mBytes[0] != (byte)0x80);
|
|
|
+
|
|
|
+ int iConfigSize = 64 + (int)(byConfigBak[60] & 0xFF) * 256 + (byConfigBak[59] & 0xFF); //the head lend is 64
|
|
|
+
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x3B, (byte)0x74, byConfigBak,0,iConfigSize);
|
|
|
+
|
|
|
+ //if (!recallCheck((byte)0x01, (byte)0x3B, (byte)0x74, mBytes, 0, iconfiglen + 64)) {
|
|
|
+ // stMessageLog = "Recall check config error!!";
|
|
|
+ // stMessageLogShow = stMessageLogShow.concat(stMessageLog);iConfigSize
|
|
|
+ //} else {
|
|
|
+ // stMessageLog = "Recall check config success!!";
|
|
|
+ // stMessageLogShow = stMessageLogShow.concat(stMessageLog);
|
|
|
+ //}
|
|
|
+
|
|
|
+ SystemClock.sleep(8);
|
|
|
+
|
|
|
+ //send 0x00 0x00 0x04 0x05 0x09 0x00 to [0x10174],通知GT29XX,cfg发送完毕
|
|
|
+ mBytes[0] = 0x00;
|
|
|
+ mBytes[1] = 0x00;
|
|
|
+ mBytes[2] = 0x04;
|
|
|
+ mBytes[3] = 0x05;
|
|
|
+ mBytes[4] = 0x09;
|
|
|
+ mBytes[5] = 0x00;
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
+
|
|
|
+ //30ms一次轮询[0x10174],如果是0x80,说明GT29XX已接收配置
|
|
|
+ do {
|
|
|
+ SystemClock.sleep(30);
|
|
|
+ iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1);
|
|
|
+ if (mBytes[0] == (byte)0x03)
|
|
|
+ {
|
|
|
+ //stMessageLog = "Config checksum is error!!";
|
|
|
+ //stMessageLogShow = stMessageLogShow.concat(stMessageLog);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ }while(mBytes[0] != (byte)0x80);
|
|
|
+
|
|
|
+ SystemClock.sleep(15);
|
|
|
+
|
|
|
+ //send 0x00 0x00 0x04 0x06 0x0A 0x00 to [0x10174],通知GT29XX,流程完成
|
|
|
+ mBytes[0] = 0x00;
|
|
|
+ mBytes[1] = 0x00;
|
|
|
+ mBytes[2] = 0x04;
|
|
|
+ mBytes[3] = 0x06;
|
|
|
+ mBytes[4] = 0x0A;
|
|
|
+ mBytes[5] = 0x00;
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
+
|
|
|
+ //30ms一次轮询[0x10174],如果是0x80,说明GT29XX已完成
|
|
|
+ do {
|
|
|
+ SystemClock.sleep(30);
|
|
|
+ iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1);
|
|
|
+ }while(mBytes[0] != (byte)0x80);
|
|
|
+
|
|
|
+ btTestStep = 3;
|
|
|
+
|
|
|
+ GT29xxShortTestProc();
|
|
|
+
|
|
|
+ SystemClock.sleep(100);
|
|
|
+
|
|
|
+ //btTestStep = 4;
|
|
|
+
|
|
|
+ showFlag = 4; //stop
|
|
|
+ count = 1000;
|
|
|
+ btTestStep = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
break;
|
|
|
case 8: //stylusdata
|
|
|
mHandler.sendEmptyMessage(STYLUS_DATA_MESSAGE);
|
|
@@ -1693,53 +1977,39 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
break;
|
|
|
|
|
|
case TEST_DATA_MESSAGE: //
|
|
|
- if (1 == btTestStep)
|
|
|
- {
|
|
|
- edt_TestiInformation.setText("");
|
|
|
- edtShortCircuitInfo.setText(Update_log);
|
|
|
- edtShortCircuitInfo.setSelection(edtShortCircuitInfo.getText().length());
|
|
|
-
|
|
|
- break;
|
|
|
- }else if (btTestStep == 2) {
|
|
|
-
|
|
|
- int imaxdataid = 65535;
|
|
|
- int imindataid = 65535;
|
|
|
-
|
|
|
- maxdata = 0;
|
|
|
- mindata = 65535;
|
|
|
- i = 0;
|
|
|
+ if (btTestStep == 1) {
|
|
|
|
|
|
textGridLayout.removeAllViews();
|
|
|
|
|
|
+ i = 0;
|
|
|
//控制行数
|
|
|
- for (int row = 0; row < rownum; row++) {
|
|
|
+ for (int row = 0; row < rownum; row++) { //sen
|
|
|
//控制列数
|
|
|
- for (int col = 0; col < colnum; col++) {
|
|
|
+ for (int col = 0; col < colnum; col++) { //drv
|
|
|
|
|
|
- idtemp = (row + col * rownum) * 2;
|
|
|
- if (byProductType == GT7) //GT7的低位在前
|
|
|
- {
|
|
|
- datatemp[i] = ((mRawdataBytes[idtemp + 1] & 0xFF) << 8) + (mRawdataBytes[idtemp] & 0xFF);
|
|
|
- } else {
|
|
|
- datatemp[i] = ((mRawdataBytes[idtemp] & 0xFF) << 8) + (mRawdataBytes[idtemp + 1] & 0xFF);
|
|
|
- }
|
|
|
+ int temp = col * rownum + row; //Rawdata存放和测试阈值存放,行列相反
|
|
|
|
|
|
//获取最大值
|
|
|
- if (datatemp[i] > maxdata) {
|
|
|
- maxdata = datatemp[i];
|
|
|
- imaxdataid = i;
|
|
|
-
|
|
|
+ if (datatemp[i] > iRawDataMaxVal[temp]) {
|
|
|
+ byOverMaxCount[i]++;
|
|
|
}
|
|
|
//获取最小值
|
|
|
- if (datatemp[i] < mindata) {
|
|
|
- mindata = datatemp[i];
|
|
|
- imindataid = i;
|
|
|
+ if (datatemp[i] < iRawDataMinVal[temp]) {
|
|
|
+ byLessMinCount[i]++;
|
|
|
}
|
|
|
|
|
|
- i++;
|
|
|
+ if (byOverMaxCount[i] > 1) {
|
|
|
+ bTestMaxResult = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (byLessMinCount[i] > 1) {
|
|
|
+ bTestMinResult = false;
|
|
|
+ }
|
|
|
|
|
|
+ i++;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/*
|
|
|
if (maxdata > iMaximum) //统计最大值大于阈值的次数
|
|
|
{
|
|
@@ -1752,10 +2022,10 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
- if (maxdata > mindata * 2) //统计最大值大于阈值的次数
|
|
|
- {
|
|
|
- byMaximumOverCount++;
|
|
|
- }
|
|
|
+ //if (maxdata > mindata * 2) //统计最大值大于阈值的次数
|
|
|
+ //{
|
|
|
+ // byMaximumOverCount++;
|
|
|
+ //}
|
|
|
|
|
|
byTestCount++;
|
|
|
stTestLog = getResources().getString(R.string.sampling) + Integer.toString(byTestCount) + getResources().getString(R.string.frame);
|
|
@@ -1775,32 +2045,9 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
stTestLogShow = stTestLogShow.concat("\n");
|
|
|
*/
|
|
|
- if (byMaximumOverCount >= 15) {
|
|
|
- bTestMaxResult = false;
|
|
|
- stTestLog = getResources().getString(R.string.maxoutrange);
|
|
|
- stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
- } else if (byMaximumOverCount < 2) {
|
|
|
- bTestMaxResult = true;
|
|
|
- //stTestLog = "最大值测试pass,";
|
|
|
- //stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
- } else {
|
|
|
- bTestMaxResult = false;
|
|
|
- stTestLog = getResources().getString(R.string.maxisrisk);
|
|
|
- stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
- }
|
|
|
-
|
|
|
+ if (bTestMaxResult == false || bTestMinResult == false) {
|
|
|
|
|
|
- if (byMinimumOverCount >= 15) {
|
|
|
- bTestMinResult = false;
|
|
|
- stTestLog = getResources().getString(R.string.minoutrange);
|
|
|
- stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
- } else if (byMinimumOverCount < 2) {
|
|
|
- bTestMinResult = true;
|
|
|
- //stTestLog = "最小值测试pass。";
|
|
|
- //stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
- } else {
|
|
|
- bTestMinResult = false;
|
|
|
- stTestLog = getResources().getString(R.string.minisrisk);
|
|
|
+ stTestLog = getResources().getString(R.string.maxoutrange);
|
|
|
stTestLogShow = stTestLogShow.concat(stTestLog);
|
|
|
}
|
|
|
|
|
@@ -1825,20 +2072,23 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
|
|
|
dv = Integer.toString(datatemp[i]);
|
|
|
|
|
|
- if ((bypDrvShortFlag[col - 1] == 0x55) || (bypSenShortFlag[row] == 0x55)) {
|
|
|
- textView.setTextColor(Color.parseColor("#FF0000")); //红色
|
|
|
- }
|
|
|
+ //if ((bypDrvShortFlag[col - 1] == 0x55) || (bypSenShortFlag[row] == 0x55)) {
|
|
|
+ // textView.setTextColor(Color.parseColor("#FF0000")); //红色
|
|
|
+ //}
|
|
|
|
|
|
if (bTestMaxResult == false) {
|
|
|
- if (imaxdataid == i) { //最大值
|
|
|
- textView.setTextColor(Color.parseColor("#FFFF00")); //黄色
|
|
|
- } else if (imindataid == i) { //最小值
|
|
|
- textView.setTextColor(Color.parseColor("#FFFF00")); //黄色
|
|
|
+ if (byOverMaxCount[i] > 1) { //最大值
|
|
|
+ textView.setTextColor(Color.parseColor("#FF0000")); //黄色
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ if (bTestMinResult == false) {
|
|
|
+ if (byLessMinCount[i] > 1) { //最大值
|
|
|
+ textView.setTextColor(Color.parseColor("#FFFF00")); //黄色
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- params.width = 42;
|
|
|
+ params.width = 50;
|
|
|
|
|
|
i++;
|
|
|
}
|
|
@@ -1850,19 +2100,41 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- showFlag = 5; //stop
|
|
|
- btTestStep = 0;
|
|
|
+ //showFlag = 5; //stop
|
|
|
+ btTestStep = 2;
|
|
|
btn_RawdataShow.setEnabled(true);
|
|
|
btn_DiffdataShow.setEnabled(true);
|
|
|
//btn_ReffdataShow.setEnabled(true);
|
|
|
//btn_ManualdiffdataShow.setEnabled(true);
|
|
|
- btn_Manualreff.setEnabled(false);
|
|
|
+ //btn_Manualreff.setEnabled(false);
|
|
|
//btn_StylusDataShow.setEnabled(true);
|
|
|
btn_Test.setEnabled(true);
|
|
|
}
|
|
|
+ edtShortCircuitInfo.setText("");
|
|
|
edt_TestiInformation.setText(stTestLogShow + stTestLog);
|
|
|
edt_TestiInformation.setSelection(edt_TestiInformation.getText().length());
|
|
|
}
|
|
|
+ else if (3 == btTestStep) {
|
|
|
+ //edt_TestiInformation.setText("");
|
|
|
+ edtShortCircuitInfo.setText(Update_log);
|
|
|
+ edtShortCircuitInfo.setSelection(edtShortCircuitInfo.getText().length());
|
|
|
+
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ else if (btTestStep == 4){
|
|
|
+ showFlag = 4; //stop
|
|
|
+ count = 1000;
|
|
|
+ btTestStep = 0;
|
|
|
+
|
|
|
+ btn_RawdataShow.setEnabled(true);
|
|
|
+ btn_DiffdataShow.setEnabled(true);
|
|
|
+ //btn_ReffdataShow.setEnabled(true);
|
|
|
+ //btn_ManualdiffdataShow.setEnabled(true);
|
|
|
+ //btn_Manualreff.setEnabled(false);
|
|
|
+ //btn_StylusDataShow.setEnabled(true);
|
|
|
+ btn_Test.setEnabled(true);
|
|
|
+ }
|
|
|
+ */
|
|
|
break;
|
|
|
|
|
|
case STYLUS_DATA_MESSAGE:
|
|
@@ -3720,141 +3992,147 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
int checksum2;
|
|
|
byte addressH;
|
|
|
byte addressL;
|
|
|
+ int iConfigSize = 0;
|
|
|
|
|
|
- if ((edt_ColNum.getText().length() == 0) || (edt_RowNum.getText().length() == 0)){
|
|
|
|
|
|
- if (byProductType == GT7)
|
|
|
- {
|
|
|
- addressH = (byte)0x80;
|
|
|
- addressL = (byte)0x50;
|
|
|
-
|
|
|
- iicRead(addressH,addressL,mBytes,444);
|
|
|
-
|
|
|
- checksum = 0;
|
|
|
- checksum2 = 0;
|
|
|
- for (int i = 0; i < 444; i++) {
|
|
|
- int k = mBytes[i] & 0xFF;
|
|
|
- if (i < 213)
|
|
|
- {
|
|
|
- checksum = checksum + k;
|
|
|
- }
|
|
|
- else {
|
|
|
- checksum2 = checksum2 + k;
|
|
|
- }
|
|
|
- }
|
|
|
- if((checksum % 256 == 0) && (checksum2 % 256 == 0)) //校验和正确
|
|
|
- {
|
|
|
- colnum = (mBytes[381] & 0xFF) + (mBytes[383] & 0xFF); //DRV
|
|
|
- rownum = (mBytes[380] & 0xFF) + (mBytes[382] & 0xFF); //SEN
|
|
|
|
|
|
- edt_ColNum.setText(Integer.toString(colnum));
|
|
|
- edt_RowNum.setText(Integer.toString(rownum));
|
|
|
+ if (byProductType == GT7)
|
|
|
+ {
|
|
|
+ addressH = (byte)0x80;
|
|
|
+ addressL = (byte)0x50;
|
|
|
|
|
|
- for (int i = 0; i < 44; i++) {
|
|
|
- bypCfgDrv[i] = mBytes[289 + i];
|
|
|
- }
|
|
|
+ iicRead(addressH,addressL,mBytes,444);
|
|
|
|
|
|
- for (int i = 0; i < 72; i++) {
|
|
|
- bypCfgSen[i] = mBytes[215 + i];
|
|
|
- }
|
|
|
+ checksum = 0;
|
|
|
+ checksum2 = 0;
|
|
|
+ for (int i = 0; i < 444; i++) {
|
|
|
+ int k = mBytes[i] & 0xFF;
|
|
|
+ if (i < 213)
|
|
|
+ {
|
|
|
+ checksum = checksum + k;
|
|
|
}
|
|
|
else {
|
|
|
- Toast.makeText(this, getResources().getString(R.string.cfgerror), Toast.LENGTH_SHORT).show();
|
|
|
- return;
|
|
|
+ checksum2 = checksum2 + k;
|
|
|
}
|
|
|
- }else{
|
|
|
+ }
|
|
|
+ if((checksum % 256 == 0) && (checksum2 % 256 == 0)) //校验和正确
|
|
|
+ {
|
|
|
+ colnum = (mBytes[381] & 0xFF) + (mBytes[383] & 0xFF); //DRV
|
|
|
+ rownum = (mBytes[380] & 0xFF) + (mBytes[382] & 0xFF); //SEN
|
|
|
|
|
|
- //send 0x00 0x00 0x04 0x07 0x0B 0x00 to [0x10174],通知GT29XX,要读cfg
|
|
|
- mBytes[0] = 0x00;
|
|
|
- mBytes[1] = 0x00;
|
|
|
- mBytes[2] = 0x04;
|
|
|
- mBytes[3] = 0x07;
|
|
|
- mBytes[4] = 0x0B;
|
|
|
- mBytes[5] = 0x00;
|
|
|
- iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
+ for (int i = 0; i < 44; i++) {
|
|
|
+ bypCfgDrv[i] = mBytes[289 + i];
|
|
|
+ }
|
|
|
|
|
|
+ for (int i = 0; i < 72; i++) {
|
|
|
+ bypCfgSen[i] = mBytes[215 + i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Toast.makeText(this, getResources().getString(R.string.cfgerror), Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
|
|
|
- //read [0x10175] = 0x80,config is ready
|
|
|
- //do {
|
|
|
- // SystemClock.sleep(30);
|
|
|
- // iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x75, mBytes, 1);
|
|
|
- //}while(mBytes[0] != (byte)0x80);
|
|
|
+ //send 0x00 0x00 0x04 0x07 0x0B 0x00 to [0x10174],通知GT29XX,要读cfg
|
|
|
+ mBytes[0] = 0x00;
|
|
|
+ mBytes[1] = 0x00;
|
|
|
+ mBytes[2] = 0x04;
|
|
|
+ mBytes[3] = 0x07;
|
|
|
+ mBytes[4] = 0x0B;
|
|
|
+ mBytes[5] = 0x00;
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
|
|
|
- //read [0x10174] = 0x80,config is ready
|
|
|
- do {
|
|
|
- SystemClock.sleep(30);
|
|
|
- iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1);
|
|
|
- }while(mBytes[0] != (byte)0x80);
|
|
|
|
|
|
- //SystemClock.sleep(2);
|
|
|
+ //read [0x10175] = 0x80,config is ready
|
|
|
+ //do {
|
|
|
+ // SystemClock.sleep(30);
|
|
|
+ // iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x75, mBytes, 1);
|
|
|
+ //}while(mBytes[0] != (byte)0x80);
|
|
|
|
|
|
- //read buffer [0x13B74]
|
|
|
- iicRead32Bits((byte)0x01, (byte)0x3B, (byte)0x74, mBytes, 63); //read config head
|
|
|
+ //read [0x10174] = 0x80,config is ready
|
|
|
+ do {
|
|
|
+ SystemClock.sleep(30);
|
|
|
+ iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1);
|
|
|
+ }while(mBytes[0] != (byte)0x80);
|
|
|
|
|
|
- int iConfigSize = 64 + (int)(mBytes[60] & 0xFF) * 256 + (mBytes[59] & 0xFF); //the head lend is 64
|
|
|
+ //SystemClock.sleep(2);
|
|
|
|
|
|
- iicRead32Bits((byte)0x01, (byte)0x3B, (byte)0x74, mBytes, iConfigSize); //read config
|
|
|
+ //read buffer [0x13B74]
|
|
|
+ iicRead32Bits((byte)0x01, (byte)0x3B, (byte)0x74, mBytes, 63); //read config head
|
|
|
|
|
|
- SystemClock.sleep(5);
|
|
|
+ iConfigSize = 64 + (int)(mBytes[60] & 0xFF) * 256 + (mBytes[59] & 0xFF); //the head lend is 64
|
|
|
|
|
|
- for (int i = 0; i < 52; i++) {
|
|
|
- bypCfgDrv[i] = mBytes[69 + i];
|
|
|
- }
|
|
|
+ iicRead32Bits((byte)0x01, (byte)0x3B, (byte)0x74, mBytes, iConfigSize); //read config
|
|
|
|
|
|
- for (int i = 0; i < 75; i++) {
|
|
|
- bypCfgSen[i] = mBytes[121 + i];
|
|
|
- }
|
|
|
+ SystemClock.sleep(5);
|
|
|
|
|
|
- colnum = (mBytes[67] & 0xFF) ;
|
|
|
- rownum = (mBytes[68] & 0xFF) ;
|
|
|
+ for (int i = 0; i < 52; i++) {
|
|
|
+ bypCfgDrv[i] = mBytes[69 + i];
|
|
|
+ }
|
|
|
|
|
|
- //send 0x00 0x00 0x04 0x08 0x0C 0x00 to [0x10174],通知GT29XX,通信结束
|
|
|
- mBytes[0] = 0x00;
|
|
|
- mBytes[1] = 0x00;
|
|
|
- mBytes[2] = 0x04;
|
|
|
- mBytes[3] = 0x08;
|
|
|
- mBytes[4] = 0x0C;
|
|
|
- mBytes[5] = 0x00;
|
|
|
- iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 0, 6);
|
|
|
+ for (int i = 0; i < 75; i++) {
|
|
|
+ bypCfgSen[i] = mBytes[121 + i];
|
|
|
+ }
|
|
|
|
|
|
- //read [0x10175] = 0x80,config is ready
|
|
|
- //do {
|
|
|
- // SystemClock.sleep(30);
|
|
|
- // iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x75, mBytes, 1);
|
|
|
- //}while(mBytes[0] != (byte)0x80);
|
|
|
+ //备份配置
|
|
|
+ for (int i = 0; i < iConfigSize; i++) {
|
|
|
+ byConfigBak[i] = mBytes[i];
|
|
|
+ }
|
|
|
|
|
|
- //read [0x10175] = 0x80,read config is over
|
|
|
- do {
|
|
|
- SystemClock.sleep(30);
|
|
|
- iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1);
|
|
|
- }while(mBytes[0] != (byte)0x80);
|
|
|
+ colnum = (mBytes[67] & 0xFF) ;
|
|
|
+ rownum = (mBytes[68] & 0xFF) ;
|
|
|
|
|
|
- edt_ColNum.setText(Integer.toString(colnum));
|
|
|
- edt_RowNum.setText(Integer.toString(rownum));
|
|
|
+ //send 0x00 0x00 0x04 0x08 0x0C 0x00 to [0x10174],通知GT29XX,通信结束
|
|
|
+ mBytes[0] = 0x00;
|
|
|
+ mBytes[1] = 0x00;
|
|
|
+ mBytes[2] = 0x04;
|
|
|
+ mBytes[3] = 0x08;
|
|
|
+ mBytes[4] = 0x0C;
|
|
|
+ mBytes[5] = 0x00;
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 0, 6);
|
|
|
|
|
|
- /*
|
|
|
- if(checksum % 256 == 0) //校验和正确
|
|
|
- {
|
|
|
- colnum = (mBytes[27] & 0x1F) + (mBytes[28] & 0x1F);
|
|
|
- rownum = (mBytes[29] & 0x0F) + ((mBytes[29] & 0xFF) >> 4);
|
|
|
+ //read [0x10175] = 0x80,config is ready
|
|
|
+ //do {
|
|
|
+ // SystemClock.sleep(30);
|
|
|
+ // iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x75, mBytes, 1);
|
|
|
+ //}while(mBytes[0] != (byte)0x80);
|
|
|
|
|
|
- edt_ColNum.setText(Integer.toString(colnum));
|
|
|
- edt_RowNum.setText(Integer.toString(rownum));
|
|
|
+ //read [0x10175] = 0x80,read config is over
|
|
|
+ do {
|
|
|
+ SystemClock.sleep(30);
|
|
|
+ iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1);
|
|
|
+ }while(mBytes[0] != (byte)0x80);
|
|
|
|
|
|
- for (int i = 0; i < 42; i++) {
|
|
|
- bypCfgDrv[i] = mBytes[142 + i];
|
|
|
- }
|
|
|
|
|
|
- for (int i = 0; i < 30; i++) {
|
|
|
- bypCfgSen[i] = mBytes[112 + i];
|
|
|
- }
|
|
|
+
|
|
|
+ /*
|
|
|
+ if(checksum % 256 == 0) //校验和正确
|
|
|
+ {
|
|
|
+ colnum = (mBytes[27] & 0x1F) + (mBytes[28] & 0x1F);
|
|
|
+ rownum = (mBytes[29] & 0x0F) + ((mBytes[29] & 0xFF) >> 4);
|
|
|
+
|
|
|
+ edt_ColNum.setText(Integer.toString(colnum));
|
|
|
+ edt_RowNum.setText(Integer.toString(rownum));
|
|
|
+
|
|
|
+ for (int i = 0; i < 42; i++) {
|
|
|
+ bypCfgDrv[i] = mBytes[142 + i];
|
|
|
}
|
|
|
- else {
|
|
|
- Toast.makeText(this, getResources().getString(R.string.cfgerror), Toast.LENGTH_SHORT).show();
|
|
|
- return;
|
|
|
+
|
|
|
+ for (int i = 0; i < 30; i++) {
|
|
|
+ bypCfgSen[i] = mBytes[112 + i];
|
|
|
}
|
|
|
- */
|
|
|
}
|
|
|
+ else {
|
|
|
+ Toast.makeText(this, getResources().getString(R.string.cfgerror), Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ */
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((edt_ColNum.getText().length() == 0) || (edt_RowNum.getText().length() == 0)){
|
|
|
+ edt_ColNum.setText(Integer.toString(colnum));
|
|
|
+ edt_RowNum.setText(Integer.toString(rownum));
|
|
|
|
|
|
}else{
|
|
|
colnum = (byte) Integer.parseInt(edt_ColNum.getText().toString(),10);
|
|
@@ -4025,6 +4303,118 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
break;
|
|
|
|
|
|
case R.id.testting: //start test
|
|
|
+
|
|
|
+ if (edit_search.getText().length() == 0){
|
|
|
+ Toast.makeText(this, getResources().getString(R.string.nameandformat), Toast.LENGTH_SHORT).show();
|
|
|
+
|
|
|
+ edt_ColNum.setText("");
|
|
|
+ edt_RowNum.setText("");
|
|
|
+
|
|
|
+ btn_RawdataShow.setEnabled(true);
|
|
|
+ btn_DiffdataShow.setEnabled(true);
|
|
|
+ //btn_ReffdataShow.setEnabled(true);
|
|
|
+ //btn_ManualdiffdataShow.setEnabled(true);
|
|
|
+ //btn_Manualreff.setEnabled(false);
|
|
|
+ //btn_StylusDataShow.setEnabled(true);
|
|
|
+ btn_Test.setEnabled(true);
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ //send 0x00 to [0x10174],清除标志
|
|
|
+ mBytes[0] = 0x00;
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,1);
|
|
|
+ SystemClock.sleep(15);
|
|
|
+
|
|
|
+ //send 0x00 0x00 0x04 0x04 0x08 0x00 to [0x10174],通知GT29XX,send cfg
|
|
|
+ mBytes[0] = 0x00;
|
|
|
+ mBytes[1] = 0x00;
|
|
|
+ mBytes[2] = 0x04;
|
|
|
+ mBytes[3] = 0x04;
|
|
|
+ mBytes[4] = 0x08;
|
|
|
+ mBytes[5] = 0x00;
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
+
|
|
|
+ //30ms一次轮询[0x10174],如果是0x80,说明GT29XX已准备好,可以send cfg
|
|
|
+ do {
|
|
|
+ SystemClock.sleep(30);
|
|
|
+ iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1);
|
|
|
+ }while(mBytes[0] != (byte)0x80);
|
|
|
+
|
|
|
+ //配置
|
|
|
+ for (int i = 0; i < iConfigSize; i++) {
|
|
|
+ mBytes[i] = byConfigBak[i];
|
|
|
+ }
|
|
|
+
|
|
|
+ mBytes[287] = (byte)((mBytes[287] & 0xFF) - 4); // disable hopping [287],0x04
|
|
|
+ mBytes[1118] = (byte)((mBytes[1118] & 0xFF) - 3); // disable normalize [1118],0x03
|
|
|
+
|
|
|
+ //配置长度(不含head buffer长度)
|
|
|
+ int iconfiglen = (int)(mBytes[60] & 0xFF) * 256 + (mBytes[59] & 0xFF);
|
|
|
+
|
|
|
+ //计算配置的checksum,不含64字节的head buffer
|
|
|
+ long lchecksum = 0;
|
|
|
+ for (int i = 64; i < (iconfiglen + 64 - 4); i += 2) {
|
|
|
+ int vb = ((mBytes[i + 1] & 0xFF) << 8) + (mBytes[i] & 0xFF);
|
|
|
+ lchecksum = lchecksum + vb;
|
|
|
+ }
|
|
|
+
|
|
|
+ mBytes[iconfiglen + 64 - 4] = (byte)(lchecksum & 0x000000ff);
|
|
|
+ mBytes[iconfiglen + 64 - 3] = (byte)((lchecksum & 0x0000ff00) >> 8);
|
|
|
+ mBytes[iconfiglen + 64 - 2] = (byte)((lchecksum & 0x00ff0000) >> 16);
|
|
|
+ mBytes[iconfiglen + 64 - 1] = (byte)((lchecksum & 0xff000000) >> 24);
|
|
|
+
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x3B, (byte)0x74, mBytes,0,iconfiglen + 64);
|
|
|
+
|
|
|
+ //if (!recallCheck((byte)0x01, (byte)0x3B, (byte)0x74, mBytes, 0, iconfiglen + 64)) {
|
|
|
+ // stMessageLog = "Recall check config error!!";
|
|
|
+ // stMessageLogShow = stMessageLogShow.concat(stMessageLog);
|
|
|
+ //} else {
|
|
|
+ // stMessageLog = "Recall check config success!!";
|
|
|
+ // stMessageLogShow = stMessageLogShow.concat(stMessageLog);
|
|
|
+ //}
|
|
|
+
|
|
|
+ SystemClock.sleep(8);
|
|
|
+
|
|
|
+ //send 0x00 0x00 0x04 0x05 0x09 0x00 to [0x10174],通知GT29XX,cfg发送完毕
|
|
|
+ mBytes[0] = 0x00;
|
|
|
+ mBytes[1] = 0x00;
|
|
|
+ mBytes[2] = 0x04;
|
|
|
+ mBytes[3] = 0x05;
|
|
|
+ mBytes[4] = 0x09;
|
|
|
+ mBytes[5] = 0x00;
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
+
|
|
|
+ //30ms一次轮询[0x10174],如果是0x80,说明GT29XX已接收配置
|
|
|
+ do {
|
|
|
+ SystemClock.sleep(30);
|
|
|
+ iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1);
|
|
|
+ if (mBytes[0] == (byte)0x03)
|
|
|
+ {
|
|
|
+ //stMessageLog = "Config checksum is error!!";
|
|
|
+ //stMessageLogShow = stMessageLogShow.concat(stMessageLog);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ }while(mBytes[0] != (byte)0x80);
|
|
|
+
|
|
|
+ SystemClock.sleep(15);
|
|
|
+
|
|
|
+ //send 0x00 0x00 0x04 0x06 0x0A 0x00 to [0x10174],通知GT29XX,流程完成
|
|
|
+ mBytes[0] = 0x00;
|
|
|
+ mBytes[1] = 0x00;
|
|
|
+ mBytes[2] = 0x04;
|
|
|
+ mBytes[3] = 0x06;
|
|
|
+ mBytes[4] = 0x0A;
|
|
|
+ mBytes[5] = 0x00;
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
+
|
|
|
+ //30ms一次轮询[0x10174],如果是0x80,说明GT29XX已完成
|
|
|
+ do {
|
|
|
+ SystemClock.sleep(30);
|
|
|
+ iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1);
|
|
|
+ }while(mBytes[0] != (byte)0x80);
|
|
|
+
|
|
|
/*
|
|
|
if (edt_Maximum.getText().length() == 0)
|
|
|
{
|
|
@@ -4077,6 +4467,15 @@ public class DataAnalysis extends AppCompatActivity
|
|
|
showRawdata();
|
|
|
}
|
|
|
*/
|
|
|
+ for (int i = 0; i < 52 * 75; i++) {
|
|
|
+ byOverMaxCount[i] = 0;
|
|
|
+ byLessMinCount[i] = 0;
|
|
|
+ byOverAdjCount[i] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ bTestMaxResult = true;
|
|
|
+ bTestMinResult = true;
|
|
|
+
|
|
|
showFlag = 6;
|
|
|
byTestCount = 0;
|
|
|
byMaximumOverCount = 0;
|