Merge pull request #487 from cyberman54/master

sync dev to master
This commit is contained in:
Verkehrsrot 2019-11-17 14:18:37 +01:00 committed by GitHub
commit 39ee7b4d82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,7 @@
; ---> SELECT THE TARGET PLATFORM HERE! <---
[board]
;halfile = generic.h
halfile = generic.h
;halfile = ebox.h
;halfile = eboxtube.h
;halfile = ecopower.h

View File

@ -47,6 +47,7 @@ wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t type) {
// Software-timer driven Wifi channel rotation callback function
void switchWifiChannel(TimerHandle_t xTimer) {
configASSERT(xTimer);
channel =
(channel % WIFI_CHANNEL_MAX) + 1; // rotate channel 1..WIFI_CHANNEL_MAX
esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE);
@ -74,6 +75,7 @@ void wifi_sniffer_init(void) {
ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_NONE)); // no modem power saving
ESP_ERROR_CHECK(esp_wifi_set_promiscuous_filter(&filter)); // set frame filter
ESP_ERROR_CHECK(esp_wifi_set_promiscuous_rx_cb(&wifi_sniffer_packet_handler));
ESP_ERROR_CHECK(esp_wifi_start()); //for esp_wifi v3.3
ESP_ERROR_CHECK(esp_wifi_set_promiscuous(true)); // now switch on monitor mode
// setup wifi channel rotation timer
@ -85,14 +87,16 @@ void wifi_sniffer_init(void) {
void switch_wifi_sniffer(uint8_t state) {
assert(WifiChanTimer);
if ((state ? 1 : 0) == 1) {
if (state) {
// switch wifi sniffer on
ESP_ERROR_CHECK(esp_wifi_start());
xTimerStart(WifiChanTimer, 0);
esp_wifi_set_promiscuous(true);
} else {
// switch wifi sniffer off
xTimerStop(WifiChanTimer, 0);
esp_wifi_set_promiscuous(false);
ESP_ERROR_CHECK(esp_wifi_stop());
macs_wifi = 0; // clear WIFI counter
}
}