Explorar o código

2022-01-14 / Simon Xue

Simon Xue %!s(int64=3) %!d(string=hai) anos
pai
achega
d9c6f695df

+ 7 - 1
EVSE/Projects/DD360Tcci/Apps/CSU/main.c

@@ -4173,7 +4173,8 @@ CheckStatus:
                     log_info("============================= S_REASSIGN_CHECK(%x) ============================= ", gunIndex);
                     if (pSysInfo->OrderCharging != NO_DEFINE) {
                         pSysInfo->OrderCharging = NO_DEFINE;
-                        pDcChargingInfo->_SaftyDetect = false;
+                        pDcChargingInfo->_SaftyDetect = FALSE;
+                        pDcChargingInfo->Replug_flag = TRUE;
                     }
                     StopSystemTimeoutDet();
                     gettimeofday(&pDcChargingInfo->PreChargeTimer, NULL);
@@ -4331,6 +4332,7 @@ CheckStatus:
                     ftime(&startChargingTime[gunIndex]);
                     strcpy((char *)ShmOCPP16Data->StartTransaction[gunIndex].ResponseIdTagInfo.Status, ""); //DS60-120 add
                     ChangeStartOrStopDateTime(YES, gunIndex);
+                    pDcChargingInfo->Replug_flag = FALSE;
                 }
 
                 if (ShmOCPP16Data->CpMsg.bits[gunIndex].StartTransactionConf) {
@@ -4372,7 +4374,11 @@ CheckStatus:
                         pSysInfo->SystemPage = _PAGE_ERROR;
                     continue;
                 }
+                if (pDcChargingInfo->Replug_flag == TRUE) {
+                	setChargerMode(gunIndex, MODE_IDLE);
+                }
                 if (pDcChargingInfo->ConnectorPlugIn == NO ) {
+                	pSysInfo->SystemPage = _PAGE_PLUGOUT;
                     StartGunInfoTimeoutDet(gunIndex, Timeout_PlugOutGun);
                 }
                 if (pSysInfo->CurGunSelected == gunIndex) {

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

@@ -166,6 +166,7 @@ enum _PAGE_TCC_INDEX {
     _PAGE_PAY_FAIL,
     _PAGE_MAINTAIN,
     _PAGE_ERROR,
+	_PAGE_PLUGOUT,
 
     __SHOW_CABIENT_VERSION,
     __SHOW_DISPENSER_VERASION,

+ 31 - 58
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -45,6 +45,9 @@ bool is_show = false;
 uint8_t _everyPageRollChange;
 uint8_t _btn_press = 0;
 short _btn_press_id = 0;
+struct timeval returnIdleTimer;
+int _Text_Running_Count = 0;
+int Battery_Test = 0;
 extern void UpdateLcmFunction(DcCommonInfo *ShmDcCommonData,int _lcmport);
 //==========================================
 // Open and Close RS232 and R/W
@@ -157,6 +160,7 @@ void CheckTouchPress(short id)
                     pSysInfo->SystemPage != _PAGE_PAY_MPAY_SUCCESS) ) {
                     log_info("Reset LCM to IDLE");
                     pSysInfo->SystemPage = _PAGE_AUTHORIZE;
+                    gettimeofday(&returnIdleTimer, NULL);
                 }
 
             }
@@ -174,6 +178,7 @@ void CheckTouchPress(short id)
                     pSysInfo->SystemPage != _PAGE_PAY_MPAY_SUCCESS) ) {
                     log_info("Reset LCM to IDLE");
                     pSysInfo->SystemPage = _PAGE_AUTHORIZE;
+                    gettimeofday(&returnIdleTimer, NULL);
                 }
             }
             pSysInfo->CurGunSelected = RIGHT_GUN_NUM;
@@ -247,10 +252,12 @@ void CheckLCMPressed()
 // ********************** Test *******************
 ///*
             case _PAGE_PRECHARGE:
+            	/*
                 if ((i/100) %2 == 0)
-                    ChangeDisplay2Value(0x1080,i%100);
+                    ChangeDisplay2Value(0x109A,i%100);
                 else
-                    ChangeDisplay2Value(0x1080,100-(i%100));
+                    ChangeDisplay2Value(0x109A,100-(i%100));
+                    */
                 break;
             case _PAGE_CHARGING:
                 pDcChargingInfo->PresentChargingVoltage = i;
@@ -273,15 +280,14 @@ void CheckLCMPressed()
             ///*
             i++;
             if (i == 600 ) {
-                index >= 6 ? index = 1 : index++;
-                pSysInfo->SystemPage = index;
+                index >= 22 ? index = 1 : index++;
+                pSysInfo->SystemPage = 22;
                 i = 0;
+                /*
                 if (pSysInfo->SystemPage == _PAGE_PRECHARGE)
                     gettimeofday(&pDcChargingInfo->PreChargeTimer, NULL);
-                pSysWarning->WarningCount = 3;
-                memcpy(&pSysWarning->WarningCode[0][0],"111111",7);
-                memcpy(&pSysWarning->WarningCode[1][0],"222222",7);
-                memcpy(&pSysWarning->WarningCode[2][0],"333333",7);
+                    */
+
 
             }//*/
 
@@ -540,6 +546,7 @@ void ChangeCurPage()
     if (_currentPage != pSysInfo->PageIndex) {
         switch (pSysInfo->SystemPage) {
         case _PAGE_AUTHORIZE:
+			gettimeofday(&returnIdleTimer, NULL);
             break;
         case _PAGE_PLUGIN:
             break;
@@ -551,7 +558,6 @@ void ChangeCurPage()
             break;
         }
         _currentPage = pSysInfo->PageIndex;
-
         ChangeToOtherPage(pSysInfo->PageIndex);
     }
 }
@@ -864,58 +870,21 @@ void ProcessPageInfo()
             switch (pSysInfo->SystemPage) {
             case _PAGE_AUTHORIZE:
                 ShowHomePage();
+                log_info("Time:%d",GetTimeoutValue(returnIdleTimer) /uSEC_VAL);
+                if (GetTimeoutValue(returnIdleTimer) /uSEC_VAL >= RETURNIDLE_Timeout ) {
+                    pSysInfo->SystemPage = _PAGE_IDLE;
+                    gettimeofday(&returnIdleTimer, NULL);
+                }
                 break;
             case _PAGE_PLUGIN:
+            	_Text_Running_Count = 0;
                 break;
             case _PAGE_PRECHARGE:
-                precharg_time = (GetPreChargeTimeoutValue(pDcChargingInfo->PreChargeTimer)/1) / uSEC_VAL;
-                if (precharg_time > PRECHARGING_TTIMEOUT)
-                    precharg_time = PRECHARGING_TTIMEOUT;
-                ChangeTimeValue(PRECHARGING_TTIMEOUT- precharg_time);
-
-                if (pDcChargingInfo->SystemStatus >= S_REASSIGN_CHECK &&
-                        pDcChargingInfo->SystemStatus <= S_PREPARING_FOR_EV) {
-                    ChangeDisplay2Value(_Communication_Status, _ICON_Communication_on);
-                    ChangeDisplay2Value(_SaftyDetect_Status, _ICON_SaftyDetect_off);
-                    ChangeDisplay2Value(_PreCharge_Status, _ICON_PrepareCharge_off);
-                } else if (pDcChargingInfo->SystemStatus == S_PREPARING_FOR_EVSE) {
-                    // Detect GFD finish and into precharge mode
-                    if (pDcChargingInfo->Type == _Type_Chademo || pDcChargingInfo->Type == _Type_GB) {
-                        if (pDcChargingInfo->_SaftyDetect == FALSE ) {
-                            ChangeDisplay2Value(_Communication_Status, _ICON_Communication_off);
-                            ChangeDisplay2Value(_SaftyDetect_Status, _ICON_SaftyDetect_on);
-                            ChangeDisplay2Value(_PreCharge_Status, _ICON_PrepareCharge_off);
-                            if (pDcChargingInfo->EvBatterytargetVoltage == 0)
-                                pDcChargingInfo->_SaftyDetect = TRUE;
-                        } else {
-                            ChangeDisplay2Value(_Communication_Status, _ICON_Communication_off);
-                            ChangeDisplay2Value(_SaftyDetect_Status, _ICON_SaftyDetect_off);
-                            ChangeDisplay2Value(_PreCharge_Status, _ICON_PrepareCharge_on);
-                        }
-                    } else {
-                        ChangeDisplay2Value(_Communication_Status, _ICON_Communication_off);
-                        ChangeDisplay2Value(_SaftyDetect_Status, _ICON_SaftyDetect_on);
-                        ChangeDisplay2Value(_PreCharge_Status, _ICON_PrepareCharge_off);
-                    }
-                } else if (pDcChargingInfo->SystemStatus == S_CCS_PRECHARGE_ST0 ||
-                        pDcChargingInfo->SystemStatus == S_CCS_PRECHARGE_ST1) {
-                    if (pDcChargingInfo->_SaftyDetect == FALSE ) {
-                        ChangeDisplay2Value(_Communication_Status, _ICON_Communication_off);
-                        ChangeDisplay2Value(_SaftyDetect_Status, _ICON_SaftyDetect_on);
-                        ChangeDisplay2Value(_PreCharge_Status, _ICON_PrepareCharge_off);
-                        if (pDcChargingInfo->EvBatterytargetVoltage == 0)
-                            pDcChargingInfo->_SaftyDetect = TRUE;
-                    } else {
-                        ChangeDisplay2Value(_Communication_Status, _ICON_Communication_off);
-                        ChangeDisplay2Value(_SaftyDetect_Status, _ICON_SaftyDetect_off);
-                        ChangeDisplay2Value(_PreCharge_Status, _ICON_PrepareCharge_on);
-                    }
-                } else {
-                    ChangeDisplay2Value(_Communication_Status, _ICON_Empty);
-                    ChangeDisplay2Value(_SaftyDetect_Status, _ICON_Empty);
-                    ChangeDisplay2Value(_PreCharge_Status, _ICON_Empty);
-                }
-
+                if ((_Text_Running_Count/100) %2 == 0)
+                    ChangeDisplay2Value(_Text_PrepareToCharge,_Text_Running_Count%100);
+                else
+                    ChangeDisplay2Value(_Text_PrepareToCharge,100-(_Text_Running_Count%100));
+                _Text_Running_Count >= 200 ? _Text_Running_Count = 0 : _Text_Running_Count++;
                 break;
             case _PAGE_CHARGING:
                 if (pDcChargingInfo->PresentChargingVoltage >= 0 &&
@@ -964,6 +933,10 @@ void ProcessPageInfo()
                 break;
             case _PAGE_REFUND_SENSEING:
                 break;
+            case _PAGE_PLUGOUT:
+            	ChangeDisplay2Value(0x20B0, Battery_Test);
+            	Battery_Test >= 100 ? Battery_Test = 0 : Battery_Test++;
+            	break;
             }
         }
     }
@@ -979,7 +952,7 @@ void ChangeWarningFunc()
     //log_info("WarningCount = %d ", pSysWarning->WarningCount);
 //#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     for (i = 0; (i + pSysWarning->PageIndex * 5) < pSysWarning->WarningCount; i++) {
-        log_info("Warming Code[%d]:%s",i,&pSysWarning->WarningCode[i][0]);
+        //log_info("Warming Code[%d]:%s",i,&pSysWarning->WarningCode[i][0]);
         memset(cmd, 0x00, sizeof(cmd));
         if ((i) >= 5) {
             break;

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

@@ -5,6 +5,8 @@
 #include "../Define/define.h"
 
 //------------------------------------------------------------------------------
+
+#define RETURNIDLE_Timeout					10
 #define DEFAULT_AC_INDEX                        (2)
 
 #define TIME_MAX_SEC                            (2592000) // 一個月,秒數
@@ -80,6 +82,7 @@
 #define _Text_ChargeComplete    0x1034
 #define _Symbol_Dollar          0x1074
 #define _QR_CODE_               0x1082
+#define _Text_PrepareToCharge	0x109A
 #define _PreChargeTimer         0x2000
 #define _String_Voltage_        0x2010
 #define _String_Current_        0x2020