Ver Fonte

[Improve][AW-Regular][main.c]
2022-06-06 / EASON YANG
Action
1.Improve: isReachableInternet() function. Get ip address and net mask.

File
1. main.c
Action 1

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

8009 há 2 anos atrás
pai
commit
cade95cf56
1 ficheiros alterados com 2 adições e 10 exclusões
  1. 2 10
      EVSE/Projects/AW-Regular/Apps/main.c

+ 2 - 10
EVSE/Projects/AW-Regular/Apps/main.c

@@ -2985,18 +2985,10 @@ int isReachableInternet()
 			if (strstr(buf, "inet addr:") > 0)
 			{
 				sscanf(buf, "%*s%s", tmp);
-				substr(tmp, tmp, strspn(tmp, "addr:"), strlen(buf)-strspn(tmp, "addr:"));
-				if (strcmp(tmp, (char *)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress) != 0)
-				{
-					strcpy((char *) ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress, tmp);
-				}
+				substr((char*)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress, tmp, strspn(tmp, "addr:"), strlen(tmp)-strspn(tmp, "addr:"));
 
 				sscanf(buf, "%*s%*s%*s%s", tmp);
-				substr(tmp, tmp, strspn(tmp, "Mask:"), strlen(buf)-strspn(tmp, "Mask:"));
-				if (strcmp(tmp, (char *)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress) != 0)
-				{
-					strcpy((char *) ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress, tmp);
-				}
+				substr((char*)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress, tmp, strspn(tmp, "Mask:"), strlen(tmp)-strspn(tmp, "Mask:"));
 			}
 		}
 	}