瀏覽代碼

增加GT2931的短路测试功能,能测试短路

robbin 1 年之前
父節點
當前提交
0e1f78cdd5

+ 2 - 2
app/build.gradle

@@ -7,14 +7,14 @@ android {
         minSdkVersion 18
         targetSdkVersion 28
         versionCode 1
-        versionName "3.0.0"
+        versionName "3.0.2"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     }
     android.applicationVariants.all {
         variant ->
             variant.outputs.all{
                 //此处指定生成的apk文件名
-                outputFileName = "WingCoolAPK_V3.0.1_20230425_debug.apk"
+                outputFileName = "WingCoolAPK_V3.0.2_20230509_debug.apk"
             }
     }
     lintOptions {

+ 187 - 62
app/src/main/java/com/example/administrator/wingcool_gt9_apk/DataAnalysis.java

@@ -3396,10 +3396,14 @@ public class DataAnalysis extends AppCompatActivity
     //------------------------------------GT7 short circuit test code end------------------------------------------------------------------//
 
     //------------------------------------GT29xx short circuit test code start-------------------------------------------------------------//
+    int gnDrvMaxNum;  //gnDrvMaxNum最大52(考虑可转换的通道)
+    int gnSenMaxNum;  //gnSenMaxNum最大75
     private int GetDriverChn(int iNumber)
     {
         int i;
 
+        gnDrvMaxNum = 52;  //gnDrvMaxNum最大52(考虑可转换的通道)
+
         for (i = 0; i < gnDrvMaxNum; i++) {
             if (bypCfgDrv[i] == iNumber)
             {
@@ -3468,10 +3472,16 @@ public class DataAnalysis extends AppCompatActivity
 
         SystemClock.sleep(30);
 
-        //read BLNB_SHORT_WAIT_T_ADDR [0x26AE0]
-        if (iicRead32Bits((byte)0x02, (byte)0x6A, (byte)0xE0, mBytes, 2))
-        {
-            m_nTestPeriod = (mBytes[0] & 0xff) + ((int)(mBytes[1] & 0xff) << 8);
+        if (byProductType == GT29336) {
+            //read BLNB_SHORT_WAIT_T_ADDR [0x26AE0]
+            if (iicRead32Bits((byte) 0x02, (byte) 0x6A, (byte) 0xE0, mBytes, 2)) {
+                m_nTestPeriod = (mBytes[0] & 0xff) + ((int) (mBytes[1] & 0xff) << 8);
+            }
+        }else {
+            //read BLND_SHORT_WAIT_T_ADDR [0x14D7A]
+            if (iicRead32Bits((byte) 0x01, (byte) 0x4D, (byte) 0x7A, mBytes, 2)) {
+                m_nTestPeriod = (mBytes[0] & 0xff) + ((int) (mBytes[1] & 0xff) << 8);
+            }
         }
 
         m_nTestPeriod += 100;
@@ -3556,7 +3566,7 @@ public class DataAnalysis extends AppCompatActivity
 
             SystemClock.sleep(30);
 
-            //read BLNB_SHORT_TEST_CMD_ADDR [0x20402]
+            //read BLNB/BLND_SHORT_TEST_CMD_ADDR [0x20402]
             if (!iicRead32Bits((byte)0x02, (byte)0x04, (byte)0x02, mBytes, 6))
             {
                 return false;
@@ -3595,10 +3605,16 @@ public class DataAnalysis extends AppCompatActivity
 
         for (i = 0; i < 100; i++)
         {
-            //read buffer [0x020400]
-            if (!iicRead32Bits((byte)0x02, (byte)0x04, (byte)0x00, mBytes, 1))
-            {
-                continue;
+            if (byProductType == GT29336) {
+                //read BLNB_SHORT_TEST_STA_ADDR [0x020400]
+                if (!iicRead32Bits((byte) 0x02, (byte) 0x04, (byte) 0x00, mBytes, 1)) {
+                    continue;
+                }
+            }else {
+                //read BLND_SHORT_TEST_STA_ADDR [0x13400]
+                if (!iicRead32Bits((byte) 0x01, (byte) 0x34, (byte) 0x00, mBytes, 1)) {
+                    continue;
+                }
             }
 
             if (mBytes[0] == (byte)0x88)
@@ -3620,14 +3636,20 @@ public class DataAnalysis extends AppCompatActivity
         int ichecksum;
 
         //gnSenMaxNum最大75,gnDrvMaxNum最大52(考虑可转换的通道)
-        byte[] pBuf = new byte[75 * 52 * 2];
+        //byte[] pBuf = new byte[75 * 52 * 2];
         byte[] ShortResult = new byte[64];
         //stBerlinShortResult short_res;
 
-        //read buffer [0x020410]
-        if (!iicRead32Bits((byte)0x02, (byte)0x04, (byte)0x10, ShortResult, 8))
-        {
-            return false;
+        if (byProductType == GT29336) {
+            //read BLNB_SHORT_TEST_RES_ADDR [0x020410]
+            if (!iicRead32Bits((byte) 0x02, (byte) 0x04, (byte) 0x10, ShortResult, 8)) {
+                return false;
+            }
+        }else {
+            //read BLND_SHORT_TEST_RES_ADDR [0x13408]
+            if (!iicRead32Bits((byte) 0x01, (byte) 0x34, (byte) 0x08, ShortResult, 8)) {
+                return false;
+            }
         }
 
         ichecksum = 0;
@@ -3691,20 +3713,32 @@ public class DataAnalysis extends AppCompatActivity
         return true;
     }
 
-    int m_drv_gnd_vdd_resistor_threshold =500;
+    int m_drv_gnd_vdd_resistor_threshold = 500;
     int m_sen_gnd_vdd_resistor_threshold = 500;
-    int gnDrvMaxNum = 52;  //gnDrvMaxNum最大52(考虑可转换的通道)
-    int gnSenMaxNum = 75;  //gnSenMaxNum最大75
     private boolean CheckGndVddShortChn()
     {
         boolean ret = true;
+
+        if (byProductType == GT29336) {
+            gnDrvMaxNum = 52;  //gnDrvMaxNum最大52(考虑可转换的通道)
+            gnSenMaxNum = 75;  //gnSenMaxNum最大75
+        }else {
+            gnDrvMaxNum = 20;  //gnDrvMaxNum最大20
+            gnSenMaxNum = 40;  //gnSenMaxNum最大40
+        }
         //CString str;
         int nDataLen = (gnDrvMaxNum + gnSenMaxNum) * 2;  //gnSenMaxNum最大75,gnDrvMaxNum最大52(考虑可转换的通道)
 
-        //read buffer [0x269E0]
-        if (!iicRead32Bits((byte)0x02, (byte)0x69, (byte)0xE0, mBytes, nDataLen))
-        {
-            return false;
+        if (byProductType == GT29336) {
+            //read BLNB_SHORT_DIFFCODE_ADDR [0x269E0]
+            if (!iicRead32Bits((byte) 0x02, (byte) 0x69, (byte) 0xE0, mBytes, nDataLen)) {
+                return false;
+            }
+        }else {
+            //read BLND_SHORT_DIFFCODE_ADDR [0x14D00]
+            if (!iicRead32Bits((byte) 0x01, (byte) 0x4D, (byte) 0x00, mBytes, nDataLen)) {
+                return false;
+            }
         }
 
         int i, j;
@@ -3725,7 +3759,11 @@ public class DataAnalysis extends AppCompatActivity
 
             if ((diff_code & 0x8000) == 0)//CHN_GND
             {
-                r = (float)((150500 / (float)diff_code) - 60);//TODO berlinD 145000 -15
+                if (byProductType == GT29336) {
+                    r = (float) ((150500 / (float) diff_code) - 60);//berlinB
+                }else {
+                    r = (float) ((145000 / (float) diff_code) - 15);//berlinD
+                }
                 r = r >= 0 ? r : 0;
 
                 //chn = GetDriverChn(chn);
@@ -3743,7 +3781,11 @@ public class DataAnalysis extends AppCompatActivity
             }
             else {
                 diff_code &= (~0x8000); //CHN_VDD
-                r = ((float)(1.25 * 1024 * (3.3 - 1.25) * 99) / (float)diff_code) - 60;//TODO berlinD *93 -20
+                if (byProductType == GT29336) {
+                    r = ((float) (1.25 * 1024 * (3.3 - 1.25) * 99) / (float) diff_code) - 60;//berlinB
+                }else {
+                    r = ((float) (1.25 * 1024 * (3.3 - 1.25) * 93) / (float) diff_code) - 20;//berlinD
+                }
                 r = r >= 0 ? r : 0;
 
                 //chn = GetDriverChn(chn);
@@ -3778,7 +3820,11 @@ public class DataAnalysis extends AppCompatActivity
 
             if ((diff_code & 0x8000) == 0)//CHN_GND
             {
-                r = (float)((150500 / (float)diff_code) - 60);//TODO BerlinB 145000 -15
+                if (byProductType == GT29336) {
+                    r = (float) ((150500 / (float) diff_code) - 60);//BerlinB
+                }else {
+                    r = (float) ((145000 / (float) diff_code) - 15);//BerlinD
+                }
                 r = r >= 0 ? r : 0;
 
                 //chn = GetSensorChn(chn);
@@ -3796,7 +3842,11 @@ public class DataAnalysis extends AppCompatActivity
             }
             else {
                 diff_code &= (~0x8000); //CHN_VDD
-                r = ((float)(1.25 * 1024 * (3.3 - 1.25) * 99) / (float)diff_code) - 60;
+                if (byProductType == GT29336) {
+                    r = ((float) (1.25 * 1024 * (3.3 - 1.25) * 99) / (float) diff_code) - 60;//BerlinB
+                }else {
+                    r = ((float) (1.25 * 1024 * (3.3 - 1.25) * 93) / (float) diff_code) - 20;//BerlinD
+                }
                 r = r >= 0 ? r : 0;
 
                 //chn = GetSensorChn(chn);
@@ -3828,8 +3878,21 @@ public class DataAnalysis extends AppCompatActivity
         boolean ret = true;
         //CString str;
 
+        int nAddr;
+
+        if (byProductType == GT29336) {
+            nAddr = 0x049A;  //[0x2049A]
+
+            gnDrvMaxNum = 52;  //gnDrvMaxNum最大52(考虑可转换的通道)
+            gnSenMaxNum = 75;  //gnSenMaxNum最大75
+        }else {
+            nAddr = 0x344E;  //[0x1344E]
+
+            gnDrvMaxNum = 20;  //gnDrvMaxNum最大20
+            gnSenMaxNum = 40;  //gnSenMaxNum最大40
+        }
+
         int size = 4 + 2 * gnDrvMaxNum + 2;  //BERLIN_SHORT_HEAD是4
-        int nAddr = 0x049A;
 
         String chn_id1_isRx;
         String chn_id2_isRx;
@@ -3837,11 +3900,16 @@ public class DataAnalysis extends AppCompatActivity
         int i;
         for (i = 0; i < nNum; i++)
         {
-
-            //read buffer [0x2049A]
-            if (!iicRead32Bits((byte)0x02, (byte)((nAddr & 0xff00) >> 8), (byte)(nAddr & 0xff), mBytes, size))
-            {
-                return false;
+            if (byProductType == GT29336) {
+                //read BLNB_SHORT_TxTx_PIN_NUM_ADDR [0x2049A]
+                if (!iicRead32Bits((byte) 0x02, (byte) ((nAddr & 0xff00) >> 8), (byte) (nAddr & 0xff), mBytes, size)) {
+                    return false;
+                }
+            }else {
+                //read BLND_SHORT_TxTx_PIN_NUM_ADDR [0x1344E]
+                if (!iicRead32Bits((byte) 0x01, (byte) ((nAddr & 0xff00) >> 8), (byte) (nAddr & 0xff), mBytes, size)) {
+                    return false;
+                }
             }
 
             //str = L"";
@@ -3860,7 +3928,12 @@ public class DataAnalysis extends AppCompatActivity
                 {
                     int chn_id2 = j;// +gnSenMaxNum;
 
-                    r = (float)(1.0 * self_code * 74 / short_code - 74) + 20;//TODO berlinD
+                    if (byProductType == GT29336) {
+                        r = (float)(1.0 * self_code * 74 / short_code - 74) + 20;//berlinB
+                    }else {
+                        r = (float)(1.0 * self_code * 70 / short_code - 70) + 59;//berlinD
+                    }
+
                     r = r >= 0 ? r : 0;
 
                     //chn_id1 = GetDriverChn(chn_id1);
@@ -3869,29 +3942,34 @@ public class DataAnalysis extends AppCompatActivity
 
                     if (r < m_drv_drv_resistor_threshold && chn_id1 < 255 && chn_id2 < 255)
                     {
-                        //TX/RX可以互换,这里要做判断转换
-                        chn_id1_isRx = "Tx";
-                        if (chn_id1 < 9)  //通道序号小于9时
-                        {
-                            //如果在driver配置里找不到该通道序号,说明改通道用作sensor
-                            if (GetDriverChn(chn_id1) == 255) {
-                                chn_id1 += 66;
-                                chn_id1_isRx = "Rx";
+                        if (byProductType == GT29336) {
+                            //TX/RX可以互换,这里要做判断转换
+                            chn_id1_isRx = "Tx";
+                            if (chn_id1 < 9)  //通道序号小于9时
+                            {
+                                //如果在driver配置里找不到该通道序号,说明改通道用作sensor
+                                if (GetDriverChn(chn_id1) == 255) {
+                                    chn_id1 += 66;
+                                    chn_id1_isRx = "Rx";
+                                }
                             }
-                        }
 
-                        chn_id2_isRx = "Tx";
-                        if (chn_id2 < 9)  //通道序号小于9时
-                        {
-                            //如果在driver配置里找不到该通道序号,说明改通道用作sensor
-                            if (GetDriverChn(chn_id2) == 255) {
-                                chn_id2 += 66;
-                                chn_id2_isRx = "Rx";
+                            chn_id2_isRx = "Tx";
+                            if (chn_id2 < 9)  //通道序号小于9时
+                            {
+                                //如果在driver配置里找不到该通道序号,说明改通道用作sensor
+                                if (GetDriverChn(chn_id2) == 255) {
+                                    chn_id2 += 66;
+                                    chn_id2_isRx = "Rx";
+                                }
                             }
-                        }
 
-                        Update_log = Update_log.concat("[Short-Circuit Test]" + chn_id1_isRx + Integer.toString(chn_id1) + " and " + chn_id2_isRx
-                                + Integer.toString(chn_id2) + ": " + Integer.toString((int)r) + "K Ohm\n");
+                            Update_log = Update_log.concat("[Short-Circuit Test]" + chn_id1_isRx + Integer.toString(chn_id1) + " and " + chn_id2_isRx
+                                    + Integer.toString(chn_id2) + ": " + Integer.toString((int) r) + "K Ohm\n");
+                        }else {
+                            Update_log = Update_log.concat("[Short-Circuit Test]Tx" + Integer.toString(chn_id1) + " and Tx"
+                                    + Integer.toString(chn_id2) + ": " + Integer.toString((int)r) + "K Ohm\n");
+                        }
 
                         mHandler.sendEmptyMessage(TEST_DATA_MESSAGE);
                         //str.Format(L"TX%d and TX%d: %dK ohm", chn_id1, chn_id2,  (INT)r);
@@ -3918,15 +3996,34 @@ public class DataAnalysis extends AppCompatActivity
         boolean ret = true;
         //CString str;
 
+        int nAddr;
+
+        if (byProductType == GT29336) {
+            nAddr = 0x1AF2;  //[0x21AF2]
+
+            gnDrvMaxNum = 52;  //gnDrvMaxNum最大52(考虑可转换的通道)
+            gnSenMaxNum = 75;  //gnSenMaxNum最大75
+        }else {
+            nAddr = 0x37E6;  //[0x137E6]
+
+            gnDrvMaxNum = 20;  //gnDrvMaxNum最大20
+            gnSenMaxNum = 40;  //gnSenMaxNum最大40
+        }
+
         int size = 4 + 2 * gnSenMaxNum + 2;
-        int nAddr = 0x1AF2;
 
         for (int i = 0; i < nNum; i++)
         {
-
-            if (!iicRead32Bits((byte)0x02, (byte)((nAddr & 0xff00) >> 8), (byte)(nAddr & 0x00ff), mBytes, size))
-            {
-                return false;
+            if (byProductType == GT29336) {
+                //read BLNB_SHORT_TxTx_PIN_NUM_ADDR [0x21AF2]
+                if (!iicRead32Bits((byte) 0x02, (byte) ((nAddr & 0xff00) >> 8), (byte) (nAddr & 0xff), mBytes, size)) {
+                    return false;
+                }
+            }else {
+                //read BLND_SHORT_TxTx_PIN_NUM_ADDR [0x137E6]
+                if (!iicRead32Bits((byte) 0x01, (byte) ((nAddr & 0xff00) >> 8), (byte) (nAddr & 0xff), mBytes, size)) {
+                    return false;
+                }
             }
 
             //str = L"";
@@ -3944,7 +4041,11 @@ public class DataAnalysis extends AppCompatActivity
                 {
                     int chn_id2 = j;
 
-                    r = (float)(1.0 * self_code * 74 / short_code - 74) + 20;
+                    if (byProductType == GT29336) {
+                        r = (float)(1.0 * self_code * 74 / short_code - 74) + 20;//berlinB
+                    }else {
+                        r = (float)(1.0 * self_code * 70 / short_code - 70) + 59;//berlinD
+                    }
                     r = r >= 0 ? r : 0;
 
                     //chn_id1 = GetSensorChn(chn_id1);
@@ -3981,8 +4082,21 @@ public class DataAnalysis extends AppCompatActivity
         boolean ret = true;
         //CString str;
 
+        int nAddr;
+
+        if (byProductType == GT29336) {
+            nAddr = 0x48A6;  //[0x248A6]
+
+            gnDrvMaxNum = 52;  //gnDrvMaxNum最大52(考虑可转换的通道)
+            gnSenMaxNum = 75;  //gnSenMaxNum最大75
+        }else {
+            nAddr = 0x4556;  //[0x14556]
+
+            gnDrvMaxNum = 20;  //gnDrvMaxNum最大20
+            gnSenMaxNum = 40;  //gnSenMaxNum最大40
+        }
+
         int size = 4 + 2 * gnDrvMaxNum + 2;
-        int nAddr = 0x48A6;
 
         int i;
         for (i = 0; i < nNum; i++)
@@ -3990,9 +4104,16 @@ public class DataAnalysis extends AppCompatActivity
             //str = L"";
             float r = 0;
 
-            if (!iicRead32Bits((byte)0x02, (byte)((nAddr & 0xff00) >> 8), (byte)(nAddr & 0x00ff), mBytes, size))
-            {
-                return false;
+            if (byProductType == GT29336) {
+                //read BLNB_SHORT_TxTx_PIN_NUM_ADDR [0x248A6]
+                if (!iicRead32Bits((byte) 0x02, (byte) ((nAddr & 0xff00) >> 8), (byte) (nAddr & 0xff), mBytes, size)) {
+                    return false;
+                }
+            }else {
+                //read BLND_SHORT_TxTx_PIN_NUM_ADDR [0x14556]
+                if (!iicRead32Bits((byte) 0x01, (byte) ((nAddr & 0xff00) >> 8), (byte) (nAddr & 0xff), mBytes, size)) {
+                    return false;
+                }
             }
 
             int chn_id1 = (int)(mBytes[1] & 0xFF) * 256 + (mBytes[0] & 0xFF);
@@ -4007,7 +4128,11 @@ public class DataAnalysis extends AppCompatActivity
                 {
                     int chn_id2 = j;
 
-                    r = (float)(1.0 * self_code * 74 / short_code - 74) + 20;
+                    if (byProductType == GT29336) {
+                        r = (float) (1.0 * self_code * 74 / short_code - 74) + 20;//berlinB
+                    }else {
+                        r = (float) (1.0 * self_code * 70 / short_code - 70) + 59;//berlinD
+                    }
                     r = r >= 0 ? r : 0;
 
                     //chn_id1 = GetSensorChn(chn_id1);

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

@@ -107,7 +107,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:v3.0.1_20230425-Debug Version</string>
+    <string name="version">APK Version:v3.0.2_20230509-Debug Version</string>
 
     <!-- other -->
     <string name="app_name">WingCoolAPK</string>

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

@@ -107,7 +107,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版本:v3.0.1_20230425-debug版本</string>
+    <string name="version">APK版本:v3.0.2_20230509-debug版本</string>
 
     <!-- other -->
     <string name="app_name">WingCoolAPK</string>