wifiscan.cpp bugfix coex set

This commit is contained in:
Verkehrsrot 2019-07-13 18:27:56 +02:00
parent 6635ba991e
commit 6cc962ef20

View File

@ -47,21 +47,23 @@ IRAM_ATTR void wifi_sniffer_packet_handler(void *buff,
// Software-timer driven Wifi channel rotation callback function // Software-timer driven Wifi channel rotation callback function
void switchWifiChannel(TimerHandle_t xTimer) { void switchWifiChannel(TimerHandle_t xTimer) {
channel = channel =
(channel % WIFI_CHANNEL_MAX) + 1; // rotate channel 1..WIFI_CHANNEL_MAX (channel % WIFI_CHANNEL_MAX) + 1; // rotate channel 1..WIFI_CHANNEL_MAX
esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE); esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE);
} }
void wifi_sniffer_init(void) { void wifi_sniffer_init(void) {
wifi_init_config_t wificfg = WIFI_INIT_CONFIG_DEFAULT(); wifi_init_config_t wificfg = WIFI_INIT_CONFIG_DEFAULT();
wificfg.nvs_enable = 0; // we don't need any wifi settings from NVRAM wificfg.nvs_enable = 0; // we don't need any wifi settings from NVRAM
wificfg.wifi_task_core_id = 0; // we want wifi task running on core 0 wificfg.wifi_task_core_id = 0; // we want wifi task running on core 0
wifi_promiscuous_filter_t filter = {
// .filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // only MGMT frames
.filter_mask = WIFI_PROMIS_FILTER_MASK_ALL}; // we use all frames
ESP_ERROR_CHECK(esp_coex_preference_set( // wifi_promiscuous_filter_t filter = {
ESP_COEX_PREFER_BALANCE)); // configure Wifi/BT coexist lib // .filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // only MGMT frames
// .filter_mask = WIFI_PROMIS_FILTER_MASK_ALL}; // we use all frames
wifi_promiscuous_filter_t filter = {.filter_mask =
WIFI_PROMIS_FILTER_MASK_MGMT |
WIFI_PROMIS_FILTER_MASK_DATA};
ESP_ERROR_CHECK(esp_wifi_init(&wificfg)); // configure Wifi with cfg ESP_ERROR_CHECK(esp_wifi_init(&wificfg)); // configure Wifi with cfg
ESP_ERROR_CHECK( ESP_ERROR_CHECK(