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

2022-02-21 / Simon Xue

Action
1. UCar New Flow. (Stop Charge by press button)

Files
As the commit history files

Image Version: v2.01.XX.XXXX.XX
Simon Xue 3 жил өмнө
parent
commit
197803fc57
34 өөрчлөгдсөн 1404 нэмэгдсэн , 367 устгасан
  1. 81 11
      EVSE/Projects/DD360UCar/Apps/CSU/Primary.c
  2. 114 61
      EVSE/Projects/DD360UCar/Apps/CSU/main.c
  3. 79 2
      EVSE/Projects/DD360UCar/Apps/Config.h
  4. 13 6
      EVSE/Projects/DD360UCar/Apps/Define/define.h
  5. 464 99
      EVSE/Projects/DD360UCar/Apps/ModuleDoComm/DoComm.c
  6. 83 5
      EVSE/Projects/DD360UCar/Apps/ModuleDoComm/DoComm.h
  7. 5 1
      EVSE/Projects/DD360UCar/Apps/ModuleEvComm/Module_EvRxComm.c
  8. 1 1
      EVSE/Projects/DD360UCar/Apps/ModuleEvComm/Module_EvTxComm.c
  9. 18 10
      EVSE/Projects/DD360UCar/Apps/ModuleInternalComm/RelayBoard.c
  10. 334 138
      EVSE/Projects/DD360UCar/Apps/ModuleLcmCtrl/Module_LcmControl.c
  11. 115 20
      EVSE/Projects/DD360UCar/Apps/ModuleLcmCtrl/Module_LcmControl.h
  12. 8 6
      EVSE/Projects/DD360UCar/Apps/ModulePrimary/Module_PrimaryComm.c
  13. 2 0
      EVSE/Projects/DD360UCar/Apps/SelectGun/SelectGun.h
  14. BIN
      EVSE/Projects/DD360UCar/Images/FactoryDefaultConfig.bin
  15. BIN
      EVSE/Projects/DD360UCar/Images/ramdisk.gz
  16. BIN
      EVSE/Projects/DD360UCar/output/FactoryConfig
  17. BIN
      EVSE/Projects/DD360UCar/output/Module_ChkSysTask
  18. BIN
      EVSE/Projects/DD360UCar/output/Module_DoComm
  19. BIN
      EVSE/Projects/DD360UCar/output/Module_EvComm
  20. BIN
      EVSE/Projects/DD360UCar/output/Module_EventLogging
  21. BIN
      EVSE/Projects/DD360UCar/output/Module_InternalComm
  22. BIN
      EVSE/Projects/DD360UCar/output/Module_LcmControl
  23. BIN
      EVSE/Projects/DD360UCar/output/Module_PrimaryComm
  24. BIN
      EVSE/Projects/DD360UCar/output/Module_UpdateFW
  25. BIN
      EVSE/Projects/DD360UCar/output/ReadCmdline
  26. 10 0
      EVSE/Projects/DD360UCar/output/SearchIP.sh
  27. BIN
      EVSE/Projects/DD360UCar/output/UnsafetyOutputTask
  28. 15 0
      EVSE/Projects/DD360UCar/output/init.sh
  29. 47 0
      EVSE/Projects/DD360UCar/output/kill.sh
  30. BIN
      EVSE/Projects/DD360UCar/output/main
  31. BIN
      EVSE/Projects/DD360UCar/output/simulation
  32. 1 0
      EVSE/Projects/DD360UCar/output/web.sh
  33. 13 6
      EVSE/Projects/define.h
  34. 1 1
      build_rootfs_copy.sh

+ 81 - 11
EVSE/Projects/DD360UCar/Apps/CSU/Primary.c

@@ -55,6 +55,9 @@ void EnterAuthorizePage(uint8_t gunIndex)
 }
 void EnterLinkErrorPage()
 {
+	pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+
+	//ClearDetectPluginFlag();
     StopSystemTimeoutDet();
     //StopGunInfoTimeoutDet(pSysInfo->CurGunSelected);
     ChangeLCM(_LCM_LINK_ERROR);
@@ -83,6 +86,12 @@ void EnterAuthorizeStopPage()
     }
     StartSystemTimeoutDet(Timeout_ReturnViewPage);
 }
+void StopChargingBtn(uint8_t gunIndex)
+{
+    pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
+    pDcChargingInfo->SystemStatus = S_TERMINATING;
+    log_info("Press Button to Stop Charging");
+}
 void EnterSummaryPage()
 {
     StopSystemTimeoutDet();
@@ -101,29 +110,42 @@ void ReturnIDLE(uint8_t gunIndex)
     StopSystemTimeoutDet();
     StopGunInfoTimeoutDet(gunIndex);
     setChargerMode(gunIndex,MODE_IDLE);
-    destroySelGun(gunIndex);
+    //destroySelGun(gunIndex);
 }
 void ReturnAuthorize()
 {
     StopSystemTimeoutDet();
     EnterAuthorizePage(pSysInfo->CurGunSelected);
 }
+void showConfirmStopPage(uint8_t gunIndex)
+{
+    StopSystemTimeoutDet();
+    ChangeGunSelectByIndex(gunIndex);
+    log_info("Enter Confirm stop Page");
+    pSysInfo->SystemPage = _LCM_CONFIRM_STOP;
+    StartSystemTimeoutDet(Timeout_ReturnViewPage);
+}
 void CheckLeftButton()
 {
     uint8_t gunIndex = 0;
     switch (pSysInfo->SystemPage) {
         case _LCM_VIEW:
             pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(LEFT_GUN_NUM);
+            pSysInfo->CurGunSelected = LEFT_GUN_NUM;
             if(pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION) {
                 EnterAuthorizePage(LEFT_GUN_NUM);
+                pSysInfo->SystemPage = _LCM_START_SCAN;
             } else if (pDcChargingInfo->SystemStatus == S_CHARGING) {
-                EnterDetailViewPage(LEFT_GUN_NUM);
+                //EnterDetailViewPage(LEFT_GUN_NUM);
+                showConfirmStopPage(LEFT_GUN_NUM);
             }
             break;
         case _LCM_START_SCAN:
         case _LCM_START_AUTHORIZE_FAIL:
         case _LCM_LINK_ERROR:
-        	ReturnIDLE(pSysInfo->CurGunSelected);
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
+                ReturnIDLE(pSysInfo->CurGunSelected);
+            }
             break;
         case _LCM_DETAIL_VIEW:
         case _LCM_STOP_RFID:
@@ -132,11 +154,31 @@ void CheckLeftButton()
             EnterViewPage();
         	break;
         case _LCM_SUMMARY:
+            if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM)
+                break;
             log_info("Return View Page");
             ReturnIDLE(pSysInfo->CurGunSelected);
             break;
         case _LCM_ERROR:
-        	ReturnIDLE(pSysInfo->CurGunSelected);
+        	//EnterSummaryPage();
+            if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM)
+                break;
+        	pSysInfo->SystemPage = _LCM_WAIT_PLUGOUT;
+        	//ReturnIDLE(pSysInfo->CurGunSelected);
+            break;
+        case _LCM_CONFIRM_STOP:
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
+                StopChargingBtn(LEFT_GUN_NUM);
+            } else {
+                EnterViewPage();
+            }
+            break;
+        case _LCM_WAIT_PLUGIN:
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                ReturnIDLE(LEFT_GUN_NUM);
+            break;
+        case _LCM_WAIT_PLUGOUT:
+            EnterSummaryPage();
             break;
     }
 }
@@ -148,19 +190,31 @@ void CheckRightButton()
     switch (pSysInfo->SystemPage) {
         case _LCM_VIEW:
             pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(RIGHT_GUN_NUM);
+            pSysInfo->CurGunSelected = RIGHT_GUN_NUM;
             if(pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION) {
                 EnterAuthorizePage(RIGHT_GUN_NUM);
+                pSysInfo->SystemPage = _LCM_START_SCAN;
             } else if (pDcChargingInfo->SystemStatus == S_CHARGING) {
-                EnterDetailViewPage(RIGHT_GUN_NUM);
+                //EnterDetailViewPage(RIGHT_GUN_NUM);
+                showConfirmStopPage(RIGHT_GUN_NUM);
             }
             break;
+        case _LCM_START_SCAN:
+            if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM)
+                ReturnIDLE(pSysInfo->CurGunSelected);
+            break;
         case _LCM_START_AUTHORIZE_FAIL:
+            if (pSysInfo->SystemPage == _LCM_START_AUTHORIZE_FAIL && pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                break;
             ReturnAuthorize();
             break;
         case _LCM_WAIT_PLUGIN:
-            EnterLinkErrorPage();
+            if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM)
+                ReturnIDLE(RIGHT_GUN_NUM);
         	break;
         case _LCM_LINK_ERROR:
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                break;
             ReturnAuthorize();
             break;
         case _LCM_DETAIL_VIEW:
@@ -173,7 +227,23 @@ void CheckRightButton()
             EnterSummaryPage();
             break;
         case _LCM_ERROR:
-        	ReturnIDLE(pSysInfo->CurGunSelected);
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                break;
+        	pSysInfo->SystemPage = _LCM_WAIT_PLUGOUT;
+            //EnterSummaryPage();
+            break;
+        case _LCM_CONFIRM_STOP:
+            if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM) {
+                StopChargingBtn(RIGHT_GUN_NUM);
+            } else {
+                EnterViewPage();
+            }
+            break;
+        case _LCM_SUMMARY:
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                break;
+            log_info("Return View Page");
+            ReturnIDLE(pSysInfo->CurGunSelected);
             break;
     }
     
@@ -199,11 +269,11 @@ void CheckPrimaryWarm(void)
                 Rtn = 1;
             } else if (memcmp(&pSysWarning->WarningCode[i][0], "042327", 6) == 0) {
                 ShmDcCommonData->PowerAlarmState.StatusBit.DcInputOVP = YES;
-                EmcOccureByString("042200");
+                EmcOccureByString("042327");
                 Rtn = 1;
             } else if (memcmp(&pSysWarning->WarningCode[i][0], "042328", 6) == 0) {
 			   ShmDcCommonData->PowerAlarmState.StatusBit.DcInputUVP = YES;
-			   EmcOccureByString("042200");
+			   EmcOccureByString("042328");
 			   Rtn = 1;
 		    } else if (memcmp(&pSysWarning->WarningCode[i][0], "042200", 6) == 0) {
                 ShmDcCommonData->PowerAlarmState.StatusBit.SystemL1InputOVP = YES;
@@ -322,7 +392,7 @@ void ChkPrimaryStatus(void)
     if (ShmPrimaryMcuData->InputDet.bits.Button1 == BTN_PRESS && !leftBtnPush ) {
         leftBtnPush = true;
         CheckLeftButton();
-        log_info("left btn down...............................%x %x %x",
+        log_info("left btn down...............................%d %d %d",
                 pSysInfo->CurGunSelected,pDcChargingInfo->SystemStatus,pSysInfo->SystemPage);
     } else if (ShmPrimaryMcuData->InputDet.bits.Button1 == BTN_RELEASE && leftBtnPush) {
         leftBtnPush = false;
@@ -331,7 +401,7 @@ void ChkPrimaryStatus(void)
     if (ShmPrimaryMcuData->InputDet.bits.Button2 == BTN_PRESS && !rightBtnPush ) {
         rightBtnPush = true;
         CheckRightButton();
-        log_info("right btn down...............................%x %x %x",
+        log_info("right btn down...............................%d %d %d",
                pSysInfo->CurGunSelected,pDcChargingInfo->SystemStatus, pSysInfo->SystemPage);
     } else if (ShmPrimaryMcuData->InputDet.bits.Button2 == BTN_RELEASE && rightBtnPush) {
         rightBtnPush = false;

+ 114 - 61
EVSE/Projects/DD360UCar/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.00.00.0000.00"; // Phihong version
-char* DebugVersion = "v2.00.00";      // Software debug version
+char *fwVersion = "V2.01.00.0000.00"; // Phihong version
+char* DebugVersion = "v2.01.00";      // Software debug version
 //sqlite3 *localDb;
 bool isDb_ready;
 
@@ -239,11 +239,11 @@ void setSelGunWaitToAuthor(uint8_t curSel)
 {
     if (curSel == LEFT_GUN_NUM && ShmSelectGunInfo->SelGunInfo.LeftGun == SEL_GUN_CONFIRM) {
         ShmSelectGunInfo->SelGunInfo.LeftGun = SEL_GUN_ATHOR;
-        //printf("setSelGunWaitToAuthor left");
+        log_info("setSelGunWaitToAuthor left");
         StopGunInfoTimeoutDet(curSel);
     } else if (curSel == RIGHT_GUN_NUM && ShmSelectGunInfo->SelGunInfo.RightGun == SEL_GUN_CONFIRM) {
         ShmSelectGunInfo->SelGunInfo.RightGun = SEL_GUN_ATHOR;
-        //printf("setSelGunWaitToAuthor right");
+        log_info("setSelGunWaitToAuthor right");
         StopGunInfoTimeoutDet(curSel);
     }
 }
@@ -425,6 +425,15 @@ static void checkGunOTPState(uint8_t gunIndex)
             //ResetChargerAlarmCode(gunIndex, "012229");
             ShmDcCommonData->ConnectErrList[gunIndex].GunBits.ChaConnectOTP = NO;
             ShmDcCommonData->ConnectErrList[gunIndex].GunBits.ChaConnectTempSensorFail = YES;
+            if  ((gunIndex == 0) &&
+                    (strncmp((char *)&pSysConfig->ModelName[7], "J", 1) == 0)) {
+            	ShmDcCommonData->ConnectErrList[gunIndex].GunBits.ChaConnectOTP = NO;
+            	ShmDcCommonData->ConnectErrList[gunIndex].GunBits.ChaConnectTempSensorFail = NO;
+            } else if ((gunIndex == 1) &&
+                    ((strncmp((char *)&pSysConfig->ModelName[9], "J", 1) == 0) )) {
+            	ShmDcCommonData->ConnectErrList[gunIndex].GunBits.ChaConnectOTP = NO;
+            	ShmDcCommonData->ConnectErrList[gunIndex].GunBits.ChaConnectTempSensorFail = NO;
+            }
         }
         break;
 
@@ -1286,10 +1295,11 @@ void ClearDetectPluginFlag(void)
     //DS60-120 add
     for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
         pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
-
+        /*
         if (pDcChargingInfo->RemoteStartFlag == YES) {
             pDcChargingInfo->RemoteStartFlag = NO;
         }
+        */
     }
 
     if (pSysInfo->OrderCharging != NO_DEFINE) {
@@ -1339,7 +1349,7 @@ bool isEvStopCharging_chademo(uint8_t gunIndex)
 {
     if (isEvGunLocked_chademo(gunIndex) == NO) {
         // 無鎖槍 = 停止
-        log_info("gun locked none (%d) ", gunIndex);
+        //log_info("gun locked none (%d) ", gunIndex);
         return YES;
     }
 
@@ -1370,7 +1380,7 @@ bool isEvStopCharging_gb(uint8_t gunIndex)
 {
     if (isEvGunLocked_gb(gunIndex) == NO) {
         // 無鎖槍 = 停止
-        log_info("gun locked none. ");
+        //log_info("gun locked none. ");
         return YES;
     }
 
@@ -1413,7 +1423,7 @@ bool isEvStopCharging_ccs(uint8_t gunIndex)
 {
     if (isEvGunLocked_ccs(gunIndex) == NO) {
         // 無鎖槍 = 停止
-        log_info("gun locked none. ");
+        //log_info("gun locked none. ");
         return YES;
     }
 
@@ -1812,6 +1822,8 @@ void EmcOccureByString(char *code)
             strncmp(code, "042251", 6) == EQUAL ||
             strncmp(code, "042252", 6) == EQUAL ||
             strncmp(code, "012304", 6) == EQUAL ||
+            strncmp(code, "042327", 6) == EQUAL ||
+            strncmp(code, "042328", 6) == EQUAL ||
             strncmp(code, "042200", 6) == EQUAL ||
             strncmp(code, "042201", 6) == EQUAL ||
             strncmp(code, "042202", 6) == EQUAL ||
@@ -2796,6 +2808,7 @@ void OcppRemoteStartChk()
         uint8_t threeGunIndex = 0;
         uint8_t dcIndex = 0;
         bool isGunUsingStatus = false;
+        bool _remotestarting = false;
 
         for (uint8_t _index = 0; _index < pSysConfig->TotalConnectorCount; _index++) {
             pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(_index);
@@ -2812,6 +2825,9 @@ void OcppRemoteStartChk()
             if (pDcChargingInfo->SystemStatus != S_IDLE) {
                 isGunUsingStatus = true;
             }
+            if (pDcChargingInfo->RemoteStartFlag == YES) {
+            	_remotestarting = true;
+            }
         }
 
         // 如果是雙槍單模,只認閒置狀態的槍,如果有預約~ 則預約也算被使用
@@ -2830,15 +2846,19 @@ void OcppRemoteStartChk()
 
         pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(dcIndex);
 
-        if (ShmOCPP16Data->CsMsg.bits[dcIndex + threeGunIndex].RemoteStartTransactionReq == YES) {
+        if (ShmOCPP16Data->CsMsg.bits[dcIndex + threeGunIndex].RemoteStartTransactionReq == YES &&
+        		!_remotestarting ) {
             if (pDcChargingInfo->SystemStatus == S_IDLE ||
+            		pDcChargingInfo->SystemStatus == S_AUTHORIZING ||
                     pDcChargingInfo->SystemStatus == S_RESERVATION) {
                 pDcChargingInfo->RemoteStartFlag = YES;
                 pSysInfo->OrderCharging = YES;
+                //pDcChargingInfo->SystemStatus = S_AUTHORIZING;
                 //pSysInfo->OrderCharging = gunIndex;
                 ShmOCPP16Data->CsMsg.bits[dcIndex + threeGunIndex].RemoteStartTransactionReq = NO;
                 DetectPluginStart();
                 setSelGunWaitToAuthor(dcIndex);
+                log_info("Ocpp Remote Start Pass");
             }
             ShmOCPP16Data->CsMsg.bits[dcIndex + threeGunIndex].RemoteStartTransactionReq = NO;
         }
@@ -3583,8 +3603,7 @@ static void checkPileEndGfdResult(uint8_t gunIndex, uint8_t gunType, uint8_t sys
     case _Type_Chademo:
         // 檢查樁端的 GFD 結果
         if (sysStatus == S_PREPARING_FOR_EVSE &&
-                isPrechargeStatus_chademo(gunIndex) > 6 &&
-                isPrechargeStatus_chademo(gunIndex) < 8
+                isPrechargeStatus_chademo(gunIndex) >= 6
            ) {
             // 當前操作的槍號,進入 Charging
             setChargerMode(gunIndex, MODE_CHARGING);
@@ -3612,7 +3631,7 @@ static void checkPileEndGfdResult(uint8_t gunIndex, uint8_t gunType, uint8_t sys
         // 檢查樁端的 GFD 結果
         //if (isPrechargeStatus_gb(gunIndex) > 5 && isPrechargeStatus_gb(gunIndex) < 9) {
         if (sysStatus == S_PREPARING_FOR_EVSE &&
-                isPrechargeStatus_gb(gunIndex) > 6) {
+                isPrechargeStatus_gb(gunIndex) >= 6) {
             setChargerMode(gunIndex, MODE_CHARGING);
         }
 
@@ -3722,6 +3741,7 @@ void ResetIdleData(uint8_t gunIndex)
     pDcChargingInfo->RemainChargingDuration = 0;
     pDcChargingInfo->PresentChargingVoltage = 0;//DS60-120 add
     pDcChargingInfo->PresentChargingCurrent = 0;//DS60-120 add
+    pDcChargingInfo->RemoteStartFlag = NO;
     strcpy((char *)pDcChargingInfo->StartDateTime, "");
     strcpy((char *)pDcChargingInfo->StopDateTime, "");
     strcpy((char *)pDcChargingInfo->StartUserId, "");
@@ -3745,7 +3765,6 @@ void CheckErrorCode(uint8_t gunIndex)
     struct ChargingInfoData *pSelectedDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
 
     if (gunIndex == pSysInfo->CurGunSelected) {
-        //pSysInfo->SystemPage = _LCM_ERROR;
         pSysInfo->SystemPage = _LCM_MAINTAIN;
         if (ShmPrimaryMcuData->InputDet.bits.EmergencyButton)
             pSysInfo->SystemPage = _LCM_EMERGENCY;
@@ -3962,11 +3981,6 @@ int main(void)
 
         // 當 AC 沒有搭上時,清除一些錯誤碼
         ClearAlarmCodeWhenAcOff();
-        /*
-        if (pGunIndexInfo->AcGunIndex > 0 && isDetectPlugin() && !GetIsCardScan()) {
-            // AUDI_LCM_CHANGE
-            pSysInfo->SystemPage = _LCM_WAIT_PLUGIN;
-        }*/
 
         if ((GetTimeoutValue(_cmdMainPriority_time) / 1000) > 5000) {
 
@@ -4032,7 +4046,14 @@ int main(void)
                     ResetIdleData(gunIndex);
                 }
                 isChargingAverageState();
-
+                // For RemoteStart Using
+                if (pDcChargingInfo->RemoteStartFlag == YES && pDcChargingInfo->IsAvailable) {
+					log_info("-------- IDLE Remote Start(%d) --------", gunIndex);
+					ChangeGunSelectByIndex(gunIndex);
+					setChargerMode(gunIndex, MODE_AUTHORIZING);
+					break;
+                }
+                autoStartCharging(gunIndex);
                 goto CheckStatus;
                 break;
             case S_RESERVATION:
@@ -4054,15 +4075,17 @@ int main(void)
                     }
                 }
 CheckStatus:
-
 				if (pDcChargingInfo->IsAvailable == NO) {
 					setChargerMode(gunIndex, MODE_MAINTAIN);
 					break;
 				}
                 // Refresh Error Status
                 if (pSysWarning->Level == WARN_LV_ER) {
+                	pSysInfo->SystemPage = _LCM_MAINTAIN;
                     CheckErrorCode(gunIndex);
-                    break;;
+                    if (ShmPrimaryMcuData->InputDet.bits.EmergencyButton)
+                        pSysInfo->SystemPage = _LCM_EMERGENCY;
+                    continue;;
                 }
                 if (PrecheckIsPass(gunIndex) == false) {
                     log_error("Relay welding");
@@ -4071,7 +4094,7 @@ CheckStatus:
                         //pSysInfo->SystemPage = _LCM_ERROR;
                         pSysInfo->SystemPage = _LCM_MAINTAIN;
                     }
-                    break;
+                    continue;
                 }
                 if (pDcChargingInfo->SystemStatus == S_FAULT) {
                     systemPageRestoreInit();
@@ -4082,18 +4105,19 @@ CheckStatus:
             case S_AUTHORIZING:
                 if (isModeChange(gunIndex)) {
                     log_info("============================= S_AUTHORIZING(%x) ============================= ", gunIndex);
+                    pSysInfo->SystemPage = _LCM_START_SCAN;
                 }
                 // 讀卡邏輯
                 ScannerCardProcess();
                 // 隨插即充
-                autoStartCharging(gunIndex);
+                //autoStartCharging(gunIndex);
 
                 if (isDetectPlugin() && pSysInfo->SystemPage != _LCM_LINK_ERROR) {
                     // 卡號驗證成功後,等待充電槍插入充電車
                     if (pDcChargingInfo->RemoteStartFlag == YES) {
                         if (pDcChargingInfo->ConnectorPlugIn == YES &&
-                                pDcChargingInfo->IsAvailable) {
-                            log_info("-------- Remote Start(%d) --------", gunIndex);
+                                pDcChargingInfo->IsAvailable ) {
+                            log_info("-------- S_AUTHORIZING Remote Start(%d) --------", gunIndex);
                             pDcChargingInfo->RemoteStartFlag = NO;
                             pDcChargingInfo->isRemoteStart = YES; //DS60-120
                             ChangeGunSelectByIndex(gunIndex);
@@ -4127,7 +4151,7 @@ CheckStatus:
                         }
                     }
 
-                    if (!GetIsCardScan() && pSysInfo->SystemPage != _LCM_LINK_ERROR) {
+                    if (!GetIsCardScan() && pSysInfo->CurGunSelected == gunIndex) {
                         pSysInfo->SystemPage = _LCM_WAIT_PLUGIN;
                     }
                 }
@@ -4143,7 +4167,7 @@ CheckStatus:
                 }
                 setChargerMode(gunIndex, S_PREPARNING);
                 if (pSysInfo->CurGunSelected == gunIndex) {
-                    pSysInfo->SystemPage = _LCM_PRECHARGE;
+                    pSysInfo->SystemPage = _LCM_COMMUNICATION;
                 }
             }
             break;
@@ -4163,7 +4187,7 @@ CheckStatus:
 
                 checkEvBoardReqStop(pDcChargingInfo->SystemStatus, gunIndex);
                 if (pSysInfo->CurGunSelected == gunIndex) {
-                    pSysInfo->SystemPage = _LCM_PRECHARGE;
+                    pSysInfo->SystemPage = _LCM_COMMUNICATION;
                 }
                 break;
 
@@ -4194,7 +4218,7 @@ CheckStatus:
 
                 checkEvBoardReqStop(pDcChargingInfo->SystemStatus, gunIndex);
                 if (pSysInfo->CurGunSelected == gunIndex) {
-                    pSysInfo->SystemPage = _LCM_PRECHARGE;
+                    pSysInfo->SystemPage = _LCM_COMMUNICATION;
                 }
                 break;
 
@@ -4210,7 +4234,7 @@ CheckStatus:
                 checkEvBoardReqStop(pDcChargingInfo->SystemStatus, gunIndex);
 
                 if (pSysInfo->CurGunSelected == gunIndex) {
-                    pSysInfo->SystemPage = _LCM_PRECHARGE;
+                    pSysInfo->SystemPage = _LCM_CHARGING_DETECT;
                 }
                 break;
 
@@ -4258,7 +4282,7 @@ CheckStatus:
                     setChargerMode(gunIndex, MODE_CCS_PRECHARGE_STEP1);
                 }
                 if (pSysInfo->CurGunSelected == gunIndex) {
-                    pSysInfo->SystemPage = _LCM_PRECHARGE;
+                    pSysInfo->SystemPage = _LCM_PREPARECHARE;
                 }
                 break;
 
@@ -4279,10 +4303,11 @@ CheckStatus:
                 // 切換 D+ Relay to Precharge Relay
                 if (pDcChargingInfo->RelayK1K2Status == YES || pDcChargingInfo->PantographFlag == YES) {
                     pDcChargingInfo->PrechargeStatus = PRECHARGE_READY;
+                    pSysInfo->CurGunSelected == gunIndex;
                     setChargerMode(gunIndex, MODE_CHARGING);
                 }
                 if (pSysInfo->CurGunSelected == gunIndex) {
-                    pSysInfo->SystemPage = _LCM_PRECHARGE;
+                    pSysInfo->SystemPage = _LCM_PREPARECHARE;
                 }
                 break;
 
@@ -4293,8 +4318,9 @@ CheckStatus:
                     ftime(&startChargingTime[gunIndex]);
                     strcpy((char *)ShmOCPP16Data->StartTransaction[gunIndex].ResponseIdTagInfo.Status, ""); //DS60-120 add
                     ChangeStartOrStopDateTime(YES, gunIndex);
-                    pSysInfo->SystemPage = _LCM_DETAIL_VIEW;
+                    pSysInfo->SystemPage = _LCM_VIEW;
                     StartGunInfoTimeoutDet(gunIndex,Timeout_DetailView);
+                    ShmDcCommonData->finalcost_flag[gunIndex] = FALSE;
                 }
 
                 if (ShmOCPP16Data->CpMsg.bits[gunIndex].StartTransactionConf) {
@@ -4312,10 +4338,10 @@ CheckStatus:
 
                 // LCM => Charging
                 /*
-                if (pSysInfo->SystemPage != _LCM_DETAIL_VIEW) {
+                if (pSysInfo->CurGunSelected == gunIndex ) {
                     pSysInfo->SystemPage = _LCM_VIEW;
-                }
-                */
+                }*/
+                
                 break;
 
             case S_ALARM:
@@ -4330,15 +4356,29 @@ CheckStatus:
                     }
                     TheEndCharging(gunIndex);
                     StopGunInfoTimeoutDet(gunIndex);
-                    //pSysInfo->SystemPage = _LCM_ERROR;
                 }
-                pSysInfo->SystemPage = _LCM_MAINTAIN;
 
-                if (ShmPrimaryMcuData->InputDet.bits.EmergencyButton)
+                if (pSysWarning->Level == WARN_LV_ER) {
+                    pSysInfo->SystemPage = _LCM_MAINTAIN;
+                    if (ShmPrimaryMcuData->InputDet.bits.EmergencyButton)
                         pSysInfo->SystemPage = _LCM_EMERGENCY;
-                if (pDcChargingInfo->ConnectorPlugIn == NO &&
-                      GetTimeoutValue(pDcChargingInfo->TimeoutTimer) >= 10000000) {
-                  setChargerMode(gunIndex, MODE_IDLE);
+                    break;
+                }
+                /*
+                if (pSysInfo->SystemPage == _LCM_SUMMARY) {
+                    StopSystemTimeoutDet();
+                    StartSystemTimeoutDet(Timeout_ReturnViewPage);
+                    break;
+                }*/
+
+                if (pDcChargingInfo->ConnectorPlugIn == NO ) {
+                    setChargerMode(gunIndex, MODE_COMPLETE);
+                }
+                if (pSysInfo->SystemPage == _LCM_WAIT_PLUGOUT) {
+					break;
+				}
+                if (pSysInfo->CurGunSelected == gunIndex) {
+                    pSysInfo->SystemPage = _LCM_ERROR;
                 }
                 break;
 
@@ -4350,33 +4390,31 @@ CheckStatus:
                     }
                     StopGunInfoTimeoutDet(gunIndex);
                     StartSystemTimeoutDet(Timeout_Terminating);
+                    pSysInfo->CurGunSelected = gunIndex;
                 }
                 // For Precharging timeout
-
                 if (pDcChargingInfo->Type == _Type_Chademo) {
-                    if (isEvStopCharging_chademo(gunIndex) == YES ||
-                            isPrechargeStatus_chademo(gunIndex) <= 0) {
+                    if ((isEvStopCharging_chademo(gunIndex) == YES ||
+                            isPrechargeStatus_chademo(gunIndex) <= 0) &&
+                        ShmDcCommonData->finalcost_flag[gunIndex]) {
                         setChargerMode(gunIndex, MODE_COMPLETE);
                     }
                 } else if (pDcChargingInfo->Type == _Type_GB) {
-                    if (isEvStopCharging_gb(gunIndex) == YES ||
-                            isPrechargeStatus_gb(gunIndex) <= 0) {
+                    if ((isEvStopCharging_gb(gunIndex) == YES ||
+                            isPrechargeStatus_gb(gunIndex) <= 0) &&
+                        ShmDcCommonData->finalcost_flag[gunIndex]){
                         setChargerMode(gunIndex, MODE_COMPLETE);
                     }
                 } else if (pDcChargingInfo->Type == _Type_CCS_2) {
-                    if (isEvStopCharging_ccs(gunIndex) == YES &&
+                    if ((isEvStopCharging_ccs(gunIndex) == YES &&
                             (isPrechargeStatus_ccs(gunIndex) >= 53 ||
                              isPrechargeStatus_ccs(gunIndex) == 0  ||
                              isPrechargeStatus_ccs(gunIndex) == 13 ||
-                             isPrechargeStatus_ccs(gunIndex) == 14)
-                       ) {
+                             isPrechargeStatus_ccs(gunIndex) == 14) &&
+                        ShmDcCommonData->finalcost_flag[gunIndex])) {
                         setChargerMode(gunIndex, MODE_COMPLETE);
                     }
                 }
-                //if (pSysInfo->SystemPage == _LCM_ERROR) {
-                if (pSysInfo->SystemPage == _LCM_MAINTAIN) {
-					break;
-                }
                 if (pSysInfo->CurGunSelected == gunIndex) {
                     pSysInfo->SystemPage = _LCM_STOPPING;
                 }
@@ -4390,13 +4428,16 @@ CheckStatus:
                     }
                     TheEndCharging(gunIndex);
                     StopSystemTimeoutDet();
-                    StartSystemTimeoutDet(Timeout_ReturnViewPage);
-                    if (pDcChargingInfo->ConnectorPlugIn)
-                        pSysInfo->SystemPage = _LCM_WAIT_PLUGOUT;
-                     else
-                        pSysInfo->SystemPage = _LCM_SUMMARY;
-                }
 
+                }
+                /*
+                if (pDcChargingInfo->ConnectorPlugIn) {
+                	StopSystemTimeoutDet();
+                    pSysInfo->SystemPage = _LCM_WAIT_PLUGOUT;
+                } else {
+					StartSystemTimeoutDet(Timeout_ReturnViewPage);
+					pSysInfo->SystemPage = _LCM_SUMMARY;
+                }*/
                 //if (pSysInfo->SystemPage == _LCM_ERROR) {
                 if (pSysInfo->SystemPage == _LCM_MAINTAIN) {
                     StopSystemTimeoutDet();
@@ -4420,8 +4461,10 @@ CheckStatus:
             case S_MAINTAIN:
                 if (isModeChange(gunIndex)) {
                     log_info("============================= S_MAINTAIN(%x) ============================= ", gunIndex);
-                    if (pSysInfo->FirmwareUpdate == YES)
+                    if (pSysInfo->FirmwareUpdate == YES) {
+                        pSysInfo->SystemPage == _LCM_MAINTAIN;
                         continue;
+                    }
                     if (pDcChargingInfo->IsAvailable == NO )
                         continue;
 
@@ -4444,6 +4487,16 @@ CheckStatus:
                         StopProcessingLoop();
                 }
                 break;
+            case S_UPDATE:
+                if (isModeChange(gunIndex)) {
+                    log_info("============================= S_UPDATE ============================= ");
+                }
+                if (pSysInfo->FirmwareUpdate == YES) {
+                    pSysInfo->SystemPage == _LCM_MAINTAIN;
+                    continue;
+                } else {
+                }
+                break;
             }//switch
         }//for
 

+ 79 - 2
EVSE/Projects/DD360UCar/Apps/Config.h

@@ -162,6 +162,10 @@ enum _LCM_UAR_INDEX {
     _LCM_MAINTAIN               = 0x0F,
     _LCM_ERROR                  = 0x10,
     _LCM_EMERGENCY              = 0x11,
+    _LCM_CONFIRM_STOP           = 0x19,
+    _LCM_COMMUNICATION          = 0x20,
+    _LCM_CHARGING_DETECT        = 0x21,
+    _LCM_PREPARECHARE           = 0x22,
 
     /*
     _LCM_VIEW                   = _LCM_SELECT_GUN,
@@ -296,7 +300,22 @@ enum _CCS_TYPE {
     _CCS_TYPE_CCS1 = 0,
     _CCS_TYPE_CCS2 = 1,
 };
-
+enum _WEATHER_TYPE {
+	_WEATHER_TYPE_SUN = 1,
+	_WEATHER_TYPE_CLOUDY,
+	_WEATHER_TYPE_RAIN,
+	_WEATHER_TYPE_THUNDER,
+	_WEATHER_TYPE_SNOW,
+	_WEATHER_TYPE_FOG,
+};
+enum _CREDITCARD_STATUS {
+	_CREDITCARD_IDLE,
+	_CREDITCARD_PREAUTH,
+	_CREDITCARD_PREAUTHCOMPLETE,
+	_CREDITCARD_CANCEL,
+	_CREDITCARD_SETTLEMENT,
+	_CREDITCARD_START,
+};
 //------------------------------------------------------------------------------
 //struct StructMeter {
 //    float curMeterValue;
@@ -398,6 +417,38 @@ typedef struct Psu_VersionInfo{
 	uint8_t FPCVersion[32];
 }PsuVerInfo;
 
+enum _LCM_UPGRADE_RESULT {
+    _LCM_UPGRADE_RESULT_WAIT = 0,
+    _LCM_UPGRADE_RESULT_PASS,
+    _LCM_UPGRADE_RESULT_FAIL,
+};
+
+typedef struct stTransInfo
+{
+	unsigned char TransDate[6];	//交易日期
+	unsigned char TransTime[6];	//交易時間
+	unsigned char ROC[12];		//EDC簽單調閱編號 (左靠右補空白)
+	unsigned char ApprovalNo[9];		//授權碼[信用卡退貨交易] (左靠右補空白)
+	unsigned char StoreId[18];		//櫃號,機號,發票號碼(左靠右補空白)
+	unsigned char RRN[12];		//信用卡交易序號
+	unsigned char CardNo[20];		//卡號(左靠右補空白),卡號部份隱藏
+	unsigned char TransAmount[12];		//交易金額
+	unsigned char VemData[64];		//無人自助設備交易資訊 交易別31/32 (預授權完成/預授權取消) 必要欄位 資訊來源為交易別13 (預授權)的回傳
+}TransInfo;
+
+typedef struct stRecordTransactionInfo
+{
+	int TransactionId;
+    unsigned char DeductResult;                     // 0: Fail, 1: Pass
+    unsigned char IsDonateInvoice;                  // 0: Do not donate, 1: Donate
+    unsigned char ApprovalNo[9];
+    unsigned char CardNo[20];		//卡號(左靠右補空白),卡號部份隱藏
+    unsigned char VemData[64];
+    float Amount;
+    unsigned char IsUpload; // 0: not upload, 1: uploaded
+    unsigned char res;
+}RecordTransactionInfo;
+
 typedef struct StDcCommonInfo {
     uint8_t RebootCount;
     uint8_t CcsVersion;
@@ -414,7 +465,9 @@ typedef struct StDcCommonInfo {
     uint8_t TestTemperature; //ReadCmdline test, manual input value
     uint8_t CcsTypeSaved[2];
     PcPsuOutput PcPsuOutput[2];
-    uint8_t Reserved[3];
+    uint8_t _upgrade_lcm_flag;
+    uint8_t _upgrade_lcm_result;
+    uint8_t Reserved[1];
     // Power Cabinet Version
     uint8_t CabinetModelName[32];
     uint8_t CabinetBoolLoaderVersion[32];
@@ -428,6 +481,30 @@ typedef struct StDcCommonInfo {
     // PSU Version
     uint8_t PSU_Number;
     PsuVerInfo PsuVer[12];
+    int ConnectorId[2];
+    int WeatherID;
+    float Temperature;
+    int Location;
+    char PresentTime[128];
+    TransInfo pCreditCard[2];
+    int runningcost[2];
+    float finalcost[2];
+    unsigned int finalcost_flag[2];
+    float ChargingRate;
+    int PreAuth_Config;
+    int PreAuth_Result;
+    int LineStatus[2];
+    int donate_flag[2];
+    unsigned int AuthPass_flag[2];
+    unsigned int PayPass_flag[2];
+    unsigned int PayFinish[2];
+    unsigned int StopCharge[2];
+    unsigned int GetCardNo[2];
+    unsigned int TradeCancel;
+    int reupload_deduct_status;		// 0:Not ReUpload 1:ReUpload 2:ReUpload finish
+    RecordTransactionInfo TransactionInfo[2];
+    RecordTransactionInfo UploadRedectInfo;
+    RecordTransactionInfo ReAuthComplete;
 } DcCommonInfo;
 
 #endif /* CONFIG_H_ */

+ 13 - 6
EVSE/Projects/DD360UCar/Apps/Define/define.h

@@ -463,7 +463,8 @@ typedef union
         unsigned int ManualStop:1;                  // 0: no effect,    1: manual stop
         unsigned int HardResetStop:1;               // 0: no effect,    1: hard reset stop
         unsigned int SoftResetStop:1;               // 0: no effect,    1: soft reset stop
-        unsigned int res:26;
+        unsigned int InvalidIdStop:1;               // 0: no effect,    1: invalid stop when StopTransactionOnInvalidId is true
+        unsigned int res:25;
     }bits;
 }ChargingStop;
 
@@ -671,6 +672,7 @@ struct ChargingInfoData
     unsigned char       Replug_flag;
     unsigned char       isEVCCIDVerify;
     unsigned char       CCSGunType;
+    struct timeval      PreChargeTimer;
 };
 
 typedef struct
@@ -714,7 +716,8 @@ typedef union
         unsigned int StopButtonStatusRequest:1;         // 0: no request,   1: stop charging button status has changed          ( cabinet -> dispenser)
         unsigned int AuthModeConfigRequest:1;           // 0: no request,   1: AuthMode Config has changed                      ( cabinet -> dispenser)
         unsigned int EVCCIDConfigRequest:1;             // 0: no request,   1: EVCCID Config has changed                        ( cabinet -> dispenser)
-        unsigned int res:8;
+        unsigned int LEDIntensityRequest:1;             // 0: no request,   1: LED Intensity has changed                        ( cabinet -> dispenser)
+        unsigned int res:7;
     }bits;
 }DispenserSettingFlag;
 
@@ -832,7 +835,8 @@ typedef union
         unsigned int  FaultStatusRequest:1;
         unsigned int  Disconnection:1;
         unsigned int  GfdDetection:1;                   // 0: stop,         1: start
-        unsigned int  res:9;
+        unsigned int  GetStartChargingSoc:1;            // 0: no effect,    1: get start soc
+        unsigned int  res:8;
     }bits;
 }ConnectorParameter;
 
@@ -863,8 +867,11 @@ struct ConnectorInfoData
 
     unsigned short          MaxTotalChargingCurrent;        // max total output current, unit: 0.1A
     unsigned short          MaxTotalChargingPower;          // max total output power, unit: 0.1kw
-    unsigned short          MaxOutputEnergy;                //0: no limit,  1 ~ 65535   kWh
-    unsigned short          MaxOutputDuration;              //0: no limit,  1 ~ 65535   minutes
+    unsigned short          MaxOutputEnergy;                // 0: no limit,  1 ~ 65535   kWh
+    unsigned short          MaxOutputDuration;              // 0: no limit,  1 ~ 65535   minutes
+    float                   CapabilityVoltage;              // unit 0.1V
+    float                   CapabilityCurrent;              // unit 0.1A
+    float                   CapabilityPower;                // unit 0.1kW
 
     unsigned int            UserPrice;                      // connector user's user price, unit: 0.01 (dollar / kWh)
     unsigned int            TotalCost;                      // connector user's total cost, unit: 0.01 dollar
@@ -1513,7 +1520,7 @@ struct AlarmCodeData
             unsigned char DcInputOVP:1;                             //bit 7
             //AlarmVal[16]
             unsigned char DcInputUVP:1;                             //bit 0
-            unsigned char :7;                                       //reserved bit 0 ~ bit 7
+            unsigned char :7;                                       //reserved bit 1 ~ bit 7
             //AlarmVal[17]
             unsigned char :8;                                       //reserved bit 0 ~ bit 7
             //AlarmVal[18]

+ 464 - 99
EVSE/Projects/DD360UCar/Apps/ModuleDoComm/DoComm.c

@@ -27,11 +27,14 @@
 #include "../Config.h"
 #include "../SelectGun/SelectGun.h"
 #include "../timeout.h"
+#include "../DataBase/DataBase.h"
 #include "DoComm.h"
 
 //------------------------------------------------------------------------------
 static DoCommGblData gDoCommGblData             = {0};
-
+static MoreInfoReq gMoreInfoReq[2]              = {0};
+//static ChangePageReq gPageReq[2]                = {0};
+static ConnectorActReqVar gConnectorActReq[2]   = {0};
 static struct SysConfigData *pSysConfig         = NULL;
 static struct SysInfoData *pSysInfo             = NULL;
 static struct WARNING_CODE_INFO *pSysWarning    = NULL;
@@ -49,7 +52,14 @@ static struct WARNING_CODE_INFO gPreSysWarningInfo = {0};
 
 // Hexdump
 char old_Hexdump[10240];
-uint8_t psu_num= 0;
+static uint8_t RemoteStartNoIDState = NO;
+static uint8_t ReservationState[2] = {0};
+static char ReservationIdTag[2][32];
+static uint8_t DeductResultReq[2] = {0};
+static int LineStatusCode[2] = {0};
+static unsigned int LedIntensity = 0;
+static int TimeZoneOffset = 0;
+
 //------------------------------------------------------------------------------
 static void removeFaultCodeToBuf(uint8_t *Code);
 static void addFaultCodeToBuf(uint8_t *Code);
@@ -448,9 +458,15 @@ static int qrCodeUrlInfoHandle(uint8_t *data)
         memset(pSysConfig->SystemId, '\0', sizeof(pSysConfig->SystemId));
         //printf("data =  %s", data);
         //len =
+
         string2ByteArray((char *)data, (uint8_t *)pSysConfig->SystemId);
         //printf("SystemId =  %s", pSysConfig->SystemId);
+        //log_info("SystemId:%s",pSysConfig->SystemId);
     }
+    sprintf(ShmDcCommonData->PresentTime, "%04d/%02d/%02d",
+                      tm->tm_year + 1900,
+                      tm->tm_mon + 1,
+                      tm->tm_mday);
 
     //if ((char *)&data[len] == '\0') {
     //    log_error("power cabinet system date error");
@@ -576,7 +592,8 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t plugNum, uint8_t *data)
         case MISC_CMD_DEFAULT_PRICES:
             prices = transPricesUnit((int)value);
             log_info("default prices = %.2f", prices);
-
+            if (prices > 0)
+                ShmDcCommonData->ChargingRate = prices;
             //pSysConfig->BillingData.isBilling = YES;
             for (j = 0; j < 24; j++) {
                 pSysConfig->BillingData.Fee[j] = prices;
@@ -703,7 +720,7 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t plugNum, uint8_t *data)
                     pSysInfo->SystemTimeoutFlag = Timeout_None;
                 }
 
-                pSysInfo->CurGunSelected = (plugNum);
+                //pSysInfo->CurGunSelected = (plugNum);
                 pSysInfo->CurGunSelectedByAc = NO_DEFINE;
             }
 
@@ -764,7 +781,69 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t plugNum, uint8_t *data)
             log_info("Authorize By EVCCID:%d",pSysConfig->isAuthrizeByEVCCID);
             //clearMiscCommand();
         	break;
-
+        case MISC_CMD_RESERVATION:
+            if(value != YES)
+            {
+                break;
+            }
+            gMoreInfoReq[plugNum].bits.ReservationReq = YES;
+            break;
+        case MISC_CMD_CHANGE_LCM_PAGE:
+            if(value == LCM_PAGE_REMOTE_START_NO_ID)
+            {
+                gMoreInfoReq[plugNum].bits.RemoteStartNoID = YES;
+            }
+            /*
+            if(value == LCM_PAGE_JOIN_LINE)
+            {
+                if(!gPageReq[plugNum].bits.JoinLine)
+                {
+                    log_info("Gun %d JoinLine page is trigger", plugNum);
+                }
+                gPageReq[plugNum].bits.JoinLine = YES;
+            }
+            if(value == LCM_PAGE_PAYMENT_SWITCH)
+            {
+                if(!gPageReq[plugNum].bits.PaymentSwitch)
+                {
+                    log_info("Gun %d PaymentSwitch page is trigger", plugNum);
+                }
+                gPageReq[plugNum].bits.PaymentSwitch = YES;
+            }*/
+            break;
+        case MISC_CMD_QR_CODE_REQ:
+            break;
+        case MISC_CMD_STATION_INFO_REQ:
+            if(value != YES)
+            {
+                break;
+            }
+            gMoreInfoReq[plugNum].bits.StationInfoReq = YES;
+            break;
+        case MISC_CMD_FINAL_COST_REQ:
+            if(value != YES)
+            {
+                break;
+            }
+            gMoreInfoReq[plugNum].bits.FinalCostReq = YES;
+            break;
+        case MISC_CMD_LINE_STATUS_REQ:
+            LineStatusCode[plugNum] = value;
+            ShmDcCommonData->LineStatus[plugNum] = value;
+            log_info("Gun %d Line Status Code: %d", plugNum, LineStatusCode[plugNum]);
+            break;
+        case MISC_CMD_LED_INTENSITY:
+            LedIntensity = value;
+            log_info("Led Intensity: %d", LedIntensity);
+            break;
+        case MISC_CMD_TIME_OFFSET:
+            TimeZoneOffset = value;
+            log_info("Time Zone Offset: %d", TimeZoneOffset);
+            if (TimeZoneOffset == 480) {
+                system("export TZ=CST-8");
+                log_info("Set Time Zone CST 8");
+            }
+            break;
         default:
             clearMiscCommand();
             break;
@@ -774,6 +853,22 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t plugNum, uint8_t *data)
 
     return ret;
 }
+void AddDispenserReq(uint8_t* buff, MiscCommand* req)
+{
+    buff[0] = (req->CMD >> 8) & 0xFF;
+    buff[1] = req->CMD & 0xFF;
+
+
+
+    buff[2] = req->Value[0];
+    buff[3] = req->Value[1];
+    buff[4] = req->Value[2];
+    buff[5] = req->Value[3];
+}
+
+
+
+
 
 static int chargingcapabilityHandle(uint8_t *data, uint8_t plugNum)
 {
@@ -823,15 +918,23 @@ static int chargingcapabilityHandle(uint8_t *data, uint8_t plugNum)
     ShmSelectGunInfo->PricesInfo[plugNum].UserPrices = transPricesUnit(ntohl(pAccountInfo->UserPrices));
     pDcChargingInfo->ChargingFee                     = transPricesUnit(ntohl(pAccountInfo->TotalCost));
     ShmSelectGunInfo->PricesInfo[plugNum].Balance    = transPricesUnit(ntohl(pAccountInfo->Balance));
+    ShmSelectGunInfo->PricesInfo[plugNum].Discount   = transPricesUnit(ntohl(pAccountInfo->Discount));
+    ShmSelectGunInfo->PricesInfo[plugNum].TransactionId = ntohl(pAccountInfo->Transaction);
 
     if ((pricesInfo[plugNum].UserPrices != ShmSelectGunInfo->PricesInfo[plugNum].UserPrices) ||
-            (pricesInfo[plugNum].Balance != ShmSelectGunInfo->PricesInfo[plugNum].Balance)) {
+            (pricesInfo[plugNum].Balance != ShmSelectGunInfo->PricesInfo[plugNum].Balance) ||
+			(pricesInfo[plugNum].Discount != ShmSelectGunInfo->PricesInfo[plugNum].Discount) ||
+			(pricesInfo[plugNum].TransactionId != ShmSelectGunInfo->PricesInfo[plugNum].TransactionId)) {
         pricesInfo[plugNum].UserPrices = ShmSelectGunInfo->PricesInfo[plugNum].UserPrices;
         pricesInfo[plugNum].Balance = ShmSelectGunInfo->PricesInfo[plugNum].Balance;
+        pricesInfo[plugNum].Discount = ShmSelectGunInfo->PricesInfo[plugNum].Discount;
+        pricesInfo[plugNum].TransactionId = ShmSelectGunInfo->PricesInfo[plugNum].TransactionId;
 
-        log_info("id = %d, user prices = %.2f, Total cost = %.2f, Account balances = %.2f, currency = %s",
+        log_info("id = %d, transaction id = %d, user prices = %.2f, Discount = %.2f, Total cost = %.2f, Account balances = %.2f, currency = %s",
                  plugNum,
+				 ShmSelectGunInfo->PricesInfo[plugNum].TransactionId,
                  ShmSelectGunInfo->PricesInfo[plugNum].UserPrices,
+				 ShmSelectGunInfo->PricesInfo[plugNum].Discount,
                  pDcChargingInfo->ChargingFee,
                  ShmSelectGunInfo->PricesInfo[plugNum].Balance,
                  (uint8_t *)GetCurrency(pSysConfig->BillingData.Currency)
@@ -908,7 +1011,7 @@ static int powerCabinetStatusProcess(uint8_t dataLen, uint8_t *data)
     //uint8_t statusCodeError = 0;
 
     if (dataLen > 0) {
-        Hexdump((uint8_t *)data, dataLen);
+        //Hexdump((uint8_t *)data, dataLen);
 
         remaindLen = dataLen % WARNING_CODE_SIZE;
 
@@ -919,7 +1022,7 @@ static int powerCabinetStatusProcess(uint8_t dataLen, uint8_t *data)
 
         if (dataLen < WARNING_CODE_SIZE) {
             log_error("fail status code length = %d", dataLen);
-            Hexdump(data, dataLen);
+            //Hexdump(data, dataLen);
             if (pSysWarning->WarningCount > 0) {
                 for (i = 0; i < pSysWarning->WarningCount; i++) {
                     usleep(128);
@@ -989,7 +1092,7 @@ static int powerCabinetStatusProcess(uint8_t dataLen, uint8_t *data)
     } else {
         if (CompareArrayIsZero(data, WARNING_CODE_SIZE) == false) {
             log_error("power cabinet status code data length is zero, but have data");
-            Hexdump((uint8_t *)data, WARNING_CODE_SIZE);
+            //Hexdump((uint8_t *)data, WARNING_CODE_SIZE);
         }
     }
 
@@ -1072,6 +1175,8 @@ static int responsePackeHandle(int fd, uint8_t *pResult, uint8_t plugNum, uint8_
     case REG_CONNECTOR_ID:
         gDoCommGblData.ConnectorID[0] = pCsuResult->Data.Data[0];
         gDoCommGblData.ConnectorID[1] = pCsuResult->Data.Data[1];
+        ShmDcCommonData->ConnectorId[0] = pCsuResult->Data.Data[0];
+        ShmDcCommonData->ConnectorId[1] = pCsuResult->Data.Data[1];
         log_info("OK (Left connector ID = %d, Right connector ID = %d)",
                  pCsuResult->Data.Data[0],
                  pCsuResult->Data.Data[1]);
@@ -1187,19 +1292,79 @@ static int responsePackeHandle(int fd, uint8_t *pResult, uint8_t plugNum, uint8_
             pDcChargingInfo->GroundFaultStatus = gfd->Status;
         }
         break;
-    case REG_GET_CABINET_DCM_VERSION:
-    	GetCabientDcmRevHandle(pCsuResult->Data.Data);
+
+    case REG_RESERVATION_IDTAG:
+        if (pCsuResult->Data.Result == COMMAND_RESULT_NG) {
+            return COMMAND_RESULT_NG;
+        }
+        uint8_t reservationState = pCsuResult->Data.Data[0] == YES ? YES : NO;
+        memset(&ReservationIdTag[plugNum][0], 0x00, 32);
+        if(reservationState)
+        {
+            strcpy(&ReservationIdTag[plugNum][0], (char *)&pCsuResult->Data.Data[1]);
+        }
+        if(reservationState != ReservationState[plugNum])
+        {
+            log_info("id = %d reservation is %s", pCsuResult->Head.ID, reservationState ? "trigger" : "expired");
+            if(reservationState)
+            {
+                log_info("id = %d reservation idTag: %s", pCsuResult->Head.ID, (char *)&ReservationIdTag[plugNum][0]);
+            }
+        }
+        ReservationState[plugNum] = reservationState;
         break;
-    case REG_GET_CABINET_OTHER_VERSION:
-    	GetCabientOtherRevHandle(pCsuResult->Data.Data);
+
+    case REG_REMOTE_START_NO_ID:
+        if (pCsuResult->Data.Result == COMMAND_RESULT_NG) {
+            return COMMAND_RESULT_NG;
+        }
+        uint8_t remoteStartNoIdState = pCsuResult->Data.Data[0] == YES ? YES : NO;
+        if(remoteStartNoIdState != RemoteStartNoIDState)
+        {
+            log_info("RemoteStartNoID is %s", remoteStartNoIdState ? "trigger" : "expired");
+        }
+        RemoteStartNoIDState = remoteStartNoIdState;
         break;
-    case REG_GET_CABINET_PSU_NUMBER:
-    	ShmDcCommonData->PSU_Number = pCsuResult->Data.Data[0];
-    	log_info("PSU Numbers:%d",ShmDcCommonData->PSU_Number);
+
+    case REG_STATION_INFO:
+        if (pCsuResult->Data.Result == COMMAND_RESULT_NG) {
+            return COMMAND_RESULT_NG;
+        }
+        StationVar _stationInfo;
+        memset((char *)&_stationInfo, 0x00, sizeof(StationVar));
+
+        _stationInfo.StationID = (pCsuResult->Data.Data[0] << 24) +
+                                 (pCsuResult->Data.Data[1] << 16) +
+                                 (pCsuResult->Data.Data[2] << 8) +
+                                 pCsuResult->Data.Data[3];
+        memcpy(_stationInfo.StationName, (char *)&pCsuResult->Data.Data[4], 64);
+        _stationInfo.WeatherID |= (pCsuResult->Data.Data[68] << 24);
+        _stationInfo.WeatherID |= (pCsuResult->Data.Data[69] << 16);
+        _stationInfo.WeatherID |= (pCsuResult->Data.Data[70] << 8);
+        _stationInfo.WeatherID |= pCsuResult->Data.Data[71];
+        uint8_t *pFloat = (uint8_t *)&_stationInfo.Temperature;
+        *(pFloat + 3) = pCsuResult->Data.Data[72];
+        *(pFloat + 2) = pCsuResult->Data.Data[73];
+        *(pFloat + 1) = pCsuResult->Data.Data[74];
+        *(pFloat) = pCsuResult->Data.Data[75];
+
+        ShmDcCommonData->WeatherID = _stationInfo.WeatherID;
+        ShmDcCommonData->Temperature = _stationInfo.Temperature;
+        ShmDcCommonData->Location = atoi(_stationInfo.StationName);
+
+        log_info("Station Name: %s, ID: %d, Weather: %d, Temperature: %.1f",
+                _stationInfo.StationName,
+                _stationInfo.StationID,
+                _stationInfo.WeatherID,
+                _stationInfo.Temperature);
         break;
-    case REG_GET_CABINET_PSU_VERSION:
-    	GetCabientEachPsuRevHandle(pCsuResult->Data.Data);
+
+    case REG_DEDUCT_INFO:
+        if (pCsuResult->Data.Result == COMMAND_RESULT_NG) {
+            return COMMAND_RESULT_NG;
+        }
         break;
+
     default:
         break;
     }
@@ -1237,8 +1402,9 @@ static int composeSocketData(int fd,
     //Hexdump((uint8_t *)&csuCmdPkt, sendPktLen);
 
     // Not Let ask cabinet version trasmit into FAIL Network
-    if (reg == REG_GET_CABINET_DCM_VERSION || reg == REG_GET_CABINET_OTHER_VERSION ||
-    		reg == REG_GET_CABINET_PSU_NUMBER || reg == REG_GET_CABINET_PSU_VERSION) {
+
+    if (reg == REG_CABINET_DCM_VERSION || reg == REG_CABINET_OTHER_VERSION ||
+    		reg == REG_TOTAL_PSU_QUANTITY || reg == REG_PSU_VERSION) {
     	gDoCommGblData.DisConnCount = 0;
     }
 
@@ -1276,6 +1442,123 @@ static int composeSocketData(int fd,
 
     return ret;
 }
+static int writeDispenserRequest(int fd, uint8_t id, uint8_t gunIndex)
+{
+    int ret = PASS;
+    int count = 0;
+    MiscCommand dispenserReq;
+    uint8_t data[6] = { 0 };
+    if (gConnectorActReq[gunIndex].bits.ChargingCancel)
+    {
+        dispenserReq.CMD = DISPENSER_REQ_CHARGING_CANCEL;
+        dispenserReq.Value[0] = 0;
+        dispenserReq.Value[1] = 0;
+        dispenserReq.Value[2] = 0;
+        dispenserReq.Value[3] = 1;
+        AddDispenserReq(data, &dispenserReq);
+        count++;
+        log_info("Write Gun %d CHARGING_CANCEL", gunIndex);
+    }
+
+    if ((ret = composeSocketData(fd,
+        id,
+        OP_WRITE_DATA,
+        REG_DISPENSER_REQUEST,
+        (count * 6),
+        &data[0])) == FAIL) {
+        return ret;
+    }
+    return ret;
+}
+static int readReservationState(int fd, uint8_t id)
+{
+    int ret = PASS;
+
+    if ((ret = composeSocketData(fd,
+                                 id,
+                                 OP_READ_DATA,
+                                 REG_RESERVATION_IDTAG,
+                                 0,
+                                 NULL)) == FAIL) {
+        return ret;
+    }
+
+    return ret;
+}
+
+static int readRemoteStartNoIDState(int fd)
+{
+    int ret = PASS;
+
+    if ((ret = composeSocketData(fd,
+                                 ID_REGISTER,
+                                 OP_READ_DATA,
+                                 REG_REMOTE_START_NO_ID,
+                                 0,
+                                 NULL)) == FAIL) {
+        return ret;
+    }
+
+    return ret;
+}
+
+static int readChargerStationInfo(int fd)
+{
+    int ret = PASS;
+
+    if ((ret = composeSocketData(fd,
+                                 ID_REGISTER,
+                                 OP_READ_DATA,
+                                 REG_STATION_INFO,
+                                 0,
+                                 NULL)) == FAIL) {
+        return ret;
+    }
+
+    return ret;
+}
+
+static int writeDeductInfo(int fd, uint8_t id,uint8_t gunIndex, RecordTransactionInfo *transactionInfo)
+{
+    int ret = PASS;
+    uint8_t dataBuf[22] = {0};
+    int i;
+
+    memset((char *)dataBuf, 0x00, sizeof(dataBuf));
+    dataBuf[0] = transactionInfo->DeductResult;
+    dataBuf[1] = transactionInfo->IsDonateInvoice;
+    dataBuf[2] = (transactionInfo->TransactionId >> 24) & 0xFF;
+    dataBuf[3] = (transactionInfo->TransactionId >> 16) & 0xFF;
+    dataBuf[4] = (transactionInfo->TransactionId >> 8) & 0xFF;
+    dataBuf[5] = (transactionInfo->TransactionId & 0xFF);
+
+    int amount = (int)(transactionInfo->Amount * 100);
+
+    dataBuf[6] = (amount >> 24) & 0xFF;
+    dataBuf[7] = (amount >> 16) & 0xFF;
+    dataBuf[8] = (amount >> 8) & 0xFF;
+    dataBuf[9] = (amount & 0xFF);
+    memcpy((char *)&dataBuf[10], transactionInfo->ApprovalNo,9);
+    /*
+    for(i=0;i<22;i++) {
+    	log_info("dataBuf[%d]:0x%x",i,dataBuf[i]);
+    }
+    */
+    log_info("Gun[%d] TransactionId:%d DeductResult:%d IsDonateInvoice:%d Amount:%f",
+    		gunIndex,transactionInfo->TransactionId,transactionInfo->DeductResult,transactionInfo->IsDonateInvoice,transactionInfo->Amount);
+    // copy deduct result to dataBuf here
+
+    if ((ret = composeSocketData(fd,
+                                 id,
+                                 OP_WRITE_DATA,
+                                 REG_DEDUCT_INFO,
+                                 22,
+                                 &dataBuf[0])) == FAIL) {
+        return ret;
+    }
+
+    return ret;
+}
 
 static int writeWaitPlugItState(int fd, uint8_t id)
 {
@@ -1453,6 +1736,7 @@ static int writeConnectorState(int fd, uint8_t plugNum, uint8_t id)
 
     pConnState->ConnectorTemp = pDcChargingInfo->ConnectorTemp;
     pConnState->ChillerTemp = pDcChargingInfo->ChillerTemp;
+    pConnState->PlugIn = pDcChargingInfo->ConnectorPlugIn;
 
     if (pDcChargingInfo->SystemStatus <= S_AUTHORIZING) {
         pConnState->State = CONN_ST_IDLE;    //idle
@@ -1461,13 +1745,15 @@ static int writeConnectorState(int fd, uint8_t plugNum, uint8_t id)
                 sizeof(ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode));
 
         strncpy(&vendorErrorCodeTmp[plugNum][0], "", WARNING_CODE_SIZE);
+
     } else if ((pDcChargingInfo->SystemStatus <= S_PREPARING_FOR_EVSE) ||
                (pDcChargingInfo->SystemStatus == S_CCS_PRECHARGE_ST0) ||
                (pDcChargingInfo->SystemStatus == S_CCS_PRECHARGE_ST1)) {
         pConnState->State = CONN_ST_PREPARING;    //preparing
     } else if (pDcChargingInfo->SystemStatus == S_CHARGING) {
         pConnState->State = CONN_ST_CHARGING;    //charging
-    } else if (pDcChargingInfo->SystemStatus == S_TERMINATING) {
+    } else if (pDcChargingInfo->SystemStatus == S_TERMINATING ||
+            pDcChargingInfo->SystemStatus == S_COMPLETE) {
         pConnState->State = CONN_ST_TERMINATING;    //terminating
     } else if ((pDcChargingInfo->SystemStatus == S_ALARM) ||
                (pDcChargingInfo->SystemStatus == S_FAULT)) {
@@ -1481,9 +1767,12 @@ static int writeConnectorState(int fd, uint8_t plugNum, uint8_t id)
                     (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
                     WARNING_CODE_SIZE);
             vendorErrorCodeTmp[plugNum][6] = '\0';
-            log_info("1 ID = %d, VendorErrorCode = %s",
-                     plugNum,
-                     (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode);
+            /*
+                log_info("1 ID = %d, VendorErrorCode = %s",
+                         plugNum,
+                         (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode);
+                _VenderErrorCodeFlag = true;
+            */
         } else {
             if (strncmp(&vendorErrorCodeTmp[plugNum][0],
                         (char *)ShmOCPP16Data->StatusNotification[plugNum].VendorErrorCode,
@@ -1587,7 +1876,7 @@ static int readCabinetDCMVersion(int fd, uint8_t id)
     ret = composeSocketData(fd,
                             id,
                             OP_READ_DATA,
-                            REG_GET_CABINET_DCM_VERSION,
+                            REG_CABINET_DCM_VERSION,
                             0,
                             NULL);
 
@@ -1600,7 +1889,7 @@ static int readCabinetOtherVersion(int fd, uint8_t id)
     ret = composeSocketData(fd,
                             id,
                             OP_READ_DATA,
-							REG_GET_CABINET_OTHER_VERSION,
+                            REG_CABINET_OTHER_VERSION,
                             0,
                             NULL);
 
@@ -1613,7 +1902,7 @@ static int readCabinetPSUNumber(int fd, uint8_t id)
     ret = composeSocketData(fd,
                             id,
                             OP_READ_DATA,
-							REG_GET_CABINET_PSU_NUMBER,
+                            REG_TOTAL_PSU_QUANTITY,
                             0,
                             NULL);
 
@@ -1627,7 +1916,7 @@ static int readCabinetEachPSUVersion(int fd, uint8_t id,uint8_t n_psu)
     ret = composeSocketData(fd,
                             id,
                             OP_READ_DATA,
-							REG_GET_CABINET_PSU_VERSION,
+                            REG_PSU_VERSION,
 							sizeof(data_buf),
 							&data_buf[0]);
 
@@ -1802,7 +2091,7 @@ static void checkAuthorProcess(int fd, uint8_t plugNum)
         ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance = 0.0;
     }
 #else
-    gunID = ID_REGISTER;
+    gunID = gDoCommGblData.ConnectorID[pSysInfo->CurGunSelected];
 
     ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance = 0.0; //非Audi 不需要等待主櫃回報餘額
 #endif // DD360Audi
@@ -1887,6 +2176,20 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
                 writeDispenserStatus(fd, gunID);
                 ftime(&gRegTimeUp[plugNum][curReg]);
             }
+            curReg = REG_CHARGING_CAP;
+            break;
+
+        case REG_CHARGING_CAP:
+            if(gMoreInfoReq[plugNum].bits.FinalCostReq)
+            {
+                if (readChargingCapability(fd, gunID) == PASS) {
+					gMoreInfoReq[plugNum].bits.FinalCostReq = false;
+					pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(plugNum);
+					ShmDcCommonData->finalcost[plugNum] = pDcChargingInfo->ChargingFee;
+					ShmDcCommonData->finalcost_flag[plugNum] = TRUE;
+					log_info("Gun %d get final cost %d", plugNum, pDcChargingInfo->ChargingFee);
+                }
+            }
             curReg = REG_PLUG_IN_STATE;
             break;
 
@@ -1932,16 +2235,7 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
                 writeConnectorState(fd, plugNum, gunID);
                 ftime(&gRegTimeUp[plugNum][curReg]);
             }
-
-            //check misc command from power cabinet
-            if (gDoCommGblData.MiscCmd != 0) {
-                if (gDoCommGblData.MiscCmd != REG_MISC_CONTROL) {
-                    log_error("misc command failed = %x", gDoCommGblData.MiscCmd);
-                }
-                curReg = gDoCommGblData.MiscCmd;
-            } else {
-                curReg = REG_QRCODE_URL_INFO;
-            }
+            curReg = REG_QRCODE_URL_INFO;
             break;
 
         //case REG_USER_ID:
@@ -1954,7 +2248,15 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
 
         case REG_MISC_CONTROL:
             readMiscCommand(fd, gunID);
-            isContinue = 0;
+
+            if(gMoreInfoReq[plugNum].Value == 0)
+            {
+                isContinue = 0;
+            }
+            else
+            {
+                curReg = REG_RESERVATION_IDTAG;
+            }
             break;
 
         case REG_REPORT_CSU_VERSION:
@@ -1988,7 +2290,18 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
                     ftime(&gRegTimeUp[plugNum][curReg]);
                 }
             }
-            isContinue = 0;
+
+            //check misc command from power cabinet
+            if (gDoCommGblData.MiscCmd != 0) {
+                if (gDoCommGblData.MiscCmd != REG_MISC_CONTROL) {
+                    log_error("misc command failed = %x", gDoCommGblData.MiscCmd);
+                }
+                curReg = gDoCommGblData.MiscCmd;
+            } else if (gMoreInfoReq[plugNum].Value != 0) {
+                curReg = REG_RESERVATION_IDTAG;
+            } else {
+                isContinue = 0;
+            }
             //curReg = REG_SOFTWARE_UPDATE;
             break;
 
@@ -2000,6 +2313,100 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
         //    isContinue = 0;
         //    break;
 
+        //case REG_CABINET_DCM_VERSION:
+        //    break;
+
+        //case REG_CABINET_OTHER_VERSION:
+        //    break;
+
+        //case REG_TOTAL_PSU_QUANTITY:
+        //    break;
+
+        //case REG_PSU_VERSION:
+        //    break;
+
+        case REG_RESERVATION_IDTAG:
+            if(gMoreInfoReq[plugNum].bits.ReservationReq)
+            {
+                if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > LOOP_RETRY_TIME ||
+                        DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) < 0) {
+                    if(readReservationState(fd, gunID) == PASS)
+                    {
+                        gMoreInfoReq[plugNum].bits.ReservationReq = ReservationState[plugNum] == NO ? NO : YES;
+                    }
+                    ftime(&gRegTimeUp[plugNum][curReg]);
+                }
+            }
+            curReg = REG_DISPENSER_REQUEST;
+            break;
+
+        //case REG_DISPENSER_REQUEST:
+        //    break;
+            case REG_DISPENSER_REQUEST:
+                if (gConnectorActReq[plugNum].Value != 0)
+                {
+                    if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > LOOP_RETRY_TIME ||
+                        DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) < 0) {
+
+
+
+                        if (writeDispenserRequest(fd, gunID, plugNum) == PASS)
+                        {
+                            gConnectorActReq[plugNum].Value = 0;
+                            log_info("Gun %d CHARGING_CANCEL OK");
+                        }
+                        ftime(&gRegTimeUp[plugNum][curReg]);
+                    }
+                }
+                curReg = REG_REMOTE_START_NO_ID;
+                break;
+        case REG_REMOTE_START_NO_ID:
+            if(gMoreInfoReq[plugNum].bits.RemoteStartNoID)
+            {
+                if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > LOOP_RETRY_TIME ||
+                        DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) < 0) {
+                    if(readRemoteStartNoIDState(fd) == PASS)
+                    {
+                        gMoreInfoReq[plugNum].bits.RemoteStartNoID = RemoteStartNoIDState == NO ? NO : YES;
+                    }
+                    ftime(&gRegTimeUp[plugNum][curReg]);
+                }
+            }
+            curReg = REG_REFUND_AMOUNT;
+            break;
+
+        case REG_REFUND_AMOUNT:
+            curReg = REG_PREPAYMENT_INFO;
+            break;
+
+        case REG_PREPAYMENT_INFO:
+            curReg = REG_PAYMENT_FAIL_REASON;
+            break;
+
+        case REG_PAYMENT_FAIL_REASON:
+            curReg = REG_CONNECTOR_QR_CODE;
+            break;
+
+        case REG_CONNECTOR_QR_CODE:
+            curReg = REG_STATION_INFO;
+            break;
+
+        case REG_STATION_INFO:
+            if(gMoreInfoReq[plugNum].bits.StationInfoReq)
+            {
+                if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > LOOP_RETRY_TIME ||
+                        DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) < 0) {
+
+                    if(readChargerStationInfo(fd) == PASS)
+                    {
+                        gMoreInfoReq[plugNum].bits.StationInfoReq = NO;
+                    }
+                    ftime(&gRegTimeUp[plugNum][curReg]);
+                }
+            }
+            isContinue = 0;
+            break;
+
         default:
             log_error("error curReg = %x", curReg);
             gDoCommGblData.MiscCmd = 0;
@@ -2031,50 +2438,17 @@ static void systemStatusProcess(int fd, uint8_t totalGun, uint8_t plugNum, uint8
     struct timeb AuthNowTime = {0};
 
     pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(plugNum);
-    // Get Power Cabinet Version information
-    if (pSysConfig->ShowInformation == YES && pSysInfo->SystemPage == _LCM_VIEW) {
-    	// Get Power Cabinet DCM Version
-        ftime(&AuthNowTime);
-        if (DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_DCM_VERSION], AuthNowTime) > LOOP_RETRY_TIME ||
-                DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_DCM_VERSION], AuthNowTime) < 0
-           ) {
-            readCabinetDCMVersion(fd, gunID);
-            ftime(&gRegTimeUp[plugNum][REG_GET_CABINET_DCM_VERSION]);
-        }
-        // Get Power Cabinet Relay and Fan Version
-		ftime(&AuthNowTime);
-		if (DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_OTHER_VERSION], AuthNowTime) > LOOP_RETRY_TIME ||
-				DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_OTHER_VERSION], AuthNowTime) < 0
-		   ) {
-			readCabinetOtherVersion(fd, gunID);
-			ftime(&gRegTimeUp[plugNum][REG_GET_CABINET_OTHER_VERSION]);
-		}
-		// Get Power Cabinet PSU Numbers
-		ftime(&AuthNowTime);
-		if (DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_PSU_NUMBER], AuthNowTime) > LOOP_RETRY_TIME ||
-				DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_PSU_NUMBER], AuthNowTime) < 0
-		   ) {
-			readCabinetPSUNumber(fd, gunID);
-			ftime(&gRegTimeUp[plugNum][REG_GET_CABINET_PSU_NUMBER]);
-		}
-		// Get Power Cabinet each PSU Version
-		if (ShmDcCommonData->PSU_Number > 0) {
-			for(i = 0 ; i < ShmDcCommonData->PSU_Number ; i++) {
-				if (DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_PSU_VERSION], AuthNowTime) > LOOP_RETRY_TIME ||
-						DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_PSU_VERSION], AuthNowTime) < 0
-				   ) {
-					readCabinetEachPSUVersion(fd, gunID,i);
-					ftime(&gRegTimeUp[plugNum][REG_GET_CABINET_PSU_VERSION]);
-				}
-			}
-		}
-    }
+
     switch (pDcChargingInfo->SystemStatus) {
     case S_IDLE:
     case S_RESERVATION:
     case S_MAINTAIN:
     case S_ALARM:
     case S_AUTHORIZING:
+        if(pDcChargingInfo->SystemStatus != S_ALARM)
+        {
+            DeductResultReq[plugNum] = NO;
+        }
         checkAuthorProcess(fd, plugNum);
 
         //authorization complete, write wait plug it state
@@ -2236,19 +2610,17 @@ static void systemStatusProcess(int fd, uint8_t totalGun, uint8_t plugNum, uint8
         }
 
         ftime(&AuthNowTime);
-        if (pDcChargingInfo->SystemStatus != S_TERMINATING) {
-            if (DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_PERMISSION], AuthNowTime) > LOOP_RETRY_TIME ||
-                    DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_PERMISSION], AuthNowTime) < 0
-               ) {
-                if (readChargePermission(fd, gunID) == 0) {
-                    log_info("Stop charging by power cabinet's permission = %d, %d",
-                             plugNum,
-                             REG_CHARGING_PERMISSION);
-                    pDcChargingInfo->StopChargeFlag = POWER_CABINET_STOP_CHARGING;
-                    //printf("%d StopChargeFlag = %d\n", plugNum, pDcChargingInfo->StopChargeFlag);
-                }
-                ftime(&gRegTimeUp[plugNum][REG_CHARGING_PERMISSION]);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_PERMISSION], AuthNowTime) > LOOP_RETRY_TIME ||
+                DiffTimeb(gRegTimeUp[plugNum][REG_CHARGING_PERMISSION], AuthNowTime) < 0
+           ) {
+            if (readChargePermission(fd, gunID) == 0) {
+                log_info("Stop charging by power cabinet's permission = %d, %d",
+                         plugNum,
+                         REG_CHARGING_PERMISSION);
+                pDcChargingInfo->StopChargeFlag = POWER_CABINET_STOP_CHARGING;
+                //printf("%d StopChargeFlag = %d\n", plugNum, pDcChargingInfo->StopChargeFlag);
             }
+            ftime(&gRegTimeUp[plugNum][REG_CHARGING_PERMISSION]);
         }
         writeChargingTarget(fd, plugNum, gunID);
 
@@ -2405,13 +2777,6 @@ int main(int argc, char *argv[])
                 if (initDone == DISPENSER_SOCKET_RECONN) {
                     break;
                 }
-                initDone = messageTrigger(fd,
-                                          plugNum,
-                                          gunID,
-                                          REG_MISC_CONTROL);
-                if (initDone == DISPENSER_SOCKET_RECONN) {
-                    break;
-                }
             }
         }
 

+ 83 - 5
EVSE/Projects/DD360UCar/Apps/ModuleDoComm/DoComm.h

@@ -80,10 +80,20 @@
 #define REG_QRCODE_URL_INFO                     0X10
 #define REG_WAIT_PLUG_IT_STATE                  0x11
 #define REG_Ground_Fault_Detection              0x12
-#define REG_GET_CABINET_DCM_VERSION             0x13
-#define REG_GET_CABINET_OTHER_VERSION           0x14
-#define REG_GET_CABINET_PSU_NUMBER              0x15
-#define REG_GET_CABINET_PSU_VERSION             0x16
+#define REG_CABINET_DCM_VERSION                 0x13
+#define REG_CABINET_OTHER_VERSION               0x14
+#define REG_TOTAL_PSU_QUANTITY                  0x15
+#define REG_PSU_VERSION                         0x16
+#define REG_RESERVATION_IDTAG                   0x17
+#define REG_DISPENSER_REQUEST                   0x18
+#define REG_REMOTE_START_NO_ID                  0x19
+#define REG_REFUND_AMOUNT                       0x1A
+#define REG_PREPAYMENT_INFO                     0x1B
+#define REG_PAYMENT_FAIL_REASON                 0x1C
+#define REG_CONNECTOR_QR_CODE                   0x1D
+#define REG_STATION_INFO                        0x1E
+#define REG_DEDUCT_INFO                         0x1F
+
 //------------------------------------------------------------------------------
 //--- dispenser result ---
 //------------------------------------------------------------------------------
@@ -114,26 +124,92 @@
 #define MISC_CMD_WEB_STOP_CHARGING              (0x000B)
 #define MISC_CMD_AUTH_DISABLE					(0x000C)
 #define MISC_CMD_EVCCID_ENABLE					(0x000D)
+#define MISC_CMD_LED_INTENSITY                  (0x000E)
+#define MISC_CMD_AC_CONTACTOR                   (0x000F)
+#define MISC_CMD_TIME_OFFSET                    (0x0010)
 
 #define MISC_CMD_HARDWARE_REBOOT                (0x0101)
 #define MISC_CMD_SOFTWARE_RESTART               (0x0102)
 #define MISC_CMD_REMOTE_START_CHARGING          (0x0103)
 #define MISC_CMD_REMOTE_STOP_CHARGING           (0x0104)
 #define MISC_CMD_REMOTE_UNLOCK                  (0x0105)
+#define MISC_CMD_RESERVATION                    (0x0106)
+#define MISC_CMD_CHANGE_LCM_PAGE                (0x0107)
+#define MISC_CMD_QR_CODE_REQ                    (0x0108)
+#define MISC_CMD_STATION_INFO_REQ               (0x0109)
+#define MISC_CMD_FINAL_COST_REQ                 (0x010A)
+#define MISC_CMD_LINE_STATUS_REQ                (0x010B)
 
 #define ST_UPDATE_FIRMWARE                      (0x01)
 #define ST_NO_UPDATE_FIRMWARE                   (0x02)
 
+#define LCM_PAGE_REMOTE_START_NO_ID             (0x0001)
+#define DISPENSER_REQ_CHARGING_CANCEL           (0x0001)
+
+#define UPLOAD_DEDUCT_DB						(0x5656)
+
+
 //------------------------------------------------------------------------------
 #pragma pack(push)
 #pragma pack(1)
+typedef union
+{
+    unsigned int Value;
+    struct
+    {
+        unsigned int ChargingCancel : 1; // 0: no effect, 1: charging cancel request
+        unsigned int res : 31;
+    }bits;
+} ConnectorActReqVar;
+
+typedef struct StDeductInfoVar {
+    unsigned char DeductResult;                     // 0: Fail, 1: Pass
+    unsigned char IsDonateInvoice;                  // 0: Do not donate, 1: Donate
+    int TransactionId;								// transaction id
+    int Amount;                                     // unit = 0.01 dollar
+    char ApprovalNumber[12];						// approval number
+} DeductInfoVar;
+
+/*
+typedef union
+{
+    unsigned int Value;
+    struct
+    {
+        unsigned int JoinLine:1;                    // 0: no effect,                1: JoinLine page is trigger
+        unsigned int PaymentSwitch:1;               // 0: no effect,                1: PaymentSwitch page is trigger
+        unsigned int res:30;
+    }bits;
+} ChangePageReq;
+*/
+
+typedef union
+{
+    unsigned int Value;
+    struct
+    {
+        unsigned int ReservationReq:1;              // 0: no effect,                1: need to request Reservation
+        unsigned int RemoteStartNoID:1;             // 0: no effect,                1: need to request RemoteStartNoID
+        unsigned int StationInfoReq:1;              // 0: no effect,                1: need to request StationInfo
+        unsigned int FinalCostReq:1;                // 0: no effect,                1: need to request FinalCost
+        unsigned int res:28;
+    }bits;
+} MoreInfoReq;
+
+typedef struct StStationVar {
+    int StationID;
+    char StationName[64];
+    int WeatherID;
+    float Temperature;
+} StationVar;
 
 typedef struct StConnectorState {
     uint8_t State;
     uint8_t WarningCode[6];
     uint8_t ConnectorTemp;
     uint8_t ChillerTemp;
-    uint8_t Reserved[3];
+    uint8_t PlugIn;
+    uint8_t Reserved[2];
 } ConnectorState;
 
 typedef struct StConnectorIDTable {
@@ -234,6 +310,8 @@ typedef struct StAccountInfo {
     int UserPrices;
     int TotalCost;
     int Balance;
+    int Discount;
+    int Transaction;
     uint8_t Reserved[3];
 } AccountInfo;
 

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

@@ -346,6 +346,9 @@ void CANReceiver(int fd)
                     } else {
                         log_info("Conn %d, None Check. (%d) ", targetGun, frame.data[0]);
                     }
+                    if(pDcChargingInfo->RemoteStartFlag == YES) {
+                        pSysInfo->CurGunSelected = targetGun;
+                    }
                 }
 
                 pDcChargingInfo->ConnectorPlugIn = frame.data[0];
@@ -417,7 +420,8 @@ void CANReceiver(int fd)
                         (pDcChargingInfo->SystemStatus >= S_CCS_PRECHARGE_ST0 &&
                          pDcChargingInfo->SystemStatus <= S_CCS_PRECHARGE_ST1)
                    ) {
-                    if (pDcChargingInfo->EvBatteryStartSoc <= 0) {
+                    if (pDcChargingInfo->EvBatteryStartSoc <= 0 &&
+                            pDcChargingInfo->SystemStatus >= S_PREPARING_FOR_EVSE) {
                         pDcChargingInfo->EvBatteryStartSoc = frame.data[1];
                     }
 

+ 1 - 1
EVSE/Projects/DD360UCar/Apps/ModuleEvComm/Module_EvTxComm.c

@@ -1049,7 +1049,7 @@ int main(int argc, char *argv[])
                         }
 
                         pDcChargingInfo->PresentChargedEnergy += changingPow;
-                        pDcChargingInfo->PowerConsumption += changingPow;
+                        pDcChargingInfo->PowerConsumption += pDcChargingInfo->PresentChargingPower;
                         chargingTime[gunIndex] = pDcChargingInfo->PresentChargedDuration;
                     }
                 }

+ 18 - 10
EVSE/Projects/DD360UCar/Apps/ModuleInternalComm/RelayBoard.c

@@ -1030,12 +1030,12 @@ void GetPersentOutputVol(void)
     if (Query_Present_OutputVoltage(Uart5Fd, ADDR_RELAY, &outputVoltage) != PASS) {
         return;
     }
-
-    //log_info("Conn1 fuse 1 = %f ", outputVoltage.behindFuse_Voltage_C1);
-    //log_info("Conn1 relay 1 = %f ", outputVoltage.behindRelay_Voltage_C1);
-    //log_info("Conn2 fuse 2 = %f ", outputVoltage.behindFuse_Voltage_C2);
-    //log_info("Conn2 relay 2 = %f ", outputVoltage.behindRelay_Voltage_C2);
-
+    /*
+    log_info("Conn1 fuse 1 = %f ", outputVoltage.behindFuse_Voltage_C1);
+    log_info("Conn1 relay 1 = %f ", outputVoltage.behindRelay_Voltage_C1);
+    log_info("Conn2 fuse 2 = %f ", outputVoltage.behindFuse_Voltage_C2);
+    log_info("Conn2 relay 2 = %f ", outputVoltage.behindRelay_Voltage_C2);
+    */
     //log_info("outputVoltage.behindFuse_Voltage_C1 = %f ", outputVoltage.behindFuse_Voltage_C1);
     //log_info("outputVoltage.behindFuse_Voltage_C2 = %f ", outputVoltage.behindFuse_Voltage_C2);
 
@@ -1063,7 +1063,7 @@ void GetPersentOutputVol(void)
             break;
 
         case 0x02:
-#if defined DD360 || defined DD360Audi || defined DD360ComBox
+#if defined DD360 || defined DD360Audi || defined DD360ComBox || defined DD360UCar
             pDcChargingInfo->FireChargingVoltage = ShmRelayModuleData->Gun2RelayOutputVolt;
             pDcChargingInfo->PresentChargingCurrent = ((float)ShmRelayModuleData->Gun2FuseOutputVolt) / 10;
             pDcChargingInfo->PresentChargingVoltage = ((float)pDcChargingInfo->FireChargingVoltage) / 10;
@@ -1075,7 +1075,13 @@ void GetPersentOutputVol(void)
             pDcChargingInfo->FuseChargingVoltage = ShmRelayModuleData->Gun2FuseOutputVolt;
             break;
         }
-
+        /*
+        log_info("FireChargingVoltage:%.1f PresentChargingCurrent:%.1f PresentChargingVoltage:%.1f FuseChargingVoltage:%.1f",
+            pDcChargingInfo->FireChargingVoltage,
+            pDcChargingInfo->PresentChargingCurrent,
+            pDcChargingInfo->PresentChargingVoltage,
+            pDcChargingInfo->FuseChargingVoltage );
+            */
         //log_info("%d persent vol = %f, cur = %f",
         //         index,
         //         pDcChargingInfo->PresentChargingVoltage,
@@ -1460,7 +1466,6 @@ static void SetLedColor(void)
     static uint8_t _checkLedChanged = 3;
     struct ChargingInfoData *chargingData_1 = NULL;
     struct ChargingInfoData *chargingData_2 = NULL;
-    uint8_t _colorBuf = COLOR_MAX_LV * LED_INTENSITY_BRIGHTEST;
 
     if (pSysConfig->TotalConnectorCount == 1) {
         chargingData_1 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
@@ -1469,11 +1474,14 @@ static void SetLedColor(void)
         chargingData_1 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
         chargingData_2 = (struct ChargingInfoData *)GetDcChargingInfoData(1);
     }
+    uint8_t _colorBuf = COLOR_MAX_LV * LED_INTENSITY_BRIGHTEST;
 
     if (pSysConfig->LedInfo.Intensity == _LED_INTENSITY_DARKEST) {
         _colorBuf = COLOR_MAX_LV * LED_INTENSITY_DARKEST;
     } else if (pSysConfig->LedInfo.Intensity == _LED_INTENSITY_MEDIUM) {
         _colorBuf = COLOR_MAX_LV * LED_INTENSITY_MEDIUM;
+    } else if (pSysConfig->LedInfo.Intensity == LED_INTENSITY_BRIGHTEST) {
+        _colorBuf = COLOR_MAX_LV * LED_INTENSITY_BRIGHTEST;
     }
 
     //printf("chargingData_1->SystemStatus=%d\n",chargingData_1->SystemStatus);
@@ -1655,7 +1663,7 @@ static void LEDBoardProcess(void)
     if (ShmLedModuleData->SelfTest_Comp == NO) {
         return;
     }
-
+    pSysConfig->LedInfo.Intensity = LED_INTENSITY_BRIGHTEST;
     if (GetTimeoutValue(_led_priority_time) / 1000 >= 1000) {
 
         //if (pSysConfig->TotalConnectorCount == 1) {

+ 334 - 138
EVSE/Projects/DD360UCar/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -28,6 +28,7 @@ static struct FanModuleData *ShmFanModuleData;
 static struct PrimaryMcuData *ShmPrimaryMcuData;
 static SelectGunInfo *ShmSelectGunInfo = NULL;
 static struct ChargingInfoData *pDcChargingInfo = NULL;
+static DcCommonInfo *ShmDcCommonData            = NULL;
 
 short _currentPage              = _LCM_NONE;
 uint8_t _totalCount;
@@ -101,6 +102,7 @@ void ReadMsgFromLcm(uint8_t *msg, uint8_t readLen)
             case CMD_REGISTER: {
                 // 頁面
                 strcpy((char *)pSysInfo->LcmHwRev, moduleName);
+                _currentPage = *(msg + 7);
             }
             break;
             }
@@ -121,10 +123,14 @@ void ReadMsgFromLcm(uint8_t *msg, uint8_t readLen)
 void GetHrFormTimeString(char* time,char* hr)
 {
     //char tm[] = "2021-12-06 17:29:08:084";
+    int _temp_hr;
     for(int i = 0 ; i < 2 ; i++) {
         hr[i] = time[i+11];
     }
-    if( atoi(hr) == NULL ) {
+    if ((atoi(hr) + 8) > 23) {
+        _temp_hr = atoi(hr) + 8 - 24;
+        sprintf(hr, "%02d", _temp_hr);
+    } else if( atoi(hr) == NULL ) {
         strcmp(hr,"");
     }
 }
@@ -260,70 +266,107 @@ void ChangeCurPage()
     struct ChargingInfoData *pDcChargingInfo_0 = (struct ChargingInfoData *)GetDcChargingInfoData(LEFT_GUN_NUM);
     struct ChargingInfoData *pDcChargingInfo_1 = (struct ChargingInfoData *)GetDcChargingInfoData(RIGHT_GUN_NUM);
 
-    if (_currentPage != pSysInfo->SystemPage) {
-        switch (pSysInfo->SystemPage) {
-            case _LCM_VIEW:
-                if (pDcChargingInfo_0->SystemStatus == S_IDLE && pDcChargingInfo_1->SystemStatus == S_IDLE ) {
-                    pSysInfo->PageIndex = __VIEW_ALL_IDLE_;
-                } else if(pDcChargingInfo_0->SystemStatus == S_CHARGING && pDcChargingInfo_1->SystemStatus != S_CHARGING) {
-                    pSysInfo->PageIndex = __VIEW_LEFT_CHARGE_;
-                } else if(pDcChargingInfo_0->SystemStatus != S_CHARGING && pDcChargingInfo_1->SystemStatus == S_CHARGING) {
-                    pSysInfo->PageIndex = __VIEW_RIGHT_CHARGE_;
-                } else if(pDcChargingInfo_0->SystemStatus == S_CHARGING && pDcChargingInfo_1->SystemStatus == S_CHARGING) {
-                    pSysInfo->PageIndex = __VIEW_ALL_CHARGE_;
-                } else
-                    pSysInfo->PageIndex = __VIEW_ALL_IDLE_;
-                break;
-            case _LCM_START_SCAN:
-                pSysInfo->PageIndex = __START_SCAN_;
-                break;
-            case _LCM_START_AUTHORIZING:
-                pSysInfo->PageIndex = __START_AUTHORIZE_;
-                break;
-            case _LCM_START_AUTHORIZE_FAIL:
-                pSysInfo->PageIndex = __START_AUTHORIZE_FAIL_;
-                break;
-            case _LCM_WAIT_PLUGIN:
+    
+    switch (pSysInfo->SystemPage) {
+        case _LCM_VIEW:
+            if (pDcChargingInfo_0->SystemStatus == S_IDLE && pDcChargingInfo_1->SystemStatus == S_IDLE ) {
+                pSysInfo->PageIndex = __VIEW_ALL_IDLE_;
+            } else if(pDcChargingInfo_0->SystemStatus == S_CHARGING && pDcChargingInfo_1->SystemStatus != S_CHARGING) {
+                pSysInfo->PageIndex = __VIEW_LEFT_CHARGE_;
+            } else if(pDcChargingInfo_0->SystemStatus != S_CHARGING && pDcChargingInfo_1->SystemStatus == S_CHARGING) {
+                pSysInfo->PageIndex = __VIEW_RIGHT_CHARGE_;
+            } else if(pDcChargingInfo_0->SystemStatus == S_CHARGING && pDcChargingInfo_1->SystemStatus == S_CHARGING) {
+                pSysInfo->PageIndex = __VIEW_ALL_CHARGE_;
+            }
+            break;
+        case _LCM_START_SCAN:
+            log_info("Gun%d Enter Start Scan", pSysInfo->CurGunSelected);
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                pSysInfo->PageIndex = __START_SCAN_LEFT;
+            else
+                pSysInfo->PageIndex = __START_SCAN_RIGHT;
+            break;
+        case _LCM_START_AUTHORIZING:
+            pSysInfo->PageIndex = __START_AUTHORIZE_;
+            break;
+        case _LCM_START_AUTHORIZE_FAIL:
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                pSysInfo->PageIndex = __START_AUTHORIZE_FAIL_LEFT;
+            else
+                pSysInfo->PageIndex = __START_AUTHORIZE_FAIL_RIGHT;
+            break;
+        case _LCM_WAIT_PLUGIN:
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
                 pSysInfo->PageIndex = __WAIT_PLUGIN_;
-                break;
-            case _LCM_PRECHARGE:
-                pSysInfo->PageIndex =__PRE_CHARGE_;
-                break;
-            case _LCM_LINK_ERROR:
-                pSysInfo->PageIndex =__LINKING_ERROR_;
-                break;
-            case _LCM_DETAIL_VIEW:
-                pSysInfo->PageIndex =__DETAIL_VIEW_;
-                break;
-            case _LCM_STOP_RFID:
-                pSysInfo->PageIndex =__STOP_SCAN_RFID_;
-                break;
-            case _LCM_STOP_APP:
-                pSysInfo->PageIndex =__STOP_SCAN_APP_;
-                break;
-            case _LCM_STOP_RFID_FAIL:
-                pSysInfo->PageIndex =__STOP_RFID_FAIL_;
-                break;
-            case _LCM_STOPPING:
-                pSysInfo->PageIndex =__STOP_AUTHORIZE_;
-                break;
-            case _LCM_WAIT_PLUGOUT:
-                pSysInfo->PageIndex =__WAIT_PLUGOUT_;
-                break;
-            case _LCM_SUMMARY:
-                pSysInfo->PageIndex =__SUMMARY_;
-                break;
-            case _LCM_MAINTAIN:
-                pSysInfo->PageIndex =__MAINTAIN_PAGE_;
-                break;
-            case _LCM_ERROR:
-                pSysInfo->PageIndex =__ERROR_PAGE_;
-                break;
-            case _LCM_EMERGENCY:
-                pSysInfo->PageIndex =__EMERGENCY_BUTTON_;
-                break;
-        }
-        _currentPage = pSysInfo->SystemPage;
+            else
+                pSysInfo->PageIndex = __WAIT_PLUGIN_RIGHT;
+            break;
+        case _LCM_PRECHARGE:
+            pSysInfo->PageIndex =__PRE_CHARGE_;
+            break;
+        case _LCM_LINK_ERROR:
+            if(pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                pSysInfo->PageIndex = __LINKING_ERROR_LEFT;
+            else
+                pSysInfo->PageIndex = __LINKING_ERROR_RIGHT;
+            break;
+        case _LCM_DETAIL_VIEW:
+            pSysInfo->PageIndex =__DETAIL_VIEW_;
+            break;
+        case _LCM_STOP_RFID:
+            pSysInfo->PageIndex =__STOP_SCAN_RFID_;
+            break;
+        case _LCM_STOP_APP:
+            pSysInfo->PageIndex =__STOP_SCAN_APP_;
+            break;
+        case _LCM_STOP_RFID_FAIL:
+            pSysInfo->PageIndex =__STOP_RFID_FAIL_;
+            break;
+        case _LCM_STOPPING:
+            pSysInfo->PageIndex =__STOP_AUTHORIZE_;
+            break;
+        case _LCM_WAIT_PLUGOUT:
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                pSysInfo->PageIndex = __WAIT_PLUGOUT_LEFT;
+            else
+                pSysInfo->PageIndex = __WAIT_PLUGOUT_RIGHT;
+            break;
+        case _LCM_SUMMARY:
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                pSysInfo->PageIndex = __SUMMARY_LEFT;
+            else
+                pSysInfo->PageIndex = __SUMMARY_RIGHT;
+            break;
+        case _LCM_MAINTAIN:
+            pSysInfo->PageIndex =__MAINTAIN_PAGE_;
+            break;
+        case _LCM_ERROR:
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
+                pSysInfo->PageIndex = __ERROR_PAGE_LEFT;
+            else
+                pSysInfo->PageIndex = __ERROR_PAGE_RIGHT;
+            break;
+        case _LCM_EMERGENCY:
+            pSysInfo->PageIndex =__EMERGENCY_BUTTON_;
+            break;
+        case _LCM_CONFIRM_STOP:
+            if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
+                pSysInfo->PageIndex = __CONFIRM_STOP_LEFT;
+            } else 
+                pSysInfo->PageIndex = __CONFIRM_STOP_RIGHT;
+            break;
+        case _LCM_COMMUNICATION:
+            pSysInfo->PageIndex = __COMMUNICATION_PROCESS;
+            break;
+        case _LCM_CHARGING_DETECT:
+            pSysInfo->PageIndex = __GFD_PROCESS;
+            break;
+        case _LCM_PREPARECHARE:
+            pSysInfo->PageIndex = __PRECHARGE_PROCESS;
+            break;
+    }
+    if (_currentPage != pSysInfo->PageIndex) {
+        _currentPage = pSysInfo->PageIndex;
         ChangeToOtherPage(pSysInfo->PageIndex);
     }
 }
@@ -374,10 +417,23 @@ void ShowViewChargingTime(uint8_t gunIndex,int time)
     } else
         DisplayValueToLcm(_RightGun_info_time, (uint8_t *)value, sizeof(value));
 }
+void ShowViewChargingEngery(uint8_t gunIndex, float energy)
+{
+    uint8_t value[10] = { 0 };
+    int min;
+    sprintf((char*)value, "%.1f", energy);
+    //log_info("gun[%d] energy:%.1f", gunIndex, energy);
+    if (gunIndex == LEFT_GUN_NUM) {
+        DisplayValueToLcm(_LeftGun_info_cap, (uint8_t*)value, sizeof(value));
+    }
+    else
+        DisplayValueToLcm(_RightGun_info_cap, (uint8_t*)value, sizeof(value));
+}
 void ShowViewCharingMoney(uint8_t gunIndex,float money)
 {
     uint8_t value[10] = {0};
     sprintf((char *)value,"%.1f",money);
+    //log_info("gun[%d] money:%.1f", gunIndex, money);
     if (gunIndex == LEFT_GUN_NUM) {
         DisplayValueToLcm(_LeftGun_info_money, (uint8_t *)value, sizeof(value));
     } else
@@ -386,13 +442,29 @@ void ShowViewCharingMoney(uint8_t gunIndex,float money)
 void ShowViewChargingPower(uint8_t gunIndex,float power)
 {
     uint8_t value[10] = {0};
+    float _data = power * 10;
     sprintf((char *)value,"%.1f",power);
+    //log_info("gun[%d] power:%.1f",gunIndex,power);
     if (power >= 0 &&  power <= POWER_MAX_KW) {
         if (gunIndex == LEFT_GUN_NUM) {
-            DisplayValueToLcm(_LeftGun_info_power_number, (uint8_t *)value, sizeof(value));
-        } else
-            DisplayValueToLcm(_RightGun_info_power_number, (uint8_t *)value, sizeof(value));
+            ChangeDisplay2Value(_LeftGun_info_power_number, _data);
+            //DisplayValueToLcm(_LeftGun_info_power_number, (uint8_t *)value, sizeof(value));
+        } else {
+            //DisplayValueToLcm(_RightGun_info_power_number, (uint8_t*)value, sizeof(value));
+            ChangeDisplay2Value(_RightGun_info_power_number, _data);
+        }
+    }
+}
+void ShowConnectId()
+{
+    if (ShmDcCommonData->ConnectorId[0] <= 2) {
+        ChangeDisplay2Value(_LeftGun_ConnectorId, _ICON_CONNECTOR_1);
+        ChangeDisplay2Value(_RightGun_ConnectorId, _ICON_CONNECTOR_1);
+    } else {
+        ChangeDisplay2Value(_LeftGun_ConnectorId, _ICON_CONNECTOR_2);
+        ChangeDisplay2Value(_RightGun_ConnectorId, _ICON_CONNECTOR_2);
     }
+    
 }
 void ShowViewLeftGunInfo()
 {
@@ -414,7 +486,7 @@ void ShowViewLeftGunInfo()
             case _TYPE_CCS2_Liquid:
             case _TYPE_CCS2_Natural:
                 ChangeDisplay2Value(_LeftGun_type_pic_U,_ICON_CCS2_GUN_U);
-                ChangeDisplay2Value(_LeftGun_type_pic_U,_ICON_CCS2_GUN_L);
+                ChangeDisplay2Value(_LeftGun_type_pic_L,_ICON_CCS2_GUN_L);
                 ChangeDisplay2Value(_LeftGun_type_name,_ICON_CCS2_Name);
                 if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid) {
                     ChangeDisplay2Value(_LeftGun_type_speed,_ICON_High_Speed);
@@ -426,15 +498,29 @@ void ShowViewLeftGunInfo()
                 log_error("CCS Gun Type Error! Not Show in LCM!!");
         }
         memset(value, 0x00, sizeof(value));
-        sprintf((char *)value,"1A");
+        sprintf((char *)value,"1 A");
         DisplayValueToLcm(_LeftGun_location, (uint8_t *)value, sizeof(value));
     } else if (pDcChargingInfo->SystemStatus == S_CHARGING ) {
         ShowViewChargingSoc(LEFT_GUN_NUM,pDcChargingInfo->EvBatterySoc);
         ShowViewChargingTime(LEFT_GUN_NUM,pDcChargingInfo->PresentChargedDuration);
         ShowViewCharingMoney(LEFT_GUN_NUM,pDcChargingInfo->ChargingFee);
         ShowViewChargingPower(LEFT_GUN_NUM,pDcChargingInfo->PresentChargingPower);
+        ShowViewChargingEngery(LEFT_GUN_NUM, pDcChargingInfo->PresentChargedEnergy);
+
+        switch (pDcChargingInfo->CCSGunType) {
+            case _TYPE_CCS1_Liquid:
+            case _TYPE_CCS1_Natural:
+                ChangeDisplay2Value(_LeftGun_type_name, _ICON_CCS1_Name);
+                break;
+            case _TYPE_CCS2_Liquid:
+            case _TYPE_CCS2_Natural:
+                ChangeDisplay2Value(_LeftGun_type_name, _ICON_CCS2_Name);
+                break;
+        }
+
     }
 }
+
 void ShowViewRightGunInfo()
 {
     char value[5];
@@ -467,13 +553,24 @@ void ShowViewRightGunInfo()
                 log_error("CCS Gun Type Error! Not Show in LCM!!");
         }
         memset(value, 0x00, sizeof(value));
-        sprintf((char *)value,"1B");
+        sprintf((char *)value,"1 B");
         DisplayValueToLcm(_RightGun_location, (uint8_t *)value, sizeof(value));
     } else if (pDcChargingInfo->SystemStatus == S_CHARGING ) {
         ShowViewChargingSoc(RIGHT_GUN_NUM,pDcChargingInfo->EvBatterySoc);
         ShowViewChargingTime(RIGHT_GUN_NUM,pDcChargingInfo->PresentChargedDuration);
         ShowViewCharingMoney(RIGHT_GUN_NUM,pDcChargingInfo->ChargingFee);
         ShowViewChargingPower(RIGHT_GUN_NUM,pDcChargingInfo->PresentChargingPower);
+        ShowViewChargingEngery(RIGHT_GUN_NUM, pDcChargingInfo->PresentChargedEnergy);
+        switch (pDcChargingInfo->CCSGunType) {
+        case _TYPE_CCS1_Liquid:
+        case _TYPE_CCS1_Natural:
+            ChangeDisplay2Value(_RightGun_type_name, _ICON_CCS1_Name);
+            break;
+        case _TYPE_CCS2_Liquid:
+        case _TYPE_CCS2_Natural:
+            ChangeDisplay2Value(_RightGun_type_name, _ICON_CCS2_Name);
+            break;
+        }
     }
 }
 void SetViewPage()
@@ -482,6 +579,7 @@ void SetViewPage()
     if (pSysConfig->TotalConnectorCount == 1) {
 
     } else if (pSysConfig->TotalConnectorCount == 2) {
+        ShowConnectId();
         ShowViewLeftGunInfo();
         ShowViewRightGunInfo();
     }
@@ -534,6 +632,11 @@ void SetDetailViewPage()
     uint8_t value[10] = {0};
     ShowSelectGunIcon();
     pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+    if (pDcChargingInfo->SystemStatus != S_CHARGING) {
+        SetViewPage();
+        return;
+    }
+    log_info("PowerConsumption:%.1f",pDcChargingInfo->PowerConsumption);
     uint8_t digits = pDcChargingInfo->EvBatterySoc % 10;
     uint8_t tens = (pDcChargingInfo->EvBatterySoc / 10) %10;
     uint8_t hundreds = pDcChargingInfo->EvBatterySoc / 100;
@@ -549,7 +652,32 @@ void SetDetailViewPage()
     }
 
     // Show Progress Bar
-    ChangeDisplay2Value(_ProgressBar_LEVEL,_ICON_ProgressBar_10+(pDcChargingInfo->EvBatterySoc/10)-1);
+    if (hundreds) {
+    	ChangeDisplay2Value(_ProgressBar_LEVEL, _ICON_BTY_100);
+    }
+    else {
+        // 0 ~ 19 % show in progress bar 10%
+        if (pDcChargingInfo->EvBatterySoc < 10) {
+            if (_everyPageRollChange % 3 == 0)
+                ChangeDisplay2Value(_ProgressBar_LEVEL, _ICON_BTY_10);
+            else if (_everyPageRollChange % 3 == 1)
+                ChangeDisplay2Value(_ProgressBar_LEVEL, _ICON_BTY_12);
+            else
+                ChangeDisplay2Value(_ProgressBar_LEVEL, _ICON_BTY_14);
+        }
+        else {
+            ChangeDisplay2Value(_ProgressBar_LEVEL, _ICON_BTY_10 + (tens * 10) + (_everyPageRollChange % 5) * 2);
+        }
+        /*
+    	if (tens == 1)
+    		tens = 0;
+		if (_everyPageRollChange%2 == 0)
+			ChangeDisplay2Value(_ProgressBar_LEVEL,_ICON_ProgressBar_10+tens*2);
+		else
+			ChangeDisplay2Value(_ProgressBar_LEVEL,_ICON_ProgressBar_10+tens*2+1);
+            */
+		_everyPageRollChange++;
+    }
 
     // Show Power
     if (pDcChargingInfo->PresentChargingPower >= 0 &&
@@ -568,10 +696,11 @@ void SetDetailViewPage()
     // Show Energy
     if (pDcChargingInfo->PresentChargedEnergy >= 0.1 &&
             pDcChargingInfo->PresentChargedEnergy <= ENERGY_MAX_KWH) {
-        data = pDcChargingInfo->PresentChargedEnergy;
+    	float_data = pDcChargingInfo->PresentChargedEnergy;
     } else
-        data = 0;
-    sprintf((char *)value,"%d",data);
+    	float_data = 0;
+    sprintf((char *)value,"%.1f",float_data);
+    log_info("Energy:%s",value);
     DisplayValueToLcm(_Detail_Cap_Num,value, sizeof(value));
 
     // Show Money
@@ -589,7 +718,12 @@ void ShowCountDownTimer()
     min = tm/60;
     sec = tm%60;
     sprintf((char *)value,"%02d:%02d",min,sec);
-    DisplayValueToLcm(_Count_Down_Time, (uint8_t *)value, sizeof(value));
+    if (pSysInfo->SystemPage == _LCM_SUMMARY) {
+        sprintf((char*)value, "");
+        DisplayValueToLcm(_Count_Down_Time, (uint8_t*)value, sizeof(value));
+    }
+    else
+        DisplayValueToLcm(_Count_Down_Time, (uint8_t *)value, sizeof(value));
 }
 unsigned long GetTimeoutValue(struct timeval _sour_time)
 {
@@ -612,10 +746,11 @@ void ShowGunCountDownTimer()
 }
 void ShowProgressBar()
 {
+    /*
     for(int i = 0 ; i <= 19 ; i++) {
         ChangeDisplay2Value(_ProgressBar_LEVEL,_ICON_ProgressBar_10+i);
         usleep(100000);
-    }
+    }*/
 }
 void ShowSummaryPage()
 {
@@ -626,9 +761,11 @@ void ShowSummaryPage()
     // Show Money
     data = pDcChargingInfo->ChargingFee;
     sprintf((char *)value,"%.1f",data);
-    int discount,settlement = 0;
-    DisplayValueToLcm(_Summary_total_money, (uint8_t *)value, sizeof(value));
-    DisplayValueToLcm(_Summary_cal_Total_money, (uint8_t *)value, sizeof(value));
+    //int discount,settlement = 0;
+    //DisplayValueToLcm(_Summary_total_money, (uint8_t *)value, sizeof(value));
+    //DisplayValueToLcm(_Summary_cal_Total_money, (uint8_t *)value, sizeof(value));
+    ChangeDisplay2Value(_Summary_total_money, (int)pDcChargingInfo->ChargingFee);
+    ChangeDisplay2Value(_Summary_cal_Total_money, (int)pDcChargingInfo->ChargingFee);
     /*
     log_info("start time:%s",pDcChargingInfo->StartDateTime);
     log_info("stop time:%s",pDcChargingInfo->StopDateTime);*/
@@ -637,45 +774,70 @@ void ShowSummaryPage()
     GetMinFormTimeString(pDcChargingInfo->StartDateTime,start_min);
     GetHrFormTimeString(pDcChargingInfo->StopDateTime,end_hr);
     GetMinFormTimeString(pDcChargingInfo->StopDateTime,end_min);
+    ChangeDisplay2Value(_Summary_Start_time_hr, atoi(start_hr));
+    ChangeDisplay2Value(_Summary_Start_time_min, atoi(start_min));
+    ChangeDisplay2Value(_Summary_end_time_hr, atoi(end_hr));
+    ChangeDisplay2Value(_Summary_end_time_min, atoi(end_min));
+    /*
     DisplayValueToLcm(_Summary_Start_time_hr, (uint8_t *)start_hr, sizeof(start_hr));
     DisplayValueToLcm(_Summary_Start_time_min, (uint8_t *)start_min, sizeof(start_min));
     DisplayValueToLcm(_Summary_end_time_hr, (uint8_t *)end_hr, sizeof(end_hr));
     DisplayValueToLcm(_Summary_end_time_min, (uint8_t *)end_min, sizeof(end_min));
+    */
 
     uint8_t min = (pDcChargingInfo->PresentChargedDuration)/60;
+    /*
     sprintf((char *)value,"%d",min);
     DisplayValueToLcm(_Summary_duration_time, (uint8_t *)value, sizeof(value));
+    */
+    ChangeDisplay2Value(_Summary_duration_time, (int)min);
 
     if (pDcChargingInfo->PresentChargedEnergy >= 0.1 &&
             pDcChargingInfo->PresentChargedEnergy <= ENERGY_MAX_KWH) {
-        data = pDcChargingInfo->PresentChargedEnergy;
+        data = pDcChargingInfo->PresentChargedEnergy*10;
     } else
         data = 0;
-    sprintf((char *)value,"%d",data);
-    DisplayValueToLcm(_Summary_cap, (uint8_t *)value, sizeof(value));
-
+    //sprintf((char *)value,"%.1f",data);
+    ChangeDisplay2Value(_Summary_cap, data);
+    //DisplayValueToLcm(_Summary_cap, (uint8_t *)value, sizeof(value));
+    /*
     sprintf((char *)value,"%.1f",discount);
     DisplayValueToLcm(_Summary_cal_discount, (uint8_t *)value, sizeof(value));
     settlement = pDcChargingInfo->ChargingFee - discount;
     sprintf((char *)value,"%.1f",settlement);
     DisplayValueToLcm(_Summary_cal_Settlement, (char *)value, sizeof(value));
-
+   
     if(pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
         sprintf((char *)value,"%.1f",ChargeMaxPower_0);
     } else if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM) {
         sprintf((char *)value,"%.1f",ChargeMaxPower_1);
     }
     DisplayValueToLcm(_Summary_max_power, (uint8_t *)value, sizeof(value));
-    if (pDcChargingInfo->PresentChargedEnergy >= 0.1 &&
-                pDcChargingInfo->PresentChargedEnergy <= ENERGY_MAX_KWH) {
-        data = pDcChargingInfo->PresentChargedEnergy * pDcChargingInfo->PresentChargedDuration /3600;
+     */
+    if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
+        ChangeDisplay2Value(_Summary_max_power, (int)ChargeMaxPower_0);
+    }
+    else if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM) {
+        ChangeDisplay2Value(_Summary_max_power, (int)ChargeMaxPower_1);
+
+    }
+
+    if (pDcChargingInfo->PowerConsumption >= 0.1 ) {
+        data = pDcChargingInfo->PowerConsumption / pDcChargingInfo->PresentChargedDuration;
     } else
         data = 0;
-    sprintf((char *)value,"%.1f",data);
-    DisplayValueToLcm(_Summary_average_power, (uint8_t *)value, sizeof(value));
+    //sprintf((char *)value,"%.1f",data);
+    ChangeDisplay2Value(_Summary_average_power, (int)data);
+    //DisplayValueToLcm(_Summary_average_power, (uint8_t *)value, sizeof(value));
 }
 void ProcessPageInfo()
 {
+    if (pSysWarning->Level == WARN_LV_ER) {
+    	pSysInfo->SystemPage = _LCM_MAINTAIN;
+        if (ShmPrimaryMcuData->InputDet.bits.EmergencyButton)
+            pSysInfo->SystemPage = _LCM_EMERGENCY;
+        return;;
+    }
     switch (pSysInfo->SystemPage) {
     case _LCM_VIEW:
         // Confirm Charging Gun Number.
@@ -694,7 +856,8 @@ void ProcessPageInfo()
     case _LCM_START_AUTHORIZING:
     case _LCM_PRECHARGE:
     case _LCM_STOPPING:
-        ShowProgressBar();
+        //ShowProgressBar();
+        ChangeDisplay2Value(_Animation_Running, 1);
         break;
     case _LCM_START_AUTHORIZE_FAIL:
     case _LCM_STOP_RFID_FAIL:
@@ -706,27 +869,39 @@ void ProcessPageInfo()
         ShowSummaryPage();
         break;
     case _LCM_ERROR:
+        break;
     case _LCM_MAINTAIN:
+    	break;
     case _LCM_WAIT_PLUGIN:
     case _LCM_WAIT_PLUGOUT:
+    	ShowSelectGunIcon();
         break;
     case _LCM_EMERGENCY:
         break;
+    case _LCM_COMMUNICATION:
+        ChangeDisplay2Value(_Animation_Communcation, 1);
+        break;
+    case _LCM_CHARGING_DETECT:
+        ChangeDisplay2Value(_Animation_GFD, 1);
+        break;
+    case _LCM_PREPARECHARE:
+        ChangeDisplay2Value(_Animation_Precharge, 1);
+        break;
     }
 }
 
 void DemoFunction()
 {
-    int i,j;
+    int i;
     uint8_t value[10];
     struct timeb  SeqEndTime;
     struct tm *tm;
     switch (pSysInfo->PageIndex) {
         case __VIEW_ALL_IDLE_:
             memset(value, 0x00, sizeof(value));
-            sprintf((char *)value,"1A");
+            sprintf((char *)value,"1 A");
             DisplayValueToLcm(_LeftGun_location, (uint8_t *)value, sizeof(value));
-            sprintf((char *)value,"1B");
+            sprintf((char *)value,"1 B");
             DisplayValueToLcm(_RightGun_location, (uint8_t *)value, sizeof(value));
             sleep(1);
 
@@ -781,13 +956,12 @@ void DemoFunction()
                 usleep(100000);
             }
             break;
-        case __START_SCAN_:
         case 7:
         case 9:
             break;
         case 11:
             for(i = 0 ; i <= 100 ; i++) {
-                RefreshProgressAnimation(_ICON_ProgressBar_10+((i/10)*2));
+               // RefreshProgressAnimation(_ICON_ProgressBar_10+((i/10)*2));
                 uint8_t digits = i % 10;
                 uint8_t tens = (i / 10) %10;
                 uint8_t hundreds = i / 100;
@@ -807,17 +981,17 @@ void DemoFunction()
                     ChangeDisplay2Value(_Confirm_Gun_Right_symbol,_ICON_Empty);
                     memset(value, 0x00, sizeof(value));
                     DisplayValueToLcm(_Confirm_Gun_Right_name, (uint8_t *)value, sizeof(value));
-                    sprintf((char *)value,"1A");
+                    sprintf((char *)value,"1 A");
                     DisplayValueToLcm(_Confirm_Gun_Left_name, (uint8_t *)value, sizeof(value));
                 } else {
                     ChangeDisplay2Value(_Confirm_Gun_Left_symbol,_ICON_Empty);
                     ChangeDisplay2Value(_Confirm_Gun_Right_symbol,_ICON_CCS2_Symbol);
                     memset(value, 0x00, sizeof(value));
                     DisplayValueToLcm(_Confirm_Gun_Left_name, (uint8_t *)value, sizeof(value));
-                    sprintf((char *)value,"1B");
+                    sprintf((char *)value,"1 B");
                     DisplayValueToLcm(_Confirm_Gun_Right_name, (uint8_t *)value, sizeof(value));
                 }
-                usleep(200000);
+                usleep(100000);
             }
             break;
         case 12:
@@ -840,12 +1014,12 @@ void DemoFunction()
         case __PRE_CHARGE_:
         case __STOP_AUTHORIZE_:
             for( i = 0 ; i <= 20 ; i++) {
-                RefreshProgressAnimation(_ICON_ProgressBar_10);
-                usleep(200000);
+                //RefreshProgressAnimation(_ICON_ProgressBar_10);
+                usleep(100000);
             }
             for( i = 0 ; i <= 20 ; i++) {
-                RefreshProgressAnimation(_ICON_ProgressBar_20);
-                usleep(200000);
+                //RefreshProgressAnimation(_ICON_ProgressBar_20);
+                usleep(100000);
             }
             break;
         case 8:
@@ -855,6 +1029,7 @@ void DemoFunction()
         case 20:
             break;
         case 21:
+            ShowCabientVersion();
             break;
         case 22:
             ShowDispenserVersion();
@@ -883,30 +1058,16 @@ void ShowCabientVersionDefaultText()
     DisplayValueToLcm(_Version_Cabient_Fan_Text, (uint8_t *)value, sizeof(value));
     sprintf((char *)value,"%s","IP Addr:");
     DisplayValueToLcm(_Version_Cabient_IPAddr_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Prim(1):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Prim1_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Prim(2):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Prim2_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Prim(3):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Prim3_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Prim(4):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Prim4_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Prim(5):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Prim5_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Prim(6):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Prim6_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Sec(1):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Sec1_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Sec(2):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Sec2_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Sec(3):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Sec3_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Sec(4):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Sec4_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Sec(5):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Sec5_Text, (uint8_t *)value, sizeof(value));
-    sprintf((char *)value,"%s","PSU Sec(6):");
-    DisplayValueToLcm(_Version_Cabient_PSU_Sec6_Text, (uint8_t *)value, sizeof(value));
+    if (ShmDcCommonData->PSU_Number > 0 && ShmDcCommonData->PSU_Number <= 12) {
+        sprintf((char *)value,"%s","Primary");
+        DisplayValueToLcm(_Version_Cabient_Primary_Text, (uint8_t *)value, sizeof(value));
+        sprintf((char *)value,"%s","Secondary");
+        DisplayValueToLcm(_Version_Cabient_Secondary_Text, (uint8_t *)value, sizeof(value));
+        for(uint8_t i = 0 ; i < ShmDcCommonData->PSU_Number ; i++) {
+            sprintf((char *)value,"PSU(%d):",i+1);
+            DisplayValueToLcm(_Version_Cabient_PSU1_Text+i*0x10, (uint8_t *)value, sizeof(value));
+        }
+    }
 }
 void ShowDispenserVersionDefautlText()
 {
@@ -939,7 +1100,41 @@ void ShowDispenserVersionDefautlText()
 }
 void ShowCabientVersion()
 {
-
+    char value[16];
+    memset(value, 0x00, sizeof(value));
+    sprintf((char *)value,"%s",ShmDcCommonData->CabinetModelName);
+    DisplayValueToLcm(_Version_Cabient_Model_value, (uint8_t *)value, sizeof(value));
+    sprintf((char *)value,"%s",ShmDcCommonData->CabinetBoolLoaderVersion);
+    DisplayValueToLcm(_Version_Cabient_BootLoader_value, (uint8_t *)value, sizeof(value));
+    sprintf((char *)value,"%s",ShmDcCommonData->CabinetKernelVersion);
+    DisplayValueToLcm(_Version_Cabient_Kernel_value, (uint8_t *)value, sizeof(value));
+    sprintf((char *)value,"%s",ShmDcCommonData->CabinetRFSystemVersion);
+    DisplayValueToLcm(_Version_Cabient_CSU_value, (uint8_t *)value, sizeof(value));
+    sprintf((char *)value,"%s",ShmDcCommonData->CabinetPrimaryVersion);
+    DisplayValueToLcm(_Version_Cabient_Priamry_value, (uint8_t *)value, sizeof(value));
+    sprintf((char *)value,"%s",ShmDcCommonData->CabinetRelay0Version);
+    DisplayValueToLcm(_Version_Cabient_Relay0_value, (uint8_t *)value, sizeof(value));
+    sprintf((char *)value,"%s",ShmDcCommonData->CabinetRelay1Version);
+    DisplayValueToLcm(_Version_Cabient_Relay1_value, (uint8_t *)value, sizeof(value));
+    sprintf((char *)value,"%s",ShmDcCommonData->CabinetFanVersion);
+    DisplayValueToLcm(_Version_Cabient_Fan_value, (uint8_t *)value, sizeof(value));
+    sprintf((char *)value,"%s",ShmDcCommonData->CabinetIPAddr);
+    DisplayValueToLcm(_Version_Cabient_IPAddr_value, (uint8_t *)value, sizeof(value));
+    if (ShmDcCommonData->PSU_Number > 0 && ShmDcCommonData->PSU_Number < 12) {
+        for(uint8_t i = 0 ; i < ShmDcCommonData->PSU_Number ; i++) {
+            if (i>=6) {
+                sprintf((char *)value,"%s",ShmDcCommonData->PsuVer[(i-6)].DCVersion);
+                DisplayValueToLcm(_Version_Cabient_PSU_Prim7_value+(i-6)*0x10, (uint8_t *)value, sizeof(value));
+                sprintf((char *)value,"%s",ShmDcCommonData->PsuVer[(i-6)].FPCVersion);
+                DisplayValueToLcm(_Version_Cabient_PSU_Sec7_value+(i-6)*0x10, (uint8_t *)value, sizeof(value));
+                continue;
+            }
+            sprintf((char *)value,"%s",ShmDcCommonData->PsuVer[i].DCVersion);
+            DisplayValueToLcm(_Version_Cabient_PSU_Prim1_value+i*0x10, (uint8_t *)value, sizeof(value));
+            sprintf((char *)value,"%s",ShmDcCommonData->PsuVer[i].FPCVersion);
+            DisplayValueToLcm(_Version_Cabient_PSU_Sec1_value+i*0x10, (uint8_t *)value, sizeof(value));
+        }
+    }
 }
 void ShowDispenserVersion()
 {
@@ -997,22 +1192,21 @@ int main(void)
     ShmFanModuleData = (struct FanModuleData *)GetShmFanModuleData();;
     ShmPrimaryMcuData = (struct PrimaryMcuData *)GetShmPrimaryMcuData();
     ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
+    ShmDcCommonData = (DcCommonInfo *)GetShmDcCommonData();
     struct StatusCodeData *ShmStatusCodeData = (struct StatusCodeData *)GetShmStatusCodeData();;
     struct ChargingInfoData *pDcChargingInfo_0 = (struct ChargingInfoData *)GetDcChargingInfoData(LEFT_GUN_NUM);
     struct ChargingInfoData *pDcChargingInfo_1 = (struct ChargingInfoData *)GetDcChargingInfoData(RIGHT_GUN_NUM);
     _port = CreateCommunicationLcmPort();
-    uint8_t changeWarningPriority = 0;
-    uint8_t curWarningCount = 255;
     ChangeBackLight(true);
     _totalCount = pSysConfig->TotalConnectorCount;
     _everyPageRollChange = 0;
     //Initialization();
-
+    system("export TZ=CST-8");
     //printf("_LCM_COMPLETE ");
     //ChangeToOtherPage(_LCM_COMPLETE);
     //return 0;
-    //uint8_t index = 5;
-
+    //uint8_t index = 21;
+    ShmDcCommonData->PSU_Number = 12;
     while (_port != -1) {
         if (strcmp((char *)pSysInfo->LcmHwRev, moduleName) != 0x00) {
             GetCurrentPage();
@@ -1029,7 +1223,7 @@ int main(void)
                 defaulttext = true;
             }
             ShmStatusCodeData->AlarmCode.AlarmEvents.bits.LcmModuleCommFail = false;
-            //pSysInfo->PageIndex = index;
+
 
             if(pSysConfig->TotalConnectorCount>=2) {
                 if (pDcChargingInfo_0->SystemStatus == S_IDLE) {
@@ -1056,7 +1250,7 @@ int main(void)
 
             // 換頁處理
             //GetCurrentPage(); //DS60-120 add
-
+            /*
             if (pSysConfig->ShowInformation == YES && pSysInfo->SystemPage == _LCM_VIEW) {
                 InformationShow();
                 ChangeToOtherPage(pSysInfo->PageIndex);
@@ -1067,18 +1261,20 @@ int main(void)
                     _showInformIndex >= 1 ? _showInformIndex = 0 : _showInformIndex++;
                 is_show = false;
             }
-            //GetCurrentPage(); //DS60-120 add
-            //ChangeCurPage();
+            */
+            GetCurrentPage(); //DS60-120 add
+            ChangeCurPage();
 
             /*
+            pSysInfo->PageIndex = index;
             GetCurrentPage();
             ChangeToOtherPage(index);
             GetCurrentPage();
             DemoFunction();
-            index >= 22 ? index = 1 : index++;
+            index >= 22 ? index = 21 : index++;
             */
             //usleep(100000);
-            usleep(100000);
+            usleep(1000000);
 
         }
     } //while

+ 115 - 20
EVSE/Projects/DD360UCar/Apps/ModuleLcmCtrl/Module_LcmControl.h

@@ -28,24 +28,36 @@
 #define __VIEW_LEFT_CHARGE_     0x0002
 #define __VIEW_RIGHT_CHARGE_    0x0003
 #define __VIEW_ALL_CHARGE_      0x0004
-#define __START_SCAN_           0x0005
+#define __START_SCAN_LEFT           0x0005
 #define __START_AUTHORIZE_      0x0006
-#define __START_AUTHORIZE_FAIL_ 0x0007
+#define __START_AUTHORIZE_FAIL_LEFT 0x0007
 #define __WAIT_PLUGIN_          0x0008
-#define __LINKING_ERROR_        0x0009
+#define __LINKING_ERROR_LEFT    0x0009
 #define __PRE_CHARGE_           0x000A
 #define __DETAIL_VIEW_          0x000B
 #define __STOP_SCAN_RFID_       0x000C
 #define __STOP_SCAN_APP_        0x000D
 #define __STOP_AUTHORIZE_       0x000E
 #define __STOP_RFID_FAIL_       0x000F
-#define __WAIT_PLUGOUT_         0x0010
-#define __SUMMARY_              0x0011
+#define __WAIT_PLUGOUT_LEFT         0x0010
+#define __SUMMARY_LEFT              0x0011
 #define __EMERGENCY_BUTTON_     0x0012
 #define __MAINTAIN_PAGE_        0x0013
-#define __ERROR_PAGE_           0x0014
+#define __ERROR_PAGE_LEFT           0x0014
 #define __SHOW_CABIENT_VERSION  0x0015
 #define __SHOW_DISPENSER_VERASION 0x0016
+#define __LINKING_ERROR_RIGHT   0x0017
+#define __START_AUTHORIZE_FAIL_RIGHT 0x0018
+#define __CONFIRM_STOP_LEFT     0x0019
+#define __CONFIRM_STOP_RIGHT    0x001A
+#define __WAIT_PLUGOUT_RIGHT    0x001B
+#define __SUMMARY_RIGHT         0x001C
+#define __ERROR_PAGE_RIGHT      0x001D
+#define __WAIT_PLUGIN_RIGHT     0x001E
+#define __START_SCAN_RIGHT      0x001F
+#define __COMMUNICATION_PROCESS        0x0020
+#define __GFD_PROCESS           0x0021
+#define __PRECHARGE_PROCESS     0x0022
 
 // ICON Map Address
 #define _LeftGun_type_pic_U         0x0001
@@ -68,7 +80,12 @@
 #define _Percent_Number_Digits      0x0031
 #define _Percent_Number_Tens        0x0033
 #define _Percent_Number_Hundreds    0x0035
-
+#define _Animation_Communcation     0x0037
+#define _Animation_GFD              0x0039
+#define _Animation_Precharge        0x003B
+#define _Animation_Running          0x003D
+#define _LeftGun_ConnectorId        0x003F
+#define _RightGun_ConnectorId       0x0041
 // String Map Address
 #define _LeftGun_location           0x0100
 #define _LeftGun_info_power         0x0110
@@ -142,7 +159,9 @@ enum _ICON_LIST_ {
     _ICON_Card_Time,
     _ICON_Card_Cap,
     _ICON_Card_Money,
-
+    _ICON_CONNECTOR_1,
+    _ICON_CONNECTOR_2,
+    /*
     _ICON_ProgressBar_10 = 60,
     _ICON_ProgressBar_10_cantrary,
     _ICON_ProgressBar_20,
@@ -162,6 +181,63 @@ enum _ICON_LIST_ {
     _ICON_ProgressBar_90,
     _ICON_ProgressBar_90_cantrary,
     _ICON_ProgressBar_100,
+    */
+    _ICON_CUR_POWER = 79,
+    _ICON_STRING_KW,
+    _ICON_SPIN_0,
+    _ICON_SPIN_1,
+    _ICON_SPIN_2,
+    _ICON_SPIN_3,
+    _ICON_SPIN_4,
+    _ICON_SPIN_5,
+    _ICON_SPIN_6,
+    _ICON_SPIN_7,
+    _ICON_BTY_10 = 110,
+    _ICON_BTY_12 = 112,
+    _ICON_BTY_14 = 114,
+    _ICON_BTY_16 = 116,
+    _ICON_BTY_18 = 118,
+    _ICON_BTY_20 = 120,
+    _ICON_BTY_22 = 122,
+    _ICON_BTY_24 = 124,
+    _ICON_BTY_26 = 126,
+    _ICON_BTY_28 = 128,
+    _ICON_BTY_30 = 130,
+    _ICON_BTY_32 = 132,
+    _ICON_BTY_34 = 134,
+    _ICON_BTY_36 = 136,
+    _ICON_BTY_38 = 138,
+    _ICON_BTY_40 = 140,
+    _ICON_BTY_42 = 142,
+    _ICON_BTY_44 = 144,
+    _ICON_BTY_46 = 146,
+    _ICON_BTY_48 = 148,
+    _ICON_BTY_50 = 150,
+    _ICON_BTY_52 = 152,
+    _ICON_BTY_54 = 154,
+    _ICON_BTY_56 = 156,
+    _ICON_BTY_58 = 158,
+    _ICON_BTY_60 = 160,
+    _ICON_BTY_62 = 162,
+    _ICON_BTY_64 = 164,
+    _ICON_BTY_66 = 166,
+    _ICON_BTY_68 = 168,
+    _ICON_BTY_70 = 170,
+    _ICON_BTY_72 = 172,
+    _ICON_BTY_74 = 174,
+    _ICON_BTY_76 = 176,
+    _ICON_BTY_78 = 178,
+    _ICON_BTY_80 = 180,
+    _ICON_BTY_82 = 182,
+    _ICON_BTY_84 = 184,
+    _ICON_BTY_86 = 186,
+    _ICON_BTY_88 = 188,
+    _ICON_BTY_90 = 190,
+    _ICON_BTY_92 = 192,
+    _ICON_BTY_94 = 194,
+    _ICON_BTY_96 = 196,
+    _ICON_BTY_98 = 198,
+    _ICON_BTY_100 = 200,
 };
 
 
@@ -175,18 +251,22 @@ enum _ICON_LIST_ {
 #define _Version_Cabient_Relay1_Text        0x0560
 #define _Version_Cabient_Fan_Text           0x0570
 #define _Version_Cabient_IPAddr_Text        0x0580
-#define _Version_Cabient_PSU_Prim1_Text     0x0590
-#define _Version_Cabient_PSU_Prim2_Text     0x05A0
-#define _Version_Cabient_PSU_Prim3_Text     0x05B0
-#define _Version_Cabient_PSU_Prim4_Text     0x05C0
-#define _Version_Cabient_PSU_Prim5_Text     0x05D0
-#define _Version_Cabient_PSU_Prim6_Text     0x05E0
-#define _Version_Cabient_PSU_Sec1_Text      0x05F0
-#define _Version_Cabient_PSU_Sec2_Text      0x0600
-#define _Version_Cabient_PSU_Sec3_Text      0x0610
-#define _Version_Cabient_PSU_Sec4_Text      0x0620
-#define _Version_Cabient_PSU_Sec5_Text      0x0630
-#define _Version_Cabient_PSU_Sec6_Text      0x0640
+#define _Version_Cabient_PSU1_Text          0x0590
+#define _Version_Cabient_PSU2_Text          0x05A0
+#define _Version_Cabient_PSU3_Text          0x05B0
+#define _Version_Cabient_PSU4_Text          0x05C0
+#define _Version_Cabient_PSU5_Text          0x05D0
+#define _Version_Cabient_PSU6_Text          0x05E0
+#define _Version_Cabient_PSU7_Text          0x05F0
+#define _Version_Cabient_PSU8_Text          0x0600
+#define _Version_Cabient_PSU9_Text          0x0610
+#define _Version_Cabient_PSU10_Text         0x0620
+#define _Version_Cabient_PSU11_Text         0x0630
+#define _Version_Cabient_PSU12_Text         0x0640
+
+#define _Version_Cabient_Primary_Text       0x0920
+#define _Version_Cabient_Secondary_Text     0x0930
+
 #define _Version_Cabient_Model_value        0x0650
 #define _Version_Cabient_BootLoader_value   0x0660
 #define _Version_Cabient_Kernel_value       0x0670
@@ -208,6 +288,20 @@ enum _ICON_LIST_ {
 #define _Version_Cabient_PSU_Sec4_value     0x0770
 #define _Version_Cabient_PSU_Sec5_value     0x0780
 #define _Version_Cabient_PSU_Sec6_value     0x0790
+
+#define _Version_Cabient_PSU_Prim7_value    0x09E0
+#define _Version_Cabient_PSU_Prim8_value    0x09F0
+#define _Version_Cabient_PSU_Prim9_value    0x1000
+#define _Version_Cabient_PSU_Prim10_value   0x1010
+#define _Version_Cabient_PSU_Prim11_value   0x1020
+#define _Version_Cabient_PSU_Prim12_value   0x1030
+#define _Version_Cabient_PSU_Sec7_value     0x1040
+#define _Version_Cabient_PSU_Sec8_value     0x1050
+#define _Version_Cabient_PSU_Sec9_value     0x1060
+#define _Version_Cabient_PSU_Sec10_value    0x1070
+#define _Version_Cabient_PSU_Sec11_value    0x1080
+#define _Version_Cabient_PSU_Sec12_value    0x1090
+
 #define _Version_Dispenser_Name_Text        0x07A0
 #define _Version_Dispenser_BootLoader_Text  0x07B0
 #define _Version_Dispenser_Kernel_Text      0x07C0
@@ -220,6 +314,7 @@ enum _ICON_LIST_ {
 #define _Version_Dispenser_Connector0_Text  0x0830
 #define _Version_Dispenser_Connector1_Text  0x0840
 #define _Version_Dispenser_IPAddr_Text      0x0850
+
 #define _Version_Dispenser_Model_value      0x0860
 #define _Version_Dispenser_BootLoader_value 0x0870
 #define _Version_Dispenser_Kernel_value     0x0880

+ 8 - 6
EVSE/Projects/DD360UCar/Apps/ModulePrimary/Module_PrimaryComm.c

@@ -208,7 +208,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;
@@ -463,6 +463,12 @@ int main(void)
     for (;;) {
         // 程序開始之前~ 必須先確定 FW 版本與硬體版本,確認後!!~ 該模組才算是真正的 Initial Comp.
         // 模組更新 FW 後,需重新做
+        if(IsPrimaryProcessNeedPause() == true)
+        {
+            sleep(1);
+            continue;
+        }
+
         if (ShmPrimaryMcuData->SelfTest_Comp != PASS) {
             //log_info("(407) Get Fw and Hw Ver. ");
             GetFwAndHwVersion(Uart1Fd);
@@ -473,11 +479,7 @@ int main(void)
 
             GetInputGpioStatus(Uart1Fd);
         }
-        if(IsPrimaryProcessNeedPause() == true)
-        {
-            sleep(1);
-            continue;
-        }
+
 
         usleep(50000);
     }

+ 2 - 0
EVSE/Projects/DD360UCar/Apps/SelectGun/SelectGun.h

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

BIN
EVSE/Projects/DD360UCar/Images/FactoryDefaultConfig.bin


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


BIN
EVSE/Projects/DD360UCar/output/FactoryConfig


BIN
EVSE/Projects/DD360UCar/output/Module_ChkSysTask


BIN
EVSE/Projects/DD360UCar/output/Module_DoComm


BIN
EVSE/Projects/DD360UCar/output/Module_EvComm


BIN
EVSE/Projects/DD360UCar/output/Module_EventLogging


BIN
EVSE/Projects/DD360UCar/output/Module_InternalComm


BIN
EVSE/Projects/DD360UCar/output/Module_LcmControl


BIN
EVSE/Projects/DD360UCar/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360UCar/output/Module_UpdateFW


BIN
EVSE/Projects/DD360UCar/output/ReadCmdline


+ 10 - 0
EVSE/Projects/DD360UCar/output/SearchIP.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+# 用 arping 來 ping 區域網路中所有的 IP 位址
+echo $0;
+
+for ip in "$1".{1..254}; do
+  arping -I "$0" -w 3 -f $ip | grep reply &;
+done
+
+# 等待所有背景的 arping 結束
+wait;

BIN
EVSE/Projects/DD360UCar/output/UnsafetyOutputTask


+ 15 - 0
EVSE/Projects/DD360UCar/output/init.sh

@@ -0,0 +1,15 @@
+chmod 777 Module_CSU
+chmod 777 Module_PrimaryComm
+chmod 777 Module_LcmControl
+chmod 777 Module_InternalComm
+chmod 777 Module_EventLogging
+chmod 777 Module_EvComm
+chmod 777 Module_PsuComm
+chmod 777 Module_UpdateFW
+chmod 777 Module_ChkSysTask
+chmod 777 OcppBackend
+chmod 777 kill.sh
+chmod 777 ReadCmdline
+chmod 777 Module_DoComm
+chmod 777 SearchIP.sh
+chmod 777 FactoryConfig

+ 47 - 0
EVSE/Projects/DD360UCar/output/kill.sh

@@ -0,0 +1,47 @@
+pkill Module_CSU;
+pkill Module_PrimaryComm;
+pkill Module_LcmControl;
+pkill Module_InternalComm;
+pkill Module_EventLogging;
+pkill Module_EvComm;
+pkill Module_PsuComm;
+pkill Module_UpdateFW;
+pkill Module_ChkSysTask;
+pkill Module_4g;
+pkill Module_Wifi;
+pkill OcppBackend;
+pkill Module_ProduceUtils;
+pkill Module_DoComm;
+pkill main;
+
+/usr/bin/fuser -k /dev/watchdog
+sleep 1
+
+echo V > /dev/watchdog
+
+ipcrm -M 0x000003e9;
+ipcrm -M 0x000003ed;
+ipcrm -M 0x000003ea;
+ipcrm -M 0x000003ec;
+ipcrm -M 0x000003ee;
+ipcrm -M 0x000003ef;
+ipcrm -M 0x000003f0;
+ipcrm -M 0x000003f3;
+ipcrm -M 0x000003f1;
+ipcrm -M 0x000003f6;
+
+ipcrm -M 0x000003e9;
+ipcrm -M 0x000003ed;
+ipcrm -M 0x000003ea;
+ipcrm -M 0x000003ec;
+ipcrm -M 0x000003ee;
+ipcrm -M 0x000003ef;
+ipcrm -M 0x000003f0;
+ipcrm -M 0x000003f3;
+ipcrm -M 0x000003f1;
+ipcrm -M 0x000003f6;
+ipcrm -M 0x000003eb;
+ipcrm -M 0x000003f2;
+ipcrm -M 0x000007d2;
+
+ipcs;

BIN
EVSE/Projects/DD360UCar/output/main


BIN
EVSE/Projects/DD360UCar/output/simulation


+ 1 - 0
EVSE/Projects/DD360UCar/output/web.sh

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

+ 13 - 6
EVSE/Projects/define.h

@@ -463,7 +463,8 @@ typedef union
         unsigned int ManualStop:1;                  // 0: no effect,    1: manual stop
         unsigned int HardResetStop:1;               // 0: no effect,    1: hard reset stop
         unsigned int SoftResetStop:1;               // 0: no effect,    1: soft reset stop
-        unsigned int res:26;
+        unsigned int InvalidIdStop:1;               // 0: no effect,    1: invalid stop when StopTransactionOnInvalidId is true
+        unsigned int res:25;
     }bits;
 }ChargingStop;
 
@@ -671,6 +672,7 @@ struct ChargingInfoData
     unsigned char       Replug_flag;
     unsigned char       isEVCCIDVerify;
     unsigned char       CCSGunType;
+    struct timeval      PreChargeTimer;
 };
 
 typedef struct
@@ -714,7 +716,8 @@ typedef union
         unsigned int StopButtonStatusRequest:1;         // 0: no request,   1: stop charging button status has changed          ( cabinet -> dispenser)
         unsigned int AuthModeConfigRequest:1;           // 0: no request,   1: AuthMode Config has changed                      ( cabinet -> dispenser)
         unsigned int EVCCIDConfigRequest:1;             // 0: no request,   1: EVCCID Config has changed                        ( cabinet -> dispenser)
-        unsigned int res:8;
+        unsigned int LEDIntensityRequest:1;             // 0: no request,   1: LED Intensity has changed                        ( cabinet -> dispenser)
+        unsigned int res:7;
     }bits;
 }DispenserSettingFlag;
 
@@ -832,7 +835,8 @@ typedef union
         unsigned int  FaultStatusRequest:1;
         unsigned int  Disconnection:1;
         unsigned int  GfdDetection:1;                   // 0: stop,         1: start
-        unsigned int  res:9;
+        unsigned int  GetStartChargingSoc:1;            // 0: no effect,    1: get start soc
+        unsigned int  res:8;
     }bits;
 }ConnectorParameter;
 
@@ -863,8 +867,11 @@ struct ConnectorInfoData
 
     unsigned short          MaxTotalChargingCurrent;        // max total output current, unit: 0.1A
     unsigned short          MaxTotalChargingPower;          // max total output power, unit: 0.1kw
-    unsigned short          MaxOutputEnergy;                //0: no limit,  1 ~ 65535   kWh
-    unsigned short          MaxOutputDuration;              //0: no limit,  1 ~ 65535   minutes
+    unsigned short          MaxOutputEnergy;                // 0: no limit,  1 ~ 65535   kWh
+    unsigned short          MaxOutputDuration;              // 0: no limit,  1 ~ 65535   minutes
+    float                   CapabilityVoltage;              // unit 0.1V
+    float                   CapabilityCurrent;              // unit 0.1A
+    float                   CapabilityPower;                // unit 0.1kW
 
     unsigned int            UserPrice;                      // connector user's user price, unit: 0.01 (dollar / kWh)
     unsigned int            TotalCost;                      // connector user's total cost, unit: 0.01 dollar
@@ -1507,7 +1514,7 @@ struct AlarmCodeData
             unsigned char DcInputOVP:1;                             //bit 7
             //AlarmVal[16]
             unsigned char DcInputUVP:1;                             //bit 0
-            unsigned char :7;                                       //reserved bit 0 ~ bit 7
+            unsigned char :7;                                       //reserved bit 1 ~ bit 7
             //AlarmVal[17]
             unsigned char :8;                                       //reserved bit 0 ~ bit 7
             //AlarmVal[18]

+ 1 - 1
build_rootfs_copy.sh

@@ -9,5 +9,5 @@ rm /mnt/e/Temp/IMAGE/*
 #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/e/Image/DD360UCar/
+cp /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects/DD360UCar/Images/* /mnt/d/Image/DD360UCar/