Ver Fonte

2022-11-11 / Simon Xue [DD360Tcc]

Action:
1. [Mod] Remove free(dir) when Upgrade.
2. [Mod] Get EV SoC until terminating or alarm.
3. [Mod] Start chiller after authorize finish and plugin.
4. [Mod] Clear Parking flag when get parking status is none.

Files
As the following commit history files

Image Version: V2.22.XX.XXXX.XX
Simon Xue há 2 anos atrás
pai
commit
0eb3eea3c9

+ 3 - 6
EVSE/Projects/DD360Tcci/Apps/CSU/main.c

@@ -82,8 +82,8 @@ uint8_t bd0_2_status = 0;
 uint8_t bd1_1_status = 0;
 uint8_t bd1_2_status = 0;
 
-char *fwVersion = "V2.21.00.0000.00"; // Phihong version
-char* DebugVersion = "V2.21.00";      // Software debug version
+char *fwVersion = "V2.22.00.0000.00"; // Phihong version
+char* DebugVersion = "V2.22.00";      // Software debug version
 //sqlite3 *localDb;
 bool isDb_ready;
 
@@ -3067,10 +3067,7 @@ void OcppRemoteStartChk()
                 !isDetectPlugin(_index)) {
                 if (pDcChargingInfo->SystemStatus == S_IDLE ||
                     pDcChargingInfo->SystemStatus == S_RESERVATION) {
-                    if (ShmDcCommonData->pGunInfo[_index].isParking) {
-                        log_info("Gun%d is in the Parking status can't enter authorizing mode",_index);
-                        continue;
-                    }
+
                     pDcChargingInfo->RemoteStartFlag = YES;
                     ShmDcCommonData->is_RemoteStart[_index] = TRUE;
                     //pSysInfo->OrderCharging = YES;

+ 23 - 19
EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.c

@@ -487,11 +487,11 @@ static int qrCodeUrlInfoHandle(uint8_t *data)
                       tm->tm_mday,
                       tm->tm_hour,
                       tm->tm_min);
-
+    memset(pSysConfig->SystemId, '\0', sizeof(pSysConfig->SystemId));
+    string2ByteArray((char *)data, (uint8_t *)pSysConfig->SystemId);
+    //log_info("Data = %s SystemId = %s",data, pSysConfig->SystemId);
     //copy QR code string
     if (strncmp((char *)localTime, (char *)&data[0], timeLen - 2) != 0) {
-        memset(pSysConfig->SystemId, '\0', sizeof(pSysConfig->SystemId));
-
         // 充電槍IDLE時才更新系統時間
         for (int i = 0; i < pSysConfig->TotalConnectorCount; i++) {
             pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(i);
@@ -499,9 +499,8 @@ static int qrCodeUrlInfoHandle(uint8_t *data)
                 is_idle = FALSE;
         }
 
-        string2ByteArray((char *)data, (uint8_t *)pSysConfig->SystemId);
         string2Date((char*)data, (uint8_t*)_setTime);
-        //printf("SystemId =  %s", pSysConfig->SystemId);
+        //printf("SystemId = %s", pSysConfig->SystemId);
         if (!timecmp(localTime, _setTime) && is_idle) {
             //log_info("Set Timer:%s", _setTime);
             sprintf((char*)cmdBuf, "date -u -s \"%s\" >> /dev/null &", _setTime);
@@ -741,11 +740,15 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t plugNum, uint8_t *data)
 
             //pSysInfo->CurGunSelected = (plugNum);
             //pSysInfo->CurGunSelectedByAc = NO_DEFINE;
-
+            if (ShmDcCommonData->pGunInfo[plugNum].ParkingStatus) {
+                log_info("Gun%d is in the Parking status can't access Remote Start",plugNum);
+                break;
+            }
             setConfirmSelGun(plugNum);
 
             ShmOCPP16Data->CsMsg.bits[plugNum].RemoteStartTransactionReq = YES;
             ShmSelectGunInfo->PricesInfo[plugNum].Balance = 0.00;
+
             clearMiscCommand();
             break;
 
@@ -945,12 +948,12 @@ static int chargingbillHandle(uint8_t* data, uint8_t gunIndex)
     ShmDcCommonData->PriceBill.ParkingFee = transPricesUnit(ntohl(pBillInfo->ParkingFee));
     pBillInfo->RemainAmount = ntohl(pBillInfo->RemainAmount);
     memcpy((char*)&ShmDcCommonData->PriceBill.RemainAmount, (char*)&pBillInfo->RemainAmount, sizeof(uint32_t));
-    log_info("\t ******* TxId %d Charging Bill *******\n", ShmDcCommonData->PriceBill.TransactionId);
-    log_info("\t Total Cost = %.2f\n", ShmDcCommonData->PriceBill.TotalCost);
-    log_info("\t Discount = %.2f\n", ShmDcCommonData->PriceBill.Discount);
-    log_info("\t EnergyCost = %.2f\n", ShmDcCommonData->PriceBill.EnergyCost);
-    log_info("\t ParkingFee = %.2f\n", ShmDcCommonData->PriceBill.ParkingFee);
-    log_info("\t RemainAmount = %.2f\n", ShmDcCommonData->PriceBill.RemainAmount);
+    log_info("\t ******* TxId %d Charging Bill *******", ShmDcCommonData->PriceBill.TransactionId);
+    log_info("\t Total Cost = %.2f", ShmDcCommonData->PriceBill.TotalCost);
+    log_info("\t Discount = %.2f", ShmDcCommonData->PriceBill.Discount);
+    log_info("\t EnergyCost = %.2f", ShmDcCommonData->PriceBill.EnergyCost);
+    log_info("\t ParkingFee = %.2f", ShmDcCommonData->PriceBill.ParkingFee);
+    log_info("\t RemainAmount = %.2f", ShmDcCommonData->PriceBill.RemainAmount);
     if (ShmDcCommonData->PriceBill.TransactionId != ShmDcCommonData->TransactionInfo[gunIndex].TransactionId)
         UpdateRedeuctBill(ShmDcCommonData->PriceBill.TransactionId, ShmDcCommonData->PriceBill.TotalCost);
 }
@@ -1556,12 +1559,13 @@ static int responsePackeHandle(int fd, uint8_t *pResult, uint8_t plugNum, uint8_
             memcpy(ShmDcCommonData->ParkingInfo[plugNum].OccupancySN,&pCsuResult->Data.Data[1],36);
         }
         if (ShmDcCommonData->pGunInfo[plugNum].ParkingStatus != pCsuResult->Data.Data[0]) {
-            if (ShmDcCommonData->pGunInfo[plugNum].ParkingStatus)
-                ShmDcCommonData->pGunInfo[plugNum].isParking = TRUE;
-            else
-                ShmDcCommonData->pGunInfo[plugNum].isParking = FALSE;
             ShmDcCommonData->pGunInfo[plugNum].ParkingStatus = pCsuResult->Data.Data[0];
-            log_info("Gun%d Parking STATUS is [%d] SN:[%s]",plugNum,pCsuResult->Data.Data[0],cmd);
+            if (ShmDcCommonData->pGunInfo[plugNum].ParkingStatus == _TCC_PARKING_NONE )
+                ShmDcCommonData->pGunInfo[plugNum].isParking = FALSE;
+            else {
+                ShmDcCommonData->pGunInfo[plugNum].isParking = TRUE;
+            }
+            log_info("Gun%d Parking STATUS is [%d] SN:[%s] isParking:[%s]",plugNum,pCsuResult->Data.Data[0],cmd,(ShmDcCommonData->pGunInfo[plugNum].isParking ? "ON":"OFF"));
             if (!ShmDcCommonData->pGunInfo[plugNum].ParkingStatus) {
                 //if (pSysInfo->CurGunSelected == plugNum)
                 //    systemPageRestoreInit();
@@ -2557,14 +2561,14 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
             curReg = REG_QRCODE_URL_INFO;
             break;
         case REG_QRCODE_URL_INFO:
-            if (gunID == 1) {
+            //if (gunID == 1) {
                 if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > (LOOP_RETRY_TIME * 10) ||
                     DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) < 0
                     ) {
                     readQRcodeURLAndSystemDate(fd);
                     ftime(&gRegTimeUp[plugNum][curReg]);
                 }
-            }
+            //}
 
             //check misc command from power cabinet
             if (gDoCommGblData.MiscCmd != 0) {

+ 14 - 5
EVSE/Projects/DD360Tcci/Apps/ModuleEvComm/Module_EvRxComm.c

@@ -36,7 +36,7 @@ uint8_t ptemp_2 = 0;
 bool firstcircule = true;
 float EvTargetVolt[2] = { 0 };
 float EvTargetCur[2] = { 0 };
-
+unsigned char GunStatus[2] = {0};
 //------------------------------------------------------------------------------
 extern bool AbnormalStopAnalysis(uint8_t gun_index, uint8_t *errCode);
 
@@ -491,9 +491,9 @@ void CANReceiver(int fd)
                 break;
 
             case ACK_GET_OUTPUT_REQ:
-                //DS60-120 add
                 if ((pDcChargingInfo->SystemStatus >= S_PREPARING_FOR_EV &&
-                        pDcChargingInfo->SystemStatus <= S_CHARGING) ||
+                        pDcChargingInfo->SystemStatus <= S_TERMINATING) ||
+                        pDcChargingInfo->SystemStatus == S_ALARM ||
                         (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 &&
                          pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)
                    ) {
@@ -502,9 +502,18 @@ void CANReceiver(int fd)
                         pDcChargingInfo->EvBatteryStartSoc = frame.data[1];
                     }
 
-                    if (frame.data[1] > pDcChargingInfo->EvBatterySoc) {
+                    // 進入充電時重新更新電池電量
+                    if (GunStatus[targetGun] != pDcChargingInfo->SystemStatus && pDcChargingInfo->SystemStatus == S_CHARGING) {
+
+                        log_info("Reset Gun%d SoC:%d", targetGun, frame.data[1]);
+                        pDcChargingInfo->EvBatterySoc = frame.data[1];
+                        GunStatus[targetGun] = pDcChargingInfo->SystemStatus;
+                    }
+
+                    if (frame.data[1] > pDcChargingInfo->EvBatterySoc || pDcChargingInfo->SystemStatus == S_CHARGING) {
                         pDcChargingInfo->EvBatterySoc = frame.data[1];
-                        log_info("Gun%d SOC:%d", targetGun,pDcChargingInfo->EvBatterySoc);
+                        if (frame.data[1] > pDcChargingInfo->EvBatterySoc)
+                            log_info("Gun%d SOC:%d", targetGun,pDcChargingInfo->EvBatterySoc);
                     }
                 }
                 //pDcChargingInfo->EvBatterySoc = frame.data[1]; //DS60-120 remove

+ 1 - 1
EVSE/Projects/DD360Tcci/Apps/ModulePrimary/Module_PrimaryComm.c

@@ -216,7 +216,7 @@ static void checkChillerStatus(Gpio_out *gpio)
         pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
         pChillerInfo = (ChillerInfo *)&fChillerInfo[gunIndex];
 
-        if((pDcChargingInfo->SystemStatus > S_IDLE && pDcChargingInfo->SystemStatus < S_TERMINATING) ||
+        if((pDcChargingInfo->SystemStatus > S_AUTHORIZING && pDcChargingInfo->SystemStatus < S_TERMINATING) ||
             (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 && pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)) {
             pChillerInfo->ChillerSwitch = YES;
             pChillerInfo->ChillerOnTime = time((time_t *)NULL);

+ 1 - 1
EVSE/Projects/DD360Tcci/Apps/ModuleUpdateFW/Module_UpdateFW.c

@@ -482,7 +482,7 @@ static int CheckUpdateProcess(void)
 
         }
     }
-    free(dir);
+    //free(dir);
     closedir(d);
 
     if (retFail != 0) {

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


BIN
EVSE/Projects/DD360Tcci/output/Module_DoComm


BIN
EVSE/Projects/DD360Tcci/output/Module_EvComm


BIN
EVSE/Projects/DD360Tcci/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360Tcci/output/Module_UpdateFW


BIN
EVSE/Projects/DD360Tcci/output/main