소스 검색

2020-01-03 / Folus Wen

Actions:
1. EVSE/Projects/define.h variable ftpServer length extend to 256.
2. EVSE/Modularization/Module_Wifi.c getLinkQuality function retrive rssi from quality to signal level.

Files:
1. As follow commit history.
FolusWen 5 년 전
부모
커밋
cd071e51e3
2개의 변경된 파일7개의 추가작업 그리고 8개의 파일을 삭제
  1. 6 7
      EVSE/Modularization/Module_Wifi.c
  2. 1 1
      EVSE/Projects/define.h

+ 6 - 7
EVSE/Modularization/Module_Wifi.c

@@ -502,7 +502,6 @@ int getLinkQuality()
 	char cmd[256];
 	char buf[512];
 	char tmp[512];
-	char *q[2];
 
 	strcpy(cmd, "/root/iwconfig ");
 	strcat(cmd, Wifi.currentInterface);
@@ -513,13 +512,13 @@ int getLinkQuality()
 	{
 		while(fgets(buf, sizeof(buf), fp) != NULL)
 		{
-			if(strstr(buf, "Quality") > 0)
+			if(strstr(buf, "Signal level") > 0)
 			{
-				sscanf(buf, "%*s%s", tmp);
-				substr(tmp, tmp, strspn(tmp, "Quality="), strlen(buf)-strspn(tmp, "Quality="));
+				sscanf(buf, "%*s%*s%*s%s", tmp);
+
+				substr(tmp, tmp, strspn(tmp, "Signal level="), strlen(buf)-strspn(tmp, "Signal level="));
 
-				split(q,tmp,"/");
-				Wifi.rssi = (atoi(q[0])*100)/atoi(q[1]);
+				Wifi.rssi = atoi(tmp);
 
 				result = PASS;
 			}
@@ -933,7 +932,7 @@ void proc_sta()
 		case STA_STATE_AP_CONNECTED:
 			getInterfaceInfo();
 			getLinkQuality();
-			DEBUG_INFO("Wifi quality: %d\n", Wifi.rssi);
+			DEBUG_INFO("Wifi quality: %d dBm\n", Wifi.rssi);
 			ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi = Wifi.rssi;
 
 			if(isReachableInternet() == PASS)

+ 1 - 1
EVSE/Projects/define.h

@@ -146,7 +146,7 @@ struct SysConfigData
 	unsigned char   		LocalWhiteCard[10][32];		//Max. card quantity is 10
 	unsigned char 			UserId[32];					//the user use this ID to trigger charging event, it can be RFID card number, OCPP IdTag, etc.
 	/**************Network***************/
-	unsigned char 			FtpServer[32];				//the ftp server for Phihong server to do data transimission
+	unsigned char 			FtpServer[256];				//the ftp server for Phihong server to do data transimission
 	struct EthConfigData	Eth0Interface;
 	struct EthConfigData	Eth1Interface;
 	struct WifiConfigData 		AthInterface;