|
@@ -1721,7 +1721,7 @@ void InitEthernet()
|
|
|
{
|
|
|
if(isRouteFail())
|
|
|
{
|
|
|
- DEBUG_ERROR("eth0 not in route, restart eth0.\n");
|
|
|
+ //DEBUG_ERROR("eth0 not in route, restart eth0.\n");
|
|
|
system("/sbin/ifconfig eth0 down;/sbin/ifconfig eth0 up");
|
|
|
|
|
|
if((ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient==0))
|
|
@@ -3369,24 +3369,32 @@ void checkStopReason(uint8_t gun_index)
|
|
|
{
|
|
|
if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
{
|
|
|
- if(ShmOCPP16Data->MsMsg.bits.ResetReq)
|
|
|
+ if(!ocpp_get_starttransaction_result(gun_index))
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "DeAuthorized");
|
|
|
+ }
|
|
|
+ else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "EmergencyStop");
|
|
|
+ }
|
|
|
+ else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "EVDisconnected");
|
|
|
+ }
|
|
|
+ else if(ShmOCPP16Data->MsMsg.bits.ResetReq)
|
|
|
{
|
|
|
if(strcmp((char*)ShmOCPP16Data->Reset.Type, "Hard")==0)
|
|
|
sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "HardReset");
|
|
|
else
|
|
|
sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "SoftReset");
|
|
|
}
|
|
|
- else if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq)
|
|
|
- {
|
|
|
- sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Remote");
|
|
|
- }
|
|
|
else if(ShmCharger->gun_info[gun_index].rfidReq || ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop)
|
|
|
{
|
|
|
sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Local");
|
|
|
}
|
|
|
- else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
|
|
|
+ else if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq)
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "EVDisconnected");
|
|
|
+ sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Remote");
|
|
|
}
|
|
|
else if(ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON)
|
|
|
{
|
|
@@ -3404,24 +3412,42 @@ void checkStopReason(uint8_t gun_index)
|
|
|
}
|
|
|
else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
{
|
|
|
- if(ShmOCPP20Data->MsMsg.bits.ResetReq)
|
|
|
+ if(!ocpp_get_starttransaction_result(gun_index))
|
|
|
{
|
|
|
- if(strcmp((char*)ShmOCPP20Data->Reset.type, "Hard")==0)
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "HardReset");
|
|
|
- else
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "SoftReset");
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "DeAuthorized");
|
|
|
}
|
|
|
- else if(ShmOCPP20Data->CsMsg.bits[gun_index].RequestStopTransactionReq)
|
|
|
+ else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "Remote");
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "EmergencyStop");
|
|
|
+ }
|
|
|
+ else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "EVDisconnected");
|
|
|
+ }
|
|
|
+ else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GROUND_FAIL)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "GroundFault");
|
|
|
+ }
|
|
|
+ else if(ShmOCPP20Data->MsMsg.bits.ResetReq)
|
|
|
+ {
|
|
|
+ if(strcmp((char*)ShmOCPP20Data->Reset.type, "Immediate")==0)
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "ImmediateReset");
|
|
|
+ else
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "OnIdle");
|
|
|
}
|
|
|
else if(ShmCharger->gun_info[gun_index].rfidReq || ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop)
|
|
|
{
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "Local");
|
|
|
}
|
|
|
- else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
|
|
|
+ else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT) ||
|
|
|
+ (ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT) ||
|
|
|
+ (ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT))
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "EVDisconnected");
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "OvercurrentFault");
|
|
|
+ }
|
|
|
+ else if(ShmOCPP20Data->CsMsg.bits[gun_index].RequestStopTransactionReq)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "Remote");
|
|
|
}
|
|
|
else if(ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor == ON)
|
|
|
{
|
|
@@ -4865,6 +4891,7 @@ int main(void)
|
|
|
{
|
|
|
if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
|
|
|
{
|
|
|
+ checkStopReason(gun_index);
|
|
|
setChargerMode(gun_index, SYS_MODE_COMPLETE);
|
|
|
}
|
|
|
else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
|
|
@@ -5042,6 +5069,7 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
|
|
|
ShmCharger->gun_info[gun_index].isCCSWaitChangeDuty = OFF;
|
|
|
|
|
|
+ checkStopReason(gun_index);
|
|
|
setChargerMode(gun_index, SYS_MODE_COMPLETE);
|
|
|
}
|
|
|
|
|
@@ -5054,8 +5082,6 @@ int main(void)
|
|
|
setRequest(gun_index, OFF);
|
|
|
}
|
|
|
|
|
|
- checkStopReason(gun_index);
|
|
|
-
|
|
|
ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
ShmCharger->gun_info[gun_index].isAuthPassEnd = OFF;
|
|
|
ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
|