Procházet zdrojové kódy

GT7XXX可以进行开短路测试

robbin před 3 roky
rodič
revize
9aea4ba377

+ 40 - 60
app/src/main/java/com/example/administrator/wingcool_gt9_apk/DataAnalysis.java

@@ -1571,7 +1571,7 @@ public class DataAnalysis extends AppCompatActivity
 
                                     dv = Integer.toString(datatemp[i]);
 
-                                    if ((bypDrvShortFlag[col] == 0x55) || (bypSenShortFlag[row] == 0x55))
+                                    if ((bypDrvShortFlag[col - 1] == 0x55) || (bypSenShortFlag[row] == 0x55))
                                     {
                                         textView.setTextColor(Color.parseColor("#FF0000"));  //红色
                                     }
@@ -2412,25 +2412,13 @@ public class DataAnalysis extends AppCompatActivity
         mHandler.sendEmptyMessage(TEST_DATA_MESSAGE);
 
         iicByteWrite((byte)0x43,(byte)0x7c,(byte)0x0f,(byte)0x00);
-
+        SystemClock.sleep(15);
         iicByteWrite((byte)0x80,(byte)0x41,(byte)0x0f,(byte)0x00);  //0x8041,command data
         iicByteWrite((byte)0x80,(byte)0x42,(byte)0x0f,(byte)0xC0);  //0x8042,command checksum
-
+        SystemClock.sleep(15);
         iicByteWrite((byte)0x80,(byte)0x40,(byte)0x0f,(byte)0x40);  //0x8040,0x40:通知FW进入短路测试状态
 
-        SystemClock.sleep(300);
-
-    //    CString str;
-	//::GetPrivateProfileString(L"BasicData", L"DrvStartAddr", L"0x8171", str.GetBuffer(MAX_PATH), MAX_PATH, gstrChipIniFile);
-    //    str.ReleaseBuffer();
-    //    WORD wDrvAddr = CStringHexToWord(str);
-
-	//::GetPrivateProfileString(L"BasicData", L"SenStartAddr", L"0x8127", str.GetBuffer(MAX_PATH), MAX_PATH, gstrChipIniFile);
-    //    WORD wSenAddr = CStringHexToWord(str);
-
-	//::GetPrivateProfileString(L"Cfg", L"CFGAddr", L"0x8050", str.GetBuffer(MAX_PATH), MAX_PATH, gstrChipIniFile);
-    //    WORD wConfigAddr = CStringHexToWord(str);
-
+        SystemClock.sleep(350);
 
         for (int i = 0; i < 76; i++)
         {
@@ -2502,6 +2490,7 @@ public class DataAnalysis extends AppCompatActivity
                     }
                 }
             }
+
             k = 0;
             for (int i = 0; i < 22; i++)  //DrvHalfNmuber=22
             {
@@ -2538,10 +2527,10 @@ public class DataAnalysis extends AppCompatActivity
             }
         }
 
-        long wCheckSum = 0;
+        int wCheckSum = 0;
         for (int i = 0; i < GT7xxxShortConfig.length - 2; i += 2)
         {
-            wCheckSum += GT7xxxShortConfig[i + 1] << 8 + GT7xxxShortConfig[i];
+            wCheckSum += (int)((GT7xxxShortConfig[i + 1]& 0xff) << 8) + (int)(GT7xxxShortConfig[i] & 0xff);
         }
         wCheckSum = 0 - wCheckSum;
         GT7xxxShortConfig[GT7xxxShortConfig.length - 2] = (byte)(wCheckSum & 0xff);
@@ -2567,10 +2556,12 @@ public class DataAnalysis extends AppCompatActivity
         {
             if (iicWrite((byte)0x81, (byte)0x18, GT7xxxShortConfig, 0, GT7xxxShortConfig.length))  //下发正确,继续往下
             {
+                SystemClock.sleep(8);
                 iicByteWrite((byte)0x80,(byte)0x41,(byte)0x0f,(byte)0x00);  //0x8041,command data
                 iicByteWrite((byte)0x80,(byte)0x42,(byte)0x0f,(byte)0xBF);  //0x8042,command checksum
-
+                SystemClock.sleep(15);
                 iicByteWrite((byte)0x80,(byte)0x40,(byte)0x0f,(byte)0x41);  //0x8040,0x40:通知FW已完成参数配置
+                SystemClock.sleep(15);
 
                 temp = 100;
 
@@ -2625,7 +2616,7 @@ public class DataAnalysis extends AppCompatActivity
 
                             iicByteWrite((byte)0x80,(byte)0x40,(byte)0x0f,(byte)0xAA);  //0x8040,0xAA:关闭HID-IIC模式
 
-                            Update_log += getResources().getString(R.string.testpass);
+                            Update_log = getResources().getString(R.string.shorttestfinish) + getResources().getString(R.string.testpass);
                             mHandler.sendEmptyMessage(TEST_DATA_MESSAGE);
 
                             return;
@@ -2635,15 +2626,17 @@ public class DataAnalysis extends AppCompatActivity
             }
         }
 
+        Update_log = "";
+
         if (ShortTestResult != 0)
         {
             byte ShortResisNum = iicByteRead((byte)0x8A,(byte)0xC2);
-            byte[] buf = new byte[4];
+            byte[] buf = new byte[128];  //长度要大于64
             String str;
 
-            for (int i = 0; i < ShortResisNum * 4; i += 4)
+            for (int i = 0; i < (int)((ShortResisNum & 0xFF) * 4); i += 4)
             {
-                temp = 0x8AC4 + i;
+                temp = (int)(0x8AC4 + (byte)i);
 
                 iicRead((byte)((temp&0xff00) >> 8),(byte)(temp&0x00ff),buf,4);
 
@@ -2653,29 +2646,30 @@ public class DataAnalysis extends AppCompatActivity
                     ch = GT7xxxGetTxIndex(pConfigDrv, ch);
                     if (ch == 255)
                         continue;
-                    //str.Format(L" Tx%d and", ch);
-                    //todo
+
+                    bypDrvShortFlag[ch] = (byte)0x55;
+                    Update_log = Update_log.concat("[Short-Circuit Test]Tx" + Integer.toString(ch) + " and ");
+
                 }
                 else
                 {
-                    int ch = buf[1];
-                    //ch = gnRawDataRows - ch - 1;
+                    int ch = buf[1] & 0xFF;
+
                     ch = GT7xxxGetRxIndex(pConfigSen, ch);
                     if (ch == 255)
                         continue;
-                    //str.Format(L" Rx%d and", ch);
-                    //todo
+
+                    bypSenShortFlag[ch] = (byte)0x55;
+                    Update_log = Update_log.concat("[Short-Circuit Test]Rx" + Integer.toString(ch) + " and ");
                 }
 
-                if (buf[0] == 0xF0)
+                if (buf[0] == (byte)0xF0)
                 {
-                    //str += L"GND:";
-                    //todo
+                    Update_log = Update_log.concat("GND:");
                 }
-                else if (buf[0] == 0xF1)
+                else if (buf[0] == (byte)0xF1)
                 {
-                    //str += L"AVDD:";
-                    //todo
+                    Update_log = Update_log.concat("AVDD:");
                 }
                 else if ((buf[0] & 0x80) != 0)
                 {
@@ -2683,44 +2677,30 @@ public class DataAnalysis extends AppCompatActivity
                     ch = GT7xxxGetTxIndex(pConfigDrv, ch);
                     if (ch == 255)
                         continue;
-                    //str.AppendFormat(L"Tx%d:", ch);
-                    //todo
+
+                    bypDrvShortFlag[ch] = (byte)0x55;
+                    Update_log = Update_log.concat("Tx" + Integer.toString(ch) + ": ");
                 }
                 else
                 {
                     int ch = buf[0];
-                    //ch = gnRawDataRows - ch - 1;
+
                     ch = GT7xxxGetRxIndex(pConfigSen, ch);
                     if (ch == 255)
                         continue;
-                    //str.AppendFormat(L"Rx%d:", ch);
-                    //todo
+
+                    bypSenShortFlag[ch] = (byte)0x55;
+                    Update_log = Update_log.concat("Rx" + Integer.toString(ch) + ": ");
                 }
-                //str.AppendFormat(L"%dK ohm", buf[2] * 256 + buf[3]);
-                //todo
 
-                if (buf[2] * 256 + buf[3] > 800)
+                if ((int)((buf[2]&0xFF) * 256) + (buf[3]&0xFF) > 800)
                 {
-                    //m_pDlg->m_pctlMessageList->AppendMessage(str, MESSAGE_PAY_ATTENTION);
-                    //todo
+
                     continue;
                 }
-                //m_pDlg->m_pctlMessageList->AppendMessage(str, MESSAGE_ERR);
-                //m_pDlg->m_stTestSate[CDlgTest::OPEN_SHORT_TEST].enState = CDlgTest::TEST_FAILED;
-                //todo
-            }
-            //todo
-            /*
-            if (m_pDlg->m_stTestSate[CDlgTest::OPEN_SHORT_TEST].enState == CDlgTest::TEST_FAILED)
-            {
-                m_pDlg->m_pctlMessageList->AppendMessage(IDS_TEST_SHORT_NG, MESSAGE_ERR);
-            }
-            else
-            {
-                m_pDlg->m_pctlMessageList->AppendMessage(IDS_TEST_SHORT_FINISH, MESSAGE_WAR);
-            }
 
-             */
+                Update_log = Update_log.concat(Integer.toString((int)((buf[2]&0xFF) * 256) + (buf[3]&0xFF)) + "K ohm" + "\n");
+            }
         }
 
         Update_log += getResources().getString(R.string.shorttestng);

+ 1 - 1
app/src/main/res/values-en/strings.xml

@@ -100,7 +100,7 @@
     <string name="companyaddr">Address:Room 2008, Chuangxingda Business Building, No.36 Liuxian 3rd Road, Baoan District, Shenzhen</string>
     <string name="telephonenum">Telephone:186 8896 1937</string>
     <string name="emailaddr">Email:max@wingcool.cn</string>
-    <string name="version">APK Version:v2.0.1_20211011-Release Version</string>
+    <string name="version">APK Version:v2.0.1_20211013-Debug Version</string>
 
     <!-- other -->
     <string name="app_name">WingCoolAPK</string>

+ 1 - 1
app/src/main/res/values/strings.xml

@@ -100,7 +100,7 @@
     <string name="companyaddr">地址:深圳市宝安区留仙三路 36 号创兴达商务大厦 2008 室</string>
     <string name="telephonenum">电话:186 8896 1937</string>
     <string name="emailaddr">邮箱:max@wingcool.cn</string>
-    <string name="version">APK版本:v2.0.1_20211011-发布版本</string>
+    <string name="version">APK版本:v2.0.1_20211013-内部版本</string>
 
     <!-- other -->
     <string name="app_name">WingCoolAPK</string>