Эх сурвалжийг харах

[Improve][Noodoe][main.c][Module_ConfigTools.c]
2022-04-29 / EASON YANG
Action
1. Improve: Fixed wrong variable name.
2. Improve: Ethernet reconnection logic.

File
1. main.c
Action 2

2. Module_ConfigTools.c
Action 1

FIRMWARE VERSION: V0.55.XX.XXXX.NX

8009 2 жил өмнө
parent
commit
0aaae8a9c7

+ 2 - 2
EVSE/Projects/Noodoe/Apps/Module_ConfigTools.c

@@ -517,14 +517,14 @@ int main(void)
 			{
 				memset(cmd, 0x00, ARRAY_SIZE(cmd));
 				printf("\n ***** localloadbalance ***************************");
-				printf("\n  Current local loading balance: %d", ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging);
+				printf("\n  Current local loading balance: %d", ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing);
 				printf("\n  0: Disable.");
 				printf("\n  1: Enable.");
 				printf("\n **************************************************");
 				printf("\n  Please input local load balance mode: ");
 				scanf("%s", &cmd[0]);
 
-				ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd):0);
+				ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd):0);
 				if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
 					DEBUG_INFO("Local loading balance: Enable\n");
 				else

+ 22 - 19
EVSE/Projects/Noodoe/Apps/main.c

@@ -1880,26 +1880,29 @@ void InitEthernet()
 				if(cnt_pingDNS_Fail >= 3)
 				{
 					ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=ON;
-					if((ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient==0))
+					if(!ShmSysConfigAndInfo->SysInfo.OcppConnStatus)
 					{
-						system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
-						sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
-						system(tmpbuf);
-					}
-					else
-					{
-						system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
-						memset(tmpbuf,0,256);
-						sprintf(tmpbuf,"/sbin/ifconfig eth0 %s netmask %s up &",
-								ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
-								ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
-						system(tmpbuf);
-						memset(tmpbuf,0,256);
-						sprintf(tmpbuf,"route add default gw %s eth0 &",
-						ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
-						system(tmpbuf);
+						if((ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient==0))
+						{
+							system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+							sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
+							system(tmpbuf);
+						}
+						else
+						{
+							system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+							memset(tmpbuf,0,256);
+							sprintf(tmpbuf,"/sbin/ifconfig eth0 %s netmask %s up &",
+									ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
+									ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
+							system(tmpbuf);
+							memset(tmpbuf,0,256);
+							sprintf(tmpbuf,"route add default gw %s eth0 &",
+							ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
+							system(tmpbuf);
+						}
+						cnt_pingDNS_Fail = 0;
 					}
-					cnt_pingDNS_Fail = 0;
 				}
 				else
 				{
@@ -2206,7 +2209,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, "V0.54.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "V0.55.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)