Sfoglia il codice sorgente

修改短路测试功能,可以测试成功

robbin 2 anni fa
parent
commit
9df17d342d

+ 47 - 23
app/src/main/java/com/example/administrator/wingcool_gt9_apk/DataAnalysis.java

@@ -3255,22 +3255,22 @@ public class DataAnalysis extends AppCompatActivity
 
         //gnSenMaxNum最大75,gnDrvMaxNum最大52(考虑可转换的通道)
         byte[] pBuf = new byte[75 * 52 * 2];
-        //byte[] ShortResult = new byte[8];
+        byte[] ShortResult = new byte[64];
         //stBerlinShortResult short_res;
 
         //read buffer [0x020410]
-        if (!iicRead32Bits((byte)0x02, (byte)0x04, (byte)0x10, mBytes, 8))
+        if (!iicRead32Bits((byte)0x02, (byte)0x04, (byte)0x10, ShortResult, 8))
         {
             return false;
         }
 
         ichecksum = 0;
         for (int i = 0; i < 6; i++) {
-            int vb = mBytes[i] & 0xFF;
+            int vb = ShortResult[i] & 0xFF;
             ichecksum = ichecksum + vb;
         }
 
-        if (ichecksum != ((int)(mBytes[7] & 0xFF) * 256 + (mBytes[6] & 0xFF)))
+        if (ichecksum != ((int)(ShortResult[7] & 0xFF) * 256 + (ShortResult[6] & 0xFF)))
         {
             return false;
         }
@@ -3286,23 +3286,23 @@ public class DataAnalysis extends AppCompatActivity
         //short_res.sxgnd_short_num = mBytes[5];
 
         //Tx/Rx & GND/VDD
-        if (((mBytes[0] & 0x08) >> 3)  == 1) {
+        if (((ShortResult[0] & 0x08) >> 3)  == 1) {
             ret = CheckGndVddShortChn();
         }
 
         //Tx & Tx
-        if ((mBytes[0] & 0x01) == 1) {
-            ret = CheckTxTxShortChn(mBytes[1]);
+        if ((ShortResult[0] & 0x01) == 1) {
+            ret = CheckTxTxShortChn(ShortResult[1]);
         }
 
         //Rx & Rx
-        if (((mBytes[0] & 0x02) >> 1)  == 1)  {
-            ret = CheckRxRxShortChn(mBytes[2]);
+        if (((ShortResult[0] & 0x02) >> 1)  == 1)  {
+            ret = CheckRxRxShortChn(ShortResult[2]);
         }
 
         //Tx & Rx
-        if (((mBytes[0] & 0x04) >> 2)  == 1)  {
-            ret = CheckTxRxShortChn(mBytes[3]);
+        if (((ShortResult[0] & 0x04) >> 2)  == 1)  {
+            ret = CheckTxRxShortChn(ShortResult[3]);
         }
 
         return ret;
@@ -3345,7 +3345,7 @@ public class DataAnalysis extends AppCompatActivity
                 r = (float)((150500 / (float)diff_code) - 60);//TODO berlinD 145000 -15
                 r = r >= 0 ? r : 0;
 
-                chn = GetDriverChn(chn);
+                //chn = GetDriverChn(chn);
 
                 if (r < m_drv_gnd_vdd_resistor_threshold && chn < 255)
                 {
@@ -3363,7 +3363,7 @@ public class DataAnalysis extends AppCompatActivity
                 r = ((float)(1.25 * 1024 * (3.3 - 1.25) * 99) / (float)diff_code) - 60;//TODO berlinD *93 -20
                 r = r >= 0 ? r : 0;
 
-                chn = GetDriverChn(chn);
+                //chn = GetDriverChn(chn);
 
                 if (r < m_drv_gnd_vdd_resistor_threshold && chn < 255)
                 {
@@ -3398,7 +3398,7 @@ public class DataAnalysis extends AppCompatActivity
                 r = (float)((150500 / (float)diff_code) - 60);//TODO BerlinB 145000 -15
                 r = r >= 0 ? r : 0;
 
-                chn = GetSensorChn(chn);
+                //chn = GetSensorChn(chn);
 
                 if (r < m_sen_gnd_vdd_resistor_threshold && chn < 255)
                 {
@@ -3416,7 +3416,7 @@ public class DataAnalysis extends AppCompatActivity
                 r = ((float)(1.25 * 1024 * (3.3 - 1.25) * 99) / (float)diff_code) - 60;
                 r = r >= 0 ? r : 0;
 
-                chn = GetSensorChn(chn);
+                //chn = GetSensorChn(chn);
 
                 if (r < m_sen_gnd_vdd_resistor_threshold && chn < 255)
                 {
@@ -3443,12 +3443,15 @@ public class DataAnalysis extends AppCompatActivity
         int size = 4 + 2 * gnDrvMaxNum + 2;  //BERLIN_SHORT_HEAD是4
         int nAddr = 0x049A;
 
+        String chn_id1_isRx;
+        String chn_id2_isRx;
+
         int i;
         for (i = 0; i < nNum; i++)
         {
 
             //read buffer [0x2049A]
-            if (!iicRead32Bits((byte)0x02, (byte)((nAddr & 0xff00) >> 8), (byte)(nAddr & 0x00ff), mBytes, size))
+            if (!iicRead32Bits((byte)0x02, (byte)((nAddr & 0xff00) >> 8), (byte)(nAddr & 0xff), mBytes, size))
             {
                 return false;
             }
@@ -3472,13 +3475,34 @@ public class DataAnalysis extends AppCompatActivity
                     r = (float)(1.0 * self_code * 74 / short_code - 74) + 20;//TODO berlinD
                     r = r >= 0 ? r : 0;
 
-                    chn_id1 = GetDriverChn(chn_id1);
+                    //chn_id1 = GetDriverChn(chn_id1);
 
-                    chn_id2 = GetDriverChn(chn_id2);
+                    //chn_id2 = GetDriverChn(chn_id2);
 
                     if (r < m_drv_drv_resistor_threshold && chn_id1 < 255 && chn_id2 < 255)
                     {
-                        Update_log = Update_log.concat("[Short-Circuit Test]Tx" + Integer.toString(chn_id1) + " and Tx"
+                        //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";
+                            }
+                        }
+
+                        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");
 
                         mHandler.sendEmptyMessage(TEST_DATA_MESSAGE);
@@ -3530,9 +3554,9 @@ public class DataAnalysis extends AppCompatActivity
                     r = (float)(1.0 * self_code * 74 / short_code - 74) + 20;
                     r = r >= 0 ? r : 0;
 
-                    chn_id1 = GetSensorChn(chn_id1);
+                    //chn_id1 = GetSensorChn(chn_id1);
 
-                    chn_id2 = GetSensorChn(chn_id2);
+                    //chn_id2 = GetSensorChn(chn_id2);
 
                     if (r < m_drv_sen_resistor_threshold && chn_id1 < 255 && chn_id2 < 255)
                     {
@@ -3588,9 +3612,9 @@ public class DataAnalysis extends AppCompatActivity
                     r = (float)(1.0 * self_code * 74 / short_code - 74) + 20;
                     r = r >= 0 ? r : 0;
 
-                    chn_id1 = GetSensorChn(chn_id1);
+                    //chn_id1 = GetSensorChn(chn_id1);
 
-                    chn_id2 = GetDriverChn(chn_id2);
+                    //chn_id2 = GetDriverChn(chn_id2);
 
                     if (r < m_drv_drv_resistor_threshold && chn_id1 < 255 && chn_id2 < 255)
                     {

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

@@ -1,6 +1,6 @@
 <resources>
     <!-- Activity_gt9_main -->
-    <string name="companyname">Shenzhen Qianhai Yungu Technology Co., LTD</string>
+    <string name="companyname">Shenzhen Qianhai Wingcool Technology Co., LTD</string>
     <string name="connectdevice">Please Connect Device</string>
     <string name="connected">is connected</string>
     <string name="disconnected">S8xx is disconnected</string>
@@ -78,7 +78,7 @@
     <string name="minisrisk">Minimum value is in the critical range, there is a risk!</string>
     <string name="testpass">Test pass!</string>
     <string name="testng">Test is NG!</string>
-    <string name="startshorttest">Start short-circuit test, Please wait until finishes...</string>
+    <string name="startshorttest">Start short-circuit test, Please wait until finishes...\n</string>
     <string name="shorttestfinish">Short circuit test is finished!</string>
     <string name="shorttestng">Short circuit test is NG!</string>
 
@@ -105,7 +105,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.0_20220907-Debug Version</string>
+    <string name="version">APK Version:v3.0.0_20220916-Debug Version</string>
 
     <!-- other -->
     <string name="app_name">WingCoolAPK</string>

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

@@ -78,7 +78,7 @@
     <string name="minisrisk">最小值在临界范围,存在风险!</string>
     <string name="testpass">测试通过!</string>
     <string name="testng">测试NG!</string>
-    <string name="startshorttest">开始进行短路测试,请等待测试完成……</string>
+    <string name="startshorttest">开始进行短路测试,请等待测试完成……\n</string>
     <string name="shorttestfinish">短路测试完成!</string>
     <string name="shorttestng">短路测试NG!</string>
 
@@ -105,7 +105,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.0_20220907-debug版本</string>
+    <string name="version">APK版本:v3.0.0_20220916-debug版本</string>
 
     <!-- other -->
     <string name="app_name">WingCoolAPK</string>