浏览代码

[Improve][Modularization][Module_OcppBackend]

2021.01.07 / Folus Wen

Actions:
1. OcppConnStatus variable operation by SetOcppConnStatus().

Files:
1. As follow commit history

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

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 4 年之前
父节点
当前提交
ca4b6191be

+ 2 - 2
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -4943,7 +4943,7 @@ void CheckSystemValue(void)
 			(authorizeRetryTimes >= 3))
 	{
 		authorizeRetryTimes = 0;
-		ShmOCPP20Data->OcppConnStatus = 0;  // ocpp off-line
+		SetOcppConnStatus(FALSE);
 		server_sign = FALSE;
 	}
 	else if((server_sign == FALSE) &&
@@ -14716,7 +14716,7 @@ void handleBootNotificationResponse(char *payload, int gun_index)
 	//==============================================
 	system("/sbin/hwclock -w --systohc");
 
-	ShmOCPP20Data->OcppConnStatus = ON; ////0: disconnected, 1: connected
+	SetOcppConnStatus(TRUE);
 	ShmOCPP20Data->SpMsg.bits.BootNotificationConf = ON;
 }
 

+ 2 - 4
EVSE/Modularization/ocpp20/Module_OcppBackend20.c

@@ -1163,8 +1163,6 @@ int main(void)
 			// On line operation
 			if(GetServerSign() == TRUE)
 			{
-				SetOcppConnStatus(TRUE);
-
 				// Send message from queue
 				if((req_SendQueue == 1) && isWebsocketSendable)
 				{
@@ -1183,9 +1181,9 @@ int main(void)
 					SetHeartBeatWithNOResponse();
 				}
 
-				if((changeChageWebSocketPingInterval == TRUE) || (GetInternetConn() == 0))
+				if((changeChageWebSocketPingInterval == TRUE) || (GetOcppConnStatus() == 0))
 				{
-					DEBUG_INFO("GetInternetConn() = %d\n", GetInternetConn());
+					DEBUG_INFO("GetOcppConnStatus() = %d\n", GetOcppConnStatus());
 					changeChageWebSocketPingInterval = FALSE;
 					lws_context_destroy(context);
 					ConnectionEstablished = 0;

+ 2 - 2
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -2345,7 +2345,7 @@ void CheckSystemValue(void)
 		else if((server_sign == TRUE) && (ShmOCPP16Data->SpMsg.bits.AuthorizeReq == 1) && (authorizeRetryTimes >= 3))
 		{
 			authorizeRetryTimes = 0;
-			ShmOCPP16Data->OcppConnStatus = 0;  // ocpp offline
+			SetOcppConnStatus(FALSE);
 			server_sign = FALSE;
 		}
 		else if((server_sign == FALSE) && (strcmp((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[LocalAuthorizeOffline].ItemData, "TRUE") == 0)&&(strcmp((const char *)ShmOCPP16Data->ConfigurationTable.LocalAuthListManagementProfile[LocalAuthListEnabled].ItemData, "TRUE") == 0)&&(ShmOCPP16Data->OcppConnStatus == 0)&& (ShmOCPP16Data->SpMsg.bits.AuthorizeReq == 1))
@@ -11018,7 +11018,7 @@ void handleBootNotificationResponse(char *payload, int gun_index)
 	//==============================================
 	system("/sbin/hwclock -w --systohc");
 
-	ShmOCPP16Data->OcppConnStatus = 1; ////0: disconnected, 1: connected
+	SetOcppConnStatus(TRUE);
 	ShmOCPP16Data->SpMsg.bits.BootNotificationConf = 1;
 }
 

+ 2 - 4
EVSE/Modularization/ocppfiles/Module_OcppBackend.c

@@ -1475,8 +1475,6 @@ int main(void)
 			// On line operation
 			if(GetServerSign() == TRUE)
 			{
-				SetOcppConnStatus(TRUE);
-
 				// Send message from queue
 				if((req_SendQueue == 1) && isWebsocketSendable)
 				{
@@ -1496,9 +1494,9 @@ int main(void)
 					DEBUG_WARN("Heartbeat re-send over 30 count.\n");
 				}
 
-				if((changeChageWebSocketPingInterval == TRUE) || ((GetInternetConn() == 0) && (GetOcppConnStatus() == 0)))
+				if((changeChageWebSocketPingInterval == TRUE) || (GetOcppConnStatus() == 0))
 				{
-					DEBUG_INFO("GetInternetConn() = %d\n", GetInternetConn());
+					DEBUG_INFO("GetOcppConnStatus() = %d\n", GetOcppConnStatus());
 
 					if(changeChageWebSocketPingInterval)
 					{

+ 1 - 0
EVSE/Projects/AW-CCS/Apps/main.c

@@ -1582,6 +1582,7 @@ void InitEthernet()
 	system(tmpbuf);
 	system("ifconfig lo up &");
 	system("/sbin/ifconfig eth0:1 192.168.201.201 netmask 255.255.255.248 up &");
+	system("/sbin/ethtool -s eth0 speed 10 duplex full autoneg off");
 
     //Run DHCP client if enabled
 	system("killall udhcpc");