|
@@ -413,7 +413,7 @@ int CreatShareMemory()
|
|
|
memset(ShmOCPP16Data,0,sizeof(struct OCPP16Data));
|
|
|
|
|
|
//creat ShmOCPP20Data
|
|
|
- /*if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), IPC_CREAT | 0777)) < 0)
|
|
|
+ if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), IPC_CREAT | 0777)) < 0)
|
|
|
{
|
|
|
|
|
|
DEBUG_ERROR("shmget OCPP20Data NG\n");
|
|
@@ -427,7 +427,7 @@ int CreatShareMemory()
|
|
|
|
|
|
result = FAIL;
|
|
|
}
|
|
|
- memset(ShmOCPP20Data,0,sizeof(struct OCPP20Data));*/
|
|
|
+ memset(ShmOCPP20Data,0,sizeof(struct OCPP20Data));
|
|
|
|
|
|
//creat ShmCharger
|
|
|
if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), IPC_CREAT | 0777)) < 0)
|
|
@@ -903,6 +903,13 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
|
|
|
system("rm -f /mnt/EvseConfig.bin");
|
|
|
DEBUG_INFO("Load SysConfigData OK\n");
|
|
|
|
|
|
+ ShmCharger->isCcsEnable = OFF;
|
|
|
+ for(uint8_t idx=0;idx<3;idx++)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.ModelName[7+idx] == '7')
|
|
|
+ ShmCharger->isCcsEnable = ON;
|
|
|
+ }
|
|
|
+
|
|
|
return PASS;
|
|
|
}
|
|
|
|
|
@@ -1379,7 +1386,7 @@ void get_firmware_version(unsigned char gun_index)
|
|
|
strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
|
|
|
|
|
|
// Get CSU root file system version
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.39.00.0000.00");
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.40.00.0000.00");
|
|
|
|
|
|
// Get AC connector type from model name
|
|
|
for(uint8_t idx=0;idx<3;idx++)
|
|
@@ -2785,7 +2792,15 @@ int main(void)
|
|
|
{
|
|
|
ftime(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
|
|
|
setLedMotion(gun_index,LED_ACTION_AUTHED);
|
|
|
- ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_DUTY_5;
|
|
|
+
|
|
|
+ if(ShmCharger->isCcsEnable)
|
|
|
+ ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_DUTY_5;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_CP_STATE_E;
|
|
|
+ ShmCharger->gun_info[gun_index].chargingMode = CHARGING_MODE_BS;
|
|
|
+ setRequest(gun_index, ON);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// If control pilot detect Bx, skip watch dog time out.
|
|
@@ -2820,30 +2835,30 @@ int main(void)
|
|
|
break;
|
|
|
case HANDSHAKE_DUTY_5_CHECK:
|
|
|
if((ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF))
|
|
|
- {
|
|
|
+ {
|
|
|
//2 secs timeout
|
|
|
ftime(&startTime[gun_index][TMR_IDX_BS_HLC_HANDSHAKE]);
|
|
|
ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_CCS;
|
|
|
- }
|
|
|
+ }
|
|
|
break;
|
|
|
case HANDSHAKE_CCS:
|
|
|
//CCS handshake timeout
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_BS_HLC_HANDSHAKE]) > TIMEOUT_SPEC_BS_HLC_HANDSHAKE)
|
|
|
{
|
|
|
- ShmCharger->gun_info[gun_index].acCcsInfo.ChargingPermission = OFF;
|
|
|
+ ShmCharger->gun_info[gun_index].acCcsInfo.ChargingPermission = OFF;
|
|
|
ShmCharger->gun_info[gun_index].acCcsInfo.EVSENotification = NOTIFICATION_STOP;
|
|
|
DEBUG_INFO("BS/HLC %d secs handshake timeout.\n", (TIMEOUT_SPEC_BS_HLC_HANDSHAKE/1000));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if((ShmCharger->gun_info[gun_index].acCcsInfo.ChargingPermission == OFF) && (ShmCharger->gun_info[gun_index].acCcsInfo.CpSetPWMDuty != CCS_PWM_DUTY_5))
|
|
|
{
|
|
|
DEBUG_INFO("Wait CCS give up negotiagting.\n");
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_CP_STATE_F;
|
|
|
- ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
+ ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_CP_STATE_E;
|
|
|
ShmCharger->gun_info[gun_index].chargingMode = CHARGING_MODE_BS;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//CCS status check
|
|
|
if((16 < ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus) && (ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus < 254))
|
|
|
{
|
|
@@ -2852,15 +2867,18 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_HLC_MODE;
|
|
|
ftime(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
|
|
|
}
|
|
|
-
|
|
|
- break;
|
|
|
+
|
|
|
+ break;
|
|
|
case HANDSHAKE_CP_STATE_E:
|
|
|
if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
|
|
|
- {
|
|
|
- DEBUG_INFO("Change to CP STATE E for 4 secs.\n");
|
|
|
- //CP STATE E for 4 secs
|
|
|
- sleep(4);
|
|
|
-
|
|
|
+ {
|
|
|
+ if(ShmCharger->isCcsEnable)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("Change to CP STATE E for 4 secs.\n");
|
|
|
+ //CP STATE E for 4 secs
|
|
|
+ sleep(4);
|
|
|
+ }
|
|
|
+
|
|
|
//restore normal CP PWM duty
|
|
|
// Determine max charging current to MCU
|
|
|
DEBUG_INFO("Determine max charging current to MCU.\n");
|
|
@@ -2882,20 +2900,20 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
}
|
|
|
}
|
|
|
- ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
+ ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_SET_MAX_CURRENT;
|
|
|
ftime(&startTime[gun_index][TMR_IDX_BS_HLC_HANDSHAKE]);
|
|
|
- }
|
|
|
+ }
|
|
|
break;
|
|
|
case HANDSHAKE_SET_MAX_CURRENT:
|
|
|
if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
|
|
|
- {
|
|
|
+ {
|
|
|
ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_BS_MODE;
|
|
|
DEBUG_INFO("Enter BS Mode charging.\n");
|
|
|
//for EV READY 30 secs didn't start charging to STATE E
|
|
|
ftime(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
|
|
|
- }
|
|
|
- break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
case HANDSHAKE_BS_MODE:
|
|
|
if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)
|
|
|
setRelay(gun_index,ON);
|
|
@@ -2921,7 +2939,7 @@ int main(void)
|
|
|
memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
|
|
|
|
|
|
memcpy((char*)ShmOCPP16Data->StartTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StartTransaction[gun_index].IdTag));
|
|
|
-
|
|
|
+
|
|
|
ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionReq = ON;
|
|
|
|
|
|
setChargerMode(gun_index, SYS_MODE_CHARGING);
|
|
@@ -2936,7 +2954,7 @@ int main(void)
|
|
|
DEBUG_INFO("EV READY STATE E 4sec.\n");
|
|
|
ShmCharger->gun_info[gun_index].isEvReady2StateE = ON;
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_CP_STATE_E;
|
|
|
- ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
+ ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
ShmCharger->gun_info[gun_index].evReadyState = EV_READY_STAT_E;
|
|
|
}
|
|
|
}
|
|
@@ -2948,16 +2966,16 @@ int main(void)
|
|
|
case EV_READY_STAT_E:
|
|
|
if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
|
|
|
{
|
|
|
- sleep(4);
|
|
|
+ sleep(4);
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
|
|
|
- ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
- ShmCharger->gun_info[gun_index].evReadyState = EV_READY_STAT_C;
|
|
|
+ ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
+ ShmCharger->gun_info[gun_index].evReadyState = EV_READY_STAT_C;
|
|
|
}
|
|
|
break;
|
|
|
case EV_READY_STAT_C:
|
|
|
if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
|
|
|
{
|
|
|
- usleep(500000);
|
|
|
+ usleep(500000);
|
|
|
DEBUG_INFO("EV READY Determine max charging current to MCU.\n");
|
|
|
if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
|
|
|
{
|
|
@@ -2977,9 +2995,9 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
}
|
|
|
}
|
|
|
- ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
- ShmCharger->gun_info[gun_index].evReadyState = EV_READY_SET_MAX_CURRENT;
|
|
|
- }
|
|
|
+ ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
+ ShmCharger->gun_info[gun_index].evReadyState = EV_READY_SET_MAX_CURRENT;
|
|
|
+ }
|
|
|
break;
|
|
|
case EV_READY_SET_MAX_CURRENT:
|
|
|
if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
|
|
@@ -2987,20 +3005,20 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].isEvReady2StateE = OFF;
|
|
|
ShmCharger->gun_info[gun_index].isDoEvReadyOnce = ON;
|
|
|
}
|
|
|
- break;
|
|
|
+ break;
|
|
|
default:
|
|
|
- break;
|
|
|
- }
|
|
|
+ break;
|
|
|
+ }
|
|
|
}*/
|
|
|
-
|
|
|
- break;
|
|
|
- case HANDSHAKE_HLC_MODE:
|
|
|
+
|
|
|
+ break;
|
|
|
+ case HANDSHAKE_HLC_MODE:
|
|
|
if(ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_START_MODE)
|
|
|
{
|
|
|
setRelay(gun_index,ON);
|
|
|
ShmCharger->gun_info[gun_index].isCCSStartTransation = ON;
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
if((ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON) &&
|
|
|
(ShmCharger->gun_info[gun_index].isCCSStartTransation == ON))
|
|
|
{
|
|
@@ -3023,26 +3041,26 @@ int main(void)
|
|
|
memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
|
|
|
|
|
|
memcpy((char*)ShmOCPP16Data->StartTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StartTransaction[gun_index].IdTag));
|
|
|
-
|
|
|
+
|
|
|
ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionReq = ON;
|
|
|
-
|
|
|
+
|
|
|
ShmCharger->gun_info[gun_index].isCCSStartTransation = OFF;
|
|
|
-
|
|
|
+
|
|
|
setChargerMode(gun_index, SYS_MODE_CHARGING);
|
|
|
-
|
|
|
+
|
|
|
ftime(&startTime[gun_index][TMR_IDX_CCS_HEARTBEAT_COUNT_RESET]);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
//120 sec timeout
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > TIMEOUT_SPEC_CCS_HANDSHAKE)
|
|
|
- {
|
|
|
+ {
|
|
|
setLedMotion(gun_index, LED_ACTION_HANDSHAKE_FAIL);
|
|
|
-
|
|
|
+
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > TIMEOUT_SPEC_CCS_HANDSHAKE+5000)
|
|
|
{
|
|
|
DEBUG_INFO("CCS 120 secs handshake timeout.\n");
|
|
|
//Cancel CCS task negotiating
|
|
|
- ShmCharger->gun_info[gun_index].acCcsInfo.ChargingPermission = OFF;
|
|
|
+ ShmCharger->gun_info[gun_index].acCcsInfo.ChargingPermission = OFF;
|
|
|
ShmCharger->gun_info[gun_index].acCcsInfo.EVSENotification = NOTIFICATION_STOP;
|
|
|
ShmCharger->gun_info[gun_index].isCCSWaitChangeDuty = ON;
|
|
|
}
|
|
@@ -3051,15 +3069,16 @@ int main(void)
|
|
|
if((ShmCharger->gun_info[gun_index].isCCSWaitChangeDuty == ON) && ShmCharger->gun_info[gun_index].acCcsInfo.CpSetPWMDuty == CCS_PWM_DUTY_100)
|
|
|
{
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
|
|
|
- ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
+ ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
ShmCharger->gun_info[gun_index].isCCSWaitChangeDuty = OFF;
|
|
|
-
|
|
|
+
|
|
|
setChargerMode(gun_index, SYS_MODE_IDLE);
|
|
|
- }
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// Unplug charging gun to Idle mode
|
|
@@ -3357,6 +3376,7 @@ int main(void)
|
|
|
DEBUG_INFO("Profile purpose: %s\n", ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfilePurpose);
|
|
|
DEBUG_INFO("Transaction ID: %d\n", ShmOCPP16Data->SmartChargingProfile[gun_index].TransactionId);
|
|
|
DEBUG_INFO("ChargingRateUnit: %s\n", ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit);
|
|
|
+ DEBUG_INFO("===============================================================\n");
|
|
|
}
|
|
|
|
|
|
// Checking profile kind
|
|
@@ -3390,14 +3410,18 @@ int main(void)
|
|
|
if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
|
|
|
{
|
|
|
ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
|
|
|
- if(ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current)
|
|
|
+ if((ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current) ||
|
|
|
+ (ShmCharger->gun_info[gun_index].primaryMcuState.current_limit != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current))
|
|
|
{
|
|
|
if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
|
|
|
{
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PWN_CHANGE]) > TIMEOUT_SPEC_PWN_CHANGE)
|
|
|
{
|
|
|
- ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
|
|
|
- ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
|
|
|
+ if(ShmCharger->gun_info[gun_index].targetCurrent>0)
|
|
|
+ {
|
|
|
+ ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
|
|
|
+ ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
|
|
|
+ }
|
|
|
ftime(&startTime[gun_index][TMR_IDX_PWN_CHANGE]);
|
|
|
}
|
|
|
}
|
|
@@ -3410,14 +3434,19 @@ int main(void)
|
|
|
else
|
|
|
{
|
|
|
ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
|
|
|
- if(ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current)
|
|
|
+ if((ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current) ||
|
|
|
+ (ShmCharger->gun_info[gun_index].primaryMcuState.current_limit != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current))
|
|
|
{
|
|
|
if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
|
|
|
{
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PWN_CHANGE]) > TIMEOUT_SPEC_PWN_CHANGE)
|
|
|
{
|
|
|
- ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
|
|
|
- ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
|
|
|
+ if(ShmCharger->gun_info[gun_index].targetCurrent>0)
|
|
|
+ {
|
|
|
+ ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
|
|
|
+ ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
|
|
|
+ }
|
|
|
+
|
|
|
ftime(&startTime[gun_index][TMR_IDX_PWN_CHANGE]);
|
|
|
}
|
|
|
}
|
|
@@ -3477,7 +3506,10 @@ int main(void)
|
|
|
if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
|
|
|
{
|
|
|
ShmCharger->gun_info[gun_index].isChargerStopByCondition = NO;
|
|
|
- setRelay(gun_index, ON);
|
|
|
+ if(ShmCharger->gun_info[gun_index].targetCurrent>0)
|
|
|
+ setRelay(gun_index, ON);
|
|
|
+ else
|
|
|
+ setRelay(gun_index, OFF);
|
|
|
}
|
|
|
else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
|
|
|
{
|
|
@@ -3499,7 +3531,6 @@ int main(void)
|
|
|
setRelay(gun_index, OFF);
|
|
|
setRequest(gun_index, OFF);
|
|
|
ShmCharger->gun_info[gun_index].isChargerStopByCondition = YES;
|
|
|
-
|
|
|
}
|
|
|
else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
|
|
|
{
|
|
@@ -3528,7 +3559,10 @@ int main(void)
|
|
|
if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
|
|
|
{
|
|
|
ShmCharger->gun_info[gun_index].isChargerStopByCondition = NO;
|
|
|
- setRelay(gun_index, ON);
|
|
|
+ if(ShmCharger->gun_info[gun_index].targetCurrent>0)
|
|
|
+ setRelay(gun_index, ON);
|
|
|
+ else
|
|
|
+ setRelay(gun_index, OFF);
|
|
|
}
|
|
|
else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
|
|
|
{
|
|
@@ -3762,7 +3796,8 @@ int main(void)
|
|
|
!(ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy))) &&
|
|
|
!(!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE) && ((ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration > 0) ? (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration*60)) : (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60)))) &&
|
|
|
!(!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE) && ((ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy > 0) ? (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy)) : (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy)))) &&
|
|
|
- ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && (ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_STOP_MODE)))
|
|
|
+ (((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && (ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_START_MODE)) || (ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS))
|
|
|
+ )
|
|
|
{
|
|
|
setChargerMode(gun_index, SYS_MODE_CHARGING);
|
|
|
}
|