diff --git a/docs/hardware.md b/docs/hardware.md index 2730f036..57a8a588 100644 --- a/docs/hardware.md +++ b/docs/hardware.md @@ -62,9 +62,8 @@ Some 3D printable cases can be found (and, if wanted so, ordered) on Thingiverse Power consumption was metered at around 450 - 1000mW, depending on board and user settings in `paxcounter.conf`. -By default, bluetooth sniffing not installed. If you enable bluetooth be aware that this goes on expense of wifi sniffing results, because then wifi and bt stack must share the 2,4 GHz RF ressources of ESP32. If you need to sniff wifi and bt in parallel and need best possible results, use two boards - one for wifi only and one for bt only - and add counted results. +By default, bluetooth sniffing is not started. If you enable bluetooth be aware that this goes on expense of wifi sniffing results, because then wifi and bt stack must share the 2,4 GHz RF ressources of ESP32. If you need to sniff wifi and bt in parallel and need best possible results, use two boards - one for wifi only and one for bt only - and add counted results. - === "Deactivate BLE sniffing (Default)" ``` c linenums="29" title="paxcounter.conf" diff --git a/include/senddata.h b/include/senddata.h index 3e0f0711..e87d0b89 100644 --- a/include/senddata.h +++ b/include/senddata.h @@ -17,6 +17,5 @@ void flushQueues(void); bool allQueuesEmtpy(void); void setSendIRQ(TimerHandle_t xTimer); void setSendIRQ(void); -void initSendDataTimer(uint8_t sendcycle); #endif // _SENDDATA_H_ diff --git a/src/display.cpp b/src/display.cpp index dcd600cc..0d141cf8 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -200,7 +200,6 @@ void dp_refresh(bool nextPage) { // line 3: wifi + bluetooth counters // WIFI:abcde BLTH:abcde -#if ((WIFICOUNTER) && (BLECOUNTER)) if (cfg.wifiscan) dp->printf("WIFI:%-5u", count.wifi_count); else @@ -209,18 +208,6 @@ void dp_refresh(bool nextPage) { dp->printf("BLTH:%-5u", count.ble_count); else dp->printf(" BLTH:off"); -#elif ((WIFICOUNTER) && (!BLECOUNTER)) - if (cfg.wifiscan) - dp->printf("WIFI:%-5u", count.wifi_count); - else - dp->printf("WIFI:off "); -#elif ((!WIFICOUNTER) && (BLECOUNTER)) - if (cfg.blescan) - dp->printf("BLTH:%-5u", count.ble_count); - dp->printf("BLTH:off"); -#else - dp->printf("Sniffer disabled"); -#endif dp->printf("\r\n"); // line 4: Battery + GPS status + Wifi channel diff --git a/src/main.cpp b/src/main.cpp index 511b9244..f51e44f4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -218,7 +218,7 @@ void setup() { pinMode(HAS_TWO_LED, OUTPUT); strcat_P(features, " LED2"); #endif -// use simple LED for power display if we have additional RGB LED, else for status +// use LED for power display if we have additional RGB LED, else for status #ifdef HAS_RGB_LED switch_LED(LED_ON); #endif @@ -270,8 +270,7 @@ void setup() { if (RTC_runmode == RUNMODE_MAINTENANCE) start_boot_menu(); -#if ((WIFICOUNTER) || (BLECOUNTER)) - // use libpax timer to trigger cyclic senddata + // start libpax lib (includes timer to trigger cyclic senddata) ESP_LOGI(TAG, "Starting libpax..."); struct libpax_config_t configuration; libpax_default_config(&configuration); @@ -296,14 +295,6 @@ void setup() { } else { init_libpax(); } -#else - // use stand alone timer to trigger cyclic senddata - initSendDataTimer(cfg.sendcycle * 2); -#endif - -#if (BLECOUNTER) - strcat_P(features, " BLE"); -#endif // start rcommand processing task ESP_LOGI(TAG, "Starting rcommand interpreter..."); @@ -401,13 +392,6 @@ void setup() { strcat_P(features, " IF482"); #endif -#if (WIFICOUNTER) - strcat_P(features, " WIFI"); -#else - // remove wifi driver from RAM, if option wifi not compiled - esp_wifi_deinit(); -#endif - // start state machine ESP_LOGI(TAG, "Starting Interrupt Handler..."); xTaskCreatePinnedToCore(irqHandler, // task function diff --git a/src/paxcounter_orig.conf b/src/paxcounter_orig.conf index 4ad74ffd..b18aa36a 100644 --- a/src/paxcounter_orig.conf +++ b/src/paxcounter_orig.conf @@ -25,9 +25,9 @@ ((GPS_DATA | MEMS_DATA | COUNT_DATA | SENSOR1_DATA | SENSOR2_DATA | SENSOR3_DATA) & \ (~BATT_DATA) & (~RESERVED_DATA)) -// MAC sniffing parameters -#define BLECOUNTER 1 // set to 0 if you do not want to install the BLE sniffer -#define WIFICOUNTER 1 // set to 0 if you do not want to install the WIFI sniffer +// MAC sniffing settings +#define BLECOUNTER 0 // set to 0 if you do not want to start the BLE sniffer +#define WIFICOUNTER 1 // set to 0 if you do not want to start the WIFI sniffer #define RSSILIMIT 0 // 0...-128, set to 0 if you do not want to filter signals // BLE scan parameters diff --git a/src/rcommand.cpp b/src/rcommand.cpp index 686248f4..b5d52394 100644 --- a/src/rcommand.cpp +++ b/src/rcommand.cpp @@ -54,7 +54,6 @@ void set_reset(uint8_t val[]) { void set_rssi(uint8_t val[]) { cfg.rssilimit = val[0] * -1; -#if ((WIFICOUNTER) || (BLECOUNTER)) libpax_counter_stop(); libpax_config_t current_config; libpax_get_current_config(¤t_config); @@ -62,7 +61,6 @@ void set_rssi(uint8_t val[]) { current_config.ble_rssi_threshold = cfg.rssilimit; libpax_update_config(¤t_config); init_libpax(); -#endif ESP_LOGI(TAG, "Remote command: set RSSI limit to %d", cfg.rssilimit); } @@ -73,13 +71,8 @@ void set_sendcycle(uint8_t val[]) { cfg.sendcycle = val[0]; ESP_LOGI(TAG, "Remote command: set send cycle to %d seconds", cfg.sendcycle * 2); -#if ((WIFICOUNTER) || (BLECOUNTER)) libpax_counter_stop(); init_libpax(); -#else - // modify senddata timer - initSendDataTimer(cfg.sendcycle * 2); -#endif } void set_sleepcycle(uint8_t val[]) { @@ -91,7 +84,6 @@ void set_sleepcycle(uint8_t val[]) { void set_wifichancycle(uint8_t val[]) { cfg.wifichancycle = val[0]; -#if (WIFICOUNTER) libpax_counter_stop(); libpax_config_t current_config; libpax_get_current_config(¤t_config); @@ -109,19 +101,16 @@ void set_wifichancycle(uint8_t val[]) { current_config.wifi_channel_switch_interval = cfg.wifichancycle; libpax_update_config(¤t_config); init_libpax(); -#endif } void set_blescantime(uint8_t val[]) { cfg.blescantime = val[0]; -#if (BLECOUNTER) libpax_counter_stop(); libpax_config_t current_config; libpax_get_current_config(¤t_config); current_config.blescantime = cfg.blescantime; libpax_update_config(¤t_config); init_libpax(); -#endif } void set_countmode(uint8_t val[]) { @@ -144,10 +133,8 @@ void set_countmode(uint8_t val[]) { "Remote command: set counter mode called with invalid parameter(s)"); return; } -#if ((WIFICOUNTER) || (BLECOUNTER)) libpax_counter_stop(); init_libpax(); // re-inits counter mode from cfg.countermode -#endif } void set_screensaver(uint8_t val[]) { @@ -258,28 +245,24 @@ void set_loraadr(uint8_t val[]) { void set_blescan(uint8_t val[]) { ESP_LOGI(TAG, "Remote command: set BLE scanner to %s", val[0] ? "on" : "off"); cfg.blescan = val[0] ? 1 : 0; -#if (BLECOUNTER) libpax_counter_stop(); libpax_config_t current_config; libpax_get_current_config(¤t_config); current_config.blecounter = cfg.blescan; libpax_update_config(¤t_config); init_libpax(); -#endif } void set_wifiscan(uint8_t val[]) { ESP_LOGI(TAG, "Remote command: set WIFI scanner to %s", val[0] ? "on" : "off"); cfg.wifiscan = val[0] ? 1 : 0; -#if (WIFICOUNTER) libpax_counter_stop(); libpax_config_t current_config; libpax_get_current_config(¤t_config); current_config.wificounter = cfg.wifiscan; libpax_update_config(¤t_config); init_libpax(); -#endif } void set_wifiant(uint8_t val[]) { diff --git a/src/senddata.cpp b/src/senddata.cpp index 5fb2cd6a..09de9c65 100644 --- a/src/senddata.cpp +++ b/src/senddata.cpp @@ -10,19 +10,6 @@ void setSendIRQ(TimerHandle_t xTimer) { void setSendIRQ(void) { setSendIRQ(NULL); } -void initSendDataTimer(uint8_t sendcycle) { - static TimerHandle_t SendDataTimer = NULL; - - if (SendDataTimer == NULL) { - SendDataTimer = - xTimerCreate("SendDataTimer", pdMS_TO_TICKS(sendcycle * 1000), pdTRUE, - (void *)0, setSendIRQ); - xTimerStart(SendDataTimer, 0); - } else { - xTimerChangePeriod(SendDataTimer, pdMS_TO_TICKS(sendcycle * 1000), 0); - } -} - // put data to send in RTos Queues used for transmit over channels Lora and SPI void SendPayload(uint8_t port) { ESP_LOGD(TAG, "sending Payload for Port %d", port); @@ -81,16 +68,14 @@ void sendData() { #if (HAS_SDS011) sdsStatus_t sds_status; #endif -#if ((WIFICOUNTER) || (BLECOUNTER)) struct count_payload_t count = count_from_libpax; // copy values from global libpax var ESP_LOGD(TAG, "Sending count results: pax=%d / wifi=%d / ble=%d", count.pax, count.wifi_count, count.ble_count); -#endif while (bitmask) { switch (bitmask & mask) { -#if ((WIFICOUNTER) || (BLECOUNTER)) + case COUNT_DATA: payload.reset(); @@ -138,8 +123,6 @@ void sendData() { SendPayload(COUNTERPORT); break; // case COUNTDATA -#endif // ((WIFICOUNTER) || (BLECOUNTER)) - #if (HAS_BME) case MEMS_DATA: payload.reset();