Parcourir la source

[Improve][AW-CCS][main.c]
2022-08-12 / EASON YANG
Action:
1. Improve: When remote start charging and the system needs copy UserId into StartUserId for compaer RFID card.

File:
1. main.c
Action 1

FIRMWARE VERSION: B0.62.XX.XXXX.PX

8009 il y a 2 ans
Parent
commit
040926cc89
1 fichiers modifiés avec 17 ajouts et 2 suppressions
  1. 17 2
      EVSE/Projects/AW-CCS/Apps/main.c

+ 17 - 2
EVSE/Projects/AW-CCS/Apps/main.c

@@ -680,10 +680,20 @@ void ocpp_copy_userid_from_remotestart(uint8_t gun_index)
 	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, ARRAY_SIZE(ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag));
+
+		DEBUG_INFO("==========================================\n");
+		DEBUG_INFO("Copy IdTag into UserId. \n");
+		DEBUG_INFO("IdTag : [%s] ---> UserId : [%s] . \n", ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, ShmSysConfigAndInfo->SysConfig.UserId);
+		DEBUG_INFO("==========================================\n");
 	}
 	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 	{
 		memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP20Data->RequestStartTransaction[gun_index].idToken.idToken, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+
+		DEBUG_INFO("==========================================\n");
+		DEBUG_INFO("Copy idToken into UserId. \n");
+		DEBUG_INFO("idToken : [%s] ---> UserId : [%s]. \n", ShmOCPP20Data->RequestStartTransaction[gun_index].idToken.idToken, ShmSysConfigAndInfo->SysConfig.UserId);
+		DEBUG_INFO("==========================================\n");
 	}
 }
 
@@ -5184,7 +5194,7 @@ void checkRfidAuthrize()
 								else
 									setLedMotion(gun_index,LED_ACTION_AUTHED);
 
-								if((((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_RESERVATION)) && (((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)) || (ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn == ON))) ||
+								if((((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_RESERVATION)) && (((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)) || (ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn == ON) || (modelnameInfo.GetGunCount == 1))) ||
 								   ((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_PREPARING) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B) && (ShmCharger->gun_selectd == gun_index)) ||
 								   (((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_CHARGING) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_TERMINATING)) && (ShmCharger->gun_selectd == gun_index))
 								   )
@@ -6084,6 +6094,7 @@ int main(void)
 										if(ocpp_get_auth_result(gun_index))
 										{
 											memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+											DEBUG_INFO("[START_METHOD_BACKEND] StartUserId : %s \n",ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
 
 											DEBUG_INFO("Authorize pass.\n");
 											setSpeaker(ON,SPEAKER_SHORT);
@@ -6128,6 +6139,9 @@ int main(void)
 										//system("/root/Module_CCS &");
 									}
 
+									memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+									DEBUG_INFO("[START_METHOD_BACKEND] StartUserId : %s \n",ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
+
 									setChargerMode(gun_index, SYS_MODE_PREPARING);
 								}
 								break;
@@ -6143,6 +6157,7 @@ int main(void)
 									  (!ocpp_get_connection_status() && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)))
 									{
 										memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+										DEBUG_INFO("[START_METHOD_EVCCID] StartUserId : %s \n",ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
 
 										ShmCharger->gun_info[gun_index].resultAuthorization = VALIDATED_RFID;
 										DEBUG_INFO("Authorize pass [EVCCID].\n");
@@ -6564,7 +6579,7 @@ int main(void)
 					}
 
 					// Use RFID card to stop handshaking
-					if((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchPresentUser(gun_index))
+					if((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchStartUser(gun_index))
 					{
 						DEBUG_INFO("Use RFID card to stop handshaking.\n");
 						//Cancel CCS task negotiating