|
@@ -81,8 +81,8 @@ uint8_t bd0_2_status = 0;
|
|
|
uint8_t bd1_1_status = 0;
|
|
|
uint8_t bd1_2_status = 0;
|
|
|
|
|
|
-char *fwVersion = "V2.03.00.0000.00"; // Phihong version
|
|
|
-char* DebugVersion = "v2.03.01"; // Software debug version
|
|
|
+char *fwVersion = "V2.04.00.0000.00"; // Phihong version
|
|
|
+char* DebugVersion = "v2.04.00"; // Software debug version
|
|
|
//sqlite3 *localDb;
|
|
|
bool isDb_ready;
|
|
|
|
|
@@ -1470,6 +1470,8 @@ void _AutoReturnTimeout(void)
|
|
|
pDcChargingInfo->SystemStatus = S_ALARM;
|
|
|
//pSysInfo->SystemPage = _LCM_ERROR;
|
|
|
pSysInfo->SystemPage = _PAGE_PLUGOUT;
|
|
|
+ ShmDcCommonData->PreAuth_Config = _CREDITCARD_CANCEL;
|
|
|
+ ShmDcCommonData->PreAuth_Result = 0;
|
|
|
//pSysInfo->SystemPage = _PAGE_PAYING;
|
|
|
//StartGunInfoTimeoutDet(pSysInfo->CurGunSelected,Timeout_FinalCost);
|
|
|
ClearDetectPluginFlag();
|
|
@@ -1497,6 +1499,8 @@ void _AuthorizedTimeout(void)
|
|
|
SetIsCardScan(false);
|
|
|
|
|
|
pSysInfo->SystemPage = _PAGE_SELECT_GUN;
|
|
|
+ ShmDcCommonData->PreAuth_Config = _CREDITCARD_CANCEL;
|
|
|
+ ShmDcCommonData->PreAuth_Result = 0;
|
|
|
//ChangeLcmByIndex(_LCM_AUTHORIZ_FAIL);
|
|
|
strcpy((char *)pSysConfig->UserId, "");
|
|
|
ClearAuthorizedFlag();
|
|
@@ -1556,7 +1560,7 @@ void _DetectEvseChargingEnableTimeout(uint8_t gunIndex)
|
|
|
{
|
|
|
log_info("*********** _DetectEvseChargingEnableTimeout (GFD timeout) ***********");
|
|
|
|
|
|
- setChargerMode(pSysInfo->CurGunSelected, S_TERMINATING);
|
|
|
+ ChargingTerminalProcess(gunIndex);
|
|
|
//pSysInfo->SystemPage = _LCM_ERROR;
|
|
|
pSysInfo->SystemPage = _PAGE_MAINTAIN;
|
|
|
_AutoReturnTimeout();
|
|
@@ -1566,7 +1570,7 @@ void _PrepareTimeout(uint8_t gunIndex)
|
|
|
{
|
|
|
log_info("*********** _PrepareTimeout ***********");
|
|
|
|
|
|
- setChargerMode(pSysInfo->CurGunSelected, S_TERMINATING);
|
|
|
+ ChargingTerminalProcess(gunIndex);
|
|
|
pAlarmCode->AlarmEvents.bits.PsuNoResource = YES;
|
|
|
//pSysInfo->SystemPage = _LCM_ERROR;
|
|
|
pSysInfo->SystemPage = _PAGE_MAINTAIN;
|
|
@@ -1576,7 +1580,7 @@ void _PrepareTimeout(uint8_t gunIndex)
|
|
|
void _CcsPrechargeTimeout(uint8_t gunIndex)
|
|
|
{
|
|
|
log_info("*********** _CcsPrechargeTimeout ***********");
|
|
|
- setChargerMode(pSysInfo->CurGunSelected, S_TERMINATING);
|
|
|
+ ChargingTerminalProcess(gunIndex);
|
|
|
//pSysInfo->SystemPage = _LCM_ERROR;
|
|
|
pSysInfo->SystemPage = _PAGE_MAINTAIN;
|
|
|
}
|
|
@@ -2484,10 +2488,11 @@ void CreateTimeoutFork(void)
|
|
|
CheckConnectionTimeout();
|
|
|
gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
}
|
|
|
- //if (pSysInfo->SystemTimeoutFlag != 0)
|
|
|
- //log_info("Timeout ***********SystemTimeoutFlag = %d(%d) ********",pSysInfo->SystemTimeoutFlag,
|
|
|
- // GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL);
|
|
|
-
|
|
|
+ /*
|
|
|
+ if (pSysInfo->SystemTimeoutFlag != 0)
|
|
|
+ log_info("Timeout ***********SystemTimeoutFlag = %d(%d) ********",pSysInfo->SystemTimeoutFlag,
|
|
|
+ GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL);
|
|
|
+ */
|
|
|
// 系統
|
|
|
switch (pSysInfo->SystemTimeoutFlag) {
|
|
|
case Timeout_SelftestChk:
|
|
@@ -2585,7 +2590,9 @@ void CreateTimeoutFork(void)
|
|
|
strcpy((char *)pSysConfig->UserId, "");
|
|
|
ClearAuthorizedFlag();
|
|
|
StopSystemTimeoutDet();
|
|
|
- pSysInfo->SystemPage = _PAGE_SELECT_GUN;
|
|
|
+ pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
|
|
|
+ pDcChargingInfo->SystemStatus = S_IDLE;
|
|
|
+ pSysInfo->SystemPage = _PAGE_AUTHORIZE_FAIL;
|
|
|
}
|
|
|
break;
|
|
|
case Timeout_Terminating:
|
|
@@ -2615,6 +2622,14 @@ void CreateTimeoutFork(void)
|
|
|
pSysInfo->SystemPage = _PAGE_SELECT_GUN;
|
|
|
}
|
|
|
break;
|
|
|
+ case Timeout_TradeCancel:
|
|
|
+ if (GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL >= TCC_TRADECANCEL_TIMEOUT) {
|
|
|
+ StopSystemTimeoutDet();
|
|
|
+ pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
|
|
|
+ setChargerMode(pSysInfo->CurGunSelected, MODE_IDLE);
|
|
|
+ pSysInfo->SystemPage = _PAGE_SELECT_GUN;
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
// 各槍
|
|
@@ -2703,11 +2718,11 @@ void CreateTimeoutFork(void)
|
|
|
if (GetTimeoutValue(pDcChargingInfo->TimeoutTimer) / uSEC_VAL >= TCC_LINEREGISTER_TIMEOUT) {
|
|
|
StopGunInfoTimeoutDet(gunIndex);
|
|
|
pSysInfo->SystemPage = _PAGE_SELECT_PAY;
|
|
|
- ShmDcCommonData->donate_flag[gunIndex] = TRUE;
|
|
|
+ ShmDcCommonData->donate_flag[gunIndex] = FALSE;
|
|
|
}
|
|
|
break;
|
|
|
/*
|
|
|
- case Timeout_SelectGun: //Jerry add
|
|
|
+ case Timeout_SelectGun: //Jerry add
|
|
|
if (GetTimeoutValue(pDcChargingInfo->TimeoutTimer) / uSEC_VAL >= SEL_GUN_TIMEOUT) {
|
|
|
log_info("Timeout_SelectGun");
|
|
|
StopGunInfoTimeoutDet(gunIndex);
|
|
@@ -3856,6 +3871,7 @@ void ResetIdleData(uint8_t gunIndex)
|
|
|
ShmDcCommonData->AuthPass_flag[gunIndex] = FALSE;
|
|
|
ShmDcCommonData->PayPass_flag[gunIndex] = FALSE;
|
|
|
ShmDcCommonData->GetCardNo[gunIndex] = FALSE;
|
|
|
+ ShmDcCommonData->LineStatus[gunIndex] = 0;
|
|
|
|
|
|
ShmSelectGunInfo->PricesInfo[gunIndex].Balance = FAIL_BALANCE_PRICES;
|
|
|
destroySelGun(gunIndex);
|
|
@@ -3940,6 +3956,7 @@ int main(void)
|
|
|
bool isModelNameMatch = true;
|
|
|
uint8_t _ocppProfileChkFlag;
|
|
|
uint8_t gunIndex = 0;
|
|
|
+ uint8_t cancelcount = 0;
|
|
|
|
|
|
if (CreateAllCsuShareMemory() == FAIL) {
|
|
|
log_error("create share memory error");
|
|
@@ -4005,7 +4022,7 @@ int main(void)
|
|
|
KillAllTask();
|
|
|
StopProcessingLoop();
|
|
|
}
|
|
|
- CreateTimeoutFork();
|
|
|
+ CreateTimeoutFork();
|
|
|
log_info("Start self test... ");
|
|
|
|
|
|
SelfTestRun();
|
|
@@ -4062,7 +4079,7 @@ int main(void)
|
|
|
CheckTaskAlive();
|
|
|
|
|
|
CreateWatchdog();
|
|
|
- system("export TZ=CST-8&");
|
|
|
+
|
|
|
for (;;) {
|
|
|
|
|
|
CheckOcppStatus();
|
|
@@ -4158,7 +4175,7 @@ int main(void)
|
|
|
setChargerMode(gunIndex, MODE_AUTHORIZING);
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+ cancelcount = 0;
|
|
|
// 讀卡邏輯
|
|
|
ScannerCardProcess();
|
|
|
if (pSysInfo->SystemPage == _PAGE_SELECT_GUN) {
|
|
@@ -4170,19 +4187,24 @@ int main(void)
|
|
|
|
|
|
if(pSysInfo->SystemPage ==_PAGE_BILL) {
|
|
|
StartSystemTimeoutDet(Timeout_AddLine);
|
|
|
- if (ShmDcCommonData->LineStatus[gunIndex] == 1 || ShmDcCommonData->LineStatus[gunIndex] == 2 )
|
|
|
- pSysInfo->SystemPage =_PAGE_ADD_FRIEND;
|
|
|
+ if (/*ShmDcCommonData->LineStatus[gunIndex] == 1 || */ShmDcCommonData->LineStatus[gunIndex] == 2) {
|
|
|
+ pSysInfo->SystemPage = _PAGE_ADD_FRIEND;
|
|
|
+ log_info("Change to Add Line Friend Page");
|
|
|
+ }
|
|
|
} else if(pSysInfo->SystemPage ==_PAGE_ADD_FRIEND) {
|
|
|
StopSystemTimeoutDet();
|
|
|
StartGunInfoTimeoutDet(gunIndex, Timeout_LineReigster);
|
|
|
if (ShmDcCommonData->LineStatus[gunIndex] == 3) {
|
|
|
+ StopGunInfoTimeoutDet(gunIndex);
|
|
|
pSysInfo->SystemPage =_PAGE_SELECT_PAY;
|
|
|
ShmDcCommonData->donate_flag[gunIndex] = FALSE;
|
|
|
+ log_info("Change to Select Pay Page");
|
|
|
}
|
|
|
if (ShmDcCommonData->LineStatus[gunIndex] == 4 ) {
|
|
|
+ StopGunInfoTimeoutDet(gunIndex);
|
|
|
pSysInfo->SystemPage =_PAGE_SELECT_PAY;
|
|
|
ShmDcCommonData->donate_flag[gunIndex] = TRUE;
|
|
|
-
|
|
|
+ log_info("Change to Select Pay Page");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -4240,7 +4262,7 @@ CheckStatus:
|
|
|
ScannerCardProcess();
|
|
|
// 隨插即充
|
|
|
//autoStartCharging(gunIndex);
|
|
|
- if (pSysInfo->SystemPage == _PAGE_PLUGIN) {
|
|
|
+ if (pSysInfo->SystemPage == _PAGE_PLUGIN && ShmDcCommonData->TradeCancel == FALSE) {
|
|
|
pDcChargingInfo->Replug_flag = TRUE;
|
|
|
StopSystemTimeoutDet();
|
|
|
StartGunInfoTimeoutDet(gunIndex,Timeout_WaitPlug);
|
|
@@ -4556,7 +4578,7 @@ CheckStatus:
|
|
|
pSysInfo->SystemPage = _PAGE_EXIT;
|
|
|
break;
|
|
|
}
|
|
|
- if (pDcChargingInfo->ConnectorPlugIn == NO) {
|
|
|
+ if (pSysInfo->CurGunSelected == gunIndex && pDcChargingInfo->ConnectorPlugIn == NO) {
|
|
|
is_plugout[gunIndex] = TRUE;
|
|
|
StartGunInfoTimeoutDet(gunIndex, Timeout_PlugOutGun);
|
|
|
if (pSysInfo->CurGunSelected == gunIndex) {
|
|
@@ -4566,8 +4588,7 @@ CheckStatus:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (pSysInfo->CurGunSelected == gunIndex && pSysInfo->SystemPage != _PAGE_PAYING &&
|
|
|
- ShmDcCommonData->finalcost_flag[gunIndex]) {
|
|
|
+ if (pSysInfo->CurGunSelected == gunIndex && pSysInfo->SystemPage != _PAGE_PAYING ) {
|
|
|
if (ShmDcCommonData->PayPass_flag[pSysInfo->CurGunSelected] == TRUE)
|
|
|
pSysInfo->SystemPage = _PAGE_COMPLETE;
|
|
|
else
|
|
@@ -4594,13 +4615,18 @@ CheckStatus:
|
|
|
ShmDcCommonData->PreAuth_Result = 0;
|
|
|
pSysInfo->SystemPage = _PAGE_PLUGOUT;
|
|
|
} else {
|
|
|
- if(ShmDcCommonData->PayFinish[gunIndex] == FALSE) {
|
|
|
+ if(ShmDcCommonData->finalcost_flag[gunIndex] == FALSE) {
|
|
|
pSysInfo->SystemPage = _PAGE_PAYING;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
+ if (ShmDcCommonData->PreAuth_Config == _CREDITCARD_CANCEL &&
|
|
|
+ ShmDcCommonData->PreAuth_Result != 0 && cancelcount < 30) {
|
|
|
+ sleep(1);
|
|
|
+ cancelcount++;
|
|
|
+ log_info("Cancel Not Complete yet");
|
|
|
+ break;
|
|
|
+ }
|
|
|
if (pSysWarning->Level == WARN_LV_ER) {
|
|
|
pSysInfo->SystemPage = _PAGE_MAINTAIN;
|
|
|
|
|
@@ -4611,13 +4637,13 @@ CheckStatus:
|
|
|
pSysInfo->SystemPage = _PAGE_EXIT;
|
|
|
break;
|
|
|
}
|
|
|
- if (pDcChargingInfo->ConnectorPlugIn == NO) {
|
|
|
+
|
|
|
+ if (pSysInfo->CurGunSelected == gunIndex && pDcChargingInfo->ConnectorPlugIn == NO) {
|
|
|
is_plugout[gunIndex] = TRUE;
|
|
|
if (pDcChargingInfo->Replug_flag == TRUE) {
|
|
|
pSysInfo->SystemPage = _PAGE_SELECT_GUN;
|
|
|
pDcChargingInfo->SystemStatus = S_IDLE;
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
StartGunInfoTimeoutDet(gunIndex, Timeout_PlugOutGun);
|
|
|
pSysInfo->SystemPage = _PAGE_EXIT;
|
|
|
}
|
|
@@ -4629,7 +4655,7 @@ CheckStatus:
|
|
|
if (pSysInfo->CurGunSelected == gunIndex && pSysInfo->SystemPage != _PAGE_PAYING ) {
|
|
|
if (pDcChargingInfo->Replug_flag == TRUE)
|
|
|
pSysInfo->SystemPage = _PAGE_PLUGOUT;
|
|
|
- else if (ShmDcCommonData->finalcost_flag[gunIndex]) {
|
|
|
+ else{
|
|
|
if (ShmDcCommonData->PayPass_flag[pSysInfo->CurGunSelected] == TRUE)
|
|
|
pSysInfo->SystemPage = _PAGE_COMPLETE;
|
|
|
else
|