summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authortangyuxin <[email protected]>2019-07-25 10:30:54 +0800
committertangyuxin <[email protected]>2019-07-25 10:30:54 +0800
commit6fbc7494b830a5d6e39f53a1ab3baebdbde64505 (patch)
treefa1b1b4c7f513d268cae22338db3164ce5dda26f /components
parent8f4b4bdbcd877fc21f14d8396d0563261c6dd727 (diff)
[components][drivers][wlan] 自动连接周期可配置,可指定扫描通道
Diffstat (limited to 'components')
-rwxr-xr-xcomponents/drivers/Kconfig6
-rw-r--r--components/drivers/wlan/wlan_dev.c12
-rw-r--r--components/drivers/wlan/wlan_mgnt.c6
-rw-r--r--components/drivers/wlan/wlan_mgnt.h4
4 files changed, 21 insertions, 7 deletions
diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig
index 56e5b8373a..4aceee3b4e 100755
--- a/components/drivers/Kconfig
+++ b/components/drivers/Kconfig
@@ -471,6 +471,12 @@ menuconfig RT_USING_WIFI
select RT_WLAN_CFG_ENABLE
select RT_WLAN_WORK_THREAD_ENABLE
default y
+
+ if RT_WLAN_AUTO_CONNECT_ENABLE
+ config AUTO_CONNECTION_PERIOD_MS
+ int "Auto connect period(ms)"
+ default 2000
+ endif
endif
config RT_WLAN_CFG_ENABLE
diff --git a/components/drivers/wlan/wlan_dev.c b/components/drivers/wlan/wlan_dev.c
index e0f9eff279..2490c2c456 100644
--- a/components/drivers/wlan/wlan_dev.c
+++ b/components/drivers/wlan/wlan_dev.c
@@ -535,8 +535,16 @@ rt_err_t rt_wlan_dev_scan(struct rt_wlan_device *device, struct rt_wlan_info *in
}
rt_memcpy(&scan_info.ssid, &info->ssid, sizeof(rt_wlan_ssid_t));
rt_memcpy(scan_info.bssid, info->bssid, RT_WLAN_BSSID_MAX_LENGTH);
- scan_info.channel_min = -1;
- scan_info.channel_max = -1;
+ if (info->channel > 0)
+ {
+ scan_info.channel_min = info->channel;
+ scan_info.channel_max = info->channel;
+ }
+ else
+ {
+ scan_info.channel_min = -1;
+ scan_info.channel_max = -1;
+ }
p_scan_info = &scan_info;
}
result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_SCAN, p_scan_info);
diff --git a/components/drivers/wlan/wlan_mgnt.c b/components/drivers/wlan/wlan_mgnt.c
index 5dc0119abd..88923a61e6 100644
--- a/components/drivers/wlan/wlan_mgnt.c
+++ b/components/drivers/wlan/wlan_mgnt.c
@@ -58,10 +58,6 @@
#define TIME_START()
#endif
-#ifndef DISCONNECT_RESPONSE_MS
-#define DISCONNECT_RESPONSE_MS (2000)
-#endif
-
#if RT_WLAN_EBOX_NUM < 1
#error "event box num Too few"
#endif
@@ -2020,7 +2016,7 @@ int rt_wlan_init(void)
rt_mutex_init(&complete_mutex, "complete", RT_IPC_FLAG_FIFO);
#ifdef RT_WLAN_AUTO_CONNECT_ENABLE
rt_timer_init(&reconnect_time, "wifi_tim", rt_wlan_cyclic_check, RT_NULL,
- rt_tick_from_millisecond(DISCONNECT_RESPONSE_MS),
+ rt_tick_from_millisecond(AUTO_CONNECTION_PERIOD_MS),
RT_TIMER_FLAG_PERIODIC | RT_TIMER_FLAG_SOFT_TIMER);
#endif
_init_flag = 1;
diff --git a/components/drivers/wlan/wlan_mgnt.h b/components/drivers/wlan/wlan_mgnt.h
index 57d8dd9d78..df0827bb7b 100644
--- a/components/drivers/wlan/wlan_mgnt.h
+++ b/components/drivers/wlan/wlan_mgnt.h
@@ -41,6 +41,10 @@ extern "C" {
#define RT_WLAN_SCAN_RETRY_CNT (3)
#endif
+#ifndef AUTO_CONNECTION_PERIOD_MS
+#define AUTO_CONNECTION_PERIOD_MS (2000)
+#endif
+
/*state fot station*/
#define RT_WLAN_STATE_CONNECT (1UL << 0)
#define RT_WLAN_STATE_CONNECTING (1UL << 1)