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

2021.01.07 / Jerry Wang

Actions:
1. delete printf message.
2. debug DoComm read power cabinet status code error issue. not fixed.
3. Debug Author timeout to enter wait plug it issue.

Files:
follow commit history

Image version: V1.04.XX.XXXX.XX
Image checksum: XXXXXXXX
Jerry_Wang 4 жил өмнө
parent
commit
fc30354c6b

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

@@ -1635,7 +1635,7 @@ void CheckOutputPowerOverCarReq(byte index)
             (_chargingData[index]->Type == _Type_Chademo ||
              _chargingData[index]->Type == _Type_CCS_2 ||
              _chargingData[index]->Type == _Type_GB)) {
-        printf("fireV = %.2f, %.2f\r\n", fireV, (carV + (carV * 0.1)));
+        //printf("fireV = %.2f, %.2f\r\n", fireV, (carV + (carV * 0.1)));
         if (fireV >= (carV + (carV * 0.1))) {
             PRINTF_FUNC("[Module_InternalComm]CheckOutputPowerOverCarReq NG : fire = %f, battery = %f \n",
                         _chargingData[index]->FireChargingVoltage, (_chargingData[index]->EvBatterytargetVoltage * 10));

+ 41 - 13
EVSE/Projects/DD360Audi/Apps/ReDoComm.c

@@ -151,7 +151,7 @@ static void Hexdump(const void *p, size_t size)
 
     message_len += sprintf(&message[message_len], "\r\n");
 
-    printf("%s", message);
+    DEBUG_INFO("%s", message);
 }
 
 static int string2ByteArray(char *input, byte *output)
@@ -354,10 +354,10 @@ static void setConfirmSelGun(uint8_t selGun)
 {
     if (selGun == LEFT_GUN_NUM && gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_RELEASE) {
         gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_CONFIRM;
-        printf("confirmSelGun left\r\n");
+        //printf("confirmSelGun left\r\n");
     } else if (selGun == RIGHT_GUN_NUM && gAudiCustInfo->SelGunInfo.RightGun == SEL_GUN_RELEASE) {
         gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_CONFIRM;
-        printf("confirmSelGun right\r\n");
+        //printf("confirmSelGun right\r\n");
     }
 }
 
@@ -738,6 +738,20 @@ static void removeFaultCodeToBuf(uint8_t *Code)
     }
 }
 
+bool CompareArrayIsZero(uint8_t *array, unsigned int array_size)
+{
+    uint8_t i;
+
+    if (array != NULL) {
+        for (i = 0; i < array_size; i++) {
+            if (array[i] != 0) {
+                return false;
+            }
+        }
+    }
+
+    return true;
+}
 static int powerCabinetStatusProcess(uint8_t dataLen, uint8_t *data)
 {
     uint8_t ret = 0;
@@ -745,9 +759,15 @@ static int powerCabinetStatusProcess(uint8_t dataLen, uint8_t *data)
     uint8_t count = 0;
     uint8_t EventCodeTmp[7] = {0};
     uint8_t StatusArray[MAX_REGISTER_NUM][WARNING_CODE_SIZE] = {0};
+    uint8_t remaindLen = dataLen % dataLen;
+    uint8_t statusCodeError = 0;
+
+    if (remaindLen != 0) {
+        dataLen -= remaindLen;
+    }
 
     if (dataLen < WARNING_CODE_SIZE) {
-        DEBUG_ERROR("raw data len < 6 = %d\r\n", dataLen);
+        DEBUG_ERROR("status code len < 6 = %d\r\n", dataLen);
         if (ShmSysConfigAndInfo->SysWarningInfo.WarningCount > 0) {
             for (i = 0; i < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
                 usleep(128);
@@ -766,20 +786,27 @@ static int powerCabinetStatusProcess(uint8_t dataLen, uint8_t *data)
     for (count = 0; count < dataLen; count += WARNING_CODE_SIZE) {
         usleep(128);
         // misc command status code handle
-        if (strcmp((char *)&data[count], MISC_ST_MISC_CMD) == 0) {
-            if (gDoCommGblData.MiscCmd != REG_MISC_CONTROL) {
-                gDoCommGblData.MiscCmd = REG_MISC_CONTROL;
-            }
+        if (strncmp((char *)&data[count], MISC_ST_MISC_CMD, WARNING_CODE_SIZE) == 0) {
+            //if (gDoCommGblData.MiscCmd != REG_MISC_CONTROL) {
+            gDoCommGblData.MiscCmd = REG_MISC_CONTROL;
+            //}
             memset((char *)&data[count], 0, WARNING_CODE_SIZE);
             continue;
-        } else if (strcmp((char *)&data[count], MISC_ST_VERSION) == 0) {
-            if (gDoCommGblData.MiscCmd != REG_REPORT_CSU_VERSION) {
-                gDoCommGblData.MiscCmd = REG_REPORT_CSU_VERSION;
-            }
+        } else if (strncmp((char *)&data[count], MISC_ST_VERSION, WARNING_CODE_SIZE) == 0) {
+            //if (gDoCommGblData.MiscCmd != REG_REPORT_CSU_VERSION) {
+            gDoCommGblData.MiscCmd = REG_REPORT_CSU_VERSION;
+            //}
             memset((char *)&data[count], 0, WARNING_CODE_SIZE);
             continue;
         }
 
+        if (CompareArrayIsZero((uint8_t *)&data[count], WARNING_CODE_SIZE) == true) {
+            memset(EventCodeTmp, 0, sizeof(EventCodeTmp));
+            memcpy(EventCodeTmp, (char *)&data[count], sizeof(EventCodeTmp));
+            DEBUG_ERROR("error status = %s\r\n", EventCodeTmp);
+            continue;
+        }
+
         strncpy((char *)&StatusArray[count / WARNING_CODE_SIZE], (char *)&data[count], WARNING_CODE_SIZE);
         ret = 0;
         for (i = 0; i < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
@@ -1702,7 +1729,8 @@ static void systemStatusProcess(int fd, uint8_t plugNum, uint8_t gunID)
         checkAuthorProcess(fd, plugNum);
 
         //authorization complete, write wait plug it state
-        if (gAudiCustInfo->PricesInfo[plugNum].Balance != FAIL_BALANCE_PRICES) {
+        if (gAudiCustInfo->PricesInfo[plugNum].Balance != FAIL_BALANCE_PRICES &&
+                ShmOCPP16Data->SpMsg.bits.AuthorizeConf == YES) {
             ftime(&AuthNowTime);
             if (DiffTimeb(gRegTimeUp[plugNum][REG_WAIT_PLUG_IT_STATE], AuthNowTime) > (LOOP_RETRY_TIME / 10)) {
                 writeWaitPlugItState(fd, gunID);

BIN
EVSE/Projects/DD360Audi/Apps/UnsafetyOutputTask


+ 13 - 13
EVSE/Projects/DD360Audi/Apps/main.c

@@ -155,7 +155,7 @@ bool isModelNameMatch = true;
 
 int rfidFd = -1;
 char *rfidPortName = "/dev/ttyS2";
-char *fwVersion = "V1.03.00.0000.00"; // "V0.16.00.0000.00";
+char *fwVersion = "V1.04.00.0000.00"; // "V0.16.00.0000.00";
 
 sqlite3 *localDb;
 bool isDb_ready;
@@ -288,11 +288,11 @@ static void setSelGunWaitToAuthor(uint8_t curSel)
 {
     if (curSel == LEFT_GUN_NUM && gAudiCustInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM) {
         gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_ATHOR;
-        printf("setSelGunWaitToAuthor left\r\n");
+        //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;
-        printf("setSelGunWaitToAuthor right\r\n");
+        //printf("setSelGunWaitToAuthor right\r\n");
         StopGunInfoTimeoutDet(curSel);
     }
 }
@@ -312,11 +312,11 @@ static void confirmSelGun(uint8_t selGun)
     if (selGun == LEFT_GUN_NUM) {
         gAudiCustInfo->SelGunInfo.LeftGun = SEL_GUN_CONFIRM;
         StopGunInfoTimeoutDet(selGun);
-        printf("confirmSelGun left\r\n");
+        //printf("confirmSelGun left\r\n");
     } else if (selGun == RIGHT_GUN_NUM) {
         gAudiCustInfo->SelGunInfo.RightGun = SEL_GUN_CONFIRM;
         StopGunInfoTimeoutDet(selGun);
-        printf("confirmSelGun right\r\n");
+        //printf("confirmSelGun right\r\n");
     }
 
     changeLcmPage(_LCM_IDLE);
@@ -1935,7 +1935,7 @@ void _AuthorizedTimeout()
     if (IsAuthorizingMode()) {
         PRINTF_FUNC("*********** _AuthorizedTimeout *********** \n");
         isCardScan = false;
-        gAudiCustInfo->PricesInfo[ShmSysConfigAndInfo->SysInfo.CurGunSelected].Balance = 0.0; //Jerry add
+        //gAudiCustInfo->PricesInfo[ShmSysConfigAndInfo->SysInfo.CurGunSelected].Balance = 0.0; //Jerry add
         ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_AUTHORIZ_FAIL;
         //ChangeLcmByIndex(_LCM_AUTHORIZ_FAIL);
         strcpy((char *)ShmSysConfigAndInfo->SysConfig.UserId, "");
@@ -2399,13 +2399,13 @@ void ChkPrimaryStatus()
             switch (chargingInfo[ShmSysConfigAndInfo->SysInfo.CurGunSelected]->SystemStatus) {
             case S_IDLE: {
                 if (isDetectPlugin()) {
-                    printf("isDetectPlugin\r\n");
+                    //printf("isDetectPlugin\r\n");
                     _DetectPlugInTimeout();
                     destroySelGun(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
                     StopSystemTimeoutDet();
                 } else {
                     if (getConfirmSelectedGun(ShmSysConfigAndInfo->SysInfo.CurGunSelected) == PASS) {
-                        printf("destroy gun = %d\r\n", ShmSysConfigAndInfo->SysInfo.CurGunSelected);
+                        //printf("destroy gun = %d\r\n", ShmSysConfigAndInfo->SysInfo.CurGunSelected);
                         destroySelGun(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
                     } else {
                         confirmSelGun(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
@@ -2465,12 +2465,12 @@ void ChkPrimaryStatus()
             //PRINTF_FUNC("right btn down............................... %d \n", ShmSysConfigAndInfo->SysInfo.CurGunSelected);
             if (ShmSysConfigAndInfo->SysInfo.CurGunSelected + 1 < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount &&
                     ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == NO) {
-                printf("CurGunSelected++\r\n");
+                //printf("CurGunSelected++\r\n");
                 ShmSysConfigAndInfo->SysInfo.CurGunSelected++;
                 ChangeGunSelectByIndex(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
             } else if (ShmSysConfigAndInfo->SysConfig.AcConnectorCount > 0 &&
                        ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc == NO_DEFINE) {
-                printf("DEFAULT_AC_INDEX\r\n");
+                //printf("DEFAULT_AC_INDEX\r\n");
                 ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc = DEFAULT_AC_INDEX;
             } else if (ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == YES) {
                 for (byte _index = 0; _index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; _index++) {
@@ -2482,11 +2482,11 @@ void ChkPrimaryStatus()
                         return;
                     }
                 }
-                printf("1 CurGunSelected = 0\r\n");
+                //printf("1 CurGunSelected = 0\r\n");
                 ShmSysConfigAndInfo->SysInfo.CurGunSelected = 0;
                 ChangeGunSelectByIndex(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
             } else {
-                printf("2 CurGunSelected = 0\r\n");
+                //printf("2 CurGunSelected = 0\r\n");
                 ShmSysConfigAndInfo->SysInfo.CurGunSelected = 0;
                 ChangeGunSelectByIndex(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
             }
@@ -3311,7 +3311,7 @@ int CheckUpdateProcess(void)
                             }
                         }
                     } else {
-                        printf("Upgrade CCS open CAN FD fail.\n");
+                        DEBUG_ERROR_MSG("Upgrade CCS open CAN FD fail.\n");
                         //isPass = false;
                         return FAIL;
                     }

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


BIN
EVSE/Projects/DD360Audi/output/DoComm


BIN
EVSE/Projects/DD360Audi/output/FactoryConfig


BIN
EVSE/Projects/DD360Audi/output/Module_EvComm


BIN
EVSE/Projects/DD360Audi/output/Module_EventLogging


BIN
EVSE/Projects/DD360Audi/output/Module_InternalComm


BIN
EVSE/Projects/DD360Audi/output/Module_LcmControl


BIN
EVSE/Projects/DD360Audi/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360Audi/output/ReadCmdline


BIN
EVSE/Projects/DD360Audi/output/UnsafetyOutputTask


+ 1 - 1
EVSE/Projects/DD360Audi/output/init.sh

@@ -4,7 +4,7 @@ chmod 777 Module_LcmControl
 chmod 777 Module_InternalComm
 chmod 777 Module_EventLogging
 chmod 777 Module_EvComm
-chmod 777 Module_PsuComm
+#chmod 777 Module_PsuComm
 chmod 777 OcppBackend
 chmod 777 kill.sh
 chmod 777 ReadCmdline

BIN
EVSE/Projects/DD360Audi/output/main


+ 1 - 1
EVSE/Projects/DD360Audi/output/web.sh

@@ -1 +1 @@
-/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf  -m /lib
+/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf  -m /lib