Эх сурвалжийг харах

2020.05.22 / TC Hsu

Actions: Bug fixed and improve. For single connector with CCS, the CCS board detection will be miss, and self test will be failed. So, modify the detection mechanism to, for single connector EVSE, it will scan both slot to find the EV board, but should only have one EV board, and the CCS board should not in the slot0.

Image version    : N/A
Image checksum   : N/A

Hardware PWB P/N : N/A
Hardware Version : N/A

Files:

	modified:   EVSE/Projects/DM30/Apps/main.c
TC_Hsu 4 жил өмнө
parent
commit
9acd87ae48
1 өөрчлөгдсөн 115 нэмэгдсэн , 41 устгасан
  1. 115 41
      EVSE/Projects/DM30/Apps/main.c

+ 115 - 41
EVSE/Projects/DM30/Apps/main.c

@@ -2810,75 +2810,149 @@ bool CheckConnectorTypeStatus()
                 ShmSysConfigAndInfo->SysConfig.TotalConnectorCount,
                 ShmSysConfigAndInfo->SysConfig.AcConnectorCount);
 
-        if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 0 &&
-            ShmSysConfigAndInfo->SysConfig.AcConnectorCount == 0)
-            result = false;
-
-        // 偵測槍屬於哪個 slot : 可知道插在板上的Slot 0 或 1 是 Chademo 還是 CCS
-        for (byte gunIndex = 0; gunIndex < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; gunIndex++)
+        if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 0)
+        {
+            if(ShmSysConfigAndInfo->SysConfig.AcConnectorCount == 0)
+            {
+                result = false;
+            }
+        }
+        else if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1)
         {
-            if (gunIndex == 0 && bd0_1_status == 0 && bd0_2_status == 1)
+            bool SingleBoardDetected = true;
+
+            if (bd0_1_status == 0 && bd0_2_status == 1)
             {
                 // 與硬體相同 type : Chademo
-                if (chargingInfo[gunIndex]->Type == _Type_Chademo)
+                if (chargingInfo[0]->Type == _Type_Chademo)
                 {
-                    chargingInfo[gunIndex]->Evboard_id = 0x01;
+                    chargingInfo[0]->Evboard_id = 0x01;
                 }
             }
-            else if (gunIndex == 0 && bd0_1_status == 1 && bd0_2_status == 0)
+            else if (bd0_1_status == 1 && bd0_2_status == 0)
             {
-                // 與硬體相同 type : CCS
-                if (chargingInfo[gunIndex]->Type == _Type_CCS_2)
-                {
-                    chargingInfo[gunIndex]->Evboard_id = 0x01;
-                }
+                PRINTF_FUNC("For single connector EVSE, CCS board should not at slot 0\n");
+                result = false;
             }
-            else if (gunIndex == 0 && bd0_1_status == 1 && bd0_2_status == 1)
+            else if (bd0_1_status == 1 && bd0_2_status == 1)
             {
                 // 與硬體相同 type : GB
-                if (chargingInfo[gunIndex]->Type == _Type_GB)
+                if (chargingInfo[0]->Type == _Type_GB)
                 {
-                    chargingInfo[gunIndex]->Evboard_id = 0x01;
+                    chargingInfo[0]->Evboard_id = 0x01;
                 }
             }
+            else
+            {
+                SingleBoardDetected = false;
+            }
 
-            if (gunIndex == 1 && bd1_1_status == 0 && bd1_2_status == 1)
+            if(SingleBoardDetected == true)
             {
-                // 與硬體相同 type : Chademo
-                if (chargingInfo[gunIndex]->Type == _Type_Chademo)
+                if(!(bd1_1_status == 0 && bd1_2_status == 0))
                 {
-                    chargingInfo[gunIndex]->Evboard_id = 0x02;
+                    PRINTF_FUNC("For single connector EVSE, it should not have two EV board\n");
+                    result = false;
                 }
-
-                if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1)
-                    chargingInfo[gunIndex]->Evboard_id = 0x01;
             }
-            else if (gunIndex == 1 && bd1_1_status == 1 && bd1_2_status == 0)
+            else if(SingleBoardDetected == false)
             {
-                // 與硬體相同 type : CCS
-                if (chargingInfo[gunIndex]->Type == _Type_CCS_2)
+                if (bd1_1_status == 0 && bd1_2_status == 1)
+                {
+                    // 與硬體相同 type : Chademo
+                    if (chargingInfo[0]->Type == _Type_Chademo)
+                    {
+                        chargingInfo[0]->Evboard_id = 0x01;
+                    }
+                }
+                else if (bd1_1_status == 1 && bd1_2_status == 0)
+                {
+                    // 與硬體相同 type : CCS
+                    if (chargingInfo[0]->Type == _Type_CCS_2)
+                    {
+                        chargingInfo[0]->Evboard_id = 0x01;
+                    }
+                }
+                else if (bd1_1_status == 1 && bd1_2_status == 1)
                 {
-                    chargingInfo[gunIndex]->Evboard_id = 0x02;
+                    // 與硬體相同 type : GB
+                    if (chargingInfo[0]->Type == _Type_GB)
+                    {
+                        chargingInfo[0]->Evboard_id = 0x01;
+                    }
                 }
+            }
 
-                if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1)
-                    chargingInfo[gunIndex]->Evboard_id = 0x01;
+            PRINTF_FUNC("Single Connector EVSE, Type = %d, Evboard_id = %d \n", chargingInfo[0]->Type, chargingInfo[0]->Evboard_id);
+            if (chargingInfo[0]->Evboard_id == 0x00)
+            {
+                result = false;
             }
-            else if (gunIndex == 1 && bd1_1_status == 1 && bd1_2_status == 1)
+        }
+        else if(ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 2)
+        {
+            // 偵測槍屬於哪個 slot : 可知道插在板上的Slot 0 或 1 是 Chademo 還是 CCS
+            for (byte gunIndex = 0; gunIndex < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; gunIndex++)
             {
-                // 與硬體相同 type : GB
-                if (chargingInfo[gunIndex]->Type == _Type_GB)
+                if (gunIndex == 0 && bd0_1_status == 0 && bd0_2_status == 1)
+                {
+                    // 與硬體相同 type : Chademo
+                    if (chargingInfo[gunIndex]->Type == _Type_Chademo)
+                    {
+                        chargingInfo[gunIndex]->Evboard_id = 0x01;
+                    }
+                }
+                else if (gunIndex == 0 && bd0_1_status == 1 && bd0_2_status == 0)
+                {
+                    // 與硬體相同 type : CCS
+                    if (chargingInfo[gunIndex]->Type == _Type_CCS_2)
+                    {
+                        chargingInfo[gunIndex]->Evboard_id = 0x01;
+                    }
+                }
+                else if (gunIndex == 0 && bd0_1_status == 1 && bd0_2_status == 1)
                 {
-                    chargingInfo[gunIndex]->Evboard_id = 0x02;
+                    // 與硬體相同 type : GB
+                    if (chargingInfo[gunIndex]->Type == _Type_GB)
+                    {
+                        chargingInfo[gunIndex]->Evboard_id = 0x01;
+                    }
                 }
 
-                if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1)
-                    chargingInfo[gunIndex]->Evboard_id = 0x01;
-            }
+                if (gunIndex == 1 && bd1_1_status == 0 && bd1_2_status == 1)
+                {
+                    // 與硬體相同 type : Chademo
+                    if (chargingInfo[gunIndex]->Type == _Type_Chademo)
+                    {
+                        chargingInfo[gunIndex]->Evboard_id = 0x02;
+                    }
+                }
+                else if (gunIndex == 1 && bd1_1_status == 1 && bd1_2_status == 0)
+                {
+                    // 與硬體相同 type : CCS
+                    if (chargingInfo[gunIndex]->Type == _Type_CCS_2)
+                    {
+                        chargingInfo[gunIndex]->Evboard_id = 0x02;
+                    }
+                }
+                else if (gunIndex == 1 && bd1_1_status == 1 && bd1_2_status == 1)
+                {
+                    // 與硬體相同 type : GB
+                    if (chargingInfo[gunIndex]->Type == _Type_GB)
+                    {
+                        chargingInfo[gunIndex]->Evboard_id = 0x02;
+                    }
+                }
 
-            PRINTF_FUNC("index = %d, Type = %d, Evboard_id = %d \n", gunIndex, chargingInfo[gunIndex]->Type, chargingInfo[gunIndex]->Evboard_id);
-            if (chargingInfo[gunIndex]->Evboard_id == 0x00)
-                result = false;
+                PRINTF_FUNC("index = %d, Type = %d, Evboard_id = %d \n", gunIndex, chargingInfo[gunIndex]->Type, chargingInfo[gunIndex]->Evboard_id);
+                if (chargingInfo[gunIndex]->Evboard_id == 0x00)
+                    result = false;
+            }
+        }
+        else
+        {
+            // Module Name 不正確 - 告警
+            result = false;
         }
     }
     else