From 47579414ac627c88063261f74d3c91725f7d7d8c Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sun, 2 Dec 2018 14:29:32 +0100 Subject: [PATCH] code sanitization --- include/coexist_internal.h | 77 -------------------------------------- include/main.h | 3 -- src/main.cpp | 2 +- src/wifiscan.cpp | 17 ++------- 4 files changed, 5 insertions(+), 94 deletions(-) delete mode 100644 include/coexist_internal.h diff --git a/include/coexist_internal.h b/include/coexist_internal.h deleted file mode 100644 index 6b4c47cc..00000000 --- a/include/coexist_internal.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2018-2018 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef __COEXIST_INTERNAL_H__ -#define __COEXIST_INTERNAL_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - COEX_PREFER_WIFI = 0, - COEX_PREFER_BT, - COEX_PREFER_BALANCE, - COEX_PREFER_NUM, -} coex_prefer_t; - -/** - * @brief Init software coexist - * extern function for internal use. - * - * @return Init ok or failed. - */ -esp_err_t coex_init(void); - -/** - * @brief De-init software coexist - * extern function for internal use. - */ -void coex_deinit(void); - -/** - * @brief Pause software coexist - * extern function for internal use. - */ -void coex_pause(void); - -/** - * @brief Resume software coexist - * extern function for internal use. - */ -void coex_resume(void); - -/** - * @brief Get software coexist version string - * extern function for internal use. - * @return : version string - */ -const char *coex_version_get(void); - -/** - * @brief Coexist performance preference set from libbt.a - * extern function for internal use. - * - * @param prefer : the prefer enumeration value - * @return : ESP_OK - success, other - failed - */ -esp_err_t coex_preference_set(coex_prefer_t prefer); - -#ifdef __cplusplus -} -#endif - -#endif /* __COEXIST_INTERNAL_H__ */ \ No newline at end of file diff --git a/include/main.h b/include/main.h index f86e14ef..6bc1b377 100644 --- a/include/main.h +++ b/include/main.h @@ -16,7 +16,4 @@ #include "spislave.h" #include "lorawan.h" -#include -#include "coexist_internal.h" - #endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 7d5e4968..90a99992 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,7 +106,7 @@ void setup() { (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external"); ESP_LOGI(TAG, "ESP32 SDK: %s", ESP.getSdkVersion()); - ESP_LOGI(TAG, "Wifi/BT software coexist version: %s", esp_coex_version_get()); + ESP_LOGI(TAG, "Wifi/BT software coexist version: %s", coex_version_get()); ESP_LOGI(TAG, "Free RAM: %d bytes", ESP.getFreeHeap()); #ifdef HAS_GPS diff --git a/src/wifiscan.cpp b/src/wifiscan.cpp index 0cb7e411..14332b49 100644 --- a/src/wifiscan.cpp +++ b/src/wifiscan.cpp @@ -2,7 +2,6 @@ #include "globals.h" #include "wifiscan.h" #include -#include "coexist_internal.h" // Local logging tag static const char TAG[] = "wifi"; @@ -11,7 +10,7 @@ static wifi_country_t wifi_country = {WIFI_MY_COUNTRY, WIFI_CHANNEL_MIN, WIFI_CHANNEL_MAX, 100, WIFI_COUNTRY_POLICY_MANUAL}; -esp_coex_prefer_t coexist_config = ESP_COEX_PREFER_BALANCE; +esp_coex_prefer_t esp_coexist_config = ESP_COEX_PREFER_BALANCE; typedef struct { unsigned frame_ctrl : 16; @@ -45,12 +44,6 @@ IRAM_ATTR void wifi_sniffer_packet_handler(void *buff, mac_add((uint8_t *)hdr->addr2, ppkt->rx_ctrl.rssi, MAC_SNIFF_WIFI); } -const char *esp_coex_version_get(void) { return coex_version_get(); } - -esp_err_t esp_coex_preference_set(esp_coex_prefer_t prefer) { - return coex_preference_set((coex_prefer_t)prefer); -} - void wifi_sniffer_init(void) { wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); cfg.nvs_enable = 0; // we don't need any wifi settings from NVRAM @@ -59,12 +52,10 @@ void wifi_sniffer_init(void) { // .filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // only MGMT frames .filter_mask = WIFI_PROMIS_FILTER_MASK_ALL}; // we use all frames - coex_pause(); + //coex_pause(); ESP_ERROR_CHECK( - esp_coex_preference_set(coexist_config)); // configure Wifi/BT coexist lib - coex_resume(); - - //coex_deinit(); + esp_coex_preference_set(esp_coexist_config)); // configure Wifi/BT coexist lib + //coex_resume(); ESP_ERROR_CHECK(esp_wifi_init(&cfg)); // configure Wifi with cfg ESP_ERROR_CHECK(