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

2021.06.10 / Jerry Wang

Actions:
1. Debug DD360ComBox LED status.

Files:
1. As follow as commit history.
Jerry_Wang 3 жил өмнө
parent
commit
4a65cf9194
42 өөрчлөгдсөн 627 нэмэгдсэн , 417 устгасан
  1. 31 13
      EVSE/Projects/DD360/Apps/CSU/Ethernet.c
  2. 38 24
      EVSE/Projects/DD360/Apps/CSU/Primary.c
  3. 1 1
      EVSE/Projects/DD360/Apps/CSU/RFID.c
  4. 1 1
      EVSE/Projects/DD360/Apps/CSU/SelfTest.c
  5. 1 1
      EVSE/Projects/DD360/Apps/CSU/UpgradeFW.c
  6. 71 64
      EVSE/Projects/DD360/Apps/CSU/main.c
  7. 11 5
      EVSE/Projects/DD360/Apps/ModuleDoComm/DoComm.c
  8. 8 0
      EVSE/Projects/DD360/Apps/Script/replaceOtherDD360Project.sh
  9. 1 1
      EVSE/Projects/DD360/Apps/SelectGun/SelectGun.c
  10. 46 29
      EVSE/Projects/DD360/Apps/main.c
  11. 31 13
      EVSE/Projects/DD360Audi/Apps/CSU/Ethernet.c
  12. 38 24
      EVSE/Projects/DD360Audi/Apps/CSU/Primary.c
  13. 1 1
      EVSE/Projects/DD360Audi/Apps/CSU/RFID.c
  14. 1 1
      EVSE/Projects/DD360Audi/Apps/CSU/SelfTest.c
  15. 1 1
      EVSE/Projects/DD360Audi/Apps/CSU/UpgradeFW.c
  16. 71 64
      EVSE/Projects/DD360Audi/Apps/CSU/main.c
  17. 11 5
      EVSE/Projects/DD360Audi/Apps/ModuleDoComm/DoComm.c
  18. 8 0
      EVSE/Projects/DD360Audi/Apps/Script/replaceOtherDD360Project.sh
  19. 1 1
      EVSE/Projects/DD360Audi/Apps/SelectGun/SelectGun.c
  20. 46 29
      EVSE/Projects/DD360Audi/Apps/main.c
  21. BIN
      EVSE/Projects/DD360Audi/Images/ramdisk.gz
  22. BIN
      EVSE/Projects/DD360Audi/output/Module_DoComm
  23. BIN
      EVSE/Projects/DD360Audi/output/main
  24. 31 13
      EVSE/Projects/DD360ComBox/Apps/CSU/Ethernet.c
  25. 38 24
      EVSE/Projects/DD360ComBox/Apps/CSU/Primary.c
  26. 1 1
      EVSE/Projects/DD360ComBox/Apps/CSU/RFID.c
  27. 1 1
      EVSE/Projects/DD360ComBox/Apps/CSU/SelfTest.c
  28. 1 1
      EVSE/Projects/DD360ComBox/Apps/CSU/UpgradeFW.c
  29. 71 64
      EVSE/Projects/DD360ComBox/Apps/CSU/main.c
  30. 11 5
      EVSE/Projects/DD360ComBox/Apps/ModuleDoComm/DoComm.c
  31. 8 0
      EVSE/Projects/DD360ComBox/Apps/Script/replaceOtherDD360Project.sh
  32. 1 1
      EVSE/Projects/DD360ComBox/Apps/SelectGun/SelectGun.c
  33. 46 29
      EVSE/Projects/DD360ComBox/Apps/main.c
  34. BIN
      EVSE/Projects/DD360ComBox/Images/ramdisk.gz
  35. BIN
      EVSE/Projects/DD360ComBox/output/Module_DoComm
  36. BIN
      EVSE/Projects/DD360ComBox/output/Module_EvComm
  37. BIN
      EVSE/Projects/DD360ComBox/output/Module_EventLogging
  38. BIN
      EVSE/Projects/DD360ComBox/output/Module_InternalComm
  39. BIN
      EVSE/Projects/DD360ComBox/output/Module_LcmControl
  40. BIN
      EVSE/Projects/DD360ComBox/output/Module_PrimaryComm
  41. BIN
      EVSE/Projects/DD360ComBox/output/ReadCmdline
  42. BIN
      EVSE/Projects/DD360ComBox/output/main

+ 31 - 13
EVSE/Projects/DD360/Apps/CSU/Ethernet.c

@@ -11,6 +11,18 @@
 #include "../common.h"
 
 //------------------------------------------------------------------------------
+static void InitialDHCP(void)
+{
+    char tmpbuf[256] = {0};
+    struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
+
+    system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+    sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &",
+            pSysConfig->SystemId);
+
+    system(tmpbuf);
+}
+
 void GetMacAddress(void)
 {
     uint8_t index = 0;
@@ -70,10 +82,12 @@ static int isRouteFail(void)
 static int isReachableInternet(void)
 {
     int result = FAIL;
+    int idx = 0;
     FILE *fp;
-    char cmd[256];
-    char buf[512];
-    char tmp[512];
+    char cmd[256] = {0};
+    char buf[512] = {0};
+    char tmp[512] = {0};
+    char *valid_Internet[2] = {"8.8.8.8", "180.76.76.76"};
     struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
     struct AlarmCodeData *pAlarmCode = (struct AlarmCodeData *)GetShmAlarmCodeData();
 
@@ -100,9 +114,12 @@ static int isReachableInternet(void)
     } else {
         result = PASS;
     }
-#else
+
+    return result;
+#endif //defined DD360 || defined DD360Audi
+
     memset(buf, 0x00, sizeof(buf));
-    for (int idx = 0; idx < ARRAY_SIZE(valid_Internet); idx++) {
+    for (idx = 0; idx < ARRAY_SIZE(valid_Internet); idx++) {
         sprintf(cmd, "ping -c 1 -w 3 -I eth0 %s", valid_Internet[idx]);
         fp = popen(cmd, "r");
         if (fp != NULL) {
@@ -122,20 +139,18 @@ static int isReachableInternet(void)
         pclose(fp);
     }
 
-#endif //defined DD360 || defined DD360Audi
-
     return result;
 }
 
 void InitEthernet(void)
 {
     char tmpbuf[256];
-#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     bool ethResult = false;
     uint8_t cnt_pingDNS_Fail = 0;
-#endif //!defined DD360 && !defined DD360Audi
 
     struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
+    struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
+    struct InfoCodeData *pInfoCode = (struct InfoCodeData *)GetShmInfoCodeData();
 
     system("ifconfig eth0 down");// eth0 down
     system("ifconfig eth1 down");// eth1 down
@@ -144,6 +159,7 @@ void InitEthernet(void)
     // /sbin/ifconfig eth0 192.168.1.10 netmask 255.255.255.0 down
     system("echo 1 > /sys/class/gpio/gpio110/value");//reset PHY
     sleep(2);
+
     //Init Eth0 for internet
     memset(tmpbuf, 0, 256);
     sprintf(tmpbuf, "/sbin/ifconfig eth0 %s netmask %s up",
@@ -187,7 +203,12 @@ void InitEthernet(void)
     if (pid == 0) {
         log_info("InitEthernet = %d\r\n", pid);
         for (;;) {
-#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
+#if defined DD360 || defined DD360Audi || defined DD360ComBox
+            isReachableInternet();
+            sleep(5);
+            continue;
+#endif //!defined DD360 && !defined DD360
+
             if (isRouteFail()) {
                 //log_info("eth0 not in route, restart eht0. \n");
                 system("/sbin/ifconfig eth0 down;/sbin/ifconfig eth0 up");
@@ -266,9 +287,6 @@ void InitEthernet(void)
             }
 
             pSysInfo->InternetConn = ethResult;
-#else
-            isReachableInternet();
-#endif //!defined DD360 && !defined DD360
 
             sleep(5);
         }

+ 38 - 24
EVSE/Projects/DD360/Apps/CSU/Primary.c

@@ -9,7 +9,7 @@
 #include "../ShareMemory/shmMem.h"
 
 #include "../SelectGun/SelectGun.h"
-#include "../main.h"
+#include "main.h"
 
 //------------------------------------------------------------------------------
 
@@ -22,10 +22,16 @@ static uint8_t checkCabinetEthConnectState(LedConfig *ledConfig)
 
     if (pAlarmCode->AlarmEvents.bits.DisconnectedFromDo == YES) {
         ret = YES;
-        if (pLedConfig->RedLED == YES) {
+        if (pLedConfig->RedLED == YES ||
+                pLedConfig->YellowLED == YES ||
+                pLedConfig->GreenLED == YES) {
             pLedConfig->RedLED = NO;
+            pLedConfig->YellowLED = NO;
+            pLedConfig->GreenLED = NO;
         } else {
             pLedConfig->RedLED = YES;
+            pLedConfig->YellowLED = YES;
+            pLedConfig->GreenLED = YES;
         }
     }
 
@@ -55,6 +61,16 @@ void PrimaryLedIndicatorCtrlFork(void)
             for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
                 pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
 
+                if (pSysWarning->Level == 2) {
+                    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                        continue;
+                    }
+
+                    pLedConfig->YellowLED = NO;
+                    pLedConfig->GreenLED = NO;
+                    pLedConfig->RedLED = YES;
+                }
+
                 //printf("led indicator status = %d\r\n", chargingInfo[gunIndex]->SystemStatus);
                 //printf("level = %d\r\n", pSysWarning->Level);
                 switch (pDcChargingInfo->SystemStatus) {
@@ -127,32 +143,31 @@ void PrimaryLedIndicatorCtrlFork(void)
 
                 case S_TERMINATING:
                 case S_COMPLETE:
-                    if (pSysWarning->Level == 2) {
-                        pLedConfig->YellowLED = NO;
-                        pLedConfig->GreenLED = NO;
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    } else {
-                        pLedConfig->RedLED = NO;
-                        pLedConfig->YellowLED = YES;
-                        pLedConfig->GreenLED = NO;
-                    }
+                    //if (pSysWarning->Level == 2) {
+                    //    pLedConfig->YellowLED = NO;
+                    //    pLedConfig->GreenLED = NO;
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //} else {
+                    pLedConfig->RedLED = NO;
+                    pLedConfig->YellowLED = YES;
+                    pLedConfig->GreenLED = NO;
+                    //}
                     break;
 
                 case S_MAINTAIN:
                 case S_FAULT:
                     pLedConfig->YellowLED = NO;
                     pLedConfig->GreenLED = NO;
-                    if (pSysWarning->Level == 2) {
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    }
+                    pLedConfig->RedLED = YES;
+                    //if (pSysWarning->Level == 2) {
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //}
                     break;
 
                 case S_BOOKING:
@@ -161,10 +176,9 @@ void PrimaryLedIndicatorCtrlFork(void)
                 case S_NONE:
                     break;
                 }
-
-                usleep(500000);
             }//switch
         }//for
+        usleep(500000);
     }//while
 }
 

+ 1 - 1
EVSE/Projects/DD360/Apps/CSU/RFID.c

@@ -9,7 +9,7 @@
 #include "../ShareMemory/shmMem.h"
 #include "../SelectGun/SelectGun.h"
 
-#include "../main.h"
+#include "main.h"
 #include "../timeout.h"
 
 //------------------------------------------------------------------------------

+ 1 - 1
EVSE/Projects/DD360/Apps/CSU/SelfTest.c

@@ -8,7 +8,7 @@
 #include "../Define/define.h"
 #include "../ShareMemory/shmMem.h"
 
-#include "../main.h"
+#include "main.h"
 #include "../timeout.h"
 
 //------------------------------------------------------------------------------

+ 1 - 1
EVSE/Projects/DD360/Apps/CSU/UpgradeFW.c

@@ -11,7 +11,7 @@
 #include "../Define/define.h"
 #include "../ShareMemory/shmMem.h"
 
-#include "../main.h"
+#include "main.h"
 
 //------------------------------------------------------------------------------
 static char *_priPortName = "/dev/ttyS1";

+ 71 - 64
EVSE/Projects/DD360/Apps/CSU/main.c

@@ -27,21 +27,20 @@
 #include <ctype.h>
 #include <ifaddrs.h>
 #include <math.h>
-#include "./Define/define.h"
 #include <stdbool.h>
 #include <dirent.h>
 
-#include "Config.h"
+#include "../Config.h"
 #include "main.h"
-#include "common.h"
-#include "timeout.h"
+#include "../common.h"
+#include "../timeout.h"
 
-#include "./Log/log.h"
-#include "./Define/define.h"
-#include "./ShareMemory/shmMem.h"
+#include "../Log/log.h"
+#include "../Define/define.h"
+#include "../ShareMemory/shmMem.h"
 
 #if defined DD360 ||defined DD360Audi || defined DD360ComBox
-#include "./SelectGun/SelectGun.h"
+#include "../SelectGun/SelectGun.h"
 #endif //defined DD360Audi
 
 //------------------------------------------------------------------------------
@@ -81,7 +80,7 @@ struct timeb startChargingTime[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 struct timeb endChargingTime[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 
 #if defined DD360 ||defined DD360Audi || defined DD360ComBox
-static SelectGunInfo             *gAudiCustInfo = NULL; //Jerry add
+static SelectGunInfo             *ShmSelectGunInfo = NULL; //Jerry add
 #endif //defined DD360Audi
 static EvBoardErrMsg gEvBoardErr = {0};
 
@@ -198,14 +197,14 @@ void destroySelGun(uint8_t curGun)
 
     //for status timeout
     if (curGun == DESTROY_ALL_SEL) {
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
         log_info("destroy all gun = %d, %d\r\n",
-                 gAudiCustInfo->SelGunInfo.LeftGun,
-                 gAudiCustInfo->SelGunInfo.RightGun);
+                 ShmSelectGunInfo->SelGunInfo.LeftGun,
+                 ShmSelectGunInfo->SelGunInfo.RightGun);
         for (i = 0; i < totalGun; i++) {
             StopGunInfoTimeoutDet(i);
-            memset(&gAudiCustInfo->PricesInfo[i], 0, sizeof(PricesInfo));
+            memset(&ShmSelectGunInfo->PricesInfo[i], 0, sizeof(PricesInfo));
         }
         pSysInfo->CurGunSelected = 0;
         strcpy((char *)pSysConfig->UserId, "");
@@ -214,12 +213,12 @@ void destroySelGun(uint8_t curGun)
     }
 
     //for charging timeout or complete
-    if ((curGun == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun != SEL_GUN_RELEASE)) {
-        if (gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM ||
-                gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR) {
+    if ((curGun == LEFT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.LeftGun != SEL_GUN_RELEASE)) {
+        if (ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM ||
+                ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR) {
             changeLcmPage(_LCM_SELECT_GUN);
         }
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
         StopGunInfoTimeoutDet(LEFT_GUN_NUM);
         if (ShmOCPP16Data->SpMsg.bits.AuthorizeConf != NO) {
             ClearAuthorizedFlag();
@@ -228,17 +227,17 @@ void destroySelGun(uint8_t curGun)
         log_info("destroy left gun, cur page = %d\r\n", getCurLcmPage());
         if (getCurLcmPage() == pSysInfo->SystemPage) {
             log_info("clear left balance\r\n");
-            memset(&gAudiCustInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
-            gAudiCustInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
+            memset(&ShmSelectGunInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
+            ShmSelectGunInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
         }
     }
 
-    if ((curGun == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun != SEL_GUN_RELEASE)) {
-        if (gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM ||
-                gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR) {
+    if ((curGun == RIGHT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.RightGun != SEL_GUN_RELEASE)) {
+        if (ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM ||
+                ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR) {
             changeLcmPage(_LCM_SELECT_GUN);
         }
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
         StopGunInfoTimeoutDet(RIGHT_GUN_NUM);
         if (ShmOCPP16Data->SpMsg.bits.AuthorizeConf != NO) {
             ClearAuthorizedFlag();
@@ -247,8 +246,8 @@ void destroySelGun(uint8_t curGun)
         log_info("destroy right gun, cur page = %d\r\n", getCurLcmPage());
         if (getCurLcmPage() == pSysInfo->SystemPage) {
             log_info("clear right balance\r\n");
-            memset(&gAudiCustInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
-            gAudiCustInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
+            memset(&ShmSelectGunInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
+            ShmSelectGunInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
         }
     }
 }
@@ -259,7 +258,7 @@ static int waitRightGunPlugIt(uint8_t curGun)
     return;
 #endif //!defined DD360Audi
 
-    if ((curGun == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR)) {
+    if ((curGun == RIGHT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR)) {
         return PASS;
     }
 
@@ -272,7 +271,7 @@ static int waitLeftGunPlugIt(uint8_t curGun)
     return;
 #endif //!defined DD360Audi
 
-    if ((curGun == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR)) {
+    if ((curGun == LEFT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR)) {
         return PASS;
     }
 
@@ -285,12 +284,12 @@ void setSelGunWaitToAuthor(uint8_t curSel)
     return;
 #endif //!defined DD360Audi
 
-    if (curSel == LEFT_GUN_NUM && gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM) {
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_ATHOR;
+    if (curSel == LEFT_GUN_NUM && ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM) {
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_ATHOR;
         //printf("setSelGunWaitToAuthor left\r\n");
         StopGunInfoTimeoutDet(curSel);
-    } else if (curSel == RIGHT_GUN_NUM && gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM) {
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_ATHOR;
+    } else if (curSel == RIGHT_GUN_NUM && ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM) {
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_ATHOR;
         //printf("setSelGunWaitToAuthor right\r\n");
         StopGunInfoTimeoutDet(curSel);
     }
@@ -302,8 +301,8 @@ int getConfirmSelectedGun(uint8_t curSel)
     return;
 #endif //!defined DD360Audi
 
-    if (((curSel == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun >= SEL_GUN_CONFIRM)) ||
-            ((curSel == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun >= SEL_GUN_CONFIRM))) {
+    if (((curSel == LEFT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.LeftGun >= SEL_GUN_CONFIRM)) ||
+            ((curSel == RIGHT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.RightGun >= SEL_GUN_CONFIRM))) {
         return PASS;
     }
 
@@ -317,11 +316,11 @@ void confirmSelGun(uint8_t selGun)
 #endif //!defined DD360Audi
 
     if (selGun == LEFT_GUN_NUM) {
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_CONFIRM;
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_CONFIRM;
         StopGunInfoTimeoutDet(selGun);
         //printf("confirmSelGun left\r\n");
     } else if (selGun == RIGHT_GUN_NUM) {
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_CONFIRM;
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_CONFIRM;
         StopGunInfoTimeoutDet(selGun);
         //printf("confirmSelGun right\r\n");
     }
@@ -2555,7 +2554,7 @@ void _AuthorizedTimeout()
         //isCardScan = false;
         SetIsCardScan(false);
 
-        //gAudiCustInfo->PricesInfo[pSysInfo->CurGunSelected].Balance = 0.0; //Jerry add
+        //ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance = 0.0; //Jerry add
         pSysInfo->SystemPage = _LCM_AUTHORIZ_FAIL;
         //ChangeLcmByIndex(_LCM_AUTHORIZ_FAIL);
         strcpy((char *)pSysConfig->UserId, "");
@@ -3879,7 +3878,7 @@ void ScannerCardProcess()
 #if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 || pSysConfig->OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING
 #else
-                && gAudiCustInfo->PricesInfo[pSysInfo->CurGunSelected].Balance != FAIL_BALANCE_PRICES
+                && ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance != FAIL_BALANCE_PRICES
 #endif //!defined DD360 && !defined DD360Audi
            ) {
             StopSystemTimeoutDet();
@@ -4691,8 +4690,8 @@ void StopGunInfoTimeoutDet(uint8_t gunIndex)
 void CheckConnectionTimeout(void)
 {
 #if defined DD360 || defined DD360Audi || defined DD360ComBox
-    if (gAudiCustInfo->RemoteSetup.ConnectionTimeout != 0) { //Jerry add
-        _connectionTimeout = gAudiCustInfo->RemoteSetup.ConnectionTimeout;
+    if (ShmSelectGunInfo->RemoteSetup.ConnectionTimeout != 0) { //Jerry add
+        _connectionTimeout = ShmSelectGunInfo->RemoteSetup.ConnectionTimeout;
     } else {
         _connectionTimeout = CONN_PLUG_TIME_OUT;
     }
@@ -4746,8 +4745,8 @@ void CreateTimeoutFork()
                     _AuthorizedTimeout();
                     StopSystemTimeoutDet();
                     destroySelGun(pSysInfo->CurGunSelected);
-                    if (gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
-                        gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
+                    if (ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
+                        ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
                         pAlarmCode->AlarmEvents.bits.DisconnectedFromDo = ABNORMAL;
                         log_error("Author timeout restart DoComm\r\n");
                         system("killall Module_DoComm");
@@ -4762,8 +4761,8 @@ void CreateTimeoutFork()
                     _AutoReturnTimeout();
                     StopSystemTimeoutDet();
                     destroySelGun(pSysInfo->CurGunSelected);
-                    if (gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
-                        gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
+                    if (ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
+                        ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
                         pAlarmCode->AlarmEvents.bits.DisconnectedFromDo = ABNORMAL;
                         log_error("Author timeout restart DoComm\r\n");
                         system("killall Module_DoComm");
@@ -5159,9 +5158,9 @@ bool WifiScheduleStop(uint8_t gunIndex)
 
 void OcppRemoteStartChk()
 {
-    if (pSysConfig->OfflinePolicy == _OFFLINE_POLICY_NO_CHARGING)
-    {}
-    else if (!isDetectPlugin()) {
+    if (pSysConfig->OfflinePolicy == _OFFLINE_POLICY_NO_CHARGING) {
+
+    } else if (!isDetectPlugin()) {
         // 如果有 AC 槍,則固定是第 2 把槍,所以索引固定為 1
         uint8_t acDirIndex = pSysConfig->AcConnectorCount;
 
@@ -5856,6 +5855,7 @@ void CheckTask()
     }
 }
 
+/*
 void InitialDHCP()
 {
     char tmpbuf[256] = {0};
@@ -5865,6 +5865,7 @@ void InitialDHCP()
             pSysConfig->SystemId);
     system(tmpbuf);
 }
+*/
 
 //==========================================
 // Check Smart Charging Profile
@@ -5981,14 +5982,20 @@ void CheckReturnToChargingConn()
 
             // 如果選的 DC 槍在充電~ 則 DC 槍不改變
             if (count == pSysInfo->CurGunSelected) {
-                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK && pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
-                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)) {
+                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK &&
+                        pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
+                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 &&
+                         pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)
+                   ) {
                     isReturnTimeout = false;
                     break;
                 }
             } else if (count != pSysInfo->CurGunSelected) {
-                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK && pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
-                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)) {
+                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK &&
+                        pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
+                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 &&
+                         pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)
+                   ) {
                     isReturnTimeout = true;
                     StartSystemTimeoutDet(Timeout_ReturnToChargingGunDet);
                 }
@@ -6099,15 +6106,15 @@ void AdjustChargerCurrent()
         pSysConfig->MaxChargingCurrent = 0;
     }
 
-    log_info ("PSU : MaxChargingPower = %d, MaxChargingCurrent = %d",
-              ShmPsuData->SystemAvailablePower / 10,
-              ShmPsuData->SystemAvailableCurrent / 10
-             );
+    log_info("PSU : MaxChargingPower = %d, MaxChargingCurrent = %d",
+             ShmPsuData->SystemAvailablePower / 10,
+             ShmPsuData->SystemAvailableCurrent / 10
+            );
 
-    log_info ("Config : ChargingPower = %d, ChargingCurrent = %d",
-              pSysConfig->MaxChargingPower,
-              pSysConfig->MaxChargingCurrent
-             );
+    log_info("Config : ChargingPower = %d, ChargingCurrent = %d",
+             pSysConfig->MaxChargingPower,
+             pSysConfig->MaxChargingCurrent
+            );
 }
 
 void ResetDetAlarmStatus(uint8_t gun)
@@ -6299,7 +6306,7 @@ int main(void)
     ShmLedModuleData = (struct LedModuleData *)GetShmLedModuleData();
     ShmOCPP16Data = (struct OCPP16Data *)GetShmOCPP16Data();
     ShmDcCommonData = (DcCommonInfo *)GetShmDcCommonData();
-    gAudiCustInfo = (SelectGunInfo *)GetShmSelectGunInfo();
+    ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
 
     log_info(" ****************  FileSystem Boot up ***************\n");
     if (!InitialSystemDefaultConfig()) {
@@ -6506,12 +6513,12 @@ int main(void)
                     strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "");
 
                     //Jerry add
-                    memset(&gAudiCustInfo->PricesInfo[gun_index], 0, sizeof(PricesInfo));
-                    gAudiCustInfo->PricesInfo[gun_index].Balance = FAIL_BALANCE_PRICES;
+                    memset(&ShmSelectGunInfo->PricesInfo[gun_index], 0, sizeof(PricesInfo));
+                    ShmSelectGunInfo->PricesInfo[gun_index].Balance = FAIL_BALANCE_PRICES;
                     destroySelGun(gun_index);
                     ResetDetAlarmStatus(gun_index); //recovery OVP status code
-                    if (gAudiCustInfo->AuthorStateFromCabinet[gun_index] == YES) {
-                        gAudiCustInfo->AuthorStateFromCabinet[gun_index] = NO;
+                    if (ShmSelectGunInfo->AuthorStateFromCabinet[gun_index] == YES) {
+                        ShmSelectGunInfo->AuthorStateFromCabinet[gun_index] = NO;
                     }
                     //strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode, "");
                 }

+ 11 - 5
EVSE/Projects/DD360/Apps/ModuleDoComm/DoComm.c

@@ -1377,8 +1377,11 @@ static int writeConnectorState(int fd, uint8_t plugNum, uint8_t id)
 
     if (ChargingData[plugNum]->SystemStatus <= S_AUTHORIZING) {
         pConnState->State = CONN_ST_IDLE;    //idle
-        strcpy((char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode, "");
-        strcpy(&vendorErrorCodeTmp[plugNum][0], "");
+        strncpy((char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
+                "",
+                sizeof(ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode));
+
+        strncpy(&vendorErrorCodeTmp[plugNum][0], "", WARNING_CODE_SIZE);
     } else if ((ChargingData[plugNum]->SystemStatus <= S_PREPARING_FOR_EVSE) ||
                (ChargingData[plugNum]->SystemStatus == S_CCS_PRECHARGE_ST0) ||
                (ChargingData[plugNum]->SystemStatus == S_CCS_PRECHARGE_ST1)) {
@@ -1390,9 +1393,11 @@ static int writeConnectorState(int fd, uint8_t plugNum, uint8_t id)
     } else if ((ChargingData[plugNum]->SystemStatus == S_ALARM) ||
                (ChargingData[plugNum]->SystemStatus == S_FAULT)) {
         pConnState->State = CONN_ST_ALARM;
-        strncpy((char *)pConnState->WarningCode, (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode, WARNING_CODE_SIZE);
+        strncpy((char *)pConnState->WarningCode,
+                (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
+                WARNING_CODE_SIZE);
 
-        if (strcmp(&vendorErrorCodeTmp[plugNum][0], "") == 0) {
+        if (strncmp(&vendorErrorCodeTmp[plugNum][0], "", WARNING_CODE_SIZE) == 0) {
             strncpy(&vendorErrorCodeTmp[plugNum][0],
                     (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
                     WARNING_CODE_SIZE);
@@ -2243,7 +2248,8 @@ int main(int argc, char *argv[])
 
 
             if (ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient == 0) {
-                sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &",
+                sprintf(tmpbuf,
+                        "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &",
                         ShmSysConfigAndInfo->SysConfig.SystemId);
                 system(tmpbuf);
             }

+ 8 - 0
EVSE/Projects/DD360/Apps/Script/replaceOtherDD360Project.sh

@@ -1,5 +1,12 @@
 #/bin/bash
 
+# Absolute path to this script, e.g. /home/user/bin/foo.sh
+SCRIPT=$(readlink -f "$0")
+
+# Absolute path this script is in, thus /home/user/bin
+SCRIPTPATH=$(dirname "$SCRIPT")
+echo $SCRIPTPATH
+
 ProjectPath="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects"
 
 rm -rf $ProjectPath/DD360/Apps/;
@@ -13,3 +20,4 @@ cp -r  $ProjectPath/DD360Audi/ModelNameList.txt  $ProjectPath/DD360ComBox/ModelN
 git add $ProjectPath/DD360;
 git add $ProjectPath/DD360Audi;
 git add $ProjectPath/DD360ComBox;
+git status;

+ 1 - 1
EVSE/Projects/DD360/Apps/SelectGun/SelectGun.c

@@ -9,7 +9,7 @@
 #include "../Define/define.h"
 #include "../ShareMemory/shmMem.h"
 #include "../timeout.h"
-#include "../main.h"
+#include "../CSU/main.h"
 
 #include "SelectGun.h"
 

+ 46 - 29
EVSE/Projects/DD360/Apps/main.c

@@ -266,7 +266,7 @@ static void destroySelGun(uint8_t curGun)
 static int waitRightGunPlugIt(uint8_t curGun)
 {
 #if !defined DD360Audi
-    return;
+    return PASS;
 #endif //!defined DD360Audi
 
     if ((curGun == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR)) {
@@ -279,7 +279,7 @@ static int waitRightGunPlugIt(uint8_t curGun)
 static int waitLeftGunPlugIt(uint8_t curGun)
 {
 #if !defined DD360Audi
-    return;
+    return PASS;
 #endif //!defined DD360Audi
 
     if ((curGun == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR)) {
@@ -309,7 +309,7 @@ static void setSelGunWaitToAuthor(uint8_t curSel)
 static int getConfirmSelectedGun(uint8_t curSel)
 {
 #if !defined DD360Audi
-    return;
+    return PASS;
 #endif //!defined DD360Audi
 
     if (((curSel == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun >= SEL_GUN_CONFIRM)) ||
@@ -602,9 +602,15 @@ static uint8_t checkCabinetEthConnectState(LedConfig *ledConfig)
 
     if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.DisconnectedFromDo == YES) {
         ret = YES;
-        if (pLedConfig->RedLED == YES) {
+        if (pLedConfig->RedLED == YES ||
+                pLedConfig->YellowLED == YES ||
+                pLedConfig->GreenLED == YES) {
+            pLedConfig->YellowLED = NO;
+            pLedConfig->GreenLED = NO;
             pLedConfig->RedLED = NO;
         } else {
+            pLedConfig->YellowLED = YES;
+            pLedConfig->GreenLED = YES;
             pLedConfig->RedLED = YES;
         }
     }
@@ -612,7 +618,7 @@ static uint8_t checkCabinetEthConnectState(LedConfig *ledConfig)
     return ret;
 }
 
-static void startPrimaryLedIndicatorCtrlFork(void)
+static void PrimaryLedIndicatorCtrlFork(void)
 {
 #if !defined DD360ComBox
     return;
@@ -625,10 +631,21 @@ static void startPrimaryLedIndicatorCtrlFork(void)
         int isContinue = 1;
         LedConfig *pLedConfig = (LedConfig *)&ShmPrimaryMcuData->OutputDrv.OutputDrvValue[0];
 
+
         while (isContinue) {
             for (gunIndex = 0; gunIndex < totalGun; gunIndex++) {
+                if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
+                    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                        continue;
+                    }
+
+                    pLedConfig->YellowLED = NO;
+                    pLedConfig->GreenLED = NO;
+                    pLedConfig->RedLED = YES;
+                }
+
                 //printf("led indicator status = %d\r\n", chargingInfo[gunIndex]->SystemStatus);
-                //printf("level = %d\r\n", ShmSysConfigAndInfo->SysWarningInfo.Level);
+                //printf("level = %d\r\n", pSysWarning->Level);
                 switch (chargingInfo[gunIndex]->SystemStatus) {
                 case S_BOOTING:
                     if (ShmSysConfigAndInfo->SysInfo.SelfTestSeq == _STEST_COMPLETE) {
@@ -699,32 +716,31 @@ static void startPrimaryLedIndicatorCtrlFork(void)
 
                 case S_TERMINATING:
                 case S_COMPLETE:
-                    if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
-                        pLedConfig->YellowLED = NO;
-                        pLedConfig->GreenLED = NO;
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    } else {
-                        pLedConfig->RedLED = NO;
-                        pLedConfig->YellowLED = YES;
-                        pLedConfig->GreenLED = NO;
-                    }
+                    //if (pSysWarning->Level == 2) {
+                    //    pLedConfig->YellowLED = NO;
+                    //    pLedConfig->GreenLED = NO;
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //} else {
+                    pLedConfig->RedLED = NO;
+                    pLedConfig->YellowLED = YES;
+                    pLedConfig->GreenLED = NO;
+                    //}
                     break;
 
                 case S_MAINTAIN:
                 case S_FAULT:
                     pLedConfig->YellowLED = NO;
                     pLedConfig->GreenLED = NO;
-                    if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    }
+                    pLedConfig->RedLED = YES;
+                    //if (pSysWarning->Level == 2) {
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //}
                     break;
 
                 case S_BOOKING:
@@ -733,10 +749,9 @@ static void startPrimaryLedIndicatorCtrlFork(void)
                 case S_NONE:
                     break;
                 }
-
-                usleep(500000);
             }//switch
         }//for
+        usleep(500000);
     }//while
 }
 
@@ -3151,7 +3166,9 @@ void ChkPrimaryStatus()
                 if (isDetectPlugin()) {
                     _DetectPlugInTimeout();
                     StopSystemTimeoutDet();
+#if defined DD360Audi
                     destroySelGun(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
+#endif //defined DD360Audi
                 }
 #if defined DD360Audi
                 else {
@@ -6029,7 +6046,7 @@ int main(void)
     }
     CreateTimeoutFork();
     log_info("Start self test... \n");
-    startPrimaryLedIndicatorCtrlFork();
+    PrimaryLedIndicatorCtrlFork();
     SelfTestRun();
     StopSystemTimeoutDet();
     log_info("Self test finished : SelfTestSeq = %d, Work_Step = %d ",

+ 31 - 13
EVSE/Projects/DD360Audi/Apps/CSU/Ethernet.c

@@ -11,6 +11,18 @@
 #include "../common.h"
 
 //------------------------------------------------------------------------------
+static void InitialDHCP(void)
+{
+    char tmpbuf[256] = {0};
+    struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
+
+    system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+    sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &",
+            pSysConfig->SystemId);
+
+    system(tmpbuf);
+}
+
 void GetMacAddress(void)
 {
     uint8_t index = 0;
@@ -70,10 +82,12 @@ static int isRouteFail(void)
 static int isReachableInternet(void)
 {
     int result = FAIL;
+    int idx = 0;
     FILE *fp;
-    char cmd[256];
-    char buf[512];
-    char tmp[512];
+    char cmd[256] = {0};
+    char buf[512] = {0};
+    char tmp[512] = {0};
+    char *valid_Internet[2] = {"8.8.8.8", "180.76.76.76"};
     struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
     struct AlarmCodeData *pAlarmCode = (struct AlarmCodeData *)GetShmAlarmCodeData();
 
@@ -100,9 +114,12 @@ static int isReachableInternet(void)
     } else {
         result = PASS;
     }
-#else
+
+    return result;
+#endif //defined DD360 || defined DD360Audi
+
     memset(buf, 0x00, sizeof(buf));
-    for (int idx = 0; idx < ARRAY_SIZE(valid_Internet); idx++) {
+    for (idx = 0; idx < ARRAY_SIZE(valid_Internet); idx++) {
         sprintf(cmd, "ping -c 1 -w 3 -I eth0 %s", valid_Internet[idx]);
         fp = popen(cmd, "r");
         if (fp != NULL) {
@@ -122,20 +139,18 @@ static int isReachableInternet(void)
         pclose(fp);
     }
 
-#endif //defined DD360 || defined DD360Audi
-
     return result;
 }
 
 void InitEthernet(void)
 {
     char tmpbuf[256];
-#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     bool ethResult = false;
     uint8_t cnt_pingDNS_Fail = 0;
-#endif //!defined DD360 && !defined DD360Audi
 
     struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
+    struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
+    struct InfoCodeData *pInfoCode = (struct InfoCodeData *)GetShmInfoCodeData();
 
     system("ifconfig eth0 down");// eth0 down
     system("ifconfig eth1 down");// eth1 down
@@ -144,6 +159,7 @@ void InitEthernet(void)
     // /sbin/ifconfig eth0 192.168.1.10 netmask 255.255.255.0 down
     system("echo 1 > /sys/class/gpio/gpio110/value");//reset PHY
     sleep(2);
+
     //Init Eth0 for internet
     memset(tmpbuf, 0, 256);
     sprintf(tmpbuf, "/sbin/ifconfig eth0 %s netmask %s up",
@@ -187,7 +203,12 @@ void InitEthernet(void)
     if (pid == 0) {
         log_info("InitEthernet = %d\r\n", pid);
         for (;;) {
-#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
+#if defined DD360 || defined DD360Audi || defined DD360ComBox
+            isReachableInternet();
+            sleep(5);
+            continue;
+#endif //!defined DD360 && !defined DD360
+
             if (isRouteFail()) {
                 //log_info("eth0 not in route, restart eht0. \n");
                 system("/sbin/ifconfig eth0 down;/sbin/ifconfig eth0 up");
@@ -266,9 +287,6 @@ void InitEthernet(void)
             }
 
             pSysInfo->InternetConn = ethResult;
-#else
-            isReachableInternet();
-#endif //!defined DD360 && !defined DD360
 
             sleep(5);
         }

+ 38 - 24
EVSE/Projects/DD360Audi/Apps/CSU/Primary.c

@@ -9,7 +9,7 @@
 #include "../ShareMemory/shmMem.h"
 
 #include "../SelectGun/SelectGun.h"
-#include "../main.h"
+#include "main.h"
 
 //------------------------------------------------------------------------------
 
@@ -22,10 +22,16 @@ static uint8_t checkCabinetEthConnectState(LedConfig *ledConfig)
 
     if (pAlarmCode->AlarmEvents.bits.DisconnectedFromDo == YES) {
         ret = YES;
-        if (pLedConfig->RedLED == YES) {
+        if (pLedConfig->RedLED == YES ||
+                pLedConfig->YellowLED == YES ||
+                pLedConfig->GreenLED == YES) {
             pLedConfig->RedLED = NO;
+            pLedConfig->YellowLED = NO;
+            pLedConfig->GreenLED = NO;
         } else {
             pLedConfig->RedLED = YES;
+            pLedConfig->YellowLED = YES;
+            pLedConfig->GreenLED = YES;
         }
     }
 
@@ -55,6 +61,16 @@ void PrimaryLedIndicatorCtrlFork(void)
             for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
                 pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
 
+                if (pSysWarning->Level == 2) {
+                    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                        continue;
+                    }
+
+                    pLedConfig->YellowLED = NO;
+                    pLedConfig->GreenLED = NO;
+                    pLedConfig->RedLED = YES;
+                }
+
                 //printf("led indicator status = %d\r\n", chargingInfo[gunIndex]->SystemStatus);
                 //printf("level = %d\r\n", pSysWarning->Level);
                 switch (pDcChargingInfo->SystemStatus) {
@@ -127,32 +143,31 @@ void PrimaryLedIndicatorCtrlFork(void)
 
                 case S_TERMINATING:
                 case S_COMPLETE:
-                    if (pSysWarning->Level == 2) {
-                        pLedConfig->YellowLED = NO;
-                        pLedConfig->GreenLED = NO;
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    } else {
-                        pLedConfig->RedLED = NO;
-                        pLedConfig->YellowLED = YES;
-                        pLedConfig->GreenLED = NO;
-                    }
+                    //if (pSysWarning->Level == 2) {
+                    //    pLedConfig->YellowLED = NO;
+                    //    pLedConfig->GreenLED = NO;
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //} else {
+                    pLedConfig->RedLED = NO;
+                    pLedConfig->YellowLED = YES;
+                    pLedConfig->GreenLED = NO;
+                    //}
                     break;
 
                 case S_MAINTAIN:
                 case S_FAULT:
                     pLedConfig->YellowLED = NO;
                     pLedConfig->GreenLED = NO;
-                    if (pSysWarning->Level == 2) {
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    }
+                    pLedConfig->RedLED = YES;
+                    //if (pSysWarning->Level == 2) {
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //}
                     break;
 
                 case S_BOOKING:
@@ -161,10 +176,9 @@ void PrimaryLedIndicatorCtrlFork(void)
                 case S_NONE:
                     break;
                 }
-
-                usleep(500000);
             }//switch
         }//for
+        usleep(500000);
     }//while
 }
 

+ 1 - 1
EVSE/Projects/DD360Audi/Apps/CSU/RFID.c

@@ -9,7 +9,7 @@
 #include "../ShareMemory/shmMem.h"
 #include "../SelectGun/SelectGun.h"
 
-#include "../main.h"
+#include "main.h"
 #include "../timeout.h"
 
 //------------------------------------------------------------------------------

+ 1 - 1
EVSE/Projects/DD360Audi/Apps/CSU/SelfTest.c

@@ -8,7 +8,7 @@
 #include "../Define/define.h"
 #include "../ShareMemory/shmMem.h"
 
-#include "../main.h"
+#include "main.h"
 #include "../timeout.h"
 
 //------------------------------------------------------------------------------

+ 1 - 1
EVSE/Projects/DD360Audi/Apps/CSU/UpgradeFW.c

@@ -11,7 +11,7 @@
 #include "../Define/define.h"
 #include "../ShareMemory/shmMem.h"
 
-#include "../main.h"
+#include "main.h"
 
 //------------------------------------------------------------------------------
 static char *_priPortName = "/dev/ttyS1";

+ 71 - 64
EVSE/Projects/DD360Audi/Apps/CSU/main.c

@@ -27,21 +27,20 @@
 #include <ctype.h>
 #include <ifaddrs.h>
 #include <math.h>
-#include "./Define/define.h"
 #include <stdbool.h>
 #include <dirent.h>
 
-#include "Config.h"
+#include "../Config.h"
 #include "main.h"
-#include "common.h"
-#include "timeout.h"
+#include "../common.h"
+#include "../timeout.h"
 
-#include "./Log/log.h"
-#include "./Define/define.h"
-#include "./ShareMemory/shmMem.h"
+#include "../Log/log.h"
+#include "../Define/define.h"
+#include "../ShareMemory/shmMem.h"
 
 #if defined DD360 ||defined DD360Audi || defined DD360ComBox
-#include "./SelectGun/SelectGun.h"
+#include "../SelectGun/SelectGun.h"
 #endif //defined DD360Audi
 
 //------------------------------------------------------------------------------
@@ -81,7 +80,7 @@ struct timeb startChargingTime[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 struct timeb endChargingTime[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 
 #if defined DD360 ||defined DD360Audi || defined DD360ComBox
-static SelectGunInfo             *gAudiCustInfo = NULL; //Jerry add
+static SelectGunInfo             *ShmSelectGunInfo = NULL; //Jerry add
 #endif //defined DD360Audi
 static EvBoardErrMsg gEvBoardErr = {0};
 
@@ -198,14 +197,14 @@ void destroySelGun(uint8_t curGun)
 
     //for status timeout
     if (curGun == DESTROY_ALL_SEL) {
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
         log_info("destroy all gun = %d, %d\r\n",
-                 gAudiCustInfo->SelGunInfo.LeftGun,
-                 gAudiCustInfo->SelGunInfo.RightGun);
+                 ShmSelectGunInfo->SelGunInfo.LeftGun,
+                 ShmSelectGunInfo->SelGunInfo.RightGun);
         for (i = 0; i < totalGun; i++) {
             StopGunInfoTimeoutDet(i);
-            memset(&gAudiCustInfo->PricesInfo[i], 0, sizeof(PricesInfo));
+            memset(&ShmSelectGunInfo->PricesInfo[i], 0, sizeof(PricesInfo));
         }
         pSysInfo->CurGunSelected = 0;
         strcpy((char *)pSysConfig->UserId, "");
@@ -214,12 +213,12 @@ void destroySelGun(uint8_t curGun)
     }
 
     //for charging timeout or complete
-    if ((curGun == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun != SEL_GUN_RELEASE)) {
-        if (gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM ||
-                gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR) {
+    if ((curGun == LEFT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.LeftGun != SEL_GUN_RELEASE)) {
+        if (ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM ||
+                ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR) {
             changeLcmPage(_LCM_SELECT_GUN);
         }
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
         StopGunInfoTimeoutDet(LEFT_GUN_NUM);
         if (ShmOCPP16Data->SpMsg.bits.AuthorizeConf != NO) {
             ClearAuthorizedFlag();
@@ -228,17 +227,17 @@ void destroySelGun(uint8_t curGun)
         log_info("destroy left gun, cur page = %d\r\n", getCurLcmPage());
         if (getCurLcmPage() == pSysInfo->SystemPage) {
             log_info("clear left balance\r\n");
-            memset(&gAudiCustInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
-            gAudiCustInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
+            memset(&ShmSelectGunInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
+            ShmSelectGunInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
         }
     }
 
-    if ((curGun == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun != SEL_GUN_RELEASE)) {
-        if (gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM ||
-                gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR) {
+    if ((curGun == RIGHT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.RightGun != SEL_GUN_RELEASE)) {
+        if (ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM ||
+                ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR) {
             changeLcmPage(_LCM_SELECT_GUN);
         }
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
         StopGunInfoTimeoutDet(RIGHT_GUN_NUM);
         if (ShmOCPP16Data->SpMsg.bits.AuthorizeConf != NO) {
             ClearAuthorizedFlag();
@@ -247,8 +246,8 @@ void destroySelGun(uint8_t curGun)
         log_info("destroy right gun, cur page = %d\r\n", getCurLcmPage());
         if (getCurLcmPage() == pSysInfo->SystemPage) {
             log_info("clear right balance\r\n");
-            memset(&gAudiCustInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
-            gAudiCustInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
+            memset(&ShmSelectGunInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
+            ShmSelectGunInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
         }
     }
 }
@@ -259,7 +258,7 @@ static int waitRightGunPlugIt(uint8_t curGun)
     return;
 #endif //!defined DD360Audi
 
-    if ((curGun == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR)) {
+    if ((curGun == RIGHT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR)) {
         return PASS;
     }
 
@@ -272,7 +271,7 @@ static int waitLeftGunPlugIt(uint8_t curGun)
     return;
 #endif //!defined DD360Audi
 
-    if ((curGun == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR)) {
+    if ((curGun == LEFT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR)) {
         return PASS;
     }
 
@@ -285,12 +284,12 @@ void setSelGunWaitToAuthor(uint8_t curSel)
     return;
 #endif //!defined DD360Audi
 
-    if (curSel == LEFT_GUN_NUM && gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM) {
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_ATHOR;
+    if (curSel == LEFT_GUN_NUM && ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM) {
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_ATHOR;
         //printf("setSelGunWaitToAuthor left\r\n");
         StopGunInfoTimeoutDet(curSel);
-    } else if (curSel == RIGHT_GUN_NUM && gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM) {
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_ATHOR;
+    } else if (curSel == RIGHT_GUN_NUM && ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM) {
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_ATHOR;
         //printf("setSelGunWaitToAuthor right\r\n");
         StopGunInfoTimeoutDet(curSel);
     }
@@ -302,8 +301,8 @@ int getConfirmSelectedGun(uint8_t curSel)
     return;
 #endif //!defined DD360Audi
 
-    if (((curSel == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun >= SEL_GUN_CONFIRM)) ||
-            ((curSel == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun >= SEL_GUN_CONFIRM))) {
+    if (((curSel == LEFT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.LeftGun >= SEL_GUN_CONFIRM)) ||
+            ((curSel == RIGHT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.RightGun >= SEL_GUN_CONFIRM))) {
         return PASS;
     }
 
@@ -317,11 +316,11 @@ void confirmSelGun(uint8_t selGun)
 #endif //!defined DD360Audi
 
     if (selGun == LEFT_GUN_NUM) {
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_CONFIRM;
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_CONFIRM;
         StopGunInfoTimeoutDet(selGun);
         //printf("confirmSelGun left\r\n");
     } else if (selGun == RIGHT_GUN_NUM) {
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_CONFIRM;
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_CONFIRM;
         StopGunInfoTimeoutDet(selGun);
         //printf("confirmSelGun right\r\n");
     }
@@ -2555,7 +2554,7 @@ void _AuthorizedTimeout()
         //isCardScan = false;
         SetIsCardScan(false);
 
-        //gAudiCustInfo->PricesInfo[pSysInfo->CurGunSelected].Balance = 0.0; //Jerry add
+        //ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance = 0.0; //Jerry add
         pSysInfo->SystemPage = _LCM_AUTHORIZ_FAIL;
         //ChangeLcmByIndex(_LCM_AUTHORIZ_FAIL);
         strcpy((char *)pSysConfig->UserId, "");
@@ -3879,7 +3878,7 @@ void ScannerCardProcess()
 #if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 || pSysConfig->OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING
 #else
-                && gAudiCustInfo->PricesInfo[pSysInfo->CurGunSelected].Balance != FAIL_BALANCE_PRICES
+                && ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance != FAIL_BALANCE_PRICES
 #endif //!defined DD360 && !defined DD360Audi
            ) {
             StopSystemTimeoutDet();
@@ -4691,8 +4690,8 @@ void StopGunInfoTimeoutDet(uint8_t gunIndex)
 void CheckConnectionTimeout(void)
 {
 #if defined DD360 || defined DD360Audi || defined DD360ComBox
-    if (gAudiCustInfo->RemoteSetup.ConnectionTimeout != 0) { //Jerry add
-        _connectionTimeout = gAudiCustInfo->RemoteSetup.ConnectionTimeout;
+    if (ShmSelectGunInfo->RemoteSetup.ConnectionTimeout != 0) { //Jerry add
+        _connectionTimeout = ShmSelectGunInfo->RemoteSetup.ConnectionTimeout;
     } else {
         _connectionTimeout = CONN_PLUG_TIME_OUT;
     }
@@ -4746,8 +4745,8 @@ void CreateTimeoutFork()
                     _AuthorizedTimeout();
                     StopSystemTimeoutDet();
                     destroySelGun(pSysInfo->CurGunSelected);
-                    if (gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
-                        gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
+                    if (ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
+                        ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
                         pAlarmCode->AlarmEvents.bits.DisconnectedFromDo = ABNORMAL;
                         log_error("Author timeout restart DoComm\r\n");
                         system("killall Module_DoComm");
@@ -4762,8 +4761,8 @@ void CreateTimeoutFork()
                     _AutoReturnTimeout();
                     StopSystemTimeoutDet();
                     destroySelGun(pSysInfo->CurGunSelected);
-                    if (gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
-                        gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
+                    if (ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
+                        ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
                         pAlarmCode->AlarmEvents.bits.DisconnectedFromDo = ABNORMAL;
                         log_error("Author timeout restart DoComm\r\n");
                         system("killall Module_DoComm");
@@ -5159,9 +5158,9 @@ bool WifiScheduleStop(uint8_t gunIndex)
 
 void OcppRemoteStartChk()
 {
-    if (pSysConfig->OfflinePolicy == _OFFLINE_POLICY_NO_CHARGING)
-    {}
-    else if (!isDetectPlugin()) {
+    if (pSysConfig->OfflinePolicy == _OFFLINE_POLICY_NO_CHARGING) {
+
+    } else if (!isDetectPlugin()) {
         // 如果有 AC 槍,則固定是第 2 把槍,所以索引固定為 1
         uint8_t acDirIndex = pSysConfig->AcConnectorCount;
 
@@ -5856,6 +5855,7 @@ void CheckTask()
     }
 }
 
+/*
 void InitialDHCP()
 {
     char tmpbuf[256] = {0};
@@ -5865,6 +5865,7 @@ void InitialDHCP()
             pSysConfig->SystemId);
     system(tmpbuf);
 }
+*/
 
 //==========================================
 // Check Smart Charging Profile
@@ -5981,14 +5982,20 @@ void CheckReturnToChargingConn()
 
             // 如果選的 DC 槍在充電~ 則 DC 槍不改變
             if (count == pSysInfo->CurGunSelected) {
-                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK && pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
-                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)) {
+                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK &&
+                        pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
+                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 &&
+                         pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)
+                   ) {
                     isReturnTimeout = false;
                     break;
                 }
             } else if (count != pSysInfo->CurGunSelected) {
-                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK && pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
-                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)) {
+                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK &&
+                        pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
+                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 &&
+                         pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)
+                   ) {
                     isReturnTimeout = true;
                     StartSystemTimeoutDet(Timeout_ReturnToChargingGunDet);
                 }
@@ -6099,15 +6106,15 @@ void AdjustChargerCurrent()
         pSysConfig->MaxChargingCurrent = 0;
     }
 
-    log_info ("PSU : MaxChargingPower = %d, MaxChargingCurrent = %d",
-              ShmPsuData->SystemAvailablePower / 10,
-              ShmPsuData->SystemAvailableCurrent / 10
-             );
+    log_info("PSU : MaxChargingPower = %d, MaxChargingCurrent = %d",
+             ShmPsuData->SystemAvailablePower / 10,
+             ShmPsuData->SystemAvailableCurrent / 10
+            );
 
-    log_info ("Config : ChargingPower = %d, ChargingCurrent = %d",
-              pSysConfig->MaxChargingPower,
-              pSysConfig->MaxChargingCurrent
-             );
+    log_info("Config : ChargingPower = %d, ChargingCurrent = %d",
+             pSysConfig->MaxChargingPower,
+             pSysConfig->MaxChargingCurrent
+            );
 }
 
 void ResetDetAlarmStatus(uint8_t gun)
@@ -6299,7 +6306,7 @@ int main(void)
     ShmLedModuleData = (struct LedModuleData *)GetShmLedModuleData();
     ShmOCPP16Data = (struct OCPP16Data *)GetShmOCPP16Data();
     ShmDcCommonData = (DcCommonInfo *)GetShmDcCommonData();
-    gAudiCustInfo = (SelectGunInfo *)GetShmSelectGunInfo();
+    ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
 
     log_info(" ****************  FileSystem Boot up ***************\n");
     if (!InitialSystemDefaultConfig()) {
@@ -6506,12 +6513,12 @@ int main(void)
                     strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "");
 
                     //Jerry add
-                    memset(&gAudiCustInfo->PricesInfo[gun_index], 0, sizeof(PricesInfo));
-                    gAudiCustInfo->PricesInfo[gun_index].Balance = FAIL_BALANCE_PRICES;
+                    memset(&ShmSelectGunInfo->PricesInfo[gun_index], 0, sizeof(PricesInfo));
+                    ShmSelectGunInfo->PricesInfo[gun_index].Balance = FAIL_BALANCE_PRICES;
                     destroySelGun(gun_index);
                     ResetDetAlarmStatus(gun_index); //recovery OVP status code
-                    if (gAudiCustInfo->AuthorStateFromCabinet[gun_index] == YES) {
-                        gAudiCustInfo->AuthorStateFromCabinet[gun_index] = NO;
+                    if (ShmSelectGunInfo->AuthorStateFromCabinet[gun_index] == YES) {
+                        ShmSelectGunInfo->AuthorStateFromCabinet[gun_index] = NO;
                     }
                     //strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode, "");
                 }

+ 11 - 5
EVSE/Projects/DD360Audi/Apps/ModuleDoComm/DoComm.c

@@ -1377,8 +1377,11 @@ static int writeConnectorState(int fd, uint8_t plugNum, uint8_t id)
 
     if (ChargingData[plugNum]->SystemStatus <= S_AUTHORIZING) {
         pConnState->State = CONN_ST_IDLE;    //idle
-        strcpy((char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode, "");
-        strcpy(&vendorErrorCodeTmp[plugNum][0], "");
+        strncpy((char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
+                "",
+                sizeof(ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode));
+
+        strncpy(&vendorErrorCodeTmp[plugNum][0], "", WARNING_CODE_SIZE);
     } else if ((ChargingData[plugNum]->SystemStatus <= S_PREPARING_FOR_EVSE) ||
                (ChargingData[plugNum]->SystemStatus == S_CCS_PRECHARGE_ST0) ||
                (ChargingData[plugNum]->SystemStatus == S_CCS_PRECHARGE_ST1)) {
@@ -1390,9 +1393,11 @@ static int writeConnectorState(int fd, uint8_t plugNum, uint8_t id)
     } else if ((ChargingData[plugNum]->SystemStatus == S_ALARM) ||
                (ChargingData[plugNum]->SystemStatus == S_FAULT)) {
         pConnState->State = CONN_ST_ALARM;
-        strncpy((char *)pConnState->WarningCode, (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode, WARNING_CODE_SIZE);
+        strncpy((char *)pConnState->WarningCode,
+                (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
+                WARNING_CODE_SIZE);
 
-        if (strcmp(&vendorErrorCodeTmp[plugNum][0], "") == 0) {
+        if (strncmp(&vendorErrorCodeTmp[plugNum][0], "", WARNING_CODE_SIZE) == 0) {
             strncpy(&vendorErrorCodeTmp[plugNum][0],
                     (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
                     WARNING_CODE_SIZE);
@@ -2243,7 +2248,8 @@ int main(int argc, char *argv[])
 
 
             if (ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient == 0) {
-                sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &",
+                sprintf(tmpbuf,
+                        "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &",
                         ShmSysConfigAndInfo->SysConfig.SystemId);
                 system(tmpbuf);
             }

+ 8 - 0
EVSE/Projects/DD360Audi/Apps/Script/replaceOtherDD360Project.sh

@@ -1,5 +1,12 @@
 #/bin/bash
 
+# Absolute path to this script, e.g. /home/user/bin/foo.sh
+SCRIPT=$(readlink -f "$0")
+
+# Absolute path this script is in, thus /home/user/bin
+SCRIPTPATH=$(dirname "$SCRIPT")
+echo $SCRIPTPATH
+
 ProjectPath="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects"
 
 rm -rf $ProjectPath/DD360/Apps/;
@@ -13,3 +20,4 @@ cp -r  $ProjectPath/DD360Audi/ModelNameList.txt  $ProjectPath/DD360ComBox/ModelN
 git add $ProjectPath/DD360;
 git add $ProjectPath/DD360Audi;
 git add $ProjectPath/DD360ComBox;
+git status;

+ 1 - 1
EVSE/Projects/DD360Audi/Apps/SelectGun/SelectGun.c

@@ -9,7 +9,7 @@
 #include "../Define/define.h"
 #include "../ShareMemory/shmMem.h"
 #include "../timeout.h"
-#include "../main.h"
+#include "../CSU/main.h"
 
 #include "SelectGun.h"
 

+ 46 - 29
EVSE/Projects/DD360Audi/Apps/main.c

@@ -266,7 +266,7 @@ static void destroySelGun(uint8_t curGun)
 static int waitRightGunPlugIt(uint8_t curGun)
 {
 #if !defined DD360Audi
-    return;
+    return PASS;
 #endif //!defined DD360Audi
 
     if ((curGun == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR)) {
@@ -279,7 +279,7 @@ static int waitRightGunPlugIt(uint8_t curGun)
 static int waitLeftGunPlugIt(uint8_t curGun)
 {
 #if !defined DD360Audi
-    return;
+    return PASS;
 #endif //!defined DD360Audi
 
     if ((curGun == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR)) {
@@ -309,7 +309,7 @@ static void setSelGunWaitToAuthor(uint8_t curSel)
 static int getConfirmSelectedGun(uint8_t curSel)
 {
 #if !defined DD360Audi
-    return;
+    return PASS;
 #endif //!defined DD360Audi
 
     if (((curSel == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun >= SEL_GUN_CONFIRM)) ||
@@ -602,9 +602,15 @@ static uint8_t checkCabinetEthConnectState(LedConfig *ledConfig)
 
     if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.DisconnectedFromDo == YES) {
         ret = YES;
-        if (pLedConfig->RedLED == YES) {
+        if (pLedConfig->RedLED == YES ||
+                pLedConfig->YellowLED == YES ||
+                pLedConfig->GreenLED == YES) {
+            pLedConfig->YellowLED = NO;
+            pLedConfig->GreenLED = NO;
             pLedConfig->RedLED = NO;
         } else {
+            pLedConfig->YellowLED = YES;
+            pLedConfig->GreenLED = YES;
             pLedConfig->RedLED = YES;
         }
     }
@@ -612,7 +618,7 @@ static uint8_t checkCabinetEthConnectState(LedConfig *ledConfig)
     return ret;
 }
 
-static void startPrimaryLedIndicatorCtrlFork(void)
+static void PrimaryLedIndicatorCtrlFork(void)
 {
 #if !defined DD360ComBox
     return;
@@ -625,10 +631,21 @@ static void startPrimaryLedIndicatorCtrlFork(void)
         int isContinue = 1;
         LedConfig *pLedConfig = (LedConfig *)&ShmPrimaryMcuData->OutputDrv.OutputDrvValue[0];
 
+
         while (isContinue) {
             for (gunIndex = 0; gunIndex < totalGun; gunIndex++) {
+                if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
+                    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                        continue;
+                    }
+
+                    pLedConfig->YellowLED = NO;
+                    pLedConfig->GreenLED = NO;
+                    pLedConfig->RedLED = YES;
+                }
+
                 //printf("led indicator status = %d\r\n", chargingInfo[gunIndex]->SystemStatus);
-                //printf("level = %d\r\n", ShmSysConfigAndInfo->SysWarningInfo.Level);
+                //printf("level = %d\r\n", pSysWarning->Level);
                 switch (chargingInfo[gunIndex]->SystemStatus) {
                 case S_BOOTING:
                     if (ShmSysConfigAndInfo->SysInfo.SelfTestSeq == _STEST_COMPLETE) {
@@ -699,32 +716,31 @@ static void startPrimaryLedIndicatorCtrlFork(void)
 
                 case S_TERMINATING:
                 case S_COMPLETE:
-                    if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
-                        pLedConfig->YellowLED = NO;
-                        pLedConfig->GreenLED = NO;
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    } else {
-                        pLedConfig->RedLED = NO;
-                        pLedConfig->YellowLED = YES;
-                        pLedConfig->GreenLED = NO;
-                    }
+                    //if (pSysWarning->Level == 2) {
+                    //    pLedConfig->YellowLED = NO;
+                    //    pLedConfig->GreenLED = NO;
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //} else {
+                    pLedConfig->RedLED = NO;
+                    pLedConfig->YellowLED = YES;
+                    pLedConfig->GreenLED = NO;
+                    //}
                     break;
 
                 case S_MAINTAIN:
                 case S_FAULT:
                     pLedConfig->YellowLED = NO;
                     pLedConfig->GreenLED = NO;
-                    if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    }
+                    pLedConfig->RedLED = YES;
+                    //if (pSysWarning->Level == 2) {
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //}
                     break;
 
                 case S_BOOKING:
@@ -733,10 +749,9 @@ static void startPrimaryLedIndicatorCtrlFork(void)
                 case S_NONE:
                     break;
                 }
-
-                usleep(500000);
             }//switch
         }//for
+        usleep(500000);
     }//while
 }
 
@@ -3151,7 +3166,9 @@ void ChkPrimaryStatus()
                 if (isDetectPlugin()) {
                     _DetectPlugInTimeout();
                     StopSystemTimeoutDet();
+#if defined DD360Audi
                     destroySelGun(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
+#endif //defined DD360Audi
                 }
 #if defined DD360Audi
                 else {
@@ -6029,7 +6046,7 @@ int main(void)
     }
     CreateTimeoutFork();
     log_info("Start self test... \n");
-    startPrimaryLedIndicatorCtrlFork();
+    PrimaryLedIndicatorCtrlFork();
     SelfTestRun();
     StopSystemTimeoutDet();
     log_info("Self test finished : SelfTestSeq = %d, Work_Step = %d ",

BIN
EVSE/Projects/DD360Audi/Images/ramdisk.gz


BIN
EVSE/Projects/DD360Audi/output/Module_DoComm


BIN
EVSE/Projects/DD360Audi/output/main


+ 31 - 13
EVSE/Projects/DD360ComBox/Apps/CSU/Ethernet.c

@@ -11,6 +11,18 @@
 #include "../common.h"
 
 //------------------------------------------------------------------------------
+static void InitialDHCP(void)
+{
+    char tmpbuf[256] = {0};
+    struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
+
+    system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+    sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &",
+            pSysConfig->SystemId);
+
+    system(tmpbuf);
+}
+
 void GetMacAddress(void)
 {
     uint8_t index = 0;
@@ -70,10 +82,12 @@ static int isRouteFail(void)
 static int isReachableInternet(void)
 {
     int result = FAIL;
+    int idx = 0;
     FILE *fp;
-    char cmd[256];
-    char buf[512];
-    char tmp[512];
+    char cmd[256] = {0};
+    char buf[512] = {0};
+    char tmp[512] = {0};
+    char *valid_Internet[2] = {"8.8.8.8", "180.76.76.76"};
     struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
     struct AlarmCodeData *pAlarmCode = (struct AlarmCodeData *)GetShmAlarmCodeData();
 
@@ -100,9 +114,12 @@ static int isReachableInternet(void)
     } else {
         result = PASS;
     }
-#else
+
+    return result;
+#endif //defined DD360 || defined DD360Audi
+
     memset(buf, 0x00, sizeof(buf));
-    for (int idx = 0; idx < ARRAY_SIZE(valid_Internet); idx++) {
+    for (idx = 0; idx < ARRAY_SIZE(valid_Internet); idx++) {
         sprintf(cmd, "ping -c 1 -w 3 -I eth0 %s", valid_Internet[idx]);
         fp = popen(cmd, "r");
         if (fp != NULL) {
@@ -122,20 +139,18 @@ static int isReachableInternet(void)
         pclose(fp);
     }
 
-#endif //defined DD360 || defined DD360Audi
-
     return result;
 }
 
 void InitEthernet(void)
 {
     char tmpbuf[256];
-#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     bool ethResult = false;
     uint8_t cnt_pingDNS_Fail = 0;
-#endif //!defined DD360 && !defined DD360Audi
 
     struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
+    struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
+    struct InfoCodeData *pInfoCode = (struct InfoCodeData *)GetShmInfoCodeData();
 
     system("ifconfig eth0 down");// eth0 down
     system("ifconfig eth1 down");// eth1 down
@@ -144,6 +159,7 @@ void InitEthernet(void)
     // /sbin/ifconfig eth0 192.168.1.10 netmask 255.255.255.0 down
     system("echo 1 > /sys/class/gpio/gpio110/value");//reset PHY
     sleep(2);
+
     //Init Eth0 for internet
     memset(tmpbuf, 0, 256);
     sprintf(tmpbuf, "/sbin/ifconfig eth0 %s netmask %s up",
@@ -187,7 +203,12 @@ void InitEthernet(void)
     if (pid == 0) {
         log_info("InitEthernet = %d\r\n", pid);
         for (;;) {
-#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
+#if defined DD360 || defined DD360Audi || defined DD360ComBox
+            isReachableInternet();
+            sleep(5);
+            continue;
+#endif //!defined DD360 && !defined DD360
+
             if (isRouteFail()) {
                 //log_info("eth0 not in route, restart eht0. \n");
                 system("/sbin/ifconfig eth0 down;/sbin/ifconfig eth0 up");
@@ -266,9 +287,6 @@ void InitEthernet(void)
             }
 
             pSysInfo->InternetConn = ethResult;
-#else
-            isReachableInternet();
-#endif //!defined DD360 && !defined DD360
 
             sleep(5);
         }

+ 38 - 24
EVSE/Projects/DD360ComBox/Apps/CSU/Primary.c

@@ -9,7 +9,7 @@
 #include "../ShareMemory/shmMem.h"
 
 #include "../SelectGun/SelectGun.h"
-#include "../main.h"
+#include "main.h"
 
 //------------------------------------------------------------------------------
 
@@ -22,10 +22,16 @@ static uint8_t checkCabinetEthConnectState(LedConfig *ledConfig)
 
     if (pAlarmCode->AlarmEvents.bits.DisconnectedFromDo == YES) {
         ret = YES;
-        if (pLedConfig->RedLED == YES) {
+        if (pLedConfig->RedLED == YES ||
+                pLedConfig->YellowLED == YES ||
+                pLedConfig->GreenLED == YES) {
             pLedConfig->RedLED = NO;
+            pLedConfig->YellowLED = NO;
+            pLedConfig->GreenLED = NO;
         } else {
             pLedConfig->RedLED = YES;
+            pLedConfig->YellowLED = YES;
+            pLedConfig->GreenLED = YES;
         }
     }
 
@@ -55,6 +61,16 @@ void PrimaryLedIndicatorCtrlFork(void)
             for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
                 pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
 
+                if (pSysWarning->Level == 2) {
+                    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                        continue;
+                    }
+
+                    pLedConfig->YellowLED = NO;
+                    pLedConfig->GreenLED = NO;
+                    pLedConfig->RedLED = YES;
+                }
+
                 //printf("led indicator status = %d\r\n", chargingInfo[gunIndex]->SystemStatus);
                 //printf("level = %d\r\n", pSysWarning->Level);
                 switch (pDcChargingInfo->SystemStatus) {
@@ -127,32 +143,31 @@ void PrimaryLedIndicatorCtrlFork(void)
 
                 case S_TERMINATING:
                 case S_COMPLETE:
-                    if (pSysWarning->Level == 2) {
-                        pLedConfig->YellowLED = NO;
-                        pLedConfig->GreenLED = NO;
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    } else {
-                        pLedConfig->RedLED = NO;
-                        pLedConfig->YellowLED = YES;
-                        pLedConfig->GreenLED = NO;
-                    }
+                    //if (pSysWarning->Level == 2) {
+                    //    pLedConfig->YellowLED = NO;
+                    //    pLedConfig->GreenLED = NO;
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //} else {
+                    pLedConfig->RedLED = NO;
+                    pLedConfig->YellowLED = YES;
+                    pLedConfig->GreenLED = NO;
+                    //}
                     break;
 
                 case S_MAINTAIN:
                 case S_FAULT:
                     pLedConfig->YellowLED = NO;
                     pLedConfig->GreenLED = NO;
-                    if (pSysWarning->Level == 2) {
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    }
+                    pLedConfig->RedLED = YES;
+                    //if (pSysWarning->Level == 2) {
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //}
                     break;
 
                 case S_BOOKING:
@@ -161,10 +176,9 @@ void PrimaryLedIndicatorCtrlFork(void)
                 case S_NONE:
                     break;
                 }
-
-                usleep(500000);
             }//switch
         }//for
+        usleep(500000);
     }//while
 }
 

+ 1 - 1
EVSE/Projects/DD360ComBox/Apps/CSU/RFID.c

@@ -9,7 +9,7 @@
 #include "../ShareMemory/shmMem.h"
 #include "../SelectGun/SelectGun.h"
 
-#include "../main.h"
+#include "main.h"
 #include "../timeout.h"
 
 //------------------------------------------------------------------------------

+ 1 - 1
EVSE/Projects/DD360ComBox/Apps/CSU/SelfTest.c

@@ -8,7 +8,7 @@
 #include "../Define/define.h"
 #include "../ShareMemory/shmMem.h"
 
-#include "../main.h"
+#include "main.h"
 #include "../timeout.h"
 
 //------------------------------------------------------------------------------

+ 1 - 1
EVSE/Projects/DD360ComBox/Apps/CSU/UpgradeFW.c

@@ -11,7 +11,7 @@
 #include "../Define/define.h"
 #include "../ShareMemory/shmMem.h"
 
-#include "../main.h"
+#include "main.h"
 
 //------------------------------------------------------------------------------
 static char *_priPortName = "/dev/ttyS1";

+ 71 - 64
EVSE/Projects/DD360ComBox/Apps/CSU/main.c

@@ -27,21 +27,20 @@
 #include <ctype.h>
 #include <ifaddrs.h>
 #include <math.h>
-#include "./Define/define.h"
 #include <stdbool.h>
 #include <dirent.h>
 
-#include "Config.h"
+#include "../Config.h"
 #include "main.h"
-#include "common.h"
-#include "timeout.h"
+#include "../common.h"
+#include "../timeout.h"
 
-#include "./Log/log.h"
-#include "./Define/define.h"
-#include "./ShareMemory/shmMem.h"
+#include "../Log/log.h"
+#include "../Define/define.h"
+#include "../ShareMemory/shmMem.h"
 
 #if defined DD360 ||defined DD360Audi || defined DD360ComBox
-#include "./SelectGun/SelectGun.h"
+#include "../SelectGun/SelectGun.h"
 #endif //defined DD360Audi
 
 //------------------------------------------------------------------------------
@@ -81,7 +80,7 @@ struct timeb startChargingTime[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 struct timeb endChargingTime[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 
 #if defined DD360 ||defined DD360Audi || defined DD360ComBox
-static SelectGunInfo             *gAudiCustInfo = NULL; //Jerry add
+static SelectGunInfo             *ShmSelectGunInfo = NULL; //Jerry add
 #endif //defined DD360Audi
 static EvBoardErrMsg gEvBoardErr = {0};
 
@@ -198,14 +197,14 @@ void destroySelGun(uint8_t curGun)
 
     //for status timeout
     if (curGun == DESTROY_ALL_SEL) {
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
         log_info("destroy all gun = %d, %d\r\n",
-                 gAudiCustInfo->SelGunInfo.LeftGun,
-                 gAudiCustInfo->SelGunInfo.RightGun);
+                 ShmSelectGunInfo->SelGunInfo.LeftGun,
+                 ShmSelectGunInfo->SelGunInfo.RightGun);
         for (i = 0; i < totalGun; i++) {
             StopGunInfoTimeoutDet(i);
-            memset(&gAudiCustInfo->PricesInfo[i], 0, sizeof(PricesInfo));
+            memset(&ShmSelectGunInfo->PricesInfo[i], 0, sizeof(PricesInfo));
         }
         pSysInfo->CurGunSelected = 0;
         strcpy((char *)pSysConfig->UserId, "");
@@ -214,12 +213,12 @@ void destroySelGun(uint8_t curGun)
     }
 
     //for charging timeout or complete
-    if ((curGun == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun != SEL_GUN_RELEASE)) {
-        if (gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM ||
-                gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR) {
+    if ((curGun == LEFT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.LeftGun != SEL_GUN_RELEASE)) {
+        if (ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM ||
+                ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR) {
             changeLcmPage(_LCM_SELECT_GUN);
         }
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_RELEASE;
         StopGunInfoTimeoutDet(LEFT_GUN_NUM);
         if (ShmOCPP16Data->SpMsg.bits.AuthorizeConf != NO) {
             ClearAuthorizedFlag();
@@ -228,17 +227,17 @@ void destroySelGun(uint8_t curGun)
         log_info("destroy left gun, cur page = %d\r\n", getCurLcmPage());
         if (getCurLcmPage() == pSysInfo->SystemPage) {
             log_info("clear left balance\r\n");
-            memset(&gAudiCustInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
-            gAudiCustInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
+            memset(&ShmSelectGunInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
+            ShmSelectGunInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
         }
     }
 
-    if ((curGun == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun != SEL_GUN_RELEASE)) {
-        if (gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM ||
-                gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR) {
+    if ((curGun == RIGHT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.RightGun != SEL_GUN_RELEASE)) {
+        if (ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM ||
+                ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR) {
             changeLcmPage(_LCM_SELECT_GUN);
         }
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_RELEASE;
         StopGunInfoTimeoutDet(RIGHT_GUN_NUM);
         if (ShmOCPP16Data->SpMsg.bits.AuthorizeConf != NO) {
             ClearAuthorizedFlag();
@@ -247,8 +246,8 @@ void destroySelGun(uint8_t curGun)
         log_info("destroy right gun, cur page = %d\r\n", getCurLcmPage());
         if (getCurLcmPage() == pSysInfo->SystemPage) {
             log_info("clear right balance\r\n");
-            memset(&gAudiCustInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
-            gAudiCustInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
+            memset(&ShmSelectGunInfo->PricesInfo[curGun], 0, sizeof(PricesInfo));
+            ShmSelectGunInfo->PricesInfo[curGun].Balance = FAIL_BALANCE_PRICES;
         }
     }
 }
@@ -259,7 +258,7 @@ static int waitRightGunPlugIt(uint8_t curGun)
     return;
 #endif //!defined DD360Audi
 
-    if ((curGun == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR)) {
+    if ((curGun == RIGHT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR)) {
         return PASS;
     }
 
@@ -272,7 +271,7 @@ static int waitLeftGunPlugIt(uint8_t curGun)
     return;
 #endif //!defined DD360Audi
 
-    if ((curGun == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR)) {
+    if ((curGun == LEFT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR)) {
         return PASS;
     }
 
@@ -285,12 +284,12 @@ void setSelGunWaitToAuthor(uint8_t curSel)
     return;
 #endif //!defined DD360Audi
 
-    if (curSel == LEFT_GUN_NUM && gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM) {
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_ATHOR;
+    if (curSel == LEFT_GUN_NUM && ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM) {
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_ATHOR;
         //printf("setSelGunWaitToAuthor left\r\n");
         StopGunInfoTimeoutDet(curSel);
-    } else if (curSel == RIGHT_GUN_NUM && gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM) {
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_ATHOR;
+    } else if (curSel == RIGHT_GUN_NUM && ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM) {
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_ATHOR;
         //printf("setSelGunWaitToAuthor right\r\n");
         StopGunInfoTimeoutDet(curSel);
     }
@@ -302,8 +301,8 @@ int getConfirmSelectedGun(uint8_t curSel)
     return;
 #endif //!defined DD360Audi
 
-    if (((curSel == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun >= SEL_GUN_CONFIRM)) ||
-            ((curSel == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun >= SEL_GUN_CONFIRM))) {
+    if (((curSel == LEFT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.LeftGun >= SEL_GUN_CONFIRM)) ||
+            ((curSel == RIGHT_GUN_NUM) && (ShmSelectGunInfo->SelGunInfo.RightGun >= SEL_GUN_CONFIRM))) {
         return PASS;
     }
 
@@ -317,11 +316,11 @@ void confirmSelGun(uint8_t selGun)
 #endif //!defined DD360Audi
 
     if (selGun == LEFT_GUN_NUM) {
-        gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_CONFIRM;
+        ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_CONFIRM;
         StopGunInfoTimeoutDet(selGun);
         //printf("confirmSelGun left\r\n");
     } else if (selGun == RIGHT_GUN_NUM) {
-        gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_CONFIRM;
+        ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_CONFIRM;
         StopGunInfoTimeoutDet(selGun);
         //printf("confirmSelGun right\r\n");
     }
@@ -2555,7 +2554,7 @@ void _AuthorizedTimeout()
         //isCardScan = false;
         SetIsCardScan(false);
 
-        //gAudiCustInfo->PricesInfo[pSysInfo->CurGunSelected].Balance = 0.0; //Jerry add
+        //ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance = 0.0; //Jerry add
         pSysInfo->SystemPage = _LCM_AUTHORIZ_FAIL;
         //ChangeLcmByIndex(_LCM_AUTHORIZ_FAIL);
         strcpy((char *)pSysConfig->UserId, "");
@@ -3879,7 +3878,7 @@ void ScannerCardProcess()
 #if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 || pSysConfig->OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING
 #else
-                && gAudiCustInfo->PricesInfo[pSysInfo->CurGunSelected].Balance != FAIL_BALANCE_PRICES
+                && ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance != FAIL_BALANCE_PRICES
 #endif //!defined DD360 && !defined DD360Audi
            ) {
             StopSystemTimeoutDet();
@@ -4691,8 +4690,8 @@ void StopGunInfoTimeoutDet(uint8_t gunIndex)
 void CheckConnectionTimeout(void)
 {
 #if defined DD360 || defined DD360Audi || defined DD360ComBox
-    if (gAudiCustInfo->RemoteSetup.ConnectionTimeout != 0) { //Jerry add
-        _connectionTimeout = gAudiCustInfo->RemoteSetup.ConnectionTimeout;
+    if (ShmSelectGunInfo->RemoteSetup.ConnectionTimeout != 0) { //Jerry add
+        _connectionTimeout = ShmSelectGunInfo->RemoteSetup.ConnectionTimeout;
     } else {
         _connectionTimeout = CONN_PLUG_TIME_OUT;
     }
@@ -4746,8 +4745,8 @@ void CreateTimeoutFork()
                     _AuthorizedTimeout();
                     StopSystemTimeoutDet();
                     destroySelGun(pSysInfo->CurGunSelected);
-                    if (gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
-                        gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
+                    if (ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
+                        ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
                         pAlarmCode->AlarmEvents.bits.DisconnectedFromDo = ABNORMAL;
                         log_error("Author timeout restart DoComm\r\n");
                         system("killall Module_DoComm");
@@ -4762,8 +4761,8 @@ void CreateTimeoutFork()
                     _AutoReturnTimeout();
                     StopSystemTimeoutDet();
                     destroySelGun(pSysInfo->CurGunSelected);
-                    if (gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
-                        gAudiCustInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
+                    if (ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] == YES) { //DoComm no ask cabinet balance
+                        ShmSelectGunInfo->AuthorStateFromCabinet[pSysInfo->CurGunSelected] = NO;
                         pAlarmCode->AlarmEvents.bits.DisconnectedFromDo = ABNORMAL;
                         log_error("Author timeout restart DoComm\r\n");
                         system("killall Module_DoComm");
@@ -5159,9 +5158,9 @@ bool WifiScheduleStop(uint8_t gunIndex)
 
 void OcppRemoteStartChk()
 {
-    if (pSysConfig->OfflinePolicy == _OFFLINE_POLICY_NO_CHARGING)
-    {}
-    else if (!isDetectPlugin()) {
+    if (pSysConfig->OfflinePolicy == _OFFLINE_POLICY_NO_CHARGING) {
+
+    } else if (!isDetectPlugin()) {
         // 如果有 AC 槍,則固定是第 2 把槍,所以索引固定為 1
         uint8_t acDirIndex = pSysConfig->AcConnectorCount;
 
@@ -5856,6 +5855,7 @@ void CheckTask()
     }
 }
 
+/*
 void InitialDHCP()
 {
     char tmpbuf[256] = {0};
@@ -5865,6 +5865,7 @@ void InitialDHCP()
             pSysConfig->SystemId);
     system(tmpbuf);
 }
+*/
 
 //==========================================
 // Check Smart Charging Profile
@@ -5981,14 +5982,20 @@ void CheckReturnToChargingConn()
 
             // 如果選的 DC 槍在充電~ 則 DC 槍不改變
             if (count == pSysInfo->CurGunSelected) {
-                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK && pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
-                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)) {
+                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK &&
+                        pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
+                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 &&
+                         pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)
+                   ) {
                     isReturnTimeout = false;
                     break;
                 }
             } else if (count != pSysInfo->CurGunSelected) {
-                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK && pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
-                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)) {
+                if ((pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK &&
+                        pDcChargingInfo->SystemStatus <= S_COMPLETE) ||
+                        (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 &&
+                         pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)
+                   ) {
                     isReturnTimeout = true;
                     StartSystemTimeoutDet(Timeout_ReturnToChargingGunDet);
                 }
@@ -6099,15 +6106,15 @@ void AdjustChargerCurrent()
         pSysConfig->MaxChargingCurrent = 0;
     }
 
-    log_info ("PSU : MaxChargingPower = %d, MaxChargingCurrent = %d",
-              ShmPsuData->SystemAvailablePower / 10,
-              ShmPsuData->SystemAvailableCurrent / 10
-             );
+    log_info("PSU : MaxChargingPower = %d, MaxChargingCurrent = %d",
+             ShmPsuData->SystemAvailablePower / 10,
+             ShmPsuData->SystemAvailableCurrent / 10
+            );
 
-    log_info ("Config : ChargingPower = %d, ChargingCurrent = %d",
-              pSysConfig->MaxChargingPower,
-              pSysConfig->MaxChargingCurrent
-             );
+    log_info("Config : ChargingPower = %d, ChargingCurrent = %d",
+             pSysConfig->MaxChargingPower,
+             pSysConfig->MaxChargingCurrent
+            );
 }
 
 void ResetDetAlarmStatus(uint8_t gun)
@@ -6299,7 +6306,7 @@ int main(void)
     ShmLedModuleData = (struct LedModuleData *)GetShmLedModuleData();
     ShmOCPP16Data = (struct OCPP16Data *)GetShmOCPP16Data();
     ShmDcCommonData = (DcCommonInfo *)GetShmDcCommonData();
-    gAudiCustInfo = (SelectGunInfo *)GetShmSelectGunInfo();
+    ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
 
     log_info(" ****************  FileSystem Boot up ***************\n");
     if (!InitialSystemDefaultConfig()) {
@@ -6506,12 +6513,12 @@ int main(void)
                     strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "");
 
                     //Jerry add
-                    memset(&gAudiCustInfo->PricesInfo[gun_index], 0, sizeof(PricesInfo));
-                    gAudiCustInfo->PricesInfo[gun_index].Balance = FAIL_BALANCE_PRICES;
+                    memset(&ShmSelectGunInfo->PricesInfo[gun_index], 0, sizeof(PricesInfo));
+                    ShmSelectGunInfo->PricesInfo[gun_index].Balance = FAIL_BALANCE_PRICES;
                     destroySelGun(gun_index);
                     ResetDetAlarmStatus(gun_index); //recovery OVP status code
-                    if (gAudiCustInfo->AuthorStateFromCabinet[gun_index] == YES) {
-                        gAudiCustInfo->AuthorStateFromCabinet[gun_index] = NO;
+                    if (ShmSelectGunInfo->AuthorStateFromCabinet[gun_index] == YES) {
+                        ShmSelectGunInfo->AuthorStateFromCabinet[gun_index] = NO;
                     }
                     //strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode, "");
                 }

+ 11 - 5
EVSE/Projects/DD360ComBox/Apps/ModuleDoComm/DoComm.c

@@ -1377,8 +1377,11 @@ static int writeConnectorState(int fd, uint8_t plugNum, uint8_t id)
 
     if (ChargingData[plugNum]->SystemStatus <= S_AUTHORIZING) {
         pConnState->State = CONN_ST_IDLE;    //idle
-        strcpy((char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode, "");
-        strcpy(&vendorErrorCodeTmp[plugNum][0], "");
+        strncpy((char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
+                "",
+                sizeof(ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode));
+
+        strncpy(&vendorErrorCodeTmp[plugNum][0], "", WARNING_CODE_SIZE);
     } else if ((ChargingData[plugNum]->SystemStatus <= S_PREPARING_FOR_EVSE) ||
                (ChargingData[plugNum]->SystemStatus == S_CCS_PRECHARGE_ST0) ||
                (ChargingData[plugNum]->SystemStatus == S_CCS_PRECHARGE_ST1)) {
@@ -1390,9 +1393,11 @@ static int writeConnectorState(int fd, uint8_t plugNum, uint8_t id)
     } else if ((ChargingData[plugNum]->SystemStatus == S_ALARM) ||
                (ChargingData[plugNum]->SystemStatus == S_FAULT)) {
         pConnState->State = CONN_ST_ALARM;
-        strncpy((char *)pConnState->WarningCode, (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode, WARNING_CODE_SIZE);
+        strncpy((char *)pConnState->WarningCode,
+                (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
+                WARNING_CODE_SIZE);
 
-        if (strcmp(&vendorErrorCodeTmp[plugNum][0], "") == 0) {
+        if (strncmp(&vendorErrorCodeTmp[plugNum][0], "", WARNING_CODE_SIZE) == 0) {
             strncpy(&vendorErrorCodeTmp[plugNum][0],
                     (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
                     WARNING_CODE_SIZE);
@@ -2243,7 +2248,8 @@ int main(int argc, char *argv[])
 
 
             if (ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient == 0) {
-                sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &",
+                sprintf(tmpbuf,
+                        "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &",
                         ShmSysConfigAndInfo->SysConfig.SystemId);
                 system(tmpbuf);
             }

+ 8 - 0
EVSE/Projects/DD360ComBox/Apps/Script/replaceOtherDD360Project.sh

@@ -1,5 +1,12 @@
 #/bin/bash
 
+# Absolute path to this script, e.g. /home/user/bin/foo.sh
+SCRIPT=$(readlink -f "$0")
+
+# Absolute path this script is in, thus /home/user/bin
+SCRIPTPATH=$(dirname "$SCRIPT")
+echo $SCRIPTPATH
+
 ProjectPath="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects"
 
 rm -rf $ProjectPath/DD360/Apps/;
@@ -13,3 +20,4 @@ cp -r  $ProjectPath/DD360Audi/ModelNameList.txt  $ProjectPath/DD360ComBox/ModelN
 git add $ProjectPath/DD360;
 git add $ProjectPath/DD360Audi;
 git add $ProjectPath/DD360ComBox;
+git status;

+ 1 - 1
EVSE/Projects/DD360ComBox/Apps/SelectGun/SelectGun.c

@@ -9,7 +9,7 @@
 #include "../Define/define.h"
 #include "../ShareMemory/shmMem.h"
 #include "../timeout.h"
-#include "../main.h"
+#include "../CSU/main.h"
 
 #include "SelectGun.h"
 

+ 46 - 29
EVSE/Projects/DD360ComBox/Apps/main.c

@@ -266,7 +266,7 @@ static void destroySelGun(uint8_t curGun)
 static int waitRightGunPlugIt(uint8_t curGun)
 {
 #if !defined DD360Audi
-    return;
+    return PASS;
 #endif //!defined DD360Audi
 
     if ((curGun == RIGHT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_ATHOR)) {
@@ -279,7 +279,7 @@ static int waitRightGunPlugIt(uint8_t curGun)
 static int waitLeftGunPlugIt(uint8_t curGun)
 {
 #if !defined DD360Audi
-    return;
+    return PASS;
 #endif //!defined DD360Audi
 
     if ((curGun == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_ATHOR)) {
@@ -309,7 +309,7 @@ static void setSelGunWaitToAuthor(uint8_t curSel)
 static int getConfirmSelectedGun(uint8_t curSel)
 {
 #if !defined DD360Audi
-    return;
+    return PASS;
 #endif //!defined DD360Audi
 
     if (((curSel == LEFT_GUN_NUM) && (gAudiCustInfo->SelGunInfo.LeftGun >= SEL_GUN_CONFIRM)) ||
@@ -602,9 +602,15 @@ static uint8_t checkCabinetEthConnectState(LedConfig *ledConfig)
 
     if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.DisconnectedFromDo == YES) {
         ret = YES;
-        if (pLedConfig->RedLED == YES) {
+        if (pLedConfig->RedLED == YES ||
+                pLedConfig->YellowLED == YES ||
+                pLedConfig->GreenLED == YES) {
+            pLedConfig->YellowLED = NO;
+            pLedConfig->GreenLED = NO;
             pLedConfig->RedLED = NO;
         } else {
+            pLedConfig->YellowLED = YES;
+            pLedConfig->GreenLED = YES;
             pLedConfig->RedLED = YES;
         }
     }
@@ -612,7 +618,7 @@ static uint8_t checkCabinetEthConnectState(LedConfig *ledConfig)
     return ret;
 }
 
-static void startPrimaryLedIndicatorCtrlFork(void)
+static void PrimaryLedIndicatorCtrlFork(void)
 {
 #if !defined DD360ComBox
     return;
@@ -625,10 +631,21 @@ static void startPrimaryLedIndicatorCtrlFork(void)
         int isContinue = 1;
         LedConfig *pLedConfig = (LedConfig *)&ShmPrimaryMcuData->OutputDrv.OutputDrvValue[0];
 
+
         while (isContinue) {
             for (gunIndex = 0; gunIndex < totalGun; gunIndex++) {
+                if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
+                    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                        continue;
+                    }
+
+                    pLedConfig->YellowLED = NO;
+                    pLedConfig->GreenLED = NO;
+                    pLedConfig->RedLED = YES;
+                }
+
                 //printf("led indicator status = %d\r\n", chargingInfo[gunIndex]->SystemStatus);
-                //printf("level = %d\r\n", ShmSysConfigAndInfo->SysWarningInfo.Level);
+                //printf("level = %d\r\n", pSysWarning->Level);
                 switch (chargingInfo[gunIndex]->SystemStatus) {
                 case S_BOOTING:
                     if (ShmSysConfigAndInfo->SysInfo.SelfTestSeq == _STEST_COMPLETE) {
@@ -699,32 +716,31 @@ static void startPrimaryLedIndicatorCtrlFork(void)
 
                 case S_TERMINATING:
                 case S_COMPLETE:
-                    if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
-                        pLedConfig->YellowLED = NO;
-                        pLedConfig->GreenLED = NO;
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    } else {
-                        pLedConfig->RedLED = NO;
-                        pLedConfig->YellowLED = YES;
-                        pLedConfig->GreenLED = NO;
-                    }
+                    //if (pSysWarning->Level == 2) {
+                    //    pLedConfig->YellowLED = NO;
+                    //    pLedConfig->GreenLED = NO;
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //} else {
+                    pLedConfig->RedLED = NO;
+                    pLedConfig->YellowLED = YES;
+                    pLedConfig->GreenLED = NO;
+                    //}
                     break;
 
                 case S_MAINTAIN:
                 case S_FAULT:
                     pLedConfig->YellowLED = NO;
                     pLedConfig->GreenLED = NO;
-                    if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
-                        if (checkCabinetEthConnectState(pLedConfig) == YES) {
-                            break;
-                        }
-
-                        pLedConfig->RedLED = YES;
-                    }
+                    pLedConfig->RedLED = YES;
+                    //if (pSysWarning->Level == 2) {
+                    //    if (checkCabinetEthConnectState(pLedConfig) == YES) {
+                    //        break;
+                    //    }
+                    //    pLedConfig->RedLED = YES;
+                    //}
                     break;
 
                 case S_BOOKING:
@@ -733,10 +749,9 @@ static void startPrimaryLedIndicatorCtrlFork(void)
                 case S_NONE:
                     break;
                 }
-
-                usleep(500000);
             }//switch
         }//for
+        usleep(500000);
     }//while
 }
 
@@ -3151,7 +3166,9 @@ void ChkPrimaryStatus()
                 if (isDetectPlugin()) {
                     _DetectPlugInTimeout();
                     StopSystemTimeoutDet();
+#if defined DD360Audi
                     destroySelGun(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
+#endif //defined DD360Audi
                 }
 #if defined DD360Audi
                 else {
@@ -6029,7 +6046,7 @@ int main(void)
     }
     CreateTimeoutFork();
     log_info("Start self test... \n");
-    startPrimaryLedIndicatorCtrlFork();
+    PrimaryLedIndicatorCtrlFork();
     SelfTestRun();
     StopSystemTimeoutDet();
     log_info("Self test finished : SelfTestSeq = %d, Work_Step = %d ",

BIN
EVSE/Projects/DD360ComBox/Images/ramdisk.gz


BIN
EVSE/Projects/DD360ComBox/output/Module_DoComm


BIN
EVSE/Projects/DD360ComBox/output/Module_EvComm


BIN
EVSE/Projects/DD360ComBox/output/Module_EventLogging


BIN
EVSE/Projects/DD360ComBox/output/Module_InternalComm


BIN
EVSE/Projects/DD360ComBox/output/Module_LcmControl


BIN
EVSE/Projects/DD360ComBox/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360ComBox/output/ReadCmdline


BIN
EVSE/Projects/DD360ComBox/output/main