| 
					
				 | 
			
			
				@@ -89,9 +89,9 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static final byte GT7 = 0x02; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Button mReadCfg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Button mSendCfg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private byte[] mBytes = new byte[1024]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private byte[] mSendData = new byte[1024]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private String[] mConfigShow = new String[512]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private byte[] mBytes = new byte[2048]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private byte[] mSendData = new byte[2048]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private String[] mConfigShow = new String[2048]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Context mAlertContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -116,6 +116,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Context mSaveCfgContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private TextView mShow; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private EditText edtConfigDataShow; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private TextView tvVenderID; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //View Sample 定义 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -309,7 +310,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private EditText mCfg8200,mCfg8201,mCfg8202,mCfg8203,mCfg8204,mCfg8205,mCfg8206,mCfg8207; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private EditText mCfg8208,mCfg8209,mCfg820A,mCfg820B; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private ViewPager vpagerCfg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //private ViewPager vpagerCfg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ImageView img_cursor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private TextView tvSample; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private TextView tvModuleSwitch; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -485,6 +486,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mReadCfg = (Button) findViewById(R.id.readcfg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mSendCfg = (Button) findViewById(R.id.sendcfg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mShow = (TextView) findViewById(R.id.show); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        edtConfigDataShow = (EditText) findViewById(R.id.configdata); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         edit_search = (TextView) findViewById(R.id.editsearch); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         edit_text = (EditText) findViewById(R.id.editsearch); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -530,7 +532,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private void initViewPager() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        vpagerCfg = (ViewPager) findViewById(R.id.vpagercfg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //vpagerCfg = (ViewPager) findViewById(R.id.vpagercfg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tvSample = (TextView) findViewById(R.id.tvsample); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tvModuleSwitch = (TextView) findViewById(R.id.tvmoduleswitch); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -592,8 +594,8 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         listViews.add(viewkeysetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         listViews.add(viewhoppingsetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         listViews.add(viewcfgram); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        vpagerCfg.setAdapter(new MyPagerAdapter(listViews)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        vpagerCfg.setCurrentItem(0);          //设置ViewPager当前页,从0开始算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //vpagerCfg.setAdapter(new MyPagerAdapter(listViews)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //vpagerCfg.setCurrentItem(0);          //设置ViewPager当前页,从0开始算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tvSample.setOnClickListener(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tvModuleSwitch.setOnClickListener(this); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -605,7 +607,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tvHoppingSetting.setOnClickListener(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tvCfgRam.setOnClickListener(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        vpagerCfg.addOnPageChangeListener(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //vpagerCfg.addOnPageChangeListener(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //===============================各view中的元素初始化开始===============================================// 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1826,7 +1828,8 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 loadFile(uri.getPath().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            edtConfigDataShow.setText(configString); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //value = value.trim();  //去除空格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             configString = configString.replaceAll("0x", ""); //0x转换为没有 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //editdetail.setText(configString.toString()); //buffer.toString())就是读出的内容字符 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1856,6 +1859,8 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ReadCfgRam(stringCfgArr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }  //end of if (resultCode == Activity.RESULT_OK) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3204,8 +3209,12 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int checksum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int checksum2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int ichecksumhead; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        long lchecksum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mShow.setText(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         switch (v.getId()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case R.id.tvsample: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 vpagerCfg.setCurrentItem(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 iChooseVPager = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3242,6 +3251,8 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 vpagerCfg.setCurrentItem(8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 iChooseVPager = 8; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case R.id.btnsensorrev: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 configBuilder.append(edtSensorCH0.getText().toString()+","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 configBuilder.append(edtSensorCH1.getText().toString()+","); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3994,136 +4005,137 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //mShow.setText(configBuilder.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                value = configBuilder.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //value = mMessage.getText().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //value = configBuilder.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                value = edtConfigDataShow.getText().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                value = value.replaceAll("0x", ""); //0x转换为没有 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 stringArr = value.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                value = value.replace(',', ' '); //逗号转换为空格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //value = value.replace(',', ' '); //逗号转换为空格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                value = value.trim();  //去除空格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                value = value.replaceAll(" ", ""); //逗号转换为空格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //value = value.trim();  //去除空格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //value = value.replaceAll(" ", ""); //逗号转换为空格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //char mTextData[] = value.toCharArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                byte[] mBufferData = new byte[1024]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                byte[] mBufferData = new byte[2048]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for (int b = 0; b < stringArr.length; b++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     byte aByte = (byte) Integer.parseInt(stringArr[b], 16); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     mBufferData[b] = aByte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //mBufferData = value.getBytes(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                mSendData = new byte[1024]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                mSendData = new byte[2048]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //重新计算checksum 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (byProductType == GT7) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //判断固件是否进入等待配置状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    mBytes[0] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addressH = (byte)0x80; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addressL = (byte)0x40; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    iicRead(addressH,addressL,mBytes,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (mBytes[0] != (byte)0x82) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //head buffer长度为64字节,最后两个字节是checksum,低位在前存放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ichecksumhead = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for (int i = 0; i < 2; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (int i = 0; i < 62; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         int vb = mBufferData[i] & 0xFF; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         ichecksumhead = ichecksumhead + vb; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    mBufferData[2] = (byte) (256 - ichecksumhead % 256); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    checksum = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    checksum2 = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for (int i = 0; i < 443; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        int vb = mBufferData[i] & 0xFF; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    mBufferData[62] = (byte)(ichecksumhead & 0x00ff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    mBufferData[63] = (byte)((ichecksumhead & 0xff00) >> 8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (i < 212) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            checksum = checksum + vb; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        else if (i > 212){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            checksum2 = checksum2 + vb; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //配置长度(不含head buffer长度) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    int iconfiglen = (int)(mBufferData[60] & 0xFF) * 256 + (mBufferData[59] & 0xFF); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //将checksum填入配置中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //if (checksum % 256 == 0)  //校验和正确 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mBufferData[212] = (byte) (256 - checksum % 256); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mBufferData[443] = (byte) (256 - checksum2 % 256); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        // mShow.setText("Cfg Checksum  re-calculation!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //计算配置的checksum,不含64字节的head buffer 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lchecksum = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (int i = 64; i < (iconfiglen + 64 - 4); i += 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        int vb = ((mBufferData[i + 1] & 0xFF) << 8) + (mBufferData[i] & 0xFF); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        lchecksum = lchecksum + vb; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //mSendData = mBufferData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //mHandler.sendEmptyMessage(DEBUG_MESSAGE_SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //扩展命令  0x03,0x01,0x0f,-128,0x47,0x00,0x39, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addressH = (byte)0x80; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addressL = (byte)0x50; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    iicWrite(addressH,addressL,mBufferData,0,444); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (!recallCheck(addressH, addressL,mBufferData,0,444)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mShow.setText("Recall check error,Send cfg failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        // return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mShow.setText("Recall check success,Send cfg success"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (iChooseVPager == 8) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mCfg8052.setText(Integer.toHexString(mBufferData[2] & 0xff)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mCfg8124.setText(Integer.toHexString(mBufferData[212] & 0xff)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mCfg820B.setText(Integer.toHexString(mBufferData[443] & 0xff)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //主控下发完配置后写完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    value = "83 00 7D"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    stringArr = value.split(" "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addressH = (byte)0x80; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addressL = (byte)0x40; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for (int i = 0; i < stringArr.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        byte aByte = (byte) Integer.parseInt(stringArr[i], 16); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mBufferData[i] = aByte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    iicWrite(addressH,addressL,mBufferData,0,3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else {  //GT9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    checksum = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for (int i = 0; i < 184; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        int vb = mBufferData[i] & 0xFF; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        checksum = checksum + vb; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    mBufferData[iconfiglen + 64 - 4] = (byte)(lchecksum & 0x000000ff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    mBufferData[iconfiglen + 64 - 3] = (byte)((lchecksum & 0x0000ff00) >> 8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    mBufferData[iconfiglen + 64 - 2] = (byte)((lchecksum & 0x00ff0000) >> 16); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    mBufferData[iconfiglen + 64 - 1] = (byte)((lchecksum & 0xff000000) >> 24); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicWrite32Bits((byte)0x01, (byte)0x3B, (byte)0x74, mBufferData,0,iconfiglen + 64); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    mShow.setText("Send cfg success!!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //将checksum填入配置中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //if (checksum % 256 == 0)  //校验和正确 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mBufferData[184] = (byte) (256 - checksum % 256); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //mBufferData[184] = (byte) (256 - checksum % 256); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         // mShow.setText("Cfg Checksum  re-calculation!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //更新配置标志位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    mBufferData[185] = 0x01; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //mBufferData[185] = 0x01; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //mSendData = mBufferData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //mHandler.sendEmptyMessage(DEBUG_MESSAGE_SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //扩展命令  0x03,0x01,0x0f,-128,0x47,0x00,0x39, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addressH = (byte) 0x80; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addressL = (byte) 0x47; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    iicWrite(addressH, addressL, mBufferData, 0, 186); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (!recallCheck(addressH, addressL, mBufferData, 0, 185)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mShow.setText("Recall check error,Send cfg failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //addressH = (byte) 0x80; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //addressL = (byte) 0x47; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //iicWrite(addressH, addressL, mBufferData, 0, 186); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //if (!recallCheck(addressH, addressL, mBufferData, 0, 185)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //    mShow.setText("Recall check error,Send cfg failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         // return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mShow.setText("Recall check success,Send cfg success"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //    mShow.setText("Recall check success,Send cfg success"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //if (iChooseVPager == 8) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //    mCfg80FF.setText(Integer.toHexString(mBufferData[184] & 0xff)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (iChooseVPager == 8) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mCfg80FF.setText(Integer.toHexString(mBufferData[184] & 0xff)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case R.id.readcfg:  //read cfg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 bottonMode = 2; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4134,6 +4146,89 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (byProductType == GT9) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //read [0x10174] = 0x80 or 0x01,表示上条命令已执行完毕,或当前固件处于空闲状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        SystemClock.sleep(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }while((mBytes[0] != 0x80) && (mBytes[0] != 0x01)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //send 0x00 0x00 0x04 0x07 0x0B 0x00 to [0x10174],通知GT79XX,要读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 [0x10175] = 0x80,config is ready 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //    SystemClock.sleep(30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x75, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //}while(mBytes[0] != (byte)0x80); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        SystemClock.sleep(30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }while(mBytes[0] != (byte)0x80); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //SystemClock.sleep(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //read buffer [0x13B74] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicRead32Bits((byte)0x01, (byte)0x3B, (byte)0x74, mBytes, 63);  //read config head 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    int iConfigSize = 64 + (int)(mBytes[60] & 0xFF) * 256 + (mBytes[59] & 0xFF);   //the head lend is 64 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicRead32Bits((byte)0x01, (byte)0x3B, (byte)0x74, mBytes, iConfigSize);  //read config 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (int i = 0; i < iConfigSize; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        int k = mBytes[i] & 0xFF; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        checksum =checksum+ k; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String hv = Integer.toHexString(k); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (hv.length() < 2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            hv = "0" + hv; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        mConfigShow[i] = hv; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        stringBuilder.append("0x" + hv); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        stringBuilder.append(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ReadCfgRam(mConfigShow); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    edtConfigDataShow.setText(stringBuilder.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    SystemClock.sleep(5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //send 0x00 0x00 0x04 0x08 0x0C 0x00 to [0x10174],通知GT79XX,通信结束 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //read [0x10175] = 0x80,config is ready 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //    SystemClock.sleep(30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //    iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x75, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //}while(mBytes[0] != (byte)0x80); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        SystemClock.sleep(30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        iicRead32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }while(mBytes[0] != (byte)0x80); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //SystemClock.sleep(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    iicRead32Bits((byte)0x01, (byte)0x00, (byte)0x2B, mBytes, 4);  //read Sensor ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tvVenderID.setText("VenderID:"+Integer.toString(mBytes[0] & 0xFF)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     addressH = (byte)0x80; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     addressL = (byte)0x47; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     iicRead(addressH,addressL,mBytes,186); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4166,6 +4261,8 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ReadCfgPlamRestrain(mBytes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ReadCfgKeySetting(mBytes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ReadCfgHoppingSetting(mBytes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }else{  //GT7 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     addressH = (byte)0x80; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     addressL = (byte)0x50; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4199,16 +4296,16 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                ReadCfgRam(mConfigShow); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //ReadCfgRam(mConfigShow); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                addressH = (byte)0x81; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (byProductType == GT7) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addressH = (byte)0x82; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                addressL = (byte)0x40; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                iicRead(addressH,addressL,mBytes,32); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                tvVenderID.setText("VenderID:"+Integer.toString(mBytes[10] & 0xFF)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //addressH = (byte)0x81; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //if (byProductType == GT7) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //    addressH = (byte)0x82; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //addressL = (byte)0x40; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //iicRead(addressH,addressL,mBytes,32); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //tvVenderID.setText("VenderID:"+Integer.toString(mBytes[10] & 0xFF)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case R.id.savecfg: 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4426,7 +4523,7 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointIn, wBuffer, offset, 0x40, 3000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (i != 0x40) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                editname.setText("iicWrite Failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                editname.setText("IIC Read Failed!!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4451,6 +4548,90 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //发送命令,使得S8xx可以通过IIC向GT79xx的固定地址读取任意bytes的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private boolean iicRead32Bits(byte addrfirstbyte,byte addrsecondbyte,byte addrthirdbyte,byte[] wBuffer,int length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicByteData[1] = 0x0f; //7bit:0-read,1-write;other:command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //iicByteData[2] = 0x0f; //no command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicByteData[2] = addrfirstbyte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicByteData[3] = addrsecondbyte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicByteData[4] = addrthirdbyte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicByteData[5] = 0x00; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicByteData[6] = 63;  //length 一次接收63个数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int j = 7; j < 64; j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            iicByteData[j] = 0x00; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int address1 = ((addrsecondbyte & 0xff) << 8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int address2 = addrthirdbyte & 0xff; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int address = address1 | address2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int sendTimes = length/63;  //预计是向下取整,所以+1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ((length % 63) != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sendTimes += 1;   //预计是向下取整,所以+1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //iicByteData[5] = (byte)(length>>8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //iicByteData[6] = (byte)length;  //length 一次接收63个数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int k = 0; k < sendTimes; k++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int finalOffset = k*63; //每次只能发57bytes数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int offset = k * 64; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              if(length - (finalOffset ) < 63) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             iicByteData[6] = (byte) (length - (finalOffset));  //length 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              iicByteData[6] = 63; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //发送读取命令 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointOut, iicByteData, 0, 0x40, 100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (i != 0x40) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false;  //传输失败 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // SystemClock.sleep(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //接收数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointIn, wBuffer, offset, 0x40, 100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointIn, wBuffer, offset, 0x40, 100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //if (i != 0x40) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (i != 0x40) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                editname.setText("IIC Read Failed!!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            address = address + 63; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            iicByteData[3] = (byte)(address>>8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            iicByteData[4] = (byte)address; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //将report id从数组中去除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //byte[] temperBuffer =new byte[length]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int count1 = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int k = 0; k < length; k++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (k % 63 == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    count1++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                wBuffer[k] = wBuffer[k + count1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //发送命令,使得S818可以通过IIC向GT9的固定地址写任意bytes的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private  boolean iicWrite(byte addressHigh,byte addressLow,byte[] wBuffer,int offset,int length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int i; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4499,6 +4680,64 @@ public class Config extends AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //发送命令,使得S8xx可以通过IIC向GT79xx的固定地址写任意bytes的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private  boolean iicWrite32Bits(byte addrfirstbyte,byte addrsecondbyte,byte addrthirdbyte,byte[] wBuffer,int offset, int length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicWriteData[1] = (byte)0x8f; //7bit:0-read,1-write;other:command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //iicWriteData[2] = 0x0f; //no command 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicWriteData[2] = addrfirstbyte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicWriteData[3] = addrsecondbyte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicWriteData[4] = addrthirdbyte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicWriteData[5] = 0x00; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        iicWriteData[6] = 63;  //length 一次接收63个数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int j = 7; j < 64; j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            iicWriteData[j] = 0x00; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //int address1 = ((addressHigh&0xff)<<8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //int address2 = addressLow&0xff; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        long address = ((long)addrfirstbyte << 16) | ((long)addrsecondbyte << 8) | addrthirdbyte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int sendTimes = length/57 + 1;  //预计是向下取整,所以+1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //iicByteData[5] = (byte)(length>>8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //iicByteData[6] = (byte)length;  //length 一次接收63个数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int k = 0; k < sendTimes; k++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int finalOffset = offset + k*57; //每次只能发57bytes数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(length - (finalOffset -offset) < 57) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                iicWriteData[6] = (byte) (length - (finalOffset -offset));  //length 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                iicWriteData[6] = 0x39; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int j = 7; j < 64; j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                iicWriteData[j] = wBuffer[finalOffset + j -7]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointOut, iicWriteData, 0, 0x40, 100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (i != 0x40) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                editname.setText("iicWrite Failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            address = address + 57; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            iicWriteData[2] = (byte)(address >> 16); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            iicWriteData[3] = (byte)(address>>8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            iicWriteData[4] = (byte)address; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     boolean memCmp(byte[] sBuffer,byte[] dBuffer,int offset,int length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |