From 77e795dbf8932c7f4fa11afad3ea051bcd7902b4 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sat, 13 Apr 2019 17:39:08 +0200 Subject: [PATCH] Option to switch off wifi sniffing --- src/main.cpp | 18 ++++++++++++++---- src/paxcounter.conf | 5 +++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 249cc3be..e0cad626 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -346,9 +346,8 @@ void setup() { strcat_P(features, " IF482"); #endif - // show compiled features - ESP_LOGI(TAG, "Features:%s", features); - +#if (WIFICOUNTER) + strcat_P(features, " WIFI"); // start wifi in monitor mode and start channel rotation timer ESP_LOGI(TAG, "Starting Wifi..."); wifi_sniffer_init(); @@ -356,6 +355,15 @@ void setup() { // arduino-esp32 core. Note: do this *after* wifi has started, since // function gets it's seed from RF noise get_salt(); // get new 16bit for salting hashes +#else + // switch off wifi + WiFi.mode(WIFI_OFF); + esp_wifi_stop(); + esp_wifi_deinit(); +#endif + + // show compiled features + ESP_LOGI(TAG, "Features:%s", features); // start state machine ESP_LOGI(TAG, "Starting Interrupt Handler..."); @@ -400,8 +408,10 @@ void setup() { timerAlarmEnable(displayIRQ); #endif - // cyclic function interrupts +// cyclic function interrupts +#if (WIFICOUNTER) || (BLECOUNTER) sendcycler.attach(SENDCYCLE * 2, sendcycle); +#endif housekeeper.attach(HOMECYCLE, housekeeping); // button interrupt diff --git a/src/paxcounter.conf b/src/paxcounter.conf index dfff6434..fdefdb56 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -13,9 +13,10 @@ #define SENDCYCLE 30 // payload send cycle [seconds/2], 0 .. 255 #define PAYLOAD_ENCODER 2 // payload encoder: 1=Plain, 2=Packed, 3=Cayenne LPP dynamic, 4=Cayenne LPP packed -// Set this to include BLE counting and vendor filter functions +// Set this to include BLE counting and vendor filter functions, or to switch off WIFI counting #define VENDORFILTER 1 // set to 0 if you want to count things, not people -#define BLECOUNTER 0 // set it to 1 if you want to use BLE count, at expense of memory +#define BLECOUNTER 0 // set it to 1 if you want to use BLE count, at expense of power & memory +#define WIFICOUNTER 0 // set it to 0 if you want to switch off WIFI count // BLE scan parameters #define BLESCANTIME 0 // [seconds] scan duration, 0 means infinite [default], see note below