mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-21 02:27:10 +08:00
Merge pull request #2894 from enkiller/wlan
[components][drivers][wlan] 自动连接周期可配置,可指定扫描通道
This commit is contained in:
commit
20130d19b5
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user