From ec81293a388cd921e7f92fae5a1b667da3f8d087 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Wed, 1 Aug 2018 08:53:05 +0200 Subject: [PATCH] v1.3.97 @ Espressif 1.2.0 --- platformio.ini | 4 ++-- src/globals.h | 2 +- src/hal/generic.h | 3 +++ src/wifiscan.cpp | 29 ++++++++++++----------------- src/wifiscan.h | 1 - 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/platformio.ini b/platformio.ini index 579cd667..5e9adf89 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,8 +12,8 @@ ; ---> SELECT TARGET PLATFORM HERE! <--- [platformio] ;env_default = test -env_default = generic -;env_default = heltec +;env_default = generic +env_default = heltec ;env_default = ttgov1 ;env_default = ttgov2 ;env_default = ttgov21 diff --git a/src/globals.h b/src/globals.h index 9ce9802c..485b5c48 100644 --- a/src/globals.h +++ b/src/globals.h @@ -8,7 +8,7 @@ #include // attn: increment version after modifications to configData_t truct! -#define PROGVERSION "1.3.96" // use max 10 chars here! +#define PROGVERSION "1.3.97" // use max 10 chars here! #define PROGNAME "PAXCNT" // std::set for unified array functions diff --git a/src/hal/generic.h b/src/hal/generic.h index 18b215b8..52fa279c 100644 --- a/src/hal/generic.h +++ b/src/hal/generic.h @@ -15,6 +15,9 @@ #define HAS_LED GPIO_NUM_21 // on board LED #define HAS_BUTTON GPIO_NUM_39 // on board button +#define HAS_RGB_LED GPIO_NUM_0 // WS2812B RGB LED on GPIO0 + +#define BOARD_HAS_PSRAM // use extra 4MB extern RAM #define HAS_GPS 1 // use if board has GPS #define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M or 7M with default configuration diff --git a/src/wifiscan.cpp b/src/wifiscan.cpp index 8400117b..4190e182 100644 --- a/src/wifiscan.cpp +++ b/src/wifiscan.cpp @@ -18,13 +18,11 @@ IRAM_ATTR void wifi_sniffer_packet_handler(void *buff, const wifi_ieee80211_mac_hdr_t *hdr = &ipkt->hdr; if ((cfg.rssilimit) && - (ppkt->rx_ctrl.rssi < cfg.rssilimit)) { // rssi is negative value - ESP_LOGI(TAG, "WiFi RSSI %d -> ignoring (limit: %d)", ppkt->rx_ctrl.rssi, + (ppkt->rx_ctrl.rssi < cfg.rssilimit)) // rssi is negative value + ESP_LOGD(TAG, "WiFi RSSI %d -> ignoring (limit: %d)", ppkt->rx_ctrl.rssi, cfg.rssilimit); - } else { - uint8_t *p = (uint8_t *)hdr->addr2; - mac_add(p, ppkt->rx_ctrl.rssi, MAC_SNIFF_WIFI); - } + else // count seen MAC + mac_add((uint8_t *)hdr->addr2, ppkt->rx_ctrl.rssi, MAC_SNIFF_WIFI); } void wifi_sniffer_init(void) { @@ -44,16 +42,6 @@ void wifi_sniffer_init(void) { ESP_ERROR_CHECK(esp_wifi_set_promiscuous(true)); // now switch on monitor mode } -void wifi_sniffer_set_channel(uint8_t channel) { - esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE); -} - -void IRAM_ATTR ChannelSwitchIRQ() { - portENTER_CRITICAL(&timerMux); - ChannelTimerIRQ++; - portEXIT_CRITICAL(&timerMux); -} - // Wifi channel rotation task void wifi_channel_loop(void *pvParameters) { @@ -67,11 +55,18 @@ void wifi_channel_loop(void *pvParameters) { portEXIT_CRITICAL(&timerMux); // rotates variable channel 1..WIFI_CHANNEL_MAX channel = (channel % WIFI_CHANNEL_MAX) + 1; - wifi_sniffer_set_channel(channel); + esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE); ESP_LOGD(TAG, "Wifi set channel %d", channel); vTaskDelay(1 / portTICK_PERIOD_MS); // reset watchdog } } // end of infinite wifi channel rotation loop +} + +// IRQ handler +void IRAM_ATTR ChannelSwitchIRQ() { + portENTER_CRITICAL(&timerMux); + ChannelTimerIRQ++; + portEXIT_CRITICAL(&timerMux); } \ No newline at end of file diff --git a/src/wifiscan.h b/src/wifiscan.h index d442eccd..afd5700e 100644 --- a/src/wifiscan.h +++ b/src/wifiscan.h @@ -26,7 +26,6 @@ typedef struct { } wifi_ieee80211_packet_t; void wifi_sniffer_init(void); -void wifi_sniffer_set_channel(uint8_t channel); void wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t type); void ChannelSwitchIRQ(void); void wifi_channel_loop(void *pvParameters);