Browse Source

2022-03-28/Jerry Wang
Action:
1. improve ConnectWsServer() logic.
2. Correct the processWatchdog() timeout count target value.

File:
1. EVSE/Modularization/ocppfile/Module_OcppBackend.c
--> Action 1,2
1. EVSE/Modularization/ocppph/Module_OcppBackend.c
--> Action 1,2
1. EVSE/Modularization/ocpp20/Module_OcppBackend20.c
--> Action 1,2

Jerry Wang 3 năm trước cách đây
mục cha
commit
3c9b4856dc

+ 3 - 3
EVSE/Modularization/ocpp20/Module_OcppBackend20.c

@@ -467,7 +467,7 @@ void* ConnectWsServer(void* data)  //int ConnectWsServer()
 	if (!wsi_client)
 	{
 		DEBUG_ERROR("lws_client_connect_via_info NG\n");
-		goto end;
+		//goto end;
 	}
 
 	counterConnect=0;
@@ -961,7 +961,7 @@ void* processWatchdog()
 			lws_cancel_service(context);
 			lws_cancel_service_pt(wsi_client);
 
-			if(counterLwsRestart >= 2)
+			if(counterLwsRestart >= 3)
 			{
 				DEBUG_INFO("LWS watch dog timeout over 3 count.\n");
 				system("killall OcppBackend20");
@@ -972,7 +972,7 @@ void* processWatchdog()
 			refreshStartTimer(&startTime.startTimeDog);
 		}
 		
-		if(counterConnect >= 2)
+		if(counterConnect >= 3)
 		{
 			DEBUG_INFO("Connect OCPP server timeout over 3 count.\n");
 			system("killall OcppBackend20");

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

@@ -543,12 +543,11 @@ void* ConnectWsServer(void* data)  //int ConnectWsServer()
 #endif
 	}
 
-
 	wsi_client = lws_client_connect_via_info(&ConnInfo);
 	if (!wsi_client)
 	{
 		DEBUG_ERROR("lws_client_connect_via_info NG\n");
-		goto end;
+		//goto end;
 	}
 
 	counterConnect=0;
@@ -1263,7 +1262,7 @@ void* processWatchdog()
 			lws_cancel_service(context);
 			lws_cancel_service_pt(wsi_client);
 
-			if(counterLwsRestart >= 2)
+			if(counterLwsRestart >= 3)
 			{
 				DEBUG_INFO("LWS watch dog timeout over 3 count.\n");
 				system("killall OcppBackend");
@@ -1274,7 +1273,7 @@ void* processWatchdog()
 			refreshStartTimer(&startTime.startTimeDog);
 		}
 
-		if(counterConnect >= 2)
+		if(counterConnect >= 3)
 		{
 			DEBUG_INFO("Connect OCPP server timeout over 3 count.\n");
 			system("killall OcppBackend");

+ 5 - 5
EVSE/Modularization/ocppph/Module_OcppBackend.c

@@ -444,14 +444,14 @@ void* ConnectWsServer(void* data)  //int ConnectWsServer()
 	counterConnect += 1;
 
 	// If internet available synchronize datetime with ntp server
-	if(GetInternetConn() == 1)
+	/*if(GetInternetConn() == 1)
 	{
 		system("pkill ntpd");
 		DEBUG_INFO("NTP synchronize with Microsoft\n", system("/usr/sbin/ntpd -nqp time.windows.com &"));
 		DEBUG_INFO("NTP synchronize with China\n", system("/usr/sbin/ntpd -nqp cn.ntp.org.cn &"));
 		DEBUG_INFO("NTP synchronize with Taiwan\n", system("/usr/sbin/ntpd -nqp tock.stdtime.gov.tw &"));
 		DEBUG_INFO("NTP synchronize with Europe\n", system("/usr/sbin/ntpd -nqp 0.europe.pool.ntp.org &"));
-	}
+	}*/
 
 	if(context!=NULL)
 	{
@@ -546,7 +546,7 @@ void* ConnectWsServer(void* data)  //int ConnectWsServer()
 	if (!wsi_client)
 	{
 		DEBUG_ERROR("lws_client_connect_via_info NG\n");
-		goto end;
+		//goto end;
 	}
 
 	counterConnect=0;
@@ -1261,7 +1261,7 @@ void* processWatchdog()
 			lws_cancel_service(context);
 			lws_cancel_service_pt(wsi_client);
 
-			if(counterLwsRestart >= 2)
+			if(counterLwsRestart >= 3)
 			{
 				DEBUG_INFO("LWS watch dog timeout over 3 count.\n");
 				system("killall OcppBackendPH");
@@ -1272,7 +1272,7 @@ void* processWatchdog()
 			refreshStartTimer(&startTime.startTimeDog);
 		}
 
-		if(counterConnect >= 2)
+		if(counterConnect >= 3)
 		{
 			DEBUG_INFO("Connect OCPP server timeout over 3 count.\n");
 			system("killall OcppBackendPH");