Ver Fonte

2020-07-22 / Eason Yang
1.Change : main.c
Reason :
a) Rename : version
b) Added : replace ip address, when ethernet was reeived ip address from router
c) Added : clean ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status before ShmOCPP16Data->SpMsg.bits.AuthorizeReq on.
Version : B0.52.XX.XXXX.XX

8009 há 4 anos atrás
pai
commit
31a6aa0c57

+ 26 - 3
EVSE/Projects/AW-Regular/Apps/main.c

@@ -1187,7 +1187,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.51.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.52.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -1638,7 +1638,7 @@ int isReachableInternet()
 	FILE *fp;
 	char cmd[256];
 	char buf[512];
-	//char tmp[512];
+	char tmp[512];
 	
 	if(ShmOCPP16Data->OcppConnStatus == PASS)
 	{
@@ -1646,6 +1646,28 @@ int isReachableInternet()
 	}
 	else
 	{
+		strcpy(cmd, "ifconfig eth0");
+		fp = popen(cmd, "r");
+
+		if (fp != NULL)
+		{
+			while(fgets(buf, sizeof(buf), fp) != NULL)
+			{
+				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);
+					}
+				}
+			}
+		}
+		pclose(fp);
+		memset(buf, 0x00, sizeof(buf));
+
 		for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
 		{
 			sprintf(cmd, "ping -c 1 -w 3 -I eth0 %s", valid_Internet[idx]);
@@ -1844,7 +1866,7 @@ int getEth0MacAddress()
 	char buf[512];
 	char tmp[512];
 
-	strcpy(cmd, "ifconfig");;
+	strcpy(cmd, "ifconfig eth0");
 	fp = popen(cmd, "r");
 	if(fp != NULL)
 	{
@@ -2403,6 +2425,7 @@ int main(void)
 						ftime(&startTime[gun_index][TMR_IDX_AUTH]);
 						if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID)
 						{
+							memset(ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, 0x00, ARRAY_SIZE(ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status));
 							switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
 							{
 								case AUTH_MODE_ENABLE:

BIN
EVSE/Projects/AW-Regular/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/AW-Regular/Images/ramdisk.gz