wifiscan.cpp: fix wifi on/off
This commit is contained in:
parent
f6654a47e7
commit
41fd41b59b
@ -7,11 +7,11 @@
|
||||
|
||||
; ---> SELECT THE TARGET PLATFORM HERE! <---
|
||||
[board]
|
||||
;halfile = generic.h
|
||||
halfile = generic.h
|
||||
;halfile = ebox.h
|
||||
;halfile = eboxtube.h
|
||||
;halfile = ecopower.h
|
||||
halfile = heltec.h
|
||||
;halfile = heltec.h
|
||||
;halfile = heltecv2.h
|
||||
;halfile = ttgov1.h
|
||||
;halfile = ttgov2.h
|
||||
@ -43,7 +43,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
|
||||
|
||||
[common]
|
||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
||||
release_version = 1.9.8
|
||||
release_version = 1.9.81
|
||||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
||||
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||
debug_level = 3
|
||||
|
@ -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);
|
||||
@ -85,14 +86,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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user