Эх сурвалжийг харах

2021-05-03 / Eason Yang
Action
1. Added : Added stop reason for EmergencyStop. SYS_MODE_COMPLETE.
2. Improve : If use different RFID card between start charging and stop charging. The system should fill in correct idTag informtation to the central system.

File
1. main.c
Action 1
Action 2

Version : V0.52.XX.XXXX.XX

8009 3 жил өмнө
parent
commit
ce57ad4a9f

+ 16 - 2
EVSE/Projects/Noodoe/Apps/main.c

@@ -3532,6 +3532,7 @@ int main(void)
 						sleep(3);
 					}
 
+					memset(ShmOCPP16Data->StopTransaction[gun_index].IdTag, 0x00, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
 					if(ShmOCPP16Data->MsMsg.bits.ResetReq)
 					{
 						if(strcmp((char*)ShmOCPP16Data->Reset.Type, "Hard")==0)
@@ -3546,6 +3547,17 @@ int main(void)
 					else if(ShmCharger->gun_info[gun_index].rfidReq || ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop)
 					{
 						sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Local");
+						
+						if(!isMatchStartUser(gun_index))
+						{
+							memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
+						}
+						else
+						{
+							memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
+						}
+
+						DEBUG_INFO("Gun-%d [ IdTag ] : %s \n", gun_index, ShmOCPP16Data->StopTransaction[gun_index].IdTag);
 					}
 					else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
 					{
@@ -3555,6 +3567,10 @@ int main(void)
 					{
 						sprintf((char*)ShmOCPP16Data->StopTransaction[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].StopReason, "UnlockCommand");
 					}
+					else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)
+					{
+						sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "EmergencyStop");
+					}
 					else
 					{
 						sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Other");
@@ -3562,9 +3578,7 @@ int main(void)
 
 					DEBUG_INFO("Gun-%d : StopReason [ %s ]...\n.",gun_index,ShmOCPP16Data->StopTransaction[gun_index].StopReason);
 
-					memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
 					ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption = (ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100.0);
-					
 					ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq = ON;
 					ShmCharger->gun_info[gun_index].rfidReq = OFF;
 					ShmCharger->gun_info[gun_index].isAuthPassEnd = OFF;