浏览代码

[Improve][Added][AW-CCS][main.c]
2022-04-27 / EASON YANG
Actino
1. Improve: Declare gpio_set_value() function on the top. For warning.
2. Added: isUap0up() function.

File
1. main.c
Action 1
Action 2

FIRMWARE VERSION: B0.62.XX.XXXX.PX

8009 2 年之前
父节点
当前提交
2a5435df51
共有 1 个文件被更改,包括 27 次插入1 次删除
  1. 27 1
      EVSE/Projects/AW-CCS/Apps/main.c

+ 27 - 1
EVSE/Projects/AW-CCS/Apps/main.c

@@ -64,6 +64,7 @@ int GetCardSerialNumber();
 void setLedMotion(unsigned char gun_index,unsigned char led_mode);
 void setRequest(unsigned char gun_index,unsigned char isOn);
 void setSpeaker(unsigned char isOn, unsigned char speaker_mode);
+void gpio_set_value(unsigned int gpio, unsigned int value);
 
 //==========================
 // Declare RFID module type
@@ -459,6 +460,31 @@ int getEth0MacAddress()
 	return result;
 }
 
+int isUap0up(void)
+{
+	int result = FAIL;
+
+	FILE *fp;
+	char cmd[256];
+	char buf[512];
+
+	strcpy(cmd, "ifconfig uap0");;
+	fp = popen(cmd, "r");
+	if(fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			if(strstr(buf, "uap0") > 0)
+			{
+				result = PASS;
+			}
+		}
+	}
+	pclose(fp);
+
+	return result;
+}
+
 //======================================================
 // OCPP routine
 //======================================================
@@ -2654,7 +2680,7 @@ void InitEthernet()
 					{
 						DEBUG_WARN("WIFI/4G module reset.\n");
 						gpio_set_value(GPIO_OUT_RST_4G_WIFI, ON);
-						sleep(1);
+						sleep(3);
 						gpio_set_value(GPIO_OUT_RST_4G_WIFI, OFF);
 					}