Pārlūkot izejas kodu

[Improve][AW-CCS][main]

2021.03.30 / Folus Wen

Actions:
1. Before system mode change to SYS_MODE_COMPLETE call CheckStopReson() function.
2. StopReason determine condition improvement.

Files:
1. As follow commit history

Image version: D0.48.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 4 gadi atpakaļ
vecāks
revīzija
6f8db9f7ba

+ 45 - 19
EVSE/Projects/AW-CCS/Apps/main.c

@@ -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;

BIN
EVSE/Projects/AW-Regular/Images/root/Module_AlarmDetect


BIN
EVSE/Projects/AW-Regular/Images/root/Module_FactoryConfig


BIN
EVSE/Projects/AW-Regular/Images/root/Module_InternalComm