|
@@ -2321,7 +2321,9 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
|
|
|
#ifdef ENABLE_CCS
|
|
|
ShmCharger->isCcsEnable = ON;
|
|
|
#endif
|
|
|
-
|
|
|
+
|
|
|
+ DEBUG_INFO("Is CCS Enable: %s \n",((ShmCharger->isCcsEnable == ON)?"YES":"NO"));
|
|
|
+
|
|
|
RatedCurrentParsing((char*)ShmSysConfigAndInfo->SysConfig.ModelName, &modelnameInfo);
|
|
|
|
|
|
return PASS;
|
|
@@ -2607,7 +2609,7 @@ void InitEthernet()
|
|
|
// Reset wifi function
|
|
|
if((ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 1))
|
|
|
{
|
|
|
- if((!ShmSysConfigAndInfo->SysInfo.OcppConnStatus) &&
|
|
|
+ if((!ShmSysConfigAndInfo->SysInfo.OcppConnStatus) &&
|
|
|
(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi == ON) &&
|
|
|
(ShmStatusCodeData->InfoCode.InfoEvents.bits.ApDisconnectViaWiFi == ON))
|
|
|
{
|
|
@@ -2615,7 +2617,7 @@ void InitEthernet()
|
|
|
{
|
|
|
DEBUG_INFO("Wifi [Station] mode: Reset wifi power. \n");
|
|
|
DEBUG_INFO("The wifi interface may not be found. \n");
|
|
|
-
|
|
|
+
|
|
|
system("echo 1 > /sys/class/gpio/gpio59/value");
|
|
|
sleep(3);
|
|
|
system("echo 0 > /sys/class/gpio/gpio59/value");
|
|
@@ -2628,7 +2630,7 @@ void InitEthernet()
|
|
|
else
|
|
|
{
|
|
|
refreshStartTimer(&startTime[0][TMR_IDX_RESET_WIFI]);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
else if((ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 2))
|
|
|
{
|
|
@@ -2638,7 +2640,7 @@ void InitEthernet()
|
|
|
{
|
|
|
DEBUG_INFO("Wifi [Access Point] mode: reset wifi power. \n");
|
|
|
DEBUG_INFO("The wifi interface may not be found. \n");
|
|
|
-
|
|
|
+
|
|
|
system("echo 1 > /sys/class/gpio/gpio59/value");
|
|
|
sleep(3);
|
|
|
system("echo 0 > /sys/class/gpio/gpio59/value");
|
|
@@ -2651,7 +2653,7 @@ void InitEthernet()
|
|
|
else
|
|
|
{
|
|
|
refreshStartTimer(&startTime[0][TMR_IDX_RESET_WIFI]);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -4707,7 +4709,7 @@ void checkHandshakeCountdown(uint8_t gun_index)
|
|
|
switch(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus)
|
|
|
{
|
|
|
case SYS_MODE_IDLE:
|
|
|
-
|
|
|
+
|
|
|
if(ShmCharger->gun_info[ShmCharger->gun_selectd].isHandshakeTimerRefresh == YES)
|
|
|
refreshStartTimer(&startTime[0][TMR_IDX_GUN_DETECT]);
|
|
|
else
|
|
@@ -4720,12 +4722,12 @@ void checkHandshakeCountdown(uint8_t gun_index)
|
|
|
else
|
|
|
refreshStartTimer(&startTime[0][TMR_IDX_GUN_DETECT]);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
case SYS_MODE_PREPARING:
|
|
|
-
|
|
|
+
|
|
|
ShmCharger->timeoutSpec.Handshake_Timeout = ((ocpp_get_connection_timeout()) - getDiffSecNow(startTime[gun_index][TMR_IDX_HANDSHAKING]));
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -5231,9 +5233,9 @@ int main(void)
|
|
|
{
|
|
|
if(ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage*ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent)/1000;
|
|
|
-
|
|
|
+
|
|
|
if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower <= 1.0)
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = 0;
|
|
|
}
|
|
@@ -5247,7 +5249,7 @@ int main(void)
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = (((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage*ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent)/1000) +
|
|
|
((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL2*ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrentL2)/1000) +
|
|
|
((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL3*ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrentL3)/1000));
|
|
|
-
|
|
|
+
|
|
|
if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower <= 1.0)
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = 0;
|
|
|
}
|
|
@@ -5426,6 +5428,7 @@ int main(void)
|
|
|
setRelay(gun_index, OFF);
|
|
|
setRequest(gun_index,OFF);
|
|
|
ShmCharger->gun_info[gun_index].isGunPlugged = NO;
|
|
|
+ ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = NO;
|
|
|
ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart = OFF;
|
|
|
ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
|
|
@@ -5452,9 +5455,9 @@ int main(void)
|
|
|
//if(ShmCharger->isCcsEnable)system("pkill Module_CCS");
|
|
|
DB_Check_Record_Buf(localDb, gun_index);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
checkHandshakeCountdown(gun_index);
|
|
|
-
|
|
|
+
|
|
|
// LED status in Idle mode
|
|
|
if(!ShmCharger->isAuthrizing)
|
|
|
{
|
|
@@ -5593,7 +5596,7 @@ int main(void)
|
|
|
//system("/root/Module_CCS &");
|
|
|
}
|
|
|
else
|
|
|
- #endif
|
|
|
+ #endif
|
|
|
sleep(4);
|
|
|
|
|
|
setChargerMode(gun_index, SYS_MODE_PREPARING);
|
|
@@ -5669,6 +5672,7 @@ int main(void)
|
|
|
(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C))
|
|
|
{
|
|
|
ShmCharger->gun_info[gun_index].isGunPlugged = YES;
|
|
|
+ ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = NO;
|
|
|
|
|
|
switch(ShmCharger->gun_info[gun_index].ccsHandshakeState)
|
|
|
{
|
|
@@ -5749,7 +5753,7 @@ int main(void)
|
|
|
{
|
|
|
//chang PWM duty to BS
|
|
|
if((ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)&&(ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current!=CCS_PWM_DUTY_5))
|
|
|
- {
|
|
|
+ {
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current =CCS_PWM_DUTY_5; //((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 = ON;
|
|
|
DEBUG_INFO("ccsHandshakeState = HANDSHAKE_CCS (set 5% duty)\n");
|
|
@@ -5762,7 +5766,7 @@ int main(void)
|
|
|
{
|
|
|
//chang PWM duty to BS
|
|
|
if((ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)&&(ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current!=CCS_PWM_DUTY_5))
|
|
|
- {
|
|
|
+ {
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current =CCS_PWM_DUTY_5; //((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 = ON;
|
|
|
}
|
|
@@ -5779,7 +5783,7 @@ int main(void)
|
|
|
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;
|
|
|
- }
|
|
|
+ }
|
|
|
#endif
|
|
|
break;
|
|
|
case HANDSHAKE_CP_STATE_E:
|
|
@@ -5919,7 +5923,7 @@ int main(void)
|
|
|
if(ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_START_MODE)//powerDelivery
|
|
|
{
|
|
|
if(ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn == OFF)
|
|
|
- {
|
|
|
+ {
|
|
|
setRelay(gun_index,ON);
|
|
|
ShmCharger->gun_info[gun_index].isCCSStartTransation = ON;
|
|
|
DEBUG_INFO("HANDSHAKE_HLC_MODE:setRelay ON\n");
|
|
@@ -6085,7 +6089,14 @@ int main(void)
|
|
|
}*/
|
|
|
}
|
|
|
|
|
|
- if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A))
|
|
|
+ {
|
|
|
+ ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = YES;
|
|
|
+ DEBUG_INFO("The charging gun is unplugged under charging mode. \n");
|
|
|
+ }
|
|
|
+
|
|
|
+ if((ShmCharger->gun_info[gun_index].isGunUnpluggedBefore == YES) ||
|
|
|
+ (ShmCharger->gun_info[gun_index].rfidReq == ON) ||
|
|
|
(ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop == ON) ||
|
|
|
ocpp_get_remotestop(gun_index) ||
|
|
|
(ocpp_get_connection_status() && !ocpp_get_starttransaction_result(gun_index)) ||
|
|
@@ -6097,7 +6108,7 @@ int main(void)
|
|
|
((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_RENEGOTIATE_MODE)) ||
|
|
|
((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && (ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_STANDBY_MODE)) ||
|
|
|
- ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && ((49 <= ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus) && (ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus <= 255)))
|
|
|
+ ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && ((49 <= ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus) && (ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus <= 255)))
|
|
|
)
|
|
|
{
|
|
|
//printf("EVChargeProgress=0x%x, PresentMsgFlowStatus=0x%x\n",ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress,ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus);
|
|
@@ -6291,6 +6302,9 @@ int main(void)
|
|
|
|
|
|
getDateTimeString((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime);
|
|
|
ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
|
|
|
+
|
|
|
+ if(ShmCharger->gun_info[gun_index].isGunUnpluggedBefore == YES)
|
|
|
+ setRelay(gun_index, OFF);
|
|
|
}
|
|
|
|
|
|
refreshStartTimer(&endChargingTime[gun_index]);
|
|
@@ -6307,7 +6321,7 @@ int main(void)
|
|
|
(ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop == ON) ||
|
|
|
ocpp_get_remotestop(gun_index) ||
|
|
|
(ocpp_get_connection_status() && !ocpp_get_starttransaction_result(gun_index)) ||
|
|
|
- ((ShmCharger->gun_info[gun_index].chargingMode != CHARGING_MODE_SOCKETE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) && ocpp_get_StopTransactionOnEVSideDisconnect()) ||
|
|
|
+ ((ShmCharger->gun_info[gun_index].chargingMode != CHARGING_MODE_SOCKETE) && ((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) || (ShmCharger->gun_info[gun_index].isGunUnpluggedBefore == YES)) && ocpp_get_StopTransactionOnEVSideDisconnect()) ||
|
|
|
((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_SOCKETE) && !ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn) ||
|
|
|
ocpp_get_reset_req() ||
|
|
|
ocpp_get_unlocker_req(gun_index) ||
|
|
@@ -6379,7 +6393,8 @@ int main(void)
|
|
|
if(!ocpp_get_auth_result(YES, gun_index))
|
|
|
ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
|
|
|
- if((((ShmCharger->gun_info[gun_index].chargingMode != CHARGING_MODE_SOCKETE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)) || ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_SOCKETE) && ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn)) &&
|
|
|
+ if((ShmCharger->gun_info[gun_index].isGunUnpluggedBefore != YES) &&
|
|
|
+ (((ShmCharger->gun_info[gun_index].chargingMode != CHARGING_MODE_SOCKETE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)) || ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_SOCKETE) && ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn)) &&
|
|
|
(ShmCharger->gun_info[gun_index].rfidReq != ON) &&
|
|
|
(ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop != ON) &&
|
|
|
!ocpp_get_remotestop(gun_index) &&
|
|
@@ -6432,6 +6447,7 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
|
|
|
ocpp_set_remotestop(gun_index, OFF);
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStop = OFF;
|
|
|
+ ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = NO;
|
|
|
|
|
|
DB_Insert_Record(localDb, gun_index);
|
|
|
setChargerMode(gun_index, SYS_MODE_IDLE);
|