Browse Source

[Improve][AW-Regular][main.c]
2022-09-26/EASON YANG
Action:
1. Improve: checkStopReason() function. Copy StartUserId into IdTag. EmergencyStop, HardReset amd SoftReset.
2. Improve: checkStopReason() function. Copy StartUserId into idToken. EmergencyStop and Immediate.

File:
1. main.c
Action 1
Action 2

FIRMWARE VERSION: V0.71.XX.XXXX.PX

8009 2 years ago
parent
commit
ba6cad1b79
1 changed files with 9 additions and 0 deletions
  1. 9 0
      EVSE/Projects/AW-Regular/Apps/main.c

+ 9 - 0
EVSE/Projects/AW-Regular/Apps/main.c

@@ -4059,6 +4059,7 @@ void checkStopReason(uint8_t gun_index)
 		else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)
 		{
 			sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "EmergencyStop");
+			memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
 		}
 		else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) || (ShmCharger->gun_info[gun_index].isGunUnpluggedBefore == YES))
 		{
@@ -4069,9 +4070,15 @@ void checkStopReason(uint8_t gun_index)
 		else if(ShmOCPP16Data->MsMsg.bits.ResetReq)
 		{
 			if(strcmp((char*)ShmOCPP16Data->Reset.Type, "Hard")==0)
+			{
 				sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "HardReset");
+				memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
+			}
 			else
+			{
 				sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "SoftReset");
+				memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
+			}
 		}
 		else if(ShmCharger->gun_info[gun_index].rfidReq || ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop)
 		{
@@ -4117,6 +4124,7 @@ void checkStopReason(uint8_t gun_index)
 		else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)
 		{
 			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "EmergencyStop");
+			memcpy((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId));
 		}
 		else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) || (ShmCharger->gun_info[gun_index].isGunUnpluggedBefore == YES))
 		{
@@ -4130,6 +4138,7 @@ void checkStopReason(uint8_t gun_index)
 		else if((ShmOCPP20Data->MsMsg.bits.ResetReq) && (strcmp((char*)ShmOCPP20Data->Reset.type, "Immediate")==0))
 		{
 			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "ImmediateReset");
+			memcpy((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId));
 		}
 		else if(ShmCharger->gun_info[gun_index].rfidReq || ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop)
 		{