浏览代码

[Improve][AW-Regular][main.c]
2022-08-11 / EASON YANG
Action:
1. Improve : checkUnlocker() function. Onlt accetpted socket model unlock connector lock.

File:
1. main.c
Action 1

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

8009 2 年之前
父节点
当前提交
85891f1165
共有 1 个文件被更改,包括 30 次插入6 次删除
  1. 30 6
      EVSE/Projects/AW-Regular/Apps/main.c

+ 30 - 6
EVSE/Projects/AW-Regular/Apps/main.c

@@ -3688,10 +3688,18 @@ void checkUnlocker(uint8_t gun_index)
 		{
 			ShmOCPP16Data->CsMsg.bits[gun_index].UnlockConnectorReq = OFF;
 
-			sprintf((char*)ShmOCPP16Data->UnlockConnector[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].ResponseStatus, "NotSupported");
-			ShmOCPP16Data->CsMsg.bits[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].UnlockConnectorConf = ON;
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[9-gun_index] == '4')
+			{
+				sprintf((char*)ShmOCPP16Data->UnlockConnector[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].ResponseStatus, "Unlocked");
+				ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor = ON;
+			}
+			else
+			{
+				sprintf((char*)ShmOCPP16Data->UnlockConnector[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].ResponseStatus, "NotSupported");
+				ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor = OFF;
+			}
 
-			ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor = ON;
+			ShmOCPP16Data->CsMsg.bits[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].UnlockConnectorConf = ON;
 		}
 	}
 	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
@@ -3700,10 +3708,26 @@ void checkUnlocker(uint8_t gun_index)
 		{
 			ShmOCPP20Data->CsMsg.bits[gun_index].UnlockConnectorReq = OFF;
 
-			sprintf((char*)ShmOCPP20Data->UnlockConnector[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].Response_status, "NotSupported");
-			ShmOCPP20Data->CsMsg.bits[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].UnlockConnectorConf = ON;
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[9-gun_index] == '4')
+			{
+				if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_CHARGING)
+				{
+					sprintf((char*)ShmOCPP20Data->UnlockConnector[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].Response_status, "OngoingAuthorizedTransaction");
+					ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor = OFF;
+				}
+				else
+				{
+					sprintf((char*)ShmOCPP20Data->UnlockConnector[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].Response_status, "Unlocked");
+					ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor = ON;
+				}
+			}
+			else
+			{
+				sprintf((char*)ShmOCPP20Data->UnlockConnector[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].Response_status, "UnlockFailed");
+				ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor = OFF;
+			}
 
-			ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor = ON;
+			ShmOCPP20Data->CsMsg.bits[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].UnlockConnectorConf = ON;
 		}
 	}
 }