|
@@ -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.12.00.0000.00"; // Phihong version
|
|
|
-char* DebugVersion = "v2.12.01"; // Software debug version
|
|
|
+char *fwVersion = "V2.13.00.0000.00"; // Phihong version
|
|
|
+char* DebugVersion = "V2.13.01"; // Software debug version
|
|
|
//sqlite3 *localDb;
|
|
|
bool isDb_ready;
|
|
|
|
|
@@ -292,7 +292,7 @@ static void GetFirmwareVersion(void)
|
|
|
{
|
|
|
// Get CSU root file system version
|
|
|
sprintf((char *)pSysInfo->CsuRootFsFwRev, fwVersion);
|
|
|
-
|
|
|
+ sprintf((char*)ShmDcCommonData->DebugVersion, DebugVersion);
|
|
|
uint8_t count = 0, chademo = 0, ccs = 0, gb = 0;
|
|
|
for (uint8_t idx = 0; idx < 3; idx++) {
|
|
|
if (pSysConfig->ModelName[7 + idx] == 'J') {
|
|
@@ -2766,18 +2766,11 @@ void CreateTimeoutFork(void)
|
|
|
if (ShmDcCommonData->finalcost_flag[gunIndex] == FALSE) {
|
|
|
if (ShmDcCommonData->is_AutoStart[gunIndex] || ShmDcCommonData->is_RemoteStart[gunIndex]) {
|
|
|
ShmDcCommonData->PayPass_flag[gunIndex] = FALSE;
|
|
|
- pSysInfo->SystemPage = _PAGE_PAYFAIL;
|
|
|
ShmDcCommonData->finalcost_flag[gunIndex] = TRUE;
|
|
|
} else {
|
|
|
log_info("Not Get Final Cost");
|
|
|
ShmDcCommonData->PayPass_flag[gunIndex] = FALSE;
|
|
|
pSysInfo->SystemPage = _PAGE_PAYFAIL;
|
|
|
- /*
|
|
|
- ShmDcCommonData->TransactionInfo[gunIndex].Amount = pDcChargingInfo->PresentChargedEnergy * ShmDcCommonData->ChargingRate;
|
|
|
- if (ShmDcCommonData->TransactionInfo[gunIndex].Amount < 1)
|
|
|
- ShmDcCommonData->TransactionInfo[gunIndex].Amount = 1;
|
|
|
- ShmDcCommonData->finalcost_flag[gunIndex] = TRUE;
|
|
|
- */
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3927,7 +3920,7 @@ void ResetIdleData(uint8_t gunIndex)
|
|
|
pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
|
|
|
ShmOCPP16Data = (struct OCPP16Data *)GetShmOCPP16Data();
|
|
|
ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
|
|
|
-
|
|
|
+ float powerconsumption = ShmDcCommonData->pGunInfo[gunIndex].PowerConsumption;
|
|
|
pDcChargingInfo->PresentChargedDuration = 0;
|
|
|
pDcChargingInfo->RemainChargingDuration = 0;
|
|
|
pDcChargingInfo->PresentChargingVoltage = 0;//DS60-120 add
|
|
@@ -3944,7 +3937,7 @@ void ResetIdleData(uint8_t gunIndex)
|
|
|
memset(&ShmSelectGunInfo->PricesInfo[gunIndex], 0, sizeof(PricesInfo));
|
|
|
memset(&ShmDcCommonData->TransactionInfo[gunIndex], 0, sizeof(RecordTransactionInfo));
|
|
|
memset(&ShmDcCommonData->pGunInfo[gunIndex], 0, sizeof(GunInfo));
|
|
|
- DB_Get_PowerConsumption(gunIndex);
|
|
|
+ ShmDcCommonData->pGunInfo[gunIndex].PowerConsumption = powerconsumption;
|
|
|
ShmDcCommonData->finalcost_flag[gunIndex] = FALSE;
|
|
|
ShmDcCommonData->AuthPass_flag[gunIndex] = FALSE;
|
|
|
ShmDcCommonData->PayPass_flag[gunIndex] = FALSE;
|
|
@@ -4262,11 +4255,8 @@ int main(void)
|
|
|
isDb_ready = true;
|
|
|
for (int _index = 0; _index < pSysConfig->TotalConnectorCount; _index++) {
|
|
|
pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(_index);
|
|
|
-
|
|
|
pDcChargingInfo->IsAvailable = DB_Get_Operactive(_index);
|
|
|
- if (!DB_Get_PowerConsumption(_index)) {
|
|
|
- DB_Insert_PowerConsumption(_index, 0);
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
DB_Reboot_Record();
|
|
|
}
|
|
@@ -4275,14 +4265,22 @@ int main(void)
|
|
|
log_info("Power DB_Open fail. ");
|
|
|
isDb_ready = false;
|
|
|
} else {
|
|
|
+ int _retry = 0;
|
|
|
isDb_ready = true;
|
|
|
for (int _index = 0; _index < pSysConfig->TotalConnectorCount; _index++) {
|
|
|
pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(_index);
|
|
|
-
|
|
|
- if (!DB_Get_PowerConsumption(_index)) {
|
|
|
- DB_Insert_PowerConsumption(_index, 0);
|
|
|
- }
|
|
|
- }
|
|
|
+ while (_retry < 3) {
|
|
|
+ if (DB_Get_PowerConsumption(_index)) {
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ sleep(1);
|
|
|
+ _retry++;
|
|
|
+ if (_retry == 3) {
|
|
|
+ DB_Insert_PowerConsumption(_index, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } // while
|
|
|
+ } // for
|
|
|
}
|
|
|
log_info("===== Create DB End ===== ");
|
|
|
|
|
@@ -4407,7 +4405,7 @@ int main(void)
|
|
|
// 讀卡邏輯
|
|
|
if (!ShmDcCommonData->TradeCancel && pSysInfo->CurGunSelected == gunIndex)
|
|
|
ScannerCardProcess(gunIndex);
|
|
|
- if (pSysInfo->SystemPage == _PAGE_SELECT_GUN) {
|
|
|
+ if (pSysInfo->SystemPage == _PAGE_SELECT_GUN || pSysInfo->SystemPage == _PAGE_IDLE) {
|
|
|
//ShmDcCommonData->LineStatus[gunIndex] = 0;
|
|
|
StopGunInfoTimeoutDet(gunIndex);
|
|
|
}
|
|
@@ -4492,8 +4490,8 @@ int main(void)
|
|
|
break;
|
|
|
}
|
|
|
if (pDcChargingInfo->SystemStatus == S_FAULT) {
|
|
|
- systemPageRestoreInit();
|
|
|
setChargerMode(gunIndex, MODE_IDLE);
|
|
|
+ systemPageRestoreInit();
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -4512,9 +4510,7 @@ int main(void)
|
|
|
}
|
|
|
if (isDetectPlugin(gunIndex)) {
|
|
|
StartGunInfoTimeoutDet(gunIndex, Timeout_WaitPlug);
|
|
|
- if (pSysInfo->CurGunSelected == gunIndex) {
|
|
|
- pSysInfo->SystemPage = _PAGE_PLUGIN;
|
|
|
- }
|
|
|
+
|
|
|
// 卡號驗證成功後,等待充電槍插入充電車
|
|
|
if (pDcChargingInfo->RemoteStartFlag == YES) {
|
|
|
if (pDcChargingInfo->ConnectorPlugIn == YES &&
|
|
@@ -4858,29 +4854,32 @@ int main(void)
|
|
|
StartGunInfoTimeoutDet(gunIndex, Timeout_ExitPage);
|
|
|
}
|
|
|
}
|
|
|
+ if (pDcChargingInfo->Replug_flag == TRUE && pSysInfo->CurGunSelected == gunIndex) {
|
|
|
+ pSysInfo->SystemPage = _PAGE_PLUGOUT;
|
|
|
+ break;
|
|
|
+ }
|
|
|
// Remote start
|
|
|
if (ShmDcCommonData->is_RemoteStart[gunIndex] && pSysInfo->CurGunSelected == gunIndex) {
|
|
|
- if (pDcChargingInfo->Replug_flag == TRUE)
|
|
|
- pSysInfo->SystemPage = _PAGE_PLUGOUT;
|
|
|
- else {
|
|
|
- if (ShmDcCommonData->finalcost_flag[gunIndex]) {
|
|
|
+
|
|
|
+ if (ShmDcCommonData->finalcost_flag[gunIndex]) {
|
|
|
+ if (ShmDcCommonData->PayPass_flag[gunIndex]) {
|
|
|
pSysInfo->SystemPage = _PAGE_COMPLETE;
|
|
|
+ //log_info("_PAGE_COMPLETE");
|
|
|
} else {
|
|
|
- pSysInfo->SystemPage = _PAGE_PAYING;
|
|
|
+ pSysInfo->SystemPage = _PAGE_PAYFAIL;
|
|
|
+ //log_info("_PAGE_PAYFAIL");
|
|
|
}
|
|
|
+ } else {
|
|
|
+ pSysInfo->SystemPage = _PAGE_PAYING;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
if (pSysInfo->CurGunSelected == gunIndex &&
|
|
|
pSysInfo->SystemPage != _PAGE_PAYING && pSysInfo->SystemPage != _PAGE_SENSING) {
|
|
|
- if (pDcChargingInfo->Replug_flag == TRUE)
|
|
|
- pSysInfo->SystemPage = _PAGE_PLUGOUT;
|
|
|
- else {
|
|
|
- if (ShmDcCommonData->PayPass_flag[gunIndex] == TRUE)
|
|
|
- pSysInfo->SystemPage = _PAGE_COMPLETE;
|
|
|
- else
|
|
|
- pSysInfo->SystemPage = _PAGE_PAYFAIL;
|
|
|
- }
|
|
|
+ if (ShmDcCommonData->PayPass_flag[gunIndex] == TRUE)
|
|
|
+ pSysInfo->SystemPage = _PAGE_COMPLETE;
|
|
|
+ else
|
|
|
+ pSysInfo->SystemPage = _PAGE_PAYFAIL;
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -4934,28 +4933,27 @@ int main(void)
|
|
|
StartGunInfoTimeoutDet(gunIndex, Timeout_ExitPage);
|
|
|
}
|
|
|
}
|
|
|
+ if (pDcChargingInfo->Replug_flag == TRUE && pSysInfo->CurGunSelected == gunIndex) {
|
|
|
+ pSysInfo->SystemPage = _PAGE_PLUGOUT;
|
|
|
+ break;
|
|
|
+ }
|
|
|
// Remote start
|
|
|
if (ShmDcCommonData->is_RemoteStart[gunIndex] && pSysInfo->CurGunSelected == gunIndex) {
|
|
|
- if (pDcChargingInfo->Replug_flag == TRUE)
|
|
|
- pSysInfo->SystemPage = _PAGE_PLUGOUT;
|
|
|
- else {
|
|
|
- if (ShmDcCommonData->finalcost_flag[gunIndex]) {
|
|
|
+ if (ShmDcCommonData->finalcost_flag[gunIndex]) {
|
|
|
+ if (ShmDcCommonData->PayPass_flag[gunIndex])
|
|
|
pSysInfo->SystemPage = _PAGE_COMPLETE;
|
|
|
- } else {
|
|
|
- pSysInfo->SystemPage = _PAGE_PAYING;
|
|
|
- }
|
|
|
+ else
|
|
|
+ pSysInfo->SystemPage = _PAGE_PAYFAIL;
|
|
|
+ } else {
|
|
|
+ pSysInfo->SystemPage = _PAGE_PAYING;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
if (pSysInfo->CurGunSelected == gunIndex && pSysInfo->SystemPage != _PAGE_PAYING ) {
|
|
|
- if (pDcChargingInfo->Replug_flag == TRUE)
|
|
|
- pSysInfo->SystemPage = _PAGE_PLUGOUT;
|
|
|
- else {
|
|
|
- if (ShmDcCommonData->PayPass_flag[gunIndex] == TRUE)
|
|
|
- pSysInfo->SystemPage = _PAGE_COMPLETE;
|
|
|
- else
|
|
|
- pSysInfo->SystemPage = _PAGE_PAYFAIL;
|
|
|
- }
|
|
|
+ if (ShmDcCommonData->PayPass_flag[gunIndex] == TRUE)
|
|
|
+ pSysInfo->SystemPage = _PAGE_COMPLETE;
|
|
|
+ else
|
|
|
+ pSysInfo->SystemPage = _PAGE_PAYFAIL;
|
|
|
}
|
|
|
|
|
|
break;
|