|
@@ -332,6 +332,7 @@ int Get_Ocpp_MaxProfileScheduleNumberPhases(int schedule_index);
|
|
|
int Get_Ocpp_MaxProfileStartIndex(void);
|
|
|
int Is_Ocpp_RemoteStartWaitReq(void);
|
|
|
void Get_Ocpp_SessionTarget(int gunIndex, struct StructSessionTarget *sessionTarget);
|
|
|
+int Get_Ocpp_OffLineMaxChargingPower(void);
|
|
|
|
|
|
void Set_Deduct_UserId(int gunIndex, char *userId);
|
|
|
void Set_Deduct_TransactionId(int gunIndex, int transaction);
|
|
@@ -410,7 +411,7 @@ bool isModelNameMatch = true;
|
|
|
//char* rfidPortName = "/dev/ttyS2";
|
|
|
#if ENABLE_PCBA_TEST == 0
|
|
|
char* fwVersion = "V2.02.00.0000.00";
|
|
|
-char* subVersion = "00";
|
|
|
+char* subVersion = "01";
|
|
|
#else
|
|
|
char* fwVersion = "PCBA.00.04";
|
|
|
char* subVersion = "00";
|
|
@@ -1201,7 +1202,7 @@ int isReachableInternet()
|
|
|
if (strstr(buf, "inet addr:") > 0)
|
|
|
{
|
|
|
sscanf(buf, "%*s%s", tmp);
|
|
|
- substr(tmp, tmp, strspn(tmp, "addr:"), strlen(buf)-strspn(tmp, "addr:"));
|
|
|
+ substr(tmp, tmp, strspn(tmp, "addr:"), strlen(tmp)-strspn(tmp, "addr:"));
|
|
|
|
|
|
if (strcmp(tmp, (char *)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress) != EQUAL)
|
|
|
{
|
|
@@ -5004,6 +5005,25 @@ void Get_Ocpp_SessionTarget(int gunIndex, struct StructSessionTarget *sessionTar
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//===============================================
|
|
|
+// Ocpp OffLineMaxChargingPower
|
|
|
+//===============================================
|
|
|
+int Get_Ocpp_OffLineMaxChargingPower(void)
|
|
|
+{
|
|
|
+ // unit: W
|
|
|
+ int maxChargingPower = 0;
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
+ {
|
|
|
+ maxChargingPower = atoi((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[OffLineMaxChargingPower].ItemData);
|
|
|
+ }
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
+ {
|
|
|
+ maxChargingPower = atoi((char *)ShmOCPP20Data->ControllerComponentVariable[OffLineMaxChargingPower].variableAttribute[0].value);
|
|
|
+ }
|
|
|
+ return maxChargingPower > 0 ? maxChargingPower : 0;
|
|
|
+}
|
|
|
+
|
|
|
//===============================================
|
|
|
// DeductResult
|
|
|
//===============================================
|
|
@@ -6113,17 +6133,22 @@ void ExecuteWriteFlash(void)
|
|
|
struct timespec _WiringInfo_time;
|
|
|
int CheckFlashUpdate(void)
|
|
|
{
|
|
|
- if(ShmChargerInfo->Control.SysCtrl.bits.WriteFlashEnable)
|
|
|
+ if(ShmChargerInfo->Control.SysCtrl.bits.FlashConfigChanged)
|
|
|
{
|
|
|
- ShmChargerInfo->Control.SysCtrl.bits.WriteFlashEnable = false;
|
|
|
+ ShmChargerInfo->Control.SysCtrl.bits.FlashConfigChanged = false;
|
|
|
LOG_INFO("Flash Config Changed");
|
|
|
|
|
|
GetClockTime(&_WiringInfo_time);
|
|
|
+ ShmChargerInfo->Control.SysCtrl.bits.WriteFlashEnable = true;
|
|
|
+ }
|
|
|
|
|
|
+ if(ShmChargerInfo->Control.SysCtrl.bits.WriteFlashEnable)
|
|
|
+ {
|
|
|
// wait for 30s to write flash or write flash immediately
|
|
|
if((GetTimeoutValue(_WiringInfo_time) / uSEC_VAL) >= WIRING_INFO_DELAY ||
|
|
|
ShmChargerInfo->Control.SysCtrl.bits.WriteFlashImmediately)
|
|
|
{
|
|
|
+ ShmChargerInfo->Control.SysCtrl.bits.WriteFlashEnable = false;
|
|
|
LOG_INFO("Start Writing Flash");
|
|
|
|
|
|
pid_t writePid = fork();
|
|
@@ -7476,7 +7501,7 @@ bool CheckBackendChargingTimeout(byte gunIndex)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0)
|
|
|
{
|
|
|
- if (chargingInfo[gunIndex]->PresentChargedDuration > (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration * 60))
|
|
|
+ if (chargingInfo[gunIndex]->PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration * 60))
|
|
|
result = true;
|
|
|
}
|
|
|
}
|
|
@@ -7485,7 +7510,7 @@ bool CheckBackendChargingTimeout(byte gunIndex)
|
|
|
// 隨插即充電的要看 offline
|
|
|
if (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration > 0)
|
|
|
{
|
|
|
- if (chargingInfo[gunIndex]->PresentChargedDuration > (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration * 60))
|
|
|
+ if (chargingInfo[gunIndex]->PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration * 60))
|
|
|
result = true;
|
|
|
}
|
|
|
}
|
|
@@ -7501,7 +7526,7 @@ bool CheckBackendChargingEnergy(byte gunIndex)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0)
|
|
|
{
|
|
|
- if (chargingInfo[gunIndex]->PresentChargedEnergy > ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy)
|
|
|
+ if (chargingInfo[gunIndex]->PresentChargedEnergy >= ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy)
|
|
|
result = true;
|
|
|
}
|
|
|
}
|
|
@@ -7510,7 +7535,7 @@ bool CheckBackendChargingEnergy(byte gunIndex)
|
|
|
// 隨插即充電的要看 offline
|
|
|
if (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy > 0)
|
|
|
{
|
|
|
- if (chargingInfo[gunIndex]->PresentChargedEnergy > (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy))
|
|
|
+ if (chargingInfo[gunIndex]->PresentChargedEnergy >= (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy))
|
|
|
result = true;
|
|
|
}
|
|
|
}
|
|
@@ -7518,6 +7543,22 @@ bool CheckBackendChargingEnergy(byte gunIndex)
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+bool IsReachConfigMaxChargingSoc(byte gunIndex)
|
|
|
+{
|
|
|
+ bool result = false;
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.MaxChargingSoc > 0)
|
|
|
+ {
|
|
|
+ if(chargingInfo[gunIndex]->EvBatterySoc >= ShmSysConfigAndInfo->SysConfig.MaxChargingSoc)
|
|
|
+ {
|
|
|
+ LOG_INFO("Gun %d MaxChargingSoc: [%d%%] Stop", gunIndex + 1, ShmSysConfigAndInfo->SysConfig.MaxChargingSoc);
|
|
|
+ result = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
bool CheckSessionTargetStop(byte gunIndex)
|
|
|
{
|
|
|
bool stop = false;
|
|
@@ -10196,7 +10237,8 @@ int main(void)
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
else if(CheckBackendChargingTimeout(gun_index) ||
|
|
|
- CheckBackendChargingEnergy(gun_index))
|
|
|
+ CheckBackendChargingEnergy(gun_index) ||
|
|
|
+ IsReachConfigMaxChargingSoc(gun_index))
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Backend Stop (S_CHARGING) **********", gun_index + 1);
|
|
|
// 板端或後臺要求停止
|