فهرست منبع

2022-05-10 / Simon Xue

Action:
1. [Modify] Rededuct time change.
2. [Add] ReadCmdline add passbackend function.
3. [Add] LCM Add uploading page.
4. [Modify] Credit Card Process.

Files
As the following commit history files

Image Version: V2.11.XX.XXXX.XX
Simon Xue 2 سال پیش
والد
کامیت
ea625f6bf0
28فایلهای تغییر یافته به همراه206 افزوده شده و 107 حذف شده
  1. 33 21
      EVSE/Projects/DD360Tcci/Apps/CSU/RFID.c
  2. 22 24
      EVSE/Projects/DD360Tcci/Apps/CSU/main.c
  3. 1 1
      EVSE/Projects/DD360Tcci/Apps/CSU/main.h
  4. 41 1
      EVSE/Projects/DD360Tcci/Apps/Config.h
  5. 13 11
      EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.c
  6. 3 0
      EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.h
  7. 5 1
      EVSE/Projects/DD360Tcci/Apps/ModuleEvComm/Module_EvRxComm.c
  8. 3 5
      EVSE/Projects/DD360Tcci/Apps/ModuleEvComm/Module_EvTxComm.c
  9. 1 1
      EVSE/Projects/DD360Tcci/Apps/ModuleInternalComm/FanBoard.c
  10. 13 35
      EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.c
  11. 2 0
      EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.h
  12. 16 6
      EVSE/Projects/DD360Tcci/Apps/ReadCmdline.c
  13. 0 1
      EVSE/Projects/DD360Tcci/Apps/SelectGun/SelectGun.h
  14. 29 0
      EVSE/Projects/DD360Tcci/Apps/ShareMemory/shmMem.c
  15. 1 0
      EVSE/Projects/DD360Tcci/Apps/ShareMemory/shmMem.h
  16. BIN
      EVSE/Projects/DD360Tcci/Images/ramdisk.gz
  17. BIN
      EVSE/Projects/DD360Tcci/output/FactoryConfig
  18. BIN
      EVSE/Projects/DD360Tcci/output/Module_ChkSysTask
  19. BIN
      EVSE/Projects/DD360Tcci/output/Module_DoComm
  20. BIN
      EVSE/Projects/DD360Tcci/output/Module_EvComm
  21. BIN
      EVSE/Projects/DD360Tcci/output/Module_EventLogging
  22. BIN
      EVSE/Projects/DD360Tcci/output/Module_InternalComm
  23. BIN
      EVSE/Projects/DD360Tcci/output/Module_LcmControl
  24. BIN
      EVSE/Projects/DD360Tcci/output/Module_PrimaryComm
  25. BIN
      EVSE/Projects/DD360Tcci/output/Module_UpdateFW
  26. BIN
      EVSE/Projects/DD360Tcci/output/ReadCmdline
  27. BIN
      EVSE/Projects/DD360Tcci/output/main
  28. 23 0
      build_rootfs_copy.sh

+ 33 - 21
EVSE/Projects/DD360Tcci/Apps/CSU/RFID.c

@@ -332,11 +332,12 @@ void WritePayResult(int result ,uint8_t gunIndex)
     else
         ShmDcCommonData->TransactionInfo[gunIndex].DeductResult = _DEDUCT_COMPLETE_FAIL;
 
-    log_info("Gun[%d] TransactionId:%d DeductResult:%d IsDonateInvoice:%d Amount:%f",
+    log_info("Gun[%d] TransactionId:%d DeductResult:%d IsDonateInvoice:%d Amount:%f VemData:%s",
         gunIndex, ShmDcCommonData->TransactionInfo[gunIndex].TransactionId,
         ShmDcCommonData->TransactionInfo[gunIndex].DeductResult,
         ShmDcCommonData->TransactionInfo[gunIndex].IsDonateInvoice,
-        ShmDcCommonData->TransactionInfo[gunIndex].Amount);
+        ShmDcCommonData->TransactionInfo[gunIndex].Amount,
+        ShmDcCommonData->TransactionInfo[gunIndex].pCreditCard.VemData);
 }
 void storePayResult(uint8_t gunIndex)
 {
@@ -354,7 +355,7 @@ void PreAuthCompleteToCardReader(int fd,uint8_t gunIndex)
         ShmDcCommonData->TransactionInfo[gunIndex].Amount = 1;
     }
     storePayResult(gunIndex);
-    log_info("Start Auth Complete");
+
 	result = CreditCardPreAuthComplete(fd,(int)ShmDcCommonData->TransactionInfo[gunIndex].Amount, &pSysConfig->ModelName[0],
 											&ShmDcCommonData->TransactionInfo[gunIndex].pCreditCard.VemData[0],
 											&ShmDcCommonData->TransactionInfo[gunIndex].pCreditCard);
@@ -416,10 +417,12 @@ void ReDeductProcess(int fd)
         log_info("Rededuct Total Number:%d", rededuct_num);
         for (j = 0; j < rededuct_num; j++) {
             sleep(10);
+            /*
             if (pSysInfo->SystemPage != _PAGE_IDLE && !ShmDcCommonData->Exe_ReDeduct) {
                 ShmDcCommonData->RoutineReduct = FALSE;
                 break;
             }
+            */
             log_info("Start Rededuct item [%d]",j);
             if (deductInfo[j].isIntoCharge == FALSE ||
                 (deductInfo[j].Energy == 0 && deductInfo[j].Amount == 0)) {
@@ -436,7 +439,7 @@ void ReDeductProcess(int fd)
             } else {
                 // 度數大於零
                 if (deductInfo[j].Amount == 0 && deductInfo[j].Energy > 0) {
-                    deductInfo[j].Amount = deductInfo[j].Energy * ShmDcCommonData->ChargingRate;
+                    deductInfo[j].Amount = ceil(deductInfo[j].Energy * ShmDcCommonData->ChargingRate);
                     if (deductInfo[j].Amount < 1)
                         deductInfo[j].Amount = 1;
                     log_info("Error Close Charging recount amount:%.1f",deductInfo[j].Amount);
@@ -497,6 +500,7 @@ void CreateRfidFork(void)
     int donate = 0;
     rfidRecPid = fork();
     int j = 0;
+    int sel_gun = 0;
     if (rfidRecPid == 0) {
         //char localTime[128] = {0};
         struct timeb SeqEndTime;
@@ -540,7 +544,7 @@ void CreateRfidFork(void)
             is_idle = TRUE;
 			for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
 				pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
-				if (pDcChargingInfo->SystemStatus != S_IDLE && pDcChargingInfo->SystemStatus != S_FAULT ) {
+				if (pDcChargingInfo->SystemStatus != S_IDLE && pDcChargingInfo->SystemStatus != S_FAULT) {
 					is_idle = FALSE;
 				}
                 if (ShmDcCommonData->StopCharge[gunIndex] == TRUE && pDcChargingInfo->Replug_flag == TRUE) {
@@ -597,10 +601,11 @@ void CreateRfidFork(void)
                 CreditCardCancelPreAuth(fd,pSysInfo->CurGunSelected);
             // 預授權
             } else if (ShmDcCommonData->PreAuth_Config == _CREDITCARD_PREAUTH /* && ShmDcCommonData->GetCardNo[pSysInfo->CurGunSelected]*/) {
-                donate = (int)ShmDcCommonData->TransactionInfo[pSysInfo->CurGunSelected].IsDonateInvoice;
-                memset(&ShmDcCommonData->TransactionInfo[pSysInfo->CurGunSelected], 0x00, sizeof(RecordTransactionInfo));
-                ShmDcCommonData->TransactionInfo[pSysInfo->CurGunSelected].IsDonateInvoice = (unsigned char)donate;
-        		result = CreditCardPreAuth(fd, PREAUTHMONEY,&pSysConfig->ModelName[0], &ShmDcCommonData->TransactionInfo[pSysInfo->CurGunSelected].pCreditCard);
+                sel_gun = pSysInfo->CurGunSelected;
+                donate = (int)ShmDcCommonData->TransactionInfo[sel_gun].IsDonateInvoice;
+                memset(&ShmDcCommonData->TransactionInfo[sel_gun], 0x00, sizeof(RecordTransactionInfo));
+                ShmDcCommonData->TransactionInfo[sel_gun].IsDonateInvoice = (unsigned char)donate;
+        		result = CreditCardPreAuth(fd, PREAUTHMONEY,&pSysConfig->ModelName[0], &ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard);
                 if (!ShmDcCommonData->TradeCancel)
                     StopSystemTimeoutDet();
                 if (ShmDcCommonData->TradeCancel == FALSE && result > 0) {
@@ -610,34 +615,40 @@ void CreateRfidFork(void)
 
                 ShmDcCommonData->PreAuth_Result = result;
 				//result = 1;
-				if (result > 0 && strcmp(ShmDcCommonData->TransactionInfo[pSysInfo->CurGunSelected].pCreditCard.CardNo,"") != 0 ) {
+				if (result > 0 && strcmp(ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.CardNo,"") != 0 ) {
 
-					ShmDcCommonData->AuthPass_flag[pSysInfo->CurGunSelected] = TRUE;
-                    strncpy((char*)pSysConfig->UserId, (char *)ShmDcCommonData->TransactionInfo[pSysInfo->CurGunSelected].pCreditCard.CardNo, 20);
+					ShmDcCommonData->AuthPass_flag[sel_gun] = TRUE;
+                    strncpy((char*)pSysConfig->UserId, (char *)ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.CardNo, 20);
                     log_info("Authorize card:%s", pSysConfig->UserId);
-                    ShmDcCommonData->TransactionInfo[pSysInfo->CurGunSelected].DeductResult = _DEDUCT_PREAUTH;
-                    ShmDcCommonData->TransactionInfo[pSysInfo->CurGunSelected].IsUpload = FALSE;
-                    InsertDeductInfo(ShmDcCommonData->ConnectorID[pSysInfo->CurGunSelected], &ShmDcCommonData->TransactionInfo[pSysInfo->CurGunSelected]);
+                    ShmDcCommonData->TransactionInfo[sel_gun].DeductResult = _DEDUCT_PREAUTH;
+                    ShmDcCommonData->TransactionInfo[sel_gun].IsUpload = FALSE;
+                    ShmDcCommonData->TransactionInfo[sel_gun].ConnectorID = ShmDcCommonData->ConnectorID[sel_gun];
+                    InsertDeductInfo(ShmDcCommonData->ConnectorID[sel_gun], &ShmDcCommonData->TransactionInfo[sel_gun]);
 					log_info("PreAuth OK");
 				} else if (result < 0) {
                     if (ShmDcCommonData->TradeCancel == FALSE)
 					    pSysInfo->SystemPage = _PAGE_AUTHORIZE_FAIL;
-					ShmDcCommonData->AuthPass_flag[pSysInfo->CurGunSelected] = FALSE;
-					memset(&ShmDcCommonData->TransactionInfo[pSysInfo->CurGunSelected].pCreditCard, 0, sizeof(TransInfo));
+					ShmDcCommonData->AuthPass_flag[sel_gun] = FALSE;
+					memset(&ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard, 0, sizeof(TransInfo));
 					log_info("PreAuth Fail");
+                    sleep(7);
 				}
 				ShmDcCommonData->PreAuth_Config = _CREDITCARD_IDLE;
             }
 
-            // 每日晚上11點進行補扣款
-            if (tm->tm_min %5 == 0 && tm->tm_sec == 0) {
+            // 每30分鐘檢查補扣款
+            if (tm->tm_min %30 == 0 && tm->tm_sec == 0) {
                 ShmDcCommonData->RoutineReduct = FALSE;
             }
 
             if ((is_idle == TRUE &&
                 pSysInfo->SystemPage == _PAGE_IDLE &&
                 ShmDcCommonData->RoutineReduct == FALSE) || ShmDcCommonData->Exe_ReDeduct) {
+                ShmDcCommonData->CreditCardUpload = TRUE;
+                pSysInfo->SystemPage = _PAGE_PAYING;
                 ReDeductProcess(fd);
+                pSysInfo->SystemPage = _PAGE_IDLE;
+                ShmDcCommonData->CreditCardUpload = FALSE;
                 ShmDcCommonData->Exe_ReDeduct = 0;
             }
 
@@ -650,7 +661,8 @@ void CreateRfidFork(void)
                     ShmDcCommonData->UnionSettlement = 0;
                 else
                     ShmDcCommonData->RoutineSettlement = TRUE;
-                pSysInfo->SystemPage = _PAGE_MAINTAIN;
+                ShmDcCommonData->CreditCardUpload = TRUE;
+                pSysInfo->SystemPage = _PAGE_PAYING;
                  
                 result = CreditCardUnionSettlement(fd, &pSysConfig->ModelName[0], &LocalTransactionInfo.pCreditCard);
                 if (result > 0) {
@@ -660,10 +672,10 @@ void CreateRfidFork(void)
                     log_info("CreditCardUnionSettlement FAIL");
                 sleep(90);
                 pSysInfo->SystemPage = _PAGE_IDLE;
+                ShmDcCommonData->CreditCardUpload = FALSE;
             }
             if (tm->tm_hour == 16 && tm->tm_min == 0) {
                 ShmDcCommonData->RoutineSettlement = FALSE;
-                ShmDcCommonData->RoutineReduct = FALSE;
             }
             /*
             // 刷卡判斷

+ 22 - 24
EVSE/Projects/DD360Tcci/Apps/CSU/main.c

@@ -60,6 +60,7 @@ static struct FanModuleData *ShmFanModuleData = NULL;
 static struct RelayModuleData *ShmRelayModuleData = NULL;
 static struct LedModuleData *ShmLedModuleData = NULL;
 static struct OCPP16Data *ShmOCPP16Data = NULL;
+static struct OCPP20Data* ShmOCPP20Data = NULL;
 static DcCommonInfo *ShmDcCommonData = NULL;
 
 static struct ChargingInfoData *pDcChargingInfo = NULL;
@@ -81,8 +82,8 @@ uint8_t bd0_2_status = 0;
 uint8_t bd1_1_status = 0;
 uint8_t bd1_2_status = 0;
 
-char *fwVersion = "V2.10.00.0000.00"; // Phihong version
-char* DebugVersion = "v2.10.00";      // Software debug version
+char *fwVersion = "V2.11.00.0000.00"; // Phihong version
+char* DebugVersion = "v2.11.00";      // Software debug version
 //sqlite3 *localDb;
 bool isDb_ready;
 
@@ -1357,7 +1358,10 @@ uint8_t isPrechargeStatus_chademo(uint8_t gunIndex)
 {
     uint8_t result = 0x00;
     pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
-
+    if (ShmDcCommonData->pGunInfo[gunIndex].EVStatus != ShmCHAdeMOData->ev[pDcChargingInfo->type_index].PresentMsgFlowStatus) {
+        log_info("Gun%d Chademo board status = %d ", gunIndex, ShmCHAdeMOData->ev[pDcChargingInfo->type_index].PresentMsgFlowStatus);
+        ShmDcCommonData->pGunInfo[gunIndex].EVStatus = ShmCHAdeMOData->ev[pDcChargingInfo->type_index].PresentMsgFlowStatus;
+    }
     result = ShmCHAdeMOData->ev[pDcChargingInfo->type_index].PresentMsgFlowStatus;
 
     return result;
@@ -1388,7 +1392,10 @@ uint8_t isPrechargeStatus_gb(uint8_t gunIndex)
 {
     uint8_t result = 0x00;
     pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
-
+    if (ShmDcCommonData->pGunInfo[gunIndex].EVStatus != ShmGBTData->ev[pDcChargingInfo->type_index].PresentMsgFlowStatus) {
+        log_info("Gun%d GB Board status = %d ", gunIndex, ShmGBTData->ev[pDcChargingInfo->type_index].PresentMsgFlowStatus);
+        ShmDcCommonData->pGunInfo[gunIndex].EVStatus = ShmGBTData->ev[pDcChargingInfo->type_index].PresentMsgFlowStatus;
+    }
     result = ShmGBTData->ev[pDcChargingInfo->type_index].PresentMsgFlowStatus;
 
     return result;
@@ -1410,6 +1417,10 @@ uint8_t isPrechargeStatus_ccs(uint8_t gunIndex)
     pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
 
     if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121) {
+        if (ShmDcCommonData->pGunInfo[gunIndex].EVStatus != ShmCcsData->V2GMessage_DIN70121[pDcChargingInfo->type_index].PresentMsgFlowStatus) {
+            log_info("Gun%d CCS board status = %d ", gunIndex, ShmCcsData->V2GMessage_DIN70121[pDcChargingInfo->type_index].PresentMsgFlowStatus);
+            ShmDcCommonData->pGunInfo[gunIndex].EVStatus = ShmCcsData->V2GMessage_DIN70121[pDcChargingInfo->type_index].PresentMsgFlowStatus;
+        }
         result = ShmCcsData->V2GMessage_DIN70121[pDcChargingInfo->type_index].PresentMsgFlowStatus;
     }
 
@@ -3562,7 +3573,7 @@ static void ReviewCriticalAlarm(void)
        ) {
         if (((ShmSelectGunInfo->EthDevStatus.Backend == 0 ||
             ShmSelectGunInfo->EthDevStatus.Backend == 2) &&
-            ShmDcCommonData->DebugFlag == TRUE) || 
+            ShmDcCommonData->passbackend == TRUE) ||
             pSysConfig->AuthorisationMode) {
             pSysWarning->Level = WARN_LV_NL;
             return;
@@ -3966,22 +3977,21 @@ void showversion()
     log_info("\tRelay Board FW Rev = %s", pSysInfo->RelayModuleFwRev);
     log_info("\tFan Board FW Rev = %s", pSysInfo->FanModuleFwRev);
     log_info("\tPrimary FW Rev = %s", pSysInfo->CsuPrimFwRev);
-    log_info("\tLCM HW Rev = %s", pSysInfo->LcmHwRev);
     log_info("\tLED FW Rev = %s", pSysInfo->LedModuleFwRev);
 
     for (index = 0; index < pSysConfig->TotalConnectorCount; index++) {
         pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(index);
         if (pDcChargingInfo->Type == _Type_Chademo) {
             log_info("\tCHAdeMO[%d] FW Rev = %s",
-                                     pDcChargingInfo->type_index,
+                                     index,
                                      ShmCHAdeMOData->evse[pDcChargingInfo->type_index].version);
         } else if (pDcChargingInfo->Type == _Type_GB) {
             log_info("\tGBT[%d] FW Rev = %s",
-                                     pDcChargingInfo->type_index,
+                                     index,
                                      ShmGBTData->evse[pDcChargingInfo->type_index].version);
         } else if (pDcChargingInfo->Type == _Type_CCS_2) {
             log_info("\tCCS[%d] FW Rev = %s",
-                                         pDcChargingInfo->type_index,
+                                         index,
                                          ShmCcsData->V2GMessage_DIN70121[pDcChargingInfo->type_index].version);
         }
     }
@@ -4018,6 +4028,7 @@ int main(void)
     ShmRelayModuleData = (struct RelayModuleData *)GetShmRelayModuleData();
     ShmLedModuleData = (struct LedModuleData *)GetShmLedModuleData();
     ShmOCPP16Data = (struct OCPP16Data *)GetShmOCPP16Data();
+    ShmOCPP20Data = (struct OCPP20Data*)GetShmOCPP20Data();
     ShmDcCommonData = (DcCommonInfo *)GetShmDcCommonData();
     ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
 	
@@ -4389,7 +4400,7 @@ CheckStatus:
 
                 if (ShmPsuData->SystemPresentPsuQuantity > 0 &&
                         ShmPsuData->SystemAvailablePower > 10 &&
-                        GetTimeoutValue(pDcChargingInfo->TimeoutTimer) >= 5000000) {
+                        GetTimeoutValue(pDcChargingInfo->TimeoutTimer) >= 1000000) {
                     setChargerMode(gunIndex, MODE_PREPARE_FOR_EV);
                 }
 
@@ -4469,18 +4480,6 @@ CheckStatus:
                             pDcChargingInfo->PrechargeStatus != PRECHARGE_READY)
                         //if (pDcChargingInfo->PrechargeStatus != PRECHARGE_PRERELAY_PASS)
                     {
-                        //log_info("Send precharge ready 1..........%x, status = %d ",
-                        //         gunIndex,
-                        //         isPrechargeStatus_ccs(gunIndex));
-                        if (isPrechargeStatus_ccs(gunIndex) == 39) {
-                            log_info("Conn %x, Precharge ready, CCS status = PreChargeResponse (%d) ",
-                                     gunIndex,
-                                     isPrechargeStatus_ccs(gunIndex));
-                        } else if (isPrechargeStatus_ccs(gunIndex) == 40) {
-                            log_info("Conn %x, Precharge ready, CCS status = PowerDeliveryRequest start (%d) ",
-                                     gunIndex,
-                                     isPrechargeStatus_ccs(gunIndex));
-                        }
 
                         pDcChargingInfo->PrechargeStatus = PRECHARGE_READY;
                     }
@@ -4705,7 +4704,6 @@ CheckStatus:
                     pSysInfo->SystemPage = _PAGE_EXIT;
                     break;
                 }
-                
 
                 if (pDcChargingInfo->ConnectorPlugIn == NO &&
                     pSysInfo->SystemPage != _PAGE_PAYING && pSysInfo->SystemPage != _PAGE_SENSING) {
@@ -4719,7 +4717,7 @@ CheckStatus:
                 if (pSysInfo->CurGunSelected == gunIndex && pSysInfo->SystemPage != _PAGE_PAYING ) {
                 	if (pDcChargingInfo->Replug_flag == TRUE)
                 		pSysInfo->SystemPage = _PAGE_PLUGOUT;
-                	else{
+                	else {
                 		if (ShmDcCommonData->PayPass_flag[pSysInfo->CurGunSelected] == TRUE)
 							pSysInfo->SystemPage = _PAGE_COMPLETE;
 						else

+ 1 - 1
EVSE/Projects/DD360Tcci/Apps/CSU/main.h

@@ -50,7 +50,7 @@
 #define TCC_LINEREGISTER_TIMEOUT				(60)
 #define TCC_DONATECOMFIRM_TIMEOUT				(180)
 #define TCC_SELECTPAY_TIMEOUT					(180)
-#define TCC_FINALCOST_TIMEOUT					(30)
+#define TCC_FINALCOST_TIMEOUT					(60)
 #define TCC_SCANCARD_TIMEOUT					(30)
 #define TCC_TRADECANCEL_TIMEOUT                 (60)
 #define TCC_EXITPAGE_TIMEOUT                    (10)

+ 41 - 1
EVSE/Projects/DD360Tcci/Apps/Config.h

@@ -383,7 +383,8 @@ typedef union {
     struct {
         uint8_t ChillerOTP: 1;            //chiller Temperature OVP
         uint8_t ChillerTempSensorFail: 1; //Chiller temperature sensor failure
-        uint8_t Reserved: 6;
+        uint8_t ChillerTubeOTP : 1;
+        uint8_t Reserved: 5;
     } StatusBit;
 } ChillerTempErr;
 
@@ -399,6 +400,38 @@ typedef struct StPcPsuOutput { //from power cabinet PSU output
     uint16_t Current;
 } PcPsuOutput;
 
+typedef struct StPowerConsumptionInfo {
+    float Gun1_Consumption;
+    float Gun2_Consumption;
+    float Gun3_Consumption;
+    float Gun4_Consumption;
+} PowerConsumptionValue;
+
+typedef struct StPowConsumValue {
+    uint32_t Gun1_Consumption;
+    uint32_t Gun2_Consumption;
+    uint32_t Gun3_Consumption;
+    uint32_t Gun4_Consumption;
+} PowConsumValue;
+
+typedef struct StGunInfo {
+    int ConnectorID;
+    char ReceiptInfo[255];
+    int finalcost_flag;
+    time_t EVLoseTimer;
+    uint8_t EVLoseFlag;
+    char ReservationID[32];
+    uint8_t ReservationStatus;
+    char UserPriceString[255];
+    float PowerConsumption;
+    time_t RecordEnergyTime;
+    char ChargeStartTime[32];
+    char ChargeStopTime[32];
+    char ChargeDuration[32];
+    uint8_t withChiller;      //是否有水冷機
+    int EVStatus;          // ev小板狀態
+} GunInfo;
+
 typedef struct Psu_VersionInfo{
 	uint8_t n_PSU;
 	uint8_t DCVersion[32];
@@ -508,6 +541,13 @@ typedef struct StDcCommonInfo {
     time_t EVDisconnectTime[2];
     int EVDisconnectFlag[2];
     int is_plugout[2];
+    GunInfo pGunInfo[2];
+    uint8_t AuthroizeType; // 0: Central   1: eMAID    2: ISO14443 3: ISO15693 4: KeyCode  5: Local    6: MacAddress   7: NoAuthorization
+    char QRCodeString[255];
+    char DefaultPriceString[255];
+    PowerConsumptionValue pConsumption;
+    uint8_t CreditCardUpload;
+    uint8_t passbackend;
 } DcCommonInfo;
 
 #endif /* CONFIG_H_ */

+ 13 - 11
EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.c

@@ -1273,6 +1273,7 @@ static int responsePackeHandle(int fd, uint8_t *pResult, uint8_t plugNum, uint8_
         }
 
         ShmSelectGunInfo->WaitDoCommPermission[plugNum] = pCsuResult->Data.Data[0];
+
         return pCsuResult->Data.Data[0];
         break;
 
@@ -2166,7 +2167,7 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
 					pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(plugNum);
 					ShmDcCommonData->TransactionInfo[plugNum].Amount = pDcChargingInfo->ChargingFee;
 					ShmDcCommonData->finalcost_flag[plugNum] = TRUE;
-					log_info("Gun %d get final cost %f", plugNum, pDcChargingInfo->ChargingFee);
+					log_info("Gun %d get final cost %f", plugNum, ShmDcCommonData->TransactionInfo[plugNum].Amount);
                 }
             }
             curReg = REG_PLUG_IN_STATE;
@@ -2448,7 +2449,7 @@ static void systemStatusProcess(int fd, uint8_t totalGun, uint8_t plugNum, uint8
                 DiffTimeb(gRegTimeUp[plugNum][REG_DEDUCT_INFO], AuthNowTime) < 0
                 ) {
                 reupload_num = DB_GetMultiReUploadDeduct(&reupload_gunIndex[0], &reuploadInfo[0]);
-                if (reupload_num >= 1) {
+                if (reupload_num >= 1 && reuploadInfo[0].ConnectorID != 0) {
 
                     if (writeDeductInfo(fd, reuploadInfo[0].ConnectorID, reupload_gunIndex[0], &reuploadInfo[0]) == PASS) {
                         log_info("Reupload Success");
@@ -2737,18 +2738,19 @@ void CreditCardProcess(int fd,int plugNum,int gunID, RecordTransactionInfo *pInf
     if (pInfo->IsUpload == TRUE || (strcmp(pInfo->pCreditCard.VemData,"") == 0) ||
         pSysInfo->SystemPage == _PAGE_SENSING)
         return;
+    if (ShmDcCommonData->TransactionInfo[plugNum].ConnectorID != 0) {
+        if (writeDeductInfo(fd, gunID, plugNum, &ShmDcCommonData->TransactionInfo[plugNum]) == PASS) {
+            ShmDcCommonData->TransactionInfo[plugNum].IsUpload = YES;
+            UpdateDeductInfoStatus(plugNum, &ShmDcCommonData->TransactionInfo[plugNum]);
 
-    if (writeDeductInfo(fd, gunID, plugNum, &ShmDcCommonData->TransactionInfo[plugNum]) == PASS) {
-        ShmDcCommonData->TransactionInfo[plugNum].IsUpload = YES;
-        UpdateDeductInfoStatus(plugNum, &ShmDcCommonData->TransactionInfo[plugNum]);
+            if (ShmDcCommonData->TransactionInfo[plugNum].DeductResult == _DEDUCT_CANCEL) {
+                memset(&ShmDcCommonData->TransactionInfo[plugNum].pCreditCard, 0x00, sizeof(TransInfo));
+            }
 
-        if (ShmDcCommonData->TransactionInfo[plugNum].DeductResult == _DEDUCT_CANCEL) {
-            memset(&ShmDcCommonData->TransactionInfo[plugNum].pCreditCard, 0x00, sizeof(TransInfo));
+            log_info("writeDeductInfo finish");
+        } else {
+            log_info("Write Deduct fail");
         }
-
-        log_info("writeDeductInfo finish");
-    } else {
-        log_info("Write Deduct fail");
     }
 }
 int main(int argc, char *argv[])

+ 3 - 0
EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.h

@@ -139,6 +139,9 @@
 #define MISC_CMD_STATION_INFO_REQ               (0x0109)
 #define MISC_CMD_FINAL_COST_REQ                 (0x010A)
 #define MISC_CMD_LINE_STATUS_REQ                (0x010B)
+#define MISC_CMD_DEFAULT_PRICE_REQ              (0x010C)
+#define MISC_CMD_USER_PRICE_REQ                 (0x010D)
+#define MISC_CMD_RECEIPT_REQ                    (0x010E)
 
 #define ST_UPDATE_FIRMWARE                      (0x01)
 #define ST_NO_UPDATE_FIRMWARE                   (0x02)

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

@@ -330,10 +330,14 @@ void CANReceiver(int fd)
                 // 檢查是否有收到EV小板訊號
                 if ((time((time_t*)NULL) - ShmDcCommonData->EVDisconnectTime[_index]) > 3 &&
                     !ShmDcCommonData->EVDisconnectFlag[_index] &&
-                    pDcChargingInfo->SystemStatus != S_UPDATE) {
+                    pDcChargingInfo->SystemStatus != S_UPDATE && !ShmDcCommonData->DebugFlag) {
                     ShmDcCommonData->EVDisconnectTime[_index] = time((time_t*)NULL);
                     ShmDcCommonData->EVDisconnectFlag[_index] = TRUE;
                     log_info("Not Get EV Board %d data in 3 sec.", _index);
+                    system("/sbin/ip link set can0 down");
+                    sleep(1);
+                    system("/sbin/ip link set can0 type can bitrate 500000 restart-ms 100");
+                    system("/sbin/ip link set can0 up");
                 }
                 CheckEvConnect(_index);
             }

+ 3 - 5
EVSE/Projects/DD360Tcci/Apps/ModuleEvComm/Module_EvTxComm.c

@@ -405,8 +405,8 @@ static void SetPresentChargingOutputCap(void)
              LogInfo[1][EV_LOG_OUTPUT_CAP_CUR] >= cur2 + 5)
        ) {
         //log_info("----------------------------------------------------- ");
-        log_info("To EV (Real) Power_1 = %.1f, Cur_1 = %.1f, Power_2 = %.1f, Cur_2 = %.1f",
-                 pow1 / 10, cur1 / 10, pow2 / 10, cur2 / 10);
+        log_info("To EV PW_1 = %.1f, Cur_1 = %.1f, Vol_1 = %.1f, PW_2 = %.1f, Cur_2 = %.1f, Vol_2 = %.1f",
+                 pow1 / 10, cur1 / 10, chargingData_1->FireChargingVoltage, pow2 / 10, cur2 / 10, chargingData_2->FireChargingVoltage);
         //log_info("----------------------------------------------------- ");
 
         LogInfo[0][EV_LOG_OUTPUT_CAP_POW] = pow1;
@@ -546,11 +546,9 @@ static void SetPresentChargingOutputPower(void)
             (LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] >= cur2 + CHK_CUR_RANGE) ||
             (LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] <= cur2 - CHK_CUR_RANGE)
        ) {
-        log_info("G1->Out Vol(%s)=%.1f,Out Cur=%.1f - G2->Out Vol(%s) = %.1f, Out Cur = %.1f",
-                 isPsuVol1 == true ? "P" : "R",
+        log_info("G1-> Vol=%.1f, Cur=%.1f - G2-> Vol = %.1f, Cur = %.1f",
                  vol1 / 10,
                  cur1 / 10,
-                 isPsuVol2 == true ? "P" : "R",
                  vol2 / 10,
                  cur2 / 10);
 

+ 1 - 1
EVSE/Projects/DD360Tcci/Apps/ModuleInternalComm/FanBoard.c

@@ -25,7 +25,7 @@ static int Uart5Fd = 0;
 static struct timeval gFanBoardRunTimer;
 
 static uint16_t _setFanSpeed = 0;
-static uint16_t fanSpeedSmoothValue = 500;
+static uint16_t fanSpeedSmoothValue = 1000;
 
 //------------------------------------------------------------------------------
 static void SetFanModuleSpeed(void)

+ 13 - 35
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -1018,9 +1018,6 @@ void ChangeChargingRateValue(int rate)
     uint8_t value[10];
 
     memset(cmd, 0x00, sizeof(cmd));
-    if (rate == 0) {
-        log_info("Doesn't get Charge Fee");
-    } 
     
     sprintf((char *) value, "%d",rate);
     string2ByteArray(value, cmd);
@@ -1265,6 +1262,7 @@ void ProcessPageInfo()
         } else if (pDcChargingInfo->Type == _Type_Chademo) {
             ChangeDisplay2Value(_Icon_ShowRight,_TCC_ShowRight_CHAdeMo_Off);
         }
+        ChangeQrCode_Error();
         /*
         if (ShmDcCommonData->ClearServiceQR == FALSE) {
             ShmDcCommonData->ClearServiceQR = TRUE;
@@ -1304,24 +1302,7 @@ void ProcessPageInfo()
             	break;
             case _PAGE_AUTHORIZE:
                 StartSystemTimeoutDet(Timeout_ScanCard);
-                /*
-                int card_result = CreditCardPreAuth(CardReadFd, PREAUTHMONEY,"TCC Test", &ShmDcCommonData->pCreditCard[pSysInfo->CurGunSelected]);
-				if (card_result > 0 ) {
-					strcpy((char *)pSysConfig->UserId, (char *)ShmDcCommonData->pCreditCard[pSysInfo->CurGunSelected].CardNo);
-				} else if (card_result < 0) {
-					pSysInfo->SystemPage = _PAGE_AUTHORIZE_FAIL;
-				}*/
-            	//ChangeDisplay2Value(_Icon_Precharge,0);
-            	//ChangeDisplay2Value(_Icon_Precharge,1);
-                /*
-            	if (ShmDcCommonData->GetCardNo[pSysInfo->CurGunSelected] == TRUE &&
-            			ShmDcCommonData->AuthPass_flag[pSysInfo->CurGunSelected] != TRUE) {
-            		//ShmDcCommonData->PreAuth_Config = _CREDITCARD_PREAUTH;
-            		//ShmDcCommonData->PreAuth_Result = 0;
-            		//sleep(3);
-            		pSysInfo->SystemPage = _PAGE_SENSING;
-            	}
-                */
+
 		        ChangeChargingRateValue((int)ShmDcCommonData->ChargingRate);
                 ShowAuthorizeCountDown();
             	_Text_Running_Count = 1;
@@ -1396,28 +1377,25 @@ void ProcessPageInfo()
                 break;
 
             case _PAGE_PLUGOUT:
-            	/*
-                if (pSysConfig->isQRCode) {
-                    if (pSysConfig->QRCodeMadeMode == NO) {
-                        //uint8_t len = strlen((char *)pSysConfig->SystemId);
-                        ChangeQrCode_Idle((char *)pSysConfig->SystemId);
-                    } else {
-                        //uint8_t len = strlen((char *)pSysConfig->QRCodeContent);
-                        ChangeQrCode_Idle((char *)pSysConfig->QRCodeContent);
-                    }
-                    //ChangeQrCode_Idle((char *)pSysConfig->SystemId);
-                }*/
+
             	break;
             case _PAGE_PAYING:
                 ChangeDisplay2Value(_Icon_Ani_Dot, 1);
+                if (ShmDcCommonData->CreditCardUpload) {
+                    ChangeDisplay2Value(_Icon_Uploading, _TCC_Uploading);
+                    ChangeDisplay2Value(_Icon_Paying, _ICON_Empty);
+                } else {
+                    ChangeDisplay2Value(_Icon_Uploading, _ICON_Empty);
+                    ChangeDisplay2Value(_Icon_Paying, _TCC_Paying);
+                }
             	break;
             case _PAGE_EXIT:
                 
                 break;
-                /*
+                
             case _PAGE_MAINTAIN:
                 ChangeQrCode_Error();
-                break;*/
+                break;
             }
         }
     }
@@ -1610,7 +1588,7 @@ void DefautLayOut()
 	ChangeDisplay2Value(_Icon_MobilePay,0);
 	ChangeDisplay2Value(_Icon_CardPay,0);
 	ChangeDisplay2Value(0x5000,1);
-    ChangeDisplay2Value(_QRCode_Service, 1);
+    //ChangeDisplay2Value(_QRCode_Service, 1);
 	ShowSelectGun();
 }
 /*

+ 2 - 0
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.h

@@ -104,6 +104,7 @@
 #define _Icon_ScanCntDownDigits 0x1068
 #define _Icon_AuthCntDownTen    0x106A
 #define _Icon_AuthCntDownDigits 0x106C
+#define _Icon_Uploading         0x1070
 
 #define _String_Date			0x3000
 #define _String_Tempture		0x3010
@@ -367,6 +368,7 @@ enum _TCC_ICON_LIST_ {
 	_TCC_TradeCancelFrame,
 	_TCC_SecondSense,
 	_TCC_CntDownNumber0,
+	_TCC_Uploading = 323,
 };
 
 

+ 16 - 6
EVSE/Projects/DD360Tcci/Apps/ReadCmdline.c

@@ -526,6 +526,15 @@ void writeChillerStatus(char* v1)
     else
         printf("Please open Debug mode\n");
 }
+void writePassBackend()
+{
+    ShmDcCommonData->passbackend = !ShmDcCommonData->passbackend;
+    if (ShmDcCommonData->passbackend)
+        printf("Pass Backend on\n");
+    else
+        printf("Pass Backend off\n");
+
+}
 void SetFanSpeed(char *v1)
 {
     int speed = atoi(v1);
@@ -737,6 +746,7 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
     }
 
     //kill ev task
+    ShmDcCommonData->DebugFlag = TRUE;
     system("killall Module_EvComm");
 
     printf("Warming!!!!\nPlease pay attention chiller on or off !!!!\n");
@@ -754,9 +764,9 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
         case S_IDLE:
             if (PreviousSystemStatus[curGun] != pDcChargingInfo->SystemStatus) {
                 PreviousSystemStatus[curGun] = pDcChargingInfo->SystemStatus;
-#if defined DD360Audi
+
                 setConfirmSelGun(curGun);
-#endif //defined DD360Audi
+
                 pSysInfo->SystemPage = _PAGE_SENSING;
                 strcpy((char *)pSysConfig->UserId, "AutoStartCharging");
                 pDcChargingInfo->ConnectorPlugIn = 1;
@@ -967,6 +977,7 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
             ShmDcCommonData->chillerCtrl = FALSE;
 
             if (stopChg == pSysConfig->TotalConnectorCount) {
+                ShmDcCommonData->DebugFlag = FALSE;
                 system("/root/Module_EvComm &");
                 sleep(3);
 
@@ -1271,6 +1282,7 @@ int main(void)
                      "       rededuct                          : Credit Card rededuct\n"
                      "       preauth                           : Credit Card PreAuth\n"
                      "       preauthcancel                     : Credit Card PreAuth Cancel\n"
+                     "       passbackend                       : Pass Backend disconnect\n"
                      "\r\n";
 
     if (CreateAllCsuShareMemory() == FAIL) {
@@ -1431,10 +1443,6 @@ int main(void)
                 printf ("Input cmd fail ------  strchg [vol 150-1000] [cru 2-100]\n");
                 continue;
             }
-            if (ShmDcCommonData->DebugFlag == FALSE) {
-                printf("Not open debug mode\n");
-                continue;
-            }
             // 槍狀態
             RunUnconditionalChargeIndex1(newString[1], newString[2], newString[3]);
         } else if (strcmp(newString[0], "tempW") == 0) { //測試槍頭和水冷機溫度
@@ -1459,6 +1467,8 @@ int main(void)
             ShmDcCommonData->PreAuth_Config = _CREDITCARD_CANCEL;
         } else if (strcmp(newString[0], "chiller") == 0) { //測試槍頭和水冷機溫度
             writeChillerStatus(newString[1]);
+        } else if (strcmp(newString[0], "passbackend") == 0) { //Pass Backend disconnect
+            writePassBackend();
         } else {
             printf("%s\n", usageMsg);
         }

+ 0 - 1
EVSE/Projects/DD360Tcci/Apps/SelectGun/SelectGun.h

@@ -62,7 +62,6 @@ typedef struct StPricesInfo {
     //float DefaultPrices;        //unit = 0.01 dollar, value / 100
     float Discount;
     int TransactionId;
-    uint8_t Reserved[4];
 } PricesInfo;
 
 //typedef struct StOperativeInfo {

+ 29 - 0
EVSE/Projects/DD360Tcci/Apps/ShareMemory/shmMem.c

@@ -38,6 +38,7 @@ static struct FanModuleData *ShmFanModuleData = NULL;
 static struct RelayModuleData *ShmRelayModuleData = NULL;
 static struct LedModuleData *ShmLedModuleData = NULL;
 static struct OCPP16Data *ShmOCPP16Data = NULL;
+static struct OCPP20Data* ShmOCPP20Data = NULL;
 
 static SelectGunInfo *ShmSelectGunInfo = NULL;
 static DcCommonInfo *ShmDcCommonData = NULL;
@@ -300,6 +301,15 @@ void *GetShmOCPP16Data(void)
     return ShmOCPP16Data;
 }
 
+void* GetShmOCPP20Data(void)
+{
+    if (ShmOCPP20Data == NULL) {
+        return NULL;
+    }
+
+    return ShmOCPP20Data;
+}
+
 void *GetShmSelectGunInfo(void)
 {
     if (ShmSelectGunInfo == NULL) {
@@ -602,6 +612,21 @@ int InitOCPPShmMem(void)
     return PASS;
 }
 
+int InitOCPP20ShmMem(void)
+{
+    int MeterSMId = FAIL;
+
+    if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), IPC_CREAT | 0777)) < 0) {
+        log_info("Get OCPP20 share memory error");
+        return FAIL;
+    } else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void*)-1) {
+        log_info("Create OCPP20 share memory error");
+        return FAIL;
+    }
+
+    return PASS;
+}
+
 int InitLEDShmMem(void)
 {
     int MeterSMId = FAIL;
@@ -1123,6 +1148,10 @@ int CreateAllCsuShareMemory(void)
         return ret;
     }
 
+    if ((ret = InitOCPP20ShmMem()) == FAIL) {
+        return ret;
+    }
+
     if ((ret = InitSelectGunShmMem()) == FAIL) {
         return ret;
     }

+ 1 - 0
EVSE/Projects/DD360Tcci/Apps/ShareMemory/shmMem.h

@@ -42,6 +42,7 @@ void *GetShmSysInfoData(void);
 void *GetShmSysWarningInfo(void);
 
 void *GetShmOCPP16Data(void);
+void* GetShmOCPP20Data(void);
 
 void *GetShmCHAdeMOData(void);
 void *GetShmGBTData(void);

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


BIN
EVSE/Projects/DD360Tcci/output/FactoryConfig


BIN
EVSE/Projects/DD360Tcci/output/Module_ChkSysTask


BIN
EVSE/Projects/DD360Tcci/output/Module_DoComm


BIN
EVSE/Projects/DD360Tcci/output/Module_EvComm


BIN
EVSE/Projects/DD360Tcci/output/Module_EventLogging


BIN
EVSE/Projects/DD360Tcci/output/Module_InternalComm


BIN
EVSE/Projects/DD360Tcci/output/Module_LcmControl


BIN
EVSE/Projects/DD360Tcci/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360Tcci/output/Module_UpdateFW


BIN
EVSE/Projects/DD360Tcci/output/ReadCmdline


BIN
EVSE/Projects/DD360Tcci/output/main


+ 23 - 0
build_rootfs_copy.sh

@@ -0,0 +1,23 @@
+#!/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"
+
+sudo cp -r /mnt/d/Phihong/Project/DD360Tcci/Apps/* $ProjectPath/DD360Tcci/Apps/
+sudo rm /dev/ram*
+sleep 3
+
+#sudo make DD360Audi-rootfs
+#cp /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects/DD360Audi/Images/* /mnt/e/Image/DD360Audi/
+sudo make DD360Tcci-rootfs
+cp $ProjectPath/DD360Tcci/Images/* /mnt/d/Image/DD360Tcc/
+#sudo make DD360ComBox-rootfs
+#cp /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects/DD360ComBox/Images/* /mnt/e/Image/DD360ComBox/
+#sudo make DD360UCar-rootfs
+#cp /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects/DD360UCar/Images/* /mnt/d/Image/DD360UCar/
+