瀏覽代碼

2020-06-29 / Eason Yang
1.Change : main.c
Reason :
a) Fixed : InitEthernet() InternetConn logic
b) Fixed : isReachableInternet() sprintf(cmd, ping -c 1 -w 3 -I eth0 %s, valid_Internet[idx])
c) Fixed : if ocpp URL is empty kill Module_OcppBackend
d) Fixed : Whitelist logic at begining.
e) Added : isMatchStartUser(gun_index) into Charging mode.
f) Rename : Version
Version :B0.39.XX.XXXX.XX

8009 4 年之前
父節點
當前提交
9bca7d5fca

+ 32 - 14
EVSE/Projects/Noodoe/Apps/main.c

@@ -974,7 +974,6 @@ void InitEthernet()
 		{
 			if(isReachableInternet() == PASS)
 			{
-				ShmSysConfigAndInfo->SysInfo.InternetConn = ON;
 				ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=OFF;
 				cnt_pingDNS_Fail = 0;
 			}
@@ -982,10 +981,20 @@ void InitEthernet()
 			{
 				if(++cnt_pingDNS_Fail > 3)
 				{
-					ShmSysConfigAndInfo->SysInfo.InternetConn = OFF;
 					ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=ON;
 				}
 			}
+			
+			if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet &&
+			   ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi &&
+			   ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi)
+			{
+				ShmSysConfigAndInfo->SysInfo.InternetConn = OFF;
+			}
+			else
+			{
+				ShmSysConfigAndInfo->SysInfo.InternetConn = ON;
+			}
 
 			sleep(5);
 		}
@@ -1181,7 +1190,7 @@ void get_firmware_version(unsigned char gun_index)
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.38.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.39.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -1636,8 +1645,7 @@ int isReachableInternet()
 
 	for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
 	{
-		strcpy(cmd, "ping -c 1 -w 3 ");
-		strcat(cmd, valid_Internet[idx]);
+		sprintf(cmd, "ping -c 1 -w 3 -I eth0 %s", valid_Internet[idx]);
 		fp = popen(cmd, "r");
 		if(fp != NULL)
 		{
@@ -1884,10 +1892,13 @@ void checkTask()
 		system("/root/Module_EventLogging &");
 	}
 
-	if(system("pidof -s OcppBackend > /dev/null") != 0)
+	if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0)
 	{
-		DEBUG_INFO("OcppBackend not running, restart it.\r\n");
-		system("/root/OcppBackend &");
+		if(system("pidof -s OcppBackend > /dev/null") != 0)
+		{
+			DEBUG_INFO("OcppBackend not running, restart it.\r\n");
+			system("/root/OcppBackend &");
+		}
 	}
 
 	if(system("pidof -s Module_AlarmDetect > /dev/null") != 0)
@@ -2250,6 +2261,13 @@ int main(void)
 
 						// Set max current to rating current
 						ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+						
+						// If Web Server OPCC URL is empty kill Module_OcppBackend
+						if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0)
+						{
+							DEBUG_INFO("URL is empty kill Module_OcppBackend...\r\n");
+							system ("pkill OcppBackend");
+						}
 
 						// If rotate switch equal zero, the system needs to change Debug mode
 						if(ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch == 0)
@@ -2434,7 +2452,7 @@ int main(void)
 							case START_METHOD_RFID:
 								if((ShmOCPP16Data->SpMsg.bits.AuthorizeConf) ||
 								   (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)) ||
-								   (!ShmOCPP16Data->OcppConnStatus && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
+								   (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
 								   (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_NOCHARGE))
 								{
 									if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
@@ -2606,9 +2624,9 @@ int main(void)
 									DEBUG_INFO("End request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
 									DEBUG_INFO("Start method : %d...\r\n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
 
-									if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID)
-									|| (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND)
-									|| (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE))
+									if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID) ||
+									   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND) ||
+									   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE))
 									{
 										switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
 										{
@@ -2670,8 +2688,8 @@ int main(void)
 								}
 							}
 
-							//
-							if(ShmCharger->gun_info[gun_index].isAuthPassEnd)
+							// If Authorize and Rfid card match with start User, The system should terminating to the end
+							if(ShmCharger->gun_info[gun_index].isAuthPassEnd || isMatchStartUser(gun_index))
 								setChargerMode(gun_index, SYS_MODE_TERMINATING);
 						}
 						else

二進制
EVSE/Projects/Noodoe/Images/FactoryDefaultConfig.bin


二進制
EVSE/Projects/Noodoe/Images/MLO


二進制
EVSE/Projects/Noodoe/Images/ramdisk.gz


二進制
EVSE/Projects/Noodoe/Images/u-boot-spl.bin


二進制
EVSE/Projects/Noodoe/Images/u-boot.img


二進制
EVSE/Projects/Noodoe/Images/zImage


二進制
EVSE/rootfs/root/Module_PhBackend


+ 1 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version

@@ -1 +1 @@
-7
+8