From f9c2cbf9d768302687666cffd95ee38134227929 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sat, 16 May 2020 12:46:46 +0200 Subject: [PATCH 01/48] Update platformio.ini --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index aab79dcf..1720b4f1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -57,7 +57,7 @@ platform_espressif32 = espressif32@1.12.1 monitor_speed = 115200 upload_speed = 115200 lib_deps_lora = - MCCI LoRaWAN LMIC library@3.1.0 ; MCCI LMIC by Terrill Moore + MCCI LoRaWAN LMIC library@3.2.0 ; MCCI LMIC by Terrill Moore lib_deps_display = ss_oled@4.1.3 ; fast and small OLED lib by Larry Bank BitBang_I2C@2.1.1 From de9f01bb011b43205d13353c83d7034eb6053a28 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Mon, 18 May 2020 10:52:45 +0200 Subject: [PATCH 02/48] Update m5core.h --- src/hal/m5core.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hal/m5core.h b/src/hal/m5core.h index b391efe6..d441bcbe 100644 --- a/src/hal/m5core.h +++ b/src/hal/m5core.h @@ -29,7 +29,6 @@ //#define HAS_SENSORS 1 // comment out if device has user defined sensors #define CFG_sx1276_radio 1 // select LoRa chip -#define BOARD_HAS_PSRAM // use if board has external PSRAM #define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature #define HAS_DISPLAY 2 // TFT-LCD, support work in progess, not ready yet @@ -77,4 +76,4 @@ #define SPI_FREQUENCY 40000000 -#endif \ No newline at end of file +#endif From aaf45ea9de1bdc850ce6f0eeb6e9218467991573 Mon Sep 17 00:00:00 2001 From: Tom Stein Date: Wed, 10 Jun 2020 22:57:54 +0200 Subject: [PATCH 03/48] add example how to use remote control downlink --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c4ff5856..307a64f2 100644 --- a/README.md +++ b/README.md @@ -348,6 +348,8 @@ The device listenes for remote control commands on LoRaWAN Port 2. Multiple comm Note: all settings are stored in NVRAM and will be reloaded when device starts. +Send for example `8386` as Downlink on Port 2 to get battery status and time/date from the device. + 0x01 set scan RSSI limit 1 ... 255 used for wifi and bluetooth scan radius (greater values increase scan radius, values 50...110 make sense) From b9a024683ccd5f1e4095bfc243b8c366805f1e23 Mon Sep 17 00:00:00 2001 From: Tom Stein Date: Wed, 10 Jun 2020 22:58:43 +0200 Subject: [PATCH 04/48] Add files via upload --- img/paxcounter_downlink_example.png | Bin 0 -> 11705 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 img/paxcounter_downlink_example.png diff --git a/img/paxcounter_downlink_example.png b/img/paxcounter_downlink_example.png new file mode 100644 index 0000000000000000000000000000000000000000..aa0e500fd987be63edf61bbf8259becffce45948 GIT binary patch literal 11705 zcmeHtc{tQ<+pwNI(VfzivKuv1+K{Cv!`!;d7>bNiA-iNx$S};@k?dx&q!Ox8vZV!M zohjQ`LiVx@1_?1{EHjLmd4EIC@;%4#e&6wJ$M=5k@&3W@H`njF&hxy^{k+aA=As#5 z`)_i;iHL}7M;f0+iHL|Aiim6q5#IugERP#00*_7pD8w0&H*E@2zz;%i-?G-8S<>*CA8h_&;`70pW~z>b`#@$%M0mmO_fc} zAHAxke@YY;x3sA<*+KjrUS8K&gr;Rnn7 zAOLA1+8H2G;L#ZVKYrBQg)|o0kZMXi`)a6QoCL7!?Ik~Aw9Pq>THVG*(0H=B!B#Gp zJGwkOFxr-(H%hC<2vL}VNHJv=b%py&oE2Pth_j}0vPyjy=Y}eqB-dd`_~l2Z*O%eN zWlx9KA@0@%9$5M$T=(#>&tAVuV{f@y2}MKtf*0&JA*EN(F>^IGhT|0sQDEVi!yXxc z-y(k=`+xK(XcNEf4~MbAm7_69IqIRimJLj+7{_&rBC{xKmGf!lJS zrkUa2e5*PHy6Seh*Rd00ZLYpQqpDd02wUIDn&^Ri+oGkQ(~GVrCY%FCLzdpt8BZ$; zTp69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5En!ne%>8*l zW_z~}xDi*A-LnhmUD%E>FDSAdH{`Bj&d8J;hH;%(P^`~#P_60gyBD_Ji_t{ma!g^1 zBs1XA-5J`zHuVE`DlVXZ;k50lOA(Kr0a#vEqt;_IZ0x@gghE(OU?(3i&GVU`g(emLnfg5|sv0xuN>nt=lDeY2 zeg){!2SMhO3f7Lf5SQh)7Am;I?VD|f2mZ~69{pZB(^o^W!>X*Yhsk@%{&QDG zZEP~0KRZmH+zl_{tmp@=IB^#)C`Mh=5;~IqL%~Y648(`)4NCfI-Ta;)1dBXpcJ|E~ Hhwy&`VA+O9 literal 0 HcmV?d00001 From 444c91debdd2fd76e44f2467ecc0fb98e138950e Mon Sep 17 00:00:00 2001 From: Tom Stein Date: Wed, 10 Jun 2020 22:59:39 +0200 Subject: [PATCH 05/48] add example downlink image --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 307a64f2..c5fcec72 100644 --- a/README.md +++ b/README.md @@ -349,6 +349,7 @@ The device listenes for remote control commands on LoRaWAN Port 2. Multiple comm Note: all settings are stored in NVRAM and will be reloaded when device starts. Send for example `8386` as Downlink on Port 2 to get battery status and time/date from the device. + 0x01 set scan RSSI limit From 23974bb17f63bf04cf8ca0e6077980ebfa23f180 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Fri, 19 Jun 2020 14:14:13 +0200 Subject: [PATCH 06/48] Arduinojson requirement <6 --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 7030b54f..7f0adeba 100644 --- a/platformio.ini +++ b/platformio.ini @@ -79,7 +79,7 @@ lib_deps_sensors = BSEC Software Library@1.5.1474 https://github.com/ricki-z/SDS011.git lib_deps_basic = - ArduinoJson@^5.13.1 + ArduinoJson@<6 76@>=1.2.4 ; #76 Timezone by Jack Christensen 274@>=2.3.4 ; #274 RTC by Michael Miller SimpleButton From b288106f83e587b77275dff7fba8136a148e66cc Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:33:17 +0200 Subject: [PATCH 07/48] Update sdcard.h correcting the SD-card-pins --- include/sdcard.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/include/sdcard.h b/include/sdcard.h index e6bc62fb..fa358a71 100644 --- a/include/sdcard.h +++ b/include/sdcard.h @@ -5,7 +5,7 @@ #include #include -#ifdef HAS_SDCARD +#if (HAS_SDCARD) #if HAS_SDCARD == 1 #include //#include @@ -15,6 +15,11 @@ #error HAS_SDCARD unknown card reader value, must be either 1 or 2 #endif #endif +// Pins for SD-card +#define SDCARD_CS (13) +#define SDCARD_MOSI (15) +#define SDCARD_MISO (2) +#define SDCARD_SCLK (14) #ifdef HAS_SDS011 #include "sds011read.h" @@ -38,9 +43,13 @@ #define SDCARD_FILE_NAME "/paxcount.%02d" #define SDCARD_FILE_HEADER "date, time, wifi, bluet" - -bool sdcard_init(void); -void sdcardWriteData(uint16_t, uint16_t); -static void createFile(void); - +#define SDCARD_FILE_NAME "paxcount.%02d" +#define SDCARD_FILE_HEADER "date, time, wifi, bluet" +#if (COUNT_CWA) +#define SDCARD_FILE_HEADER_CWA ",cwa" #endif + +bool sdcard_init( void ); +void sdcardWriteData( uint16_t, uint16_t, uint16_t = 0); + +#endif // _SDCARD_H From 5007373f589675247b19ef37f96aac5a418db6e8 Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:34:13 +0200 Subject: [PATCH 08/48] Update main.h added: CWA-handling --- include/main.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/main.h b/include/main.h index bc63ff4e..3e346af7 100644 --- a/include/main.h +++ b/include/main.h @@ -20,5 +20,6 @@ #include "sensor.h" #include "lorawan.h" #include "timekeeper.h" +#include "corona.h" -#endif \ No newline at end of file +#endif From e7b7fb1144c0d8a585c4befefe949c1a6d6a633a Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:35:45 +0200 Subject: [PATCH 09/48] Update senddata.h added: CWA-handling --- include/senddata.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/senddata.h b/include/senddata.h index fd31f884..f1a43867 100644 --- a/include/senddata.h +++ b/include/senddata.h @@ -8,6 +8,7 @@ #include "lorawan.h" #include "display.h" #include "sdcard.h" +#include "corona.h" extern Ticker sendcycler; From dcc26a6c9ec7b3bd7a9c7e749d4603e49d182d0d Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:36:41 +0200 Subject: [PATCH 10/48] Update macsniff.h --- include/macsniff.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/macsniff.h b/include/macsniff.h index a04b7cc8..574048b7 100644 --- a/include/macsniff.h +++ b/include/macsniff.h @@ -12,10 +12,11 @@ #define MAC_SNIFF_WIFI 0 #define MAC_SNIFF_BLE 1 +#define MAC_SNIFF_BLE_CWA 2 uint16_t get_salt(void); uint64_t macConvert(uint8_t *paddr); bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type); void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb); -#endif \ No newline at end of file +#endif From d36579c8d090845448cb5bdf64ea30a062397e4e Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:48:19 +0200 Subject: [PATCH 11/48] Update paxcounter.conf added: CWA-handling --- src/paxcounter.conf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/paxcounter.conf b/src/paxcounter.conf index c98cc7b9..b220126e 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -24,6 +24,15 @@ #define BLESCANWINDOW 80 // [milliseconds] scan window, see below, 3 .. 10240, default 80ms #define BLESCANINTERVAL 80 // [illiseconds] scan interval, see below, 3 .. 10240, default 80ms = 100% duty cycle +#define COUNT_CWA 1 // count found copies of the Corona Warn App (CWA) + // uncomment this line if you do not want to count these apps + +// for additional sensors (added by some user) +#define HAS_SENSOR_1 1 // needed because we use SENSOR1_DATA for the CWA-data +#define HAS_SENSOR_2 0 // not used +#define HAS_SENSOR_3 0 // not used +#define HAS_SENSORS (HAS_SENSOR_1 || HAS_SENSOR_2 || HAS_SENSOR_3) // to simplify things + /* Note: guide for setting bluetooth parameters * * |< Scan Window > |< Scan Window > | ... |< Scan Window > | From add5b8ca2d5619f11f30c7676cd1cbdfb395c97c Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:49:17 +0200 Subject: [PATCH 12/48] Update ttgov21new.h corrected: SD-card --- src/hal/ttgov21new.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hal/ttgov21new.h b/src/hal/ttgov21new.h index ca2a9cc6..4b08748d 100644 --- a/src/hal/ttgov21new.h +++ b/src/hal/ttgov21new.h @@ -12,11 +12,11 @@ // This settings are for boards labeled v1.6 on pcb, NOT for v1.5 or older */ -#define HAS_LORA 1 // comment out if device shall not send data via LoRa +#define HAS_LORA 1 // comment out if device shall not send data via LoRa #define CFG_sx1276_radio 1 // HPD13A LoRa SoC // enable only if you want to store a local paxcount table on the device -#define HAS_SDCARD 2 // this board has an SD-card-reader/writer +#define HAS_SDCARD 1 // this board has an SD-card-reader/writer #define HAS_DISPLAY 1 #define HAS_LED (25) // green on board LED From 2a2ee35c59c5ba32e2a18c98411667a97c748184 Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:50:28 +0200 Subject: [PATCH 13/48] Create coona.cpp added: CWA-handling --- src/coona.cpp | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/coona.cpp diff --git a/src/coona.cpp b/src/coona.cpp new file mode 100644 index 00000000..44020d84 --- /dev/null +++ b/src/coona.cpp @@ -0,0 +1,85 @@ +// routines for counting the number of available Corona Warn Apps (CWA) + +// copied from https://github.com/kmetz/BLEExposureNotificationBeeper +// (c) by Kaspar Metz +// modified for use in the Paxcounter by AQ + +#if (COUNT_CWA) + +// Local logging tag +static const char TAG[] = __FILE__; + +#define BT_BD_ADDR_HEX(addr) \ + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] + +#include "corona.h" + +// taken from macsniff.cpp +extern uint16_t salt; +extern uint16_t hashedmac; + +// When to forget old senders. +#define FORGET_AFTER_MINUTES 2 + +static std::map cwaSeenNotifiers; + + +/** + * Remove notifiers last seen over FORGET_AFTER_MINUTES ago. + */ +void cwa_clear() { + ESP_LOGD(TAG, "CWA: forget old notifier: %d", cwaSeenNotifiers.size()); + +//#ifdef SOME_FORM_OF_DEBUG + for (auto const ¬ifier : cwaSeenNotifiers) { + ESP_LOGI(TAG, "CWA forget <%X>", notifier.first); +// } + } +//#endif + /* clear everything, + * otherwise we will count the same device again + * as in the next cycle it will get a differetn hash-value + */ + cwaSeenNotifiers.clear(); +} + +/* return the numbers of active CWAs found + */ +uint16_t cwa_report(void) { + return cwaSeenNotifiers.size(); +} + +bool cwa_init(void) +{ + ESP_LOGD(TAG, "init of BLE-scanner for CWA"); + return true; + +} + +// similar to mac_add(), found in macsniff.cpp +// for comments pls. look into this function +bool cwa_mac_add(uint8_t* paddr) { + + // are we too early? + if ( hashedmac <= 0 ) + return false; // YES -> return + + bool added = false; + ESP_LOGD(TAG, "Device address (bda): %02x:%02x:%02x:%02x:%02x:%02x", + BT_BD_ADDR_HEX(paddr)); + + ESP_LOGD(TAG, "hasehd mac = %X, count = %d (total=%d)", hashedmac, cwaSeenNotifiers.count(hashedmac), cwaSeenNotifiers.size()); + added = !(cwaSeenNotifiers.count(hashedmac) > 0); + + // Count only if MAC was not yet seen + if (added) { + ESP_LOGD(TAG, "added device with active CWA"); + } + + cwaSeenNotifiers[hashedmac] = millis(); // last seen at .... + + // True if MAC WiFi/BLE was new + return added; +} + +#endif From ad288b70586992ac414c51baa564f75914887b7b Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:52:07 +0200 Subject: [PATCH 14/48] Update sdcard.cpp added: CWA-handling --- src/sdcard.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sdcard.cpp b/src/sdcard.cpp index 94e14eaa..29f65f3a 100644 --- a/src/sdcard.cpp +++ b/src/sdcard.cpp @@ -9,6 +9,8 @@ static const char TAG[] = __FILE__; static bool useSDCard; +static void createFile(void); + File fileSDCard; bool sdcard_init() { @@ -19,9 +21,7 @@ bool sdcard_init() { // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/sdmmc_host.html #if HAS_SDCARD == 1 // use SD SPI host driver - useSDCard = SD.begin(SDCARD_CS, SDCARD_MOSI, SDCARD_MISO, SDCARD_SCLK); - //SPI.begin(SDCARD_SCLK, SDCARD_MSO, SDCARD_MOSI, SDCARD_CS); //delay(10); //useSDCard = SD.begin(SDCARD_CS, SPI, 40000000, "/sd"); @@ -38,7 +38,7 @@ bool sdcard_init() { return useSDCard; } -void sdcardWriteData(uint16_t noWifi, uint16_t noBle) { +void sdcardWriteData(uint16_t noWifi, uint16_t noBle, __attribute__((unused)) uint16_t noBleCWA) { static int counterWrites = 0; char tempBuffer[12 + 1]; time_t t = now(); @@ -56,6 +56,10 @@ void sdcardWriteData(uint16_t noWifi, uint16_t noBle) { fileSDCard.print(tempBuffer); sprintf(tempBuffer, "%d,%d", noWifi, noBle); fileSDCard.print(tempBuffer); +#if (COUNT_CWA) + sprintf(tempBuffer, ",%d", noBleCWA); + fileSDCard.print(tempBuffer); +#endif #if (HAS_SDS011) sds011_store(&sds); sprintf(tempBuffer, ",%5.1f,%4.1f", sds.pm10, sds.pm25); @@ -98,6 +102,9 @@ void createFile(void) { if (fileSDCard) { ESP_LOGD(TAG, "SD: name opened: <%s>", bufferFilename); fileSDCard.print(SDCARD_FILE_HEADER); +#if (COUNT_CWA) + fileSDCard.print(SDCARD_FILE_HEADER_CWA); // for Corona-data (CWA) +#endif #if (HAS_SDS011) fileSDCard.print(SDCARD_FILE_HEADER_SDS011); #endif From e9800db481a46158a211cf030517905d1a8f220a Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:53:49 +0200 Subject: [PATCH 15/48] Update macsniff.cpp added: CWA-handling --- src/macsniff.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/macsniff.cpp b/src/macsniff.cpp index a64e49b1..3b6ee5d5 100644 --- a/src/macsniff.cpp +++ b/src/macsniff.cpp @@ -10,7 +10,9 @@ // Local logging tag static const char TAG[] = __FILE__; -uint16_t salt; +// used here and in corona.cpp +uint16_t salt = -1; +uint16_t hashedmac = -1; // temporary buffer for generated hash value uint16_t get_salt(void) { salt = (uint16_t)random(65536); // get new 16bit random for salting hashes @@ -51,7 +53,6 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { char buff[10]; // temporary buffer for printf bool added = false; int8_t beaconID; // beacon number in test monitor mode - uint16_t hashedmac; // temporary buffer for generated hash value uint32_t *mac; // temporary buffer for shortened MAC // only last 3 MAC Address bytes are used for MAC address anonymization @@ -111,18 +112,25 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { payload.addAlarm(rssi, beaconID); SendPayload(BEACONPORT, prio_high); } - }; + }; } // added // Log scan result ESP_LOGV(TAG, "%s %s RSSI %ddBi -> salted MAC %s -> Hash %04X -> WiFi:%d " - "BLTH:%d -> " - "%d Bytes left", + "BLTH:%d " +#if (COUNT_CWA) + "(CWA:%d)" +#endif + "-> %d Bytes left", added ? "new " : "known", sniff_type == MAC_SNIFF_WIFI ? "WiFi" : "BLTH", rssi, buff, - hashedmac, macs_wifi, macs_ble, getFreeRAM()); + hashedmac, macs_wifi, macs_ble, +#if (COUNT_CWA) + cwa_report(), +#endif + getFreeRAM()); #if (VENDORFILTER) } else { From c15d8cb893da028ce1ed496f203c229fe44173d6 Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:56:21 +0200 Subject: [PATCH 16/48] Update main.cpp added: CWA-handling --- src/main.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ed0bd9ee..ff0fa2cd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -312,9 +312,25 @@ void setup() { // initialize sensors #if (HAS_SENSORS) - strcat_P(features, " SENS"); +#if (HAS_SENSOR_1) +#if (COUNT_CWA) + ESP_LOGI(TAG, "init CWA-counter"); + if ( cwa_init() ) + strcat_P(features, " CWA"); +#else + strcat_P(features, " SENS(1)"); sensor_init(); #endif +#endif +#if (HAS_SENSOR_2) + strcat_P(features, " SENS(2)"); + sensor_init(); +#endif +#if (HAS_SENSOR_3) + strcat_P(features, " SENS(3)"); + sensor_init(); +#endif +#endif // initialize LoRa #if (HAS_LORA) @@ -336,7 +352,7 @@ void setup() { assert(mqtt_init() == ESP_OK); #endif -#ifdef HAS_SDCARD +#if (HAS_SDCARD) if (sdcard_init()) strcat_P(features, " SD"); #endif From b8fc516a01c6297db6c443e63fece98a12965d99 Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:57:45 +0200 Subject: [PATCH 17/48] Update senddata.cpp added: CWA-handling --- src/senddata.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/senddata.cpp b/src/senddata.cpp index d6067131..34e9000b 100644 --- a/src/senddata.cpp +++ b/src/senddata.cpp @@ -55,8 +55,14 @@ void SendPayload(uint8_t port, sendprio_t prio) { #endif // write data to sdcard, if present -#ifdef HAS_SDCARD - sdcardWriteData(macs_wifi, macs_ble); +#if (HAS_SDCARD) + if ( port == COUNTERPORT ) { + sdcardWriteData(macs_wifi, macs_ble +#if (COUNT_CWA) + , cwa_report() +#endif + ); + } #endif } // SendPayload @@ -143,22 +149,31 @@ void sendData() { #endif #if (HAS_SENSORS) +#if (HAS_SENSOR_1) case SENSOR1_DATA: payload.reset(); payload.addSensor(sensor_read(1)); SendPayload(SENSOR1PORT, prio_normal); +#if (COUNT_CWA) + cwa_clear(); +#endif break; +#endif +#if (HAS_SENSOR_2) case SENSOR2_DATA: payload.reset(); payload.addSensor(sensor_read(2)); SendPayload(SENSOR2PORT, prio_normal); break; +#endif +#if (HAS_SENSOR_3) case SENSOR3_DATA: payload.reset(); payload.addSensor(sensor_read(3)); SendPayload(SENSOR3PORT, prio_normal); break; #endif +#endif #if (defined BAT_MEASURE_ADC || defined HAS_PMU) case BATT_DATA: From 1f388d64302d2eb8925e55c5237f73ea1bffc2b5 Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:59:00 +0200 Subject: [PATCH 18/48] Update blecsan.cpp added: CWA-handling --- src/blecsan.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/blecsan.cpp b/src/blecsan.cpp index d305680e..0806776c 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -6,6 +6,9 @@ #define BT_BD_ADDR_HEX(addr) \ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] +// checking for CWAs we need this magic bytes: +static const char cwaMagicBytes[] = "\x03\x03\x6F\xfd"; + // local Tag for logging static const char TAG[] = "bluetooth"; @@ -158,10 +161,19 @@ IRAM_ATTR void gap_callback_handler(esp_gap_ble_cb_event_t event, // add this device and show new count total if it was not previously added mac_add((uint8_t *)p->scan_rst.bda, p->scan_rst.rssi, MAC_SNIFF_BLE); +#if (COUNT_CWA) + // we can call the cwa-functions now + // because we use the hashed max-value + // done in mac_add() + + // check for CWA-signature + if ( 0 == strncmp( (const char*)p->scan_rst.ble_adv, cwaMagicBytes , 4) ) { + cwa_mac_add( p->scan_rst.bda); + } +#endif + + /* to be improved in vendorfilter if: - - - // you can search for elements in the payload using the // function esp_ble_resolve_adv_data() // From 98302a95302a2ca4bf80d5536c65b950e967029b Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 12:01:00 +0200 Subject: [PATCH 19/48] Update display.cpp added: CWA-handling --- src/display.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 162fa6b3..579956b9 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -265,7 +265,12 @@ void dp_drawPage(time_t t, bool nextpage) { else dp_printf("WIFI:off"); if (cfg.blescan) - dp_printf(" BLTH:%-5d", macs_ble); +#if !(COUNT_CWA) + dp_printf("BLTH:%-5d", macs_ble); +#else + dp_printf("BLTH:%-5d", macs_ble); + dp_printf("(CWA:%d)", cwa_report()); +#endif else dp_printf(" BLTH:off"); #elif ((WIFICOUNTER) && (!BLECOUNTER)) @@ -274,9 +279,12 @@ void dp_drawPage(time_t t, bool nextpage) { else dp_printf("WIFI:off"); #elif ((!WIFICOUNTER) && (BLECOUNTER)) - if (cfg.blescan) + if (cfg.blescan) { dp_printf("BLTH:%-5d", macs_ble); - else +#if (COUNT_CWA) + dp_printf("(CWA:%d)", cwa_report()); +#endif + } else dp_printf("BLTH:off"); #else dp_printf("Sniffer disabled"); @@ -736,4 +744,4 @@ void dp_plotCurve(uint16_t count, bool reset) { dp_drawPixel(plotbuf, col, row, 1); } -#endif // HAS_DISPLAY \ No newline at end of file +#endif // HAS_DISPLAY From 9c1d03d8868293b1715aeb0b1b72473d62608a54 Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 12:02:21 +0200 Subject: [PATCH 20/48] Update sensor.cpp added: CWA-handling --- src/sensor.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/sensor.cpp b/src/sensor.cpp index abed9b75..230718ec 100644 --- a/src/sensor.cpp +++ b/src/sensor.cpp @@ -2,6 +2,14 @@ #include "globals.h" #include "sensor.h" +#if (COUNT_CWA) +#include "payload.h" +#include "corona.h" +#include "macsniff.h" + +extern PayloadConvert payload; +#endif + // Local logging tag static const char TAG[] = __FILE__; @@ -47,10 +55,14 @@ uint8_t *sensor_read(uint8_t sensor) { case 1: // insert user specific sensor data frames here */ +#if (COUNT_CWA) + payload.addCount( cwa_report(), MAC_SNIFF_BLE_CWA); +#else buf[0] = length; buf[1] = 0x01; buf[2] = 0x02; buf[3] = 0x03; +#endif break; case 2: @@ -71,4 +83,4 @@ uint8_t *sensor_read(uint8_t sensor) { } return buf; -} \ No newline at end of file +} From f1bf16bd74b37be55a04c25c1e2a930a6ea3dd69 Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 16:26:30 +0200 Subject: [PATCH 21/48] Create corona.h added: CWA-handling --- include/corona.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 include/corona.h diff --git a/include/corona.h b/include/corona.h new file mode 100644 index 00000000..fcbf556d --- /dev/null +++ b/include/corona.h @@ -0,0 +1,16 @@ +#ifndef _CORONA_h +#define _CORONA_H + +// inspired by https://github.com/kmetz/BLEExposureNotificationBeeper +// (c) by Kaspar Metz +// modified for use in the Paxcounter by AQ + +#include "globals.h" +#include + +bool cwa_init(void); +bool cwa_mac_add(uint8_t *); +void cwa_clear(void); +uint16_t cwa_report(void); + +#endif From ec54f3e2e3bbfee7aead30fe9b6e3860d534a63e Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 16:30:27 +0200 Subject: [PATCH 22/48] Update paxcounter.conf set to standard-values --- src/paxcounter.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/paxcounter.conf b/src/paxcounter.conf index b220126e..60bfc361 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -24,11 +24,11 @@ #define BLESCANWINDOW 80 // [milliseconds] scan window, see below, 3 .. 10240, default 80ms #define BLESCANINTERVAL 80 // [illiseconds] scan interval, see below, 3 .. 10240, default 80ms = 100% duty cycle -#define COUNT_CWA 1 // count found copies of the Corona Warn App (CWA) - // uncomment this line if you do not want to count these apps +#define COUNT_CWA 0 // count found copies of the Corona Warn App (CWA) + // set to 0 if you do not want to count these apps // for additional sensors (added by some user) -#define HAS_SENSOR_1 1 // needed because we use SENSOR1_DATA for the CWA-data +#define HAS_SENSOR_1 0 // set to 1 if you want to count CWAs #define HAS_SENSOR_2 0 // not used #define HAS_SENSOR_3 0 // not used #define HAS_SENSORS (HAS_SENSOR_1 || HAS_SENSOR_2 || HAS_SENSOR_3) // to simplify things From 2c15b29255baee7956d8722da53909a8d2277c72 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Wed, 2 Sep 2020 11:20:43 +0200 Subject: [PATCH 23/48] bugfix timesync LORASERVER (issue #625) --- src/timesync.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/timesync.cpp b/src/timesync.cpp index d0bc4c5d..088ff59f 100644 --- a/src/timesync.cpp +++ b/src/timesync.cpp @@ -191,7 +191,7 @@ void IRAM_ATTR timesync_serverAnswer(void *pUserData, int flag) { // flag: length of buffer // Store the instant the time request of the node was received on the gateway - timesync_store(osticks2ms(os_getTime(), timesync_rx); + timesync_store(osticks2ms(os_getTime()), timesync_rx); // parse pUserData: // p type meaning From c014824667e86da6796b549a4302bd25267aad0b Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Wed, 2 Sep 2020 11:21:56 +0200 Subject: [PATCH 24/48] CWA detection (experimental) --- include/sdcard.h | 7 +--- platformio.ini | 14 ++++---- src/blecsan.cpp | 21 ++++++----- src/coona.cpp | 85 --------------------------------------------- src/corona.cpp | 81 ++++++++++++++++++++++++++++++++++++++++++ src/display.cpp | 16 ++++----- src/macsniff.cpp | 22 ++++++------ src/main.cpp | 2 +- src/paxcounter.conf | 13 +++---- src/sdcard.cpp | 4 +-- src/senddata.cpp | 4 +-- src/sensor.cpp | 4 +-- 12 files changed, 131 insertions(+), 142 deletions(-) delete mode 100644 src/coona.cpp create mode 100644 src/corona.cpp diff --git a/include/sdcard.h b/include/sdcard.h index fa358a71..d95e8336 100644 --- a/include/sdcard.h +++ b/include/sdcard.h @@ -15,11 +15,6 @@ #error HAS_SDCARD unknown card reader value, must be either 1 or 2 #endif #endif -// Pins for SD-card -#define SDCARD_CS (13) -#define SDCARD_MOSI (15) -#define SDCARD_MISO (2) -#define SDCARD_SCLK (14) #ifdef HAS_SDS011 #include "sds011read.h" @@ -45,7 +40,7 @@ #define SDCARD_FILE_HEADER "date, time, wifi, bluet" #define SDCARD_FILE_NAME "paxcount.%02d" #define SDCARD_FILE_HEADER "date, time, wifi, bluet" -#if (COUNT_CWA) +#if (COUNT_ENS) #define SDCARD_FILE_HEADER_CWA ",cwa" #endif diff --git a/platformio.ini b/platformio.ini index 246d5734..96c0a9ab 100644 --- a/platformio.ini +++ b/platformio.ini @@ -37,16 +37,16 @@ halfile = generic.h [platformio] ; upload firmware to board with usb cable -;default_envs = usb +default_envs = usb ; upload firmware to a jfrog bintray repository ;default_envs = ota ; use latest versions of libraries -default_envs = dev +;default_envs = dev description = Paxcounter is a device for metering passenger flows in realtime. It counts how many mobile devices are around. [common] ; for release_version use max. 10 chars total, use any decimal format like "a.b.c" -release_version = 1.9.996 +release_version = 2.0.1 ; 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 = 4 @@ -61,19 +61,19 @@ display_library = ; set by build.py and taken from hal file lib_deps_lora = MCCI LoRaWAN LMIC library@3.2.0 ; MCCI LMIC by Terrill Moore lib_deps_display = - OneBitDisplay@1.5.0 + OneBitDisplay@1.7.1 QRCode@0.0.1 BitBang_I2C@2.1.1 - TFT_eSPI@>=2.2.8 + TFT_eSPI@>=2.2.18 lib_deps_ledmatrix = Ultrathin_LED_Matrix@>=1.0.0 lib_deps_rgbled = - SmartLeds@>=1.2.0 + SmartLeds@>=1.2.1 lib_deps_gps = 1655@>=1.0.2 ; #1655 TinyGPSPlus by Mikal Hart lib_deps_sensors = Adafruit Unified Sensor@>=1.1.4 - Adafruit BME280 Library@>=2.0.2 + Adafruit BME280 Library@>=2.1.0 Adafruit BMP085 Library@>=1.1.0 BSEC Software Library@1.5.1474 https://github.com/ricki-z/SDS011.git diff --git a/src/blecsan.cpp b/src/blecsan.cpp index 0806776c..10dcc900 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -6,8 +6,10 @@ #define BT_BD_ADDR_HEX(addr) \ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] -// checking for CWAs we need this magic bytes: -static const char cwaMagicBytes[] = "\x03\x03\x6F\xfd"; +// UUID of Exposure Notification Service (ENS) +// see +// https://blog.google/documents/70/Exposure_Notification_-_Bluetooth_Specification_v1.2.2.pdf +static const char ensMagicBytes[] = "\x03\x03\x6F\xfd"; // local Tag for logging static const char TAG[] = "bluetooth"; @@ -161,18 +163,15 @@ IRAM_ATTR void gap_callback_handler(esp_gap_ble_cb_event_t event, // add this device and show new count total if it was not previously added mac_add((uint8_t *)p->scan_rst.bda, p->scan_rst.rssi, MAC_SNIFF_BLE); -#if (COUNT_CWA) - // we can call the cwa-functions now - // because we use the hashed max-value - // done in mac_add() +#if (COUNT_ENS) + // we can call the ens functions now using hashed max-value in mac_add() - // check for CWA-signature - if ( 0 == strncmp( (const char*)p->scan_rst.ble_adv, cwaMagicBytes , 4) ) { - cwa_mac_add( p->scan_rst.bda); - } + // check for ens signature + if (0 == strncmp((const char *)p->scan_rst.ble_adv, ensMagicBytes, 4)) { + cwa_mac_add(p->scan_rst.bda); + } #endif - /* to be improved in vendorfilter if: // you can search for elements in the payload using the // function esp_ble_resolve_adv_data() diff --git a/src/coona.cpp b/src/coona.cpp deleted file mode 100644 index 44020d84..00000000 --- a/src/coona.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// routines for counting the number of available Corona Warn Apps (CWA) - -// copied from https://github.com/kmetz/BLEExposureNotificationBeeper -// (c) by Kaspar Metz -// modified for use in the Paxcounter by AQ - -#if (COUNT_CWA) - -// Local logging tag -static const char TAG[] = __FILE__; - -#define BT_BD_ADDR_HEX(addr) \ - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] - -#include "corona.h" - -// taken from macsniff.cpp -extern uint16_t salt; -extern uint16_t hashedmac; - -// When to forget old senders. -#define FORGET_AFTER_MINUTES 2 - -static std::map cwaSeenNotifiers; - - -/** - * Remove notifiers last seen over FORGET_AFTER_MINUTES ago. - */ -void cwa_clear() { - ESP_LOGD(TAG, "CWA: forget old notifier: %d", cwaSeenNotifiers.size()); - -//#ifdef SOME_FORM_OF_DEBUG - for (auto const ¬ifier : cwaSeenNotifiers) { - ESP_LOGI(TAG, "CWA forget <%X>", notifier.first); -// } - } -//#endif - /* clear everything, - * otherwise we will count the same device again - * as in the next cycle it will get a differetn hash-value - */ - cwaSeenNotifiers.clear(); -} - -/* return the numbers of active CWAs found - */ -uint16_t cwa_report(void) { - return cwaSeenNotifiers.size(); -} - -bool cwa_init(void) -{ - ESP_LOGD(TAG, "init of BLE-scanner for CWA"); - return true; - -} - -// similar to mac_add(), found in macsniff.cpp -// for comments pls. look into this function -bool cwa_mac_add(uint8_t* paddr) { - - // are we too early? - if ( hashedmac <= 0 ) - return false; // YES -> return - - bool added = false; - ESP_LOGD(TAG, "Device address (bda): %02x:%02x:%02x:%02x:%02x:%02x", - BT_BD_ADDR_HEX(paddr)); - - ESP_LOGD(TAG, "hasehd mac = %X, count = %d (total=%d)", hashedmac, cwaSeenNotifiers.count(hashedmac), cwaSeenNotifiers.size()); - added = !(cwaSeenNotifiers.count(hashedmac) > 0); - - // Count only if MAC was not yet seen - if (added) { - ESP_LOGD(TAG, "added device with active CWA"); - } - - cwaSeenNotifiers[hashedmac] = millis(); // last seen at .... - - // True if MAC WiFi/BLE was new - return added; -} - -#endif diff --git a/src/corona.cpp b/src/corona.cpp new file mode 100644 index 00000000..0ef136a2 --- /dev/null +++ b/src/corona.cpp @@ -0,0 +1,81 @@ +// routines for counting the number of devices which advertise Exposure +// Notification Service e.g. "Corona Warn App" in Germany + +// copied from https://github.com/kmetz/BLEExposureNotificationBeeper +// (c) by Kaspar Metz +// modified for use in the Paxcounter by AQ + +#if (COUNT_ENS) + +// Local logging tag +static const char TAG[] = __FILE__; + +#define BT_BD_ADDR_HEX(addr) \ + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] + +#include "corona.h" + +// taken from macsniff.cpp +extern uint16_t salt; +extern uint16_t hashedmac; + +// When to forget old senders. +#define FORGET_AFTER_MINUTES 2 + +// array of timestamps for seen notifiers +static std::map cwaSeenNotifiers; + +// Remove notifiers last seen over FORGET_AFTER_MINUTES ago. +void cwa_clear() { + ESP_LOGD(TAG, "CWA: forget old notifier: %d", cwaSeenNotifiers.size()); + + /* + #ifdef SOME_FORM_OF_DEBUG + for (auto const ¬ifier : cwaSeenNotifiers) { + ESP_LOGD(TAG, "CWA forget <%X>", notifier.first); + // } + } + #endif + */ + + // clear everything, otherwise we would count the same device again, as in the + // next cycle it likely will advertise with a different hash-value + cwaSeenNotifiers.clear(); +} + +// return the total number of devices seen advertising ENS +uint16_t cwa_report(void) { return cwaSeenNotifiers.size(); } + +bool cwa_init(void) { + ESP_LOGD(TAG, "init BLE-scanner for ENS"); + return true; +} + +// similar to mac_add(), found in macsniff.cpp +// for comments pls. look into this function +bool cwa_mac_add(uint8_t *paddr) { + + // are we too early? + if (!hashedmac) + return false; // YES -> return + + bool added = false; + ESP_LOGD(TAG, "Device address (bda): %02x:%02x:%02x:%02x:%02x:%02x", + BT_BD_ADDR_HEX(paddr)); + + ESP_LOGD(TAG, "hashed ENS mac = %X, ENS count = %d (total=%d)", hashedmac, + cwaSeenNotifiers.count(hashedmac), cwaSeenNotifiers.size()); + added = !(cwaSeenNotifiers.count(hashedmac) > 0); + + // Count only if this ENS MAC was not yet seen + if (added) { + ESP_LOGD(TAG, "added device with active ENS"); + } + + cwaSeenNotifiers[hashedmac] = millis(); // last seen at .... + + // True if MAC WiFi/BLE was new + return added; +} + +#endif diff --git a/src/display.cpp b/src/display.cpp index 579956b9..84b21952 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -265,11 +265,10 @@ void dp_drawPage(time_t t, bool nextpage) { else dp_printf("WIFI:off"); if (cfg.blescan) -#if !(COUNT_CWA) +#if (!COUNT_ENS) dp_printf("BLTH:%-5d", macs_ble); #else - dp_printf("BLTH:%-5d", macs_ble); - dp_printf("(CWA:%d)", cwa_report()); + dp_printf(" CWA:%-5d", cwa_report()); #endif else dp_printf(" BLTH:off"); @@ -281,10 +280,10 @@ void dp_drawPage(time_t t, bool nextpage) { #elif ((!WIFICOUNTER) && (BLECOUNTER)) if (cfg.blescan) { dp_printf("BLTH:%-5d", macs_ble); -#if (COUNT_CWA) +#if (COUNT_ENS) dp_printf("(CWA:%d)", cwa_report()); -#endif - } else +#endif + } else dp_printf("BLTH:off"); #else dp_printf("Sniffer disabled"); @@ -357,7 +356,7 @@ void dp_drawPage(time_t t, bool nextpage) { #if (HAS_LORA) - // 3|NtwkID:000000 TXpw:aa + // 3|NetID:000000 PWR:aa // 4|DevAdd:00000000 DR:0 // 5|CHMsk:0000 Nonce:0000 // 6|CUp:000000 CDn:000000 @@ -365,8 +364,7 @@ void dp_drawPage(time_t t, bool nextpage) { dp_setFont(MY_FONT_SMALL); dp_setTextCursor(0, 3); - dp_printf("NetwID:%06X TXpw:%-2d", LMIC.netid & 0x001FFFFF, - LMIC.radio_txpow); + dp_printf("NetID:%06X PWR:%-2d", LMIC.netid & 0x001FFFFF, LMIC.radio_txpow); dp_println(); dp_printf("DevAdd:%08X DR:%1d", LMIC.devaddr, LMIC.datarate); dp_println(); diff --git a/src/macsniff.cpp b/src/macsniff.cpp index 3b6ee5d5..6b1df845 100644 --- a/src/macsniff.cpp +++ b/src/macsniff.cpp @@ -11,8 +11,8 @@ static const char TAG[] = __FILE__; // used here and in corona.cpp -uint16_t salt = -1; -uint16_t hashedmac = -1; // temporary buffer for generated hash value +uint16_t salt = 0; +uint16_t hashedmac = 0; // temporary buffer for generated hash value uint16_t get_salt(void) { salt = (uint16_t)random(65536); // get new 16bit random for salting hashes @@ -52,8 +52,8 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { char buff[10]; // temporary buffer for printf bool added = false; - int8_t beaconID; // beacon number in test monitor mode - uint32_t *mac; // temporary buffer for shortened MAC + int8_t beaconID; // beacon number in test monitor mode + uint32_t *mac; // temporary buffer for shortened MAC // only last 3 MAC Address bytes are used for MAC address anonymization // but since it's uint32 we take 4 bytes to avoid 1st value to be 0. @@ -112,22 +112,22 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { payload.addAlarm(rssi, beaconID); SendPayload(BEACONPORT, prio_high); } - }; + }; } // added // Log scan result - ESP_LOGV(TAG, + ESP_LOGD(TAG, "%s %s RSSI %ddBi -> salted MAC %s -> Hash %04X -> WiFi:%d " "BLTH:%d " -#if (COUNT_CWA) - "(CWA:%d)" -#endif +#if (COUNT_ENS) + "(CWA:%d)" +#endif "-> %d Bytes left", added ? "new " : "known", sniff_type == MAC_SNIFF_WIFI ? "WiFi" : "BLTH", rssi, buff, - hashedmac, macs_wifi, macs_ble, -#if (COUNT_CWA) + hashedmac, macs_wifi, macs_ble, +#if (COUNT_ENS) cwa_report(), #endif getFreeRAM()); diff --git a/src/main.cpp b/src/main.cpp index ff0fa2cd..0018c53f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -313,7 +313,7 @@ void setup() { // initialize sensors #if (HAS_SENSORS) #if (HAS_SENSOR_1) -#if (COUNT_CWA) +#if (COUNT_ENS) ESP_LOGI(TAG, "init CWA-counter"); if ( cwa_init() ) strcat_P(features, " CWA"); diff --git a/src/paxcounter.conf b/src/paxcounter.conf index 60bfc361..bc235dfa 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -16,7 +16,7 @@ // 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 power & memory +#define BLECOUNTER 1 // set it to 1 if you want to use BLE count, at expense of power & memory #define WIFICOUNTER 1 // set it to 0 if you want to switch off WIFI count // BLE scan parameters @@ -24,11 +24,12 @@ #define BLESCANWINDOW 80 // [milliseconds] scan window, see below, 3 .. 10240, default 80ms #define BLESCANINTERVAL 80 // [illiseconds] scan interval, see below, 3 .. 10240, default 80ms = 100% duty cycle -#define COUNT_CWA 0 // count found copies of the Corona Warn App (CWA) - // set to 0 if you do not want to count these apps +// Corona Exposure Notification Service(ENS) counter +#define COUNT_ENS 1 // count found number of devices which advertise Exposure Notification Service + // set to 0 if you do not want to count these devices // for additional sensors (added by some user) -#define HAS_SENSOR_1 0 // set to 1 if you want to count CWAs +#define HAS_SENSOR_1 1 // set to 1 if you want to count CWAs #define HAS_SENSOR_2 0 // not used #define HAS_SENSOR_3 0 // not used #define HAS_SENSORS (HAS_SENSOR_1 || HAS_SENSOR_2 || HAS_SENSOR_3) // to simplify things @@ -82,8 +83,8 @@ #define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds] // settings for syncing time of node with a time source (network / gps / rtc / timeserver) -#define TIME_SYNC_LORAWAN 1 // set to 1 to use LORA network as time source, 0 means off [default = 1] -#define TIME_SYNC_LORASERVER 0 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0] +#define TIME_SYNC_LORAWAN 0 // set to 1 to use LORA network as time source, 0 means off [default = 1] +#define TIME_SYNC_LORASERVER 1 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0] #define TIME_SYNC_INTERVAL 60 // sync time attempt each .. minutes from time source [default = 60], 0 means off #define TIME_SYNC_INTERVAL_RETRY 10 // retry time sync after lost sync each .. minutes [default = 10], 0 means off #define TIME_SYNC_SAMPLES 1 // number of time requests for averaging, max. 255 diff --git a/src/sdcard.cpp b/src/sdcard.cpp index 29f65f3a..57fc5b81 100644 --- a/src/sdcard.cpp +++ b/src/sdcard.cpp @@ -56,7 +56,7 @@ void sdcardWriteData(uint16_t noWifi, uint16_t noBle, __attribute__((unused)) ui fileSDCard.print(tempBuffer); sprintf(tempBuffer, "%d,%d", noWifi, noBle); fileSDCard.print(tempBuffer); -#if (COUNT_CWA) +#if (COUNT_ENS) sprintf(tempBuffer, ",%d", noBleCWA); fileSDCard.print(tempBuffer); #endif @@ -102,7 +102,7 @@ void createFile(void) { if (fileSDCard) { ESP_LOGD(TAG, "SD: name opened: <%s>", bufferFilename); fileSDCard.print(SDCARD_FILE_HEADER); -#if (COUNT_CWA) +#if (COUNT_ENS) fileSDCard.print(SDCARD_FILE_HEADER_CWA); // for Corona-data (CWA) #endif #if (HAS_SDS011) diff --git a/src/senddata.cpp b/src/senddata.cpp index 34e9000b..13b42927 100644 --- a/src/senddata.cpp +++ b/src/senddata.cpp @@ -58,7 +58,7 @@ void SendPayload(uint8_t port, sendprio_t prio) { #if (HAS_SDCARD) if ( port == COUNTERPORT ) { sdcardWriteData(macs_wifi, macs_ble -#if (COUNT_CWA) +#if (COUNT_ENS) , cwa_report() #endif ); @@ -154,7 +154,7 @@ void sendData() { payload.reset(); payload.addSensor(sensor_read(1)); SendPayload(SENSOR1PORT, prio_normal); -#if (COUNT_CWA) +#if (COUNT_ENS) cwa_clear(); #endif break; diff --git a/src/sensor.cpp b/src/sensor.cpp index 230718ec..baebf9d1 100644 --- a/src/sensor.cpp +++ b/src/sensor.cpp @@ -2,7 +2,7 @@ #include "globals.h" #include "sensor.h" -#if (COUNT_CWA) +#if (COUNT_ENS) #include "payload.h" #include "corona.h" #include "macsniff.h" @@ -55,7 +55,7 @@ uint8_t *sensor_read(uint8_t sensor) { case 1: // insert user specific sensor data frames here */ -#if (COUNT_CWA) +#if (COUNT_ENS) payload.addCount( cwa_report(), MAC_SNIFF_BLE_CWA); #else buf[0] = length; From 18d15ba70931aa17582a26d286fd0bff99149aa8 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Wed, 2 Sep 2020 11:23:41 +0200 Subject: [PATCH 25/48] bugfix timesync LORASERVER (issue #625) --- src/timesync.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/timesync.cpp b/src/timesync.cpp index d0bc4c5d..088ff59f 100644 --- a/src/timesync.cpp +++ b/src/timesync.cpp @@ -191,7 +191,7 @@ void IRAM_ATTR timesync_serverAnswer(void *pUserData, int flag) { // flag: length of buffer // Store the instant the time request of the node was received on the gateway - timesync_store(osticks2ms(os_getTime(), timesync_rx); + timesync_store(osticks2ms(os_getTime()), timesync_rx); // parse pUserData: // p type meaning From 2f0b3c8ef25d3fb2a51c1b857be1e0adc493d28d Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Wed, 2 Sep 2020 18:55:06 +0200 Subject: [PATCH 26/48] CWA scanner minor modifications --- include/corona.h | 2 +- include/macsniff.h | 2 +- src/blecsan.cpp | 12 +++++------- src/corona.cpp | 29 +++++++++-------------------- src/macsniff.cpp | 17 ++++++++--------- src/paxcounter.conf | 2 +- 6 files changed, 25 insertions(+), 39 deletions(-) diff --git a/include/corona.h b/include/corona.h index fcbf556d..a11990d5 100644 --- a/include/corona.h +++ b/include/corona.h @@ -9,7 +9,7 @@ #include bool cwa_init(void); -bool cwa_mac_add(uint8_t *); +bool cwa_mac_add(uint16_t hashedmac); void cwa_clear(void); uint16_t cwa_report(void); diff --git a/include/macsniff.h b/include/macsniff.h index 574048b7..e216af62 100644 --- a/include/macsniff.h +++ b/include/macsniff.h @@ -16,7 +16,7 @@ uint16_t get_salt(void); uint64_t macConvert(uint8_t *paddr); -bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type); +uint16_t mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type); void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb); #endif diff --git a/src/blecsan.cpp b/src/blecsan.cpp index 10dcc900..bfc8adc8 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -114,7 +114,9 @@ const char *btsig_gap_type(uint32_t gap_type) { // using IRAM_:ATTR here to speed up callback function IRAM_ATTR void gap_callback_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) { + esp_ble_gap_cb_param_t *p = (esp_ble_gap_cb_param_t *)param; + uint16_t hashedmac = 0; ESP_LOGV(TAG, "BT payload rcvd -> type: 0x%.2x -> %s", *p->scan_rst.ble_adv, btsig_gap_type(*p->scan_rst.ble_adv)); @@ -151,24 +153,20 @@ IRAM_ATTR void gap_callback_handler(esp_gap_ble_cb_event_t event, } #if (VENDORFILTER) - if ((p->scan_rst.ble_addr_type == BLE_ADDR_TYPE_RANDOM) || (p->scan_rst.ble_addr_type == BLE_ADDR_TYPE_RPA_RANDOM)) { ESP_LOGV(TAG, "BT device filtered"); break; } - #endif - // add this device and show new count total if it was not previously added - mac_add((uint8_t *)p->scan_rst.bda, p->scan_rst.rssi, MAC_SNIFF_BLE); + // hash and add this device and show new count total if it was not previously added + hashedmac = mac_add((uint8_t *)p->scan_rst.bda, p->scan_rst.rssi, MAC_SNIFF_BLE); #if (COUNT_ENS) - // we can call the ens functions now using hashed max-value in mac_add() - // check for ens signature if (0 == strncmp((const char *)p->scan_rst.ble_adv, ensMagicBytes, 4)) { - cwa_mac_add(p->scan_rst.bda); + cwa_mac_add(hashedmac); } #endif diff --git a/src/corona.cpp b/src/corona.cpp index 0ef136a2..00619191 100644 --- a/src/corona.cpp +++ b/src/corona.cpp @@ -15,10 +15,6 @@ static const char TAG[] = __FILE__; #include "corona.h" -// taken from macsniff.cpp -extern uint16_t salt; -extern uint16_t hashedmac; - // When to forget old senders. #define FORGET_AFTER_MINUTES 2 @@ -27,15 +23,16 @@ static std::map cwaSeenNotifiers; // Remove notifiers last seen over FORGET_AFTER_MINUTES ago. void cwa_clear() { - ESP_LOGD(TAG, "CWA: forget old notifier: %d", cwaSeenNotifiers.size()); - /* - #ifdef SOME_FORM_OF_DEBUG + + #ifdef SOME_FORM_OF_DEBUG + ESP_LOGD(TAG, "CWA: forget old notifier: %d", cwaSeenNotifiers.size()); for (auto const ¬ifier : cwaSeenNotifiers) { ESP_LOGD(TAG, "CWA forget <%X>", notifier.first); // } } #endif + */ // clear everything, otherwise we would count the same device again, as in the @@ -51,30 +48,22 @@ bool cwa_init(void) { return true; } -// similar to mac_add(), found in macsniff.cpp -// for comments pls. look into this function -bool cwa_mac_add(uint8_t *paddr) { - - // are we too early? - if (!hashedmac) - return false; // YES -> return +// similar to mac_add(), found in macsniff.cpp, for comments look into this function +bool cwa_mac_add(uint16_t hashedmac) { bool added = false; - ESP_LOGD(TAG, "Device address (bda): %02x:%02x:%02x:%02x:%02x:%02x", - BT_BD_ADDR_HEX(paddr)); - + ESP_LOGD(TAG, "hashed ENS mac = %X, ENS count = %d (total=%d)", hashedmac, cwaSeenNotifiers.count(hashedmac), cwaSeenNotifiers.size()); added = !(cwaSeenNotifiers.count(hashedmac) > 0); // Count only if this ENS MAC was not yet seen if (added) { + cwaSeenNotifiers[hashedmac] = millis(); // last seen at .... ESP_LOGD(TAG, "added device with active ENS"); } - cwaSeenNotifiers[hashedmac] = millis(); // last seen at .... - - // True if MAC WiFi/BLE was new + // True if ENS MAC was new return added; } diff --git a/src/macsniff.cpp b/src/macsniff.cpp index 6b1df845..4ba08575 100644 --- a/src/macsniff.cpp +++ b/src/macsniff.cpp @@ -10,9 +10,7 @@ // Local logging tag static const char TAG[] = __FILE__; -// used here and in corona.cpp uint16_t salt = 0; -uint16_t hashedmac = 0; // temporary buffer for generated hash value uint16_t get_salt(void) { salt = (uint16_t)random(65536); // get new 16bit random for salting hashes @@ -45,12 +43,13 @@ uint64_t macConvert(uint8_t *paddr) { return (__builtin_bswap64(*mac) >> 16); } -bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { +uint16_t mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { - if (!salt) // ensure we have salt (appears after radio is turned on) - return false; + if (salt == 0) // ensure we have salt (appears after radio is turned on) + return 0; - char buff[10]; // temporary buffer for printf + uint16_t hashedmac = 0; // temporary buffer for generated hash value + char buff[10]; // temporary buffer for printf bool added = false; int8_t beaconID; // beacon number in test monitor mode uint32_t *mac; // temporary buffer for shortened MAC @@ -140,7 +139,7 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { } #endif - // True if MAC WiFi/BLE was new - return added; // function returns bool if a new and unique Wifi or BLE mac was - // counted (true) or not (false) + // if a new and unique Wifi or BLE mac was counted, returs hash of this mac, + // else 0 + return hashedmac; } diff --git a/src/paxcounter.conf b/src/paxcounter.conf index bc235dfa..9f683134 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -26,7 +26,7 @@ // Corona Exposure Notification Service(ENS) counter #define COUNT_ENS 1 // count found number of devices which advertise Exposure Notification Service - // set to 0 if you do not want to count these devices + // set to 0 if you do not want to enable this function // for additional sensors (added by some user) #define HAS_SENSOR_1 1 // set to 1 if you want to count CWAs From 0f6e08e7e18b554167d0e214418c4d811f0f5d3f Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Thu, 3 Sep 2020 16:37:51 +0200 Subject: [PATCH 27/48] CWA code edits --- include/corona.h | 2 +- src/blecsan.cpp | 9 +++++---- src/corona.cpp | 23 ++++------------------- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/include/corona.h b/include/corona.h index a11990d5..9af0d314 100644 --- a/include/corona.h +++ b/include/corona.h @@ -9,7 +9,7 @@ #include bool cwa_init(void); -bool cwa_mac_add(uint16_t hashedmac); +void cwa_mac_add(uint16_t hashedmac); void cwa_clear(void); uint16_t cwa_report(void); diff --git a/src/blecsan.cpp b/src/blecsan.cpp index bfc8adc8..73110fdd 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -160,14 +160,15 @@ IRAM_ATTR void gap_callback_handler(esp_gap_ble_cb_event_t event, } #endif - // hash and add this device and show new count total if it was not previously added - hashedmac = mac_add((uint8_t *)p->scan_rst.bda, p->scan_rst.rssi, MAC_SNIFF_BLE); + // hash and add this device and show new count total if it was not + // previously added + hashedmac = + mac_add((uint8_t *)p->scan_rst.bda, p->scan_rst.rssi, MAC_SNIFF_BLE); #if (COUNT_ENS) // check for ens signature - if (0 == strncmp((const char *)p->scan_rst.ble_adv, ensMagicBytes, 4)) { + if (0 == strncmp((const char *)p->scan_rst.ble_adv, ensMagicBytes, 4)) cwa_mac_add(hashedmac); - } #endif /* to be improved in vendorfilter if: diff --git a/src/corona.cpp b/src/corona.cpp index 00619191..632bff1e 100644 --- a/src/corona.cpp +++ b/src/corona.cpp @@ -15,10 +15,10 @@ static const char TAG[] = __FILE__; #include "corona.h" -// When to forget old senders. +// When to forget old senders ** currently not used ** #define FORGET_AFTER_MINUTES 2 -// array of timestamps for seen notifiers +// array of timestamps for seen notifiers: hash -> timestamp[ms] static std::map cwaSeenNotifiers; // Remove notifiers last seen over FORGET_AFTER_MINUTES ago. @@ -48,23 +48,8 @@ bool cwa_init(void) { return true; } -// similar to mac_add(), found in macsniff.cpp, for comments look into this function -bool cwa_mac_add(uint16_t hashedmac) { - - bool added = false; - - ESP_LOGD(TAG, "hashed ENS mac = %X, ENS count = %d (total=%d)", hashedmac, - cwaSeenNotifiers.count(hashedmac), cwaSeenNotifiers.size()); - added = !(cwaSeenNotifiers.count(hashedmac) > 0); - - // Count only if this ENS MAC was not yet seen - if (added) { - cwaSeenNotifiers[hashedmac] = millis(); // last seen at .... - ESP_LOGD(TAG, "added device with active ENS"); - } - - // True if ENS MAC was new - return added; +void cwa_mac_add(uint16_t hashedmac) { + cwaSeenNotifiers[hashedmac] = millis(); // hash last seen at .... } #endif From ae106406a1b6d559b4f6282606931b527c9df995 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Fri, 4 Sep 2020 20:37:47 +0200 Subject: [PATCH 28/48] CWA settings --- platformio.ini | 2 +- src/paxcounter.conf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index 96c0a9ab..5a08fc61 100644 --- a/platformio.ini +++ b/platformio.ini @@ -49,7 +49,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I release_version = 2.0.1 ; 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 = 4 +debug_level = 3 extra_scripts = pre:build.py otakeyfile = ota.conf lorakeyfile = loraconf.h diff --git a/src/paxcounter.conf b/src/paxcounter.conf index 9f683134..9ced804c 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -15,9 +15,9 @@ #define COUNTERMODE 0 // 0=cyclic, 1=cumulative, 2=cyclic confirmed // 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 VENDORFILTER 0 // set to 0 if you want to all devices, not filtering smartphone OUIs #define BLECOUNTER 1 // set it to 1 if you want to use BLE count, at expense of power & memory -#define WIFICOUNTER 1 // set it to 0 if you want to switch off WIFI count +#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 @@ -29,7 +29,7 @@ // set to 0 if you do not want to enable this function // for additional sensors (added by some user) -#define HAS_SENSOR_1 1 // set to 1 if you want to count CWAs +#define HAS_SENSOR_1 1 // set to 1 if you want to transmit CWA counter #define HAS_SENSOR_2 0 // not used #define HAS_SENSOR_3 0 // not used #define HAS_SENSORS (HAS_SENSOR_1 || HAS_SENSOR_2 || HAS_SENSOR_3) // to simplify things From 370c9bd16196ddbf65fe9f6d5f1b4b6f57770cd6 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 5 Sep 2020 14:24:59 +0200 Subject: [PATCH 29/48] readme.md: ENS feature added --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c5fcec72..9d84d4d7 100644 --- a/README.md +++ b/README.md @@ -200,12 +200,24 @@ Paxcounter can keep it's time-of-day synced with an external time source. Set *# Paxcounter can be used to sync a wall clock which has a DCF77 or IF482 time telegram input. Set *#define HAS_IF482* or *#define HAS_DCF77* in board's hal file to setup clock controller. Use case of this function is to integrate paxcounter and clock. Accurary of the synthetic DCF77 signal depends on accuracy of on board's time base, see above. # mobile PaxCounter via https://opensensemap.org/ + This describes how to set up a mobile PaxCounter: -Follow all steps so far for preparing the device, use the packed payload format. In paxcounter.conf set PAYLOAD_OPENSENSEBOX to 1. Register a new sensbox on https://opensensemap.org/. +Follow all steps so far for preparing the device, use the packed payload format. In [paxcounter.conf](src/paxcounter.conf) set PAYLOAD_OPENSENSEBOX to 1. Register a new sensbox on https://opensensemap.org/. There in the sensor configuration select "TheThingsNetwork" and set Decoding Profil to "LoRa serialization", enter your TTN Application and Device Id. Decoding option has to be [{"decoder":"latLng"},{"decoder":"uint16","sensor_id":"yoursensorid"}] +# Covid-19 Exposure Notification System beacon detection (Germany: "Corona Warn App counter") + +Bluetooth low energy service UUID 0xFD6F, used by Google/Apple COVID-19 Exposure Notification System, can be monitored and counted. By comparing with the total number of observed devices this gives an indication how many people staying in proximity are using Apps for tracing COVID-19 exposures, e.g. in Germany the "Corona Warn App". To achive best resulta withs this funcion, use following settings in [paxcounter.conf](src/paxcounter.conf): + + #define COUNT_ENS 1 // enable ENS monitoring function + #define VENDORFILTER 0 // disable OUI filter (scans ALL device MACs) + #define BLECOUNTER 1 // enable bluetooth sniffing + #define WIFICOUNTER 0 // disable wifi sniffing (improves BLE scan speed) + #define HAS_SENSOR_1 1 // optional: transmit ENS counter data to server + # SD-card + Data can be stored on an SD-card if one is availabe. Simply choose the file in src/hal and add the following lines to your hal-file: #define HAS_SDCARD 1 // SD-card-reader/writer, using SPI interface @@ -559,4 +571,4 @@ Thanks to - [terrillmoore](https://github.com/mcci-catena) for maintaining the LMIC for arduino LoRaWAN stack - [sbamueller](https://github.com/sbamueller) for writing the tutorial in Make Magazine - [Stefan](https://github.com/nerdyscout) for paxcounter opensensebox integration -- [August Quint](https://github.com/AugustQu) for adding SD card data logger and SDS011 support +- [August Quint](https://github.com/AugustQu) for adding SD card data logger, SDS011 and ENS support From 26b68963535b0090fe8413a7815aa99979cf4808 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 5 Sep 2020 14:25:14 +0200 Subject: [PATCH 30/48] display.cpp: small mask fixes --- src/display.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 84b21952..6e181dd9 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -356,17 +356,17 @@ void dp_drawPage(time_t t, bool nextpage) { #if (HAS_LORA) - // 3|NetID:000000 PWR:aa - // 4|DevAdd:00000000 DR:0 + // 3|Net:000000 Pwr:aa + // 4|Dev:00000000 DR:0 // 5|CHMsk:0000 Nonce:0000 - // 6|CUp:000000 CDn:000000 + // 6|fUp:000000 fDn:000000 // 7|SNR:-0000 RSSI:-0000 dp_setFont(MY_FONT_SMALL); dp_setTextCursor(0, 3); - dp_printf("NetID:%06X PWR:%-2d", LMIC.netid & 0x001FFFFF, LMIC.radio_txpow); + dp_printf("Net:%06X Pwr:%-2d", LMIC.netid & 0x001FFFFF, LMIC.radio_txpow); dp_println(); - dp_printf("DevAdd:%08X DR:%1d", LMIC.devaddr, LMIC.datarate); + dp_printf("Dev:%08X DR:%1d", LMIC.devaddr, LMIC.datarate); dp_println(); dp_printf("ChMsk:%04X Nonce:%04X", LMIC.channelMap, LMIC.devNonce); dp_println(); From 55062923d3bafafdc0f160cee474b977c346e73a Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 5 Sep 2020 14:25:55 +0200 Subject: [PATCH 31/48] platformio.ini: versions edited --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 5a08fc61..c76d2b7d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -61,7 +61,7 @@ display_library = ; set by build.py and taken from hal file lib_deps_lora = MCCI LoRaWAN LMIC library@3.2.0 ; MCCI LMIC by Terrill Moore lib_deps_display = - OneBitDisplay@1.7.1 + OneBitDisplay@1.5.0 QRCode@0.0.1 BitBang_I2C@2.1.1 TFT_eSPI@>=2.2.18 From c1727a5b514c641076bd9023974c608ccf144325 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 5 Sep 2020 14:27:57 +0200 Subject: [PATCH 32/48] readme.md typos --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9d84d4d7..d7a52804 100644 --- a/README.md +++ b/README.md @@ -210,11 +210,11 @@ There in the sensor configuration select "TheThingsNetwork" and set Decoding Pro Bluetooth low energy service UUID 0xFD6F, used by Google/Apple COVID-19 Exposure Notification System, can be monitored and counted. By comparing with the total number of observed devices this gives an indication how many people staying in proximity are using Apps for tracing COVID-19 exposures, e.g. in Germany the "Corona Warn App". To achive best resulta withs this funcion, use following settings in [paxcounter.conf](src/paxcounter.conf): - #define COUNT_ENS 1 // enable ENS monitoring function - #define VENDORFILTER 0 // disable OUI filter (scans ALL device MACs) - #define BLECOUNTER 1 // enable bluetooth sniffing - #define WIFICOUNTER 0 // disable wifi sniffing (improves BLE scan speed) - #define HAS_SENSOR_1 1 // optional: transmit ENS counter data to server + #define COUNT_ENS 1 // enable ENS monitoring function + #define VENDORFILTER 0 // disable OUI filter (scans ALL device MACs) + #define BLECOUNTER 1 // enable bluetooth sniffing + #define WIFICOUNTER 0 // disable wifi sniffing (improves BLE scan speed) + #define HAS_SENSOR_1 1 // optional: transmit ENS counter data to server # SD-card From 39a54556fccebc8dee56e2875baeb3155557339d Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 5 Sep 2020 14:28:49 +0200 Subject: [PATCH 33/48] readme.md typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d7a52804..4ee4f7e4 100644 --- a/README.md +++ b/README.md @@ -211,10 +211,10 @@ There in the sensor configuration select "TheThingsNetwork" and set Decoding Pro Bluetooth low energy service UUID 0xFD6F, used by Google/Apple COVID-19 Exposure Notification System, can be monitored and counted. By comparing with the total number of observed devices this gives an indication how many people staying in proximity are using Apps for tracing COVID-19 exposures, e.g. in Germany the "Corona Warn App". To achive best resulta withs this funcion, use following settings in [paxcounter.conf](src/paxcounter.conf): #define COUNT_ENS 1 // enable ENS monitoring function - #define VENDORFILTER 0 // disable OUI filter (scans ALL device MACs) + #define VENDORFILTER 0 // disable OUI filter (scans ALL device MACs) #define BLECOUNTER 1 // enable bluetooth sniffing #define WIFICOUNTER 0 // disable wifi sniffing (improves BLE scan speed) - #define HAS_SENSOR_1 1 // optional: transmit ENS counter data to server + #define HAS_SENSOR_1 1 // optional: transmit ENS counter data to server # SD-card From 6d29855d923f51473eb5ed847f4488ea5f3ef118 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sat, 5 Sep 2020 14:40:23 +0200 Subject: [PATCH 34/48] Update paxcounter.conf --- src/paxcounter.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/paxcounter.conf b/src/paxcounter.conf index 9ced804c..9dba11bc 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -15,9 +15,9 @@ #define COUNTERMODE 0 // 0=cyclic, 1=cumulative, 2=cyclic confirmed // Set this to include BLE counting and vendor filter functions, or to switch off WIFI counting -#define VENDORFILTER 0 // set to 0 if you want to all devices, not filtering smartphone OUIs -#define BLECOUNTER 1 // 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 +#define VENDORFILTER 0 // set to 0 if you want to scan all devices, not filtering smartphone OUIs +#define BLECOUNTER 0 // set it to 1 if you want to use BLE count, at expense of power & memory +#define WIFICOUNTER 1 // 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 @@ -25,11 +25,11 @@ #define BLESCANINTERVAL 80 // [illiseconds] scan interval, see below, 3 .. 10240, default 80ms = 100% duty cycle // Corona Exposure Notification Service(ENS) counter -#define COUNT_ENS 1 // count found number of devices which advertise Exposure Notification Service +#define COUNT_ENS 0 // count found number of devices which advertise Exposure Notification Service // set to 0 if you do not want to enable this function // for additional sensors (added by some user) -#define HAS_SENSOR_1 1 // set to 1 if you want to transmit CWA counter +#define HAS_SENSOR_1 0 // set to 1 if you want to transmit CWA counter #define HAS_SENSOR_2 0 // not used #define HAS_SENSOR_3 0 // not used #define HAS_SENSORS (HAS_SENSOR_1 || HAS_SENSOR_2 || HAS_SENSOR_3) // to simplify things From b5a6228f7062e2b87532f4c1d3c9e62e340fc905 Mon Sep 17 00:00:00 2001 From: Nordominus <9849707+nordominus@users.noreply.github.com> Date: Mon, 7 Sep 2020 22:50:02 +0200 Subject: [PATCH 35/48] Fix for #632 - LDF will recognize BLE dependency of OneBitDisplay correctly and not end in compiler error --- platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio.ini b/platformio.ini index c76d2b7d..d3b3e5e1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -109,6 +109,7 @@ build_flags_all = -mfix-esp32-psram-cache-issue [env] +lib_ldf_mode = deep ; #632 Fixes compiler error with OneBitDisplay library framework = arduino board = esp32dev board_build.partitions = min_spiffs.csv From 731df291cdd55f78820f8d5c6b1174099d585944 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Tue, 8 Sep 2020 11:49:48 +0200 Subject: [PATCH 36/48] platformio.ini settings updated --- platformio.ini | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/platformio.ini b/platformio.ini index c76d2b7d..b0783259 100644 --- a/platformio.ini +++ b/platformio.ini @@ -59,18 +59,17 @@ monitor_speed = 115200 upload_speed = 115200 ; set by build.py and taken from hal file display_library = ; set by build.py and taken from hal file lib_deps_lora = - MCCI LoRaWAN LMIC library@3.2.0 ; MCCI LMIC by Terrill Moore + mcci-catena/MCCI LoRaWAN LMIC library @ ^3.2.0 lib_deps_display = OneBitDisplay@1.5.0 QRCode@0.0.1 - BitBang_I2C@2.1.1 TFT_eSPI@>=2.2.18 lib_deps_ledmatrix = Ultrathin_LED_Matrix@>=1.0.0 lib_deps_rgbled = SmartLeds@>=1.2.1 lib_deps_gps = - 1655@>=1.0.2 ; #1655 TinyGPSPlus by Mikal Hart + mikalhart/TinyGPSPlus @ ^1.0.2 lib_deps_sensors = Adafruit Unified Sensor@>=1.1.4 Adafruit BME280 Library@>=2.1.0 @@ -79,12 +78,12 @@ lib_deps_sensors = https://github.com/ricki-z/SDS011.git lib_deps_basic = ArduinoJson@<6 - 76@>=1.2.4 ; #76 Timezone by Jack Christensen - 274@>=2.3.5 ; #274 RTC by Michael Miller + jchristensen/Timezone @ ^1.2.4 + makuna/RTC @ ^2.3.5 SimpleButton - AXP202X_Library@>=1.1.2 ; AXP202 PMU lib by Lewis He + lewisxhe/AXP202X_Library @ ^1.1.2 esp32-micro-sdcard - MQTT@>=2.4.7 ; MQTT client maintained by Joel Gaehwiler + 256dpi/MQTT @ ^2.4.7 lib_deps_all = ${common.lib_deps_basic} ${common.lib_deps_lora} @@ -113,13 +112,14 @@ framework = arduino board = esp32dev board_build.partitions = min_spiffs.csv upload_speed = ${common.upload_speed} -;upload_port = COM7 +;upload_port = COM8 platform = ${common.platform_espressif32} lib_deps = ${common.lib_deps_all} build_flags = ${common.build_flags_all} upload_protocol = ${common.upload_protocol} extra_scripts = ${common.extra_scripts} monitor_speed = ${common.monitor_speed} +lib_ldf_mode = deep [env:ota] upload_protocol = custom From 176424c4d7ac2e7bfbcdc6bef8e95d017634e846 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Tue, 8 Sep 2020 11:51:50 +0200 Subject: [PATCH 37/48] issue #632 --- platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 8aef300d..85e70109 100644 --- a/platformio.ini +++ b/platformio.ini @@ -120,7 +120,6 @@ build_flags = ${common.build_flags_all} upload_protocol = ${common.upload_protocol} extra_scripts = ${common.extra_scripts} monitor_speed = ${common.monitor_speed} -lib_ldf_mode = deep [env:ota] upload_protocol = custom From 2725b8770f359f3ed0e1bf62b5dd5eca760a7db6 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Fri, 11 Sep 2020 20:24:22 +0200 Subject: [PATCH 38/48] Upgrade to ESP-IDF 4.1 --- platformio.ini | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/platformio.ini b/platformio.ini index 85e70109..695b6435 100644 --- a/platformio.ini +++ b/platformio.ini @@ -46,7 +46,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 = 2.0.1 +release_version = 2.0.12 ; 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 @@ -54,35 +54,35 @@ extra_scripts = pre:build.py otakeyfile = ota.conf lorakeyfile = loraconf.h lmicconfigfile = lmic_config.h -platform_espressif32 = espressif32@1.12.4 +platform_espressif32 = espressif32@2.0.0 monitor_speed = 115200 upload_speed = 115200 ; set by build.py and taken from hal file display_library = ; set by build.py and taken from hal file lib_deps_lora = mcci-catena/MCCI LoRaWAN LMIC library @ ^3.2.0 lib_deps_display = - OneBitDisplay@1.5.0 - QRCode@0.0.1 - TFT_eSPI@>=2.2.18 + bitbank2/OneBitDisplay @ 1.5.0 + ricmoo/QRCode @ ^0.0.1 + bodmer/TFT_eSPI @ ^2.2.20 lib_deps_ledmatrix = - Ultrathin_LED_Matrix@>=1.0.0 + seeed-studio/Ultrathin_LED_Matrix @ ^1.0.0 lib_deps_rgbled = - SmartLeds@>=1.2.1 + roboticsbrno/SmartLeds @ ^1.2.1 lib_deps_gps = mikalhart/TinyGPSPlus @ ^1.0.2 lib_deps_sensors = - Adafruit Unified Sensor@>=1.1.4 - Adafruit BME280 Library@>=2.1.0 - Adafruit BMP085 Library@>=1.1.0 - BSEC Software Library@1.5.1474 + adafruit/Adafruit Unified Sensor @ ^1.1.4 + adafruit/Adafruit BME280 Library @ ^2.1.0 + adafruit/Adafruit BMP085 Library @ ^1.1.0 + boschsensortec/BSEC Software Library @ 1.5.1474 https://github.com/ricki-z/SDS011.git lib_deps_basic = - ArduinoJson@<6 + bblanchon/ArduinoJson @ <6 jchristensen/Timezone @ ^1.2.4 makuna/RTC @ ^2.3.5 - SimpleButton + spacehuhn/SimpleButton lewisxhe/AXP202X_Library @ ^1.1.2 - esp32-micro-sdcard + geeksville/esp32-micro-sdcard @ ^0.1.1 256dpi/MQTT @ ^2.4.7 lib_deps_all = ${common.lib_deps_basic} @@ -120,6 +120,7 @@ build_flags = ${common.build_flags_all} upload_protocol = ${common.upload_protocol} extra_scripts = ${common.extra_scripts} monitor_speed = ${common.monitor_speed} +monitor_filters = time, esp32_exception_decoder, default [env:ota] upload_protocol = custom From 2a9469422c7f22ff7aee91fbef71347020b08cdd Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 12 Sep 2020 13:58:18 +0200 Subject: [PATCH 39/48] wifi/bt coexist code sanitization --- include/coexist_internal.h | 77 -------------------------------------- include/main.h | 1 - include/wifiscan.h | 2 - src/blecsan.cpp | 8 ++-- 4 files changed, 3 insertions(+), 85 deletions(-) delete mode 100644 include/coexist_internal.h diff --git a/include/coexist_internal.h b/include/coexist_internal.h deleted file mode 100644 index 6b4c47cc..00000000 --- a/include/coexist_internal.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2018-2018 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef __COEXIST_INTERNAL_H__ -#define __COEXIST_INTERNAL_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - COEX_PREFER_WIFI = 0, - COEX_PREFER_BT, - COEX_PREFER_BALANCE, - COEX_PREFER_NUM, -} coex_prefer_t; - -/** - * @brief Init software coexist - * extern function for internal use. - * - * @return Init ok or failed. - */ -esp_err_t coex_init(void); - -/** - * @brief De-init software coexist - * extern function for internal use. - */ -void coex_deinit(void); - -/** - * @brief Pause software coexist - * extern function for internal use. - */ -void coex_pause(void); - -/** - * @brief Resume software coexist - * extern function for internal use. - */ -void coex_resume(void); - -/** - * @brief Get software coexist version string - * extern function for internal use. - * @return : version string - */ -const char *coex_version_get(void); - -/** - * @brief Coexist performance preference set from libbt.a - * extern function for internal use. - * - * @param prefer : the prefer enumeration value - * @return : ESP_OK - success, other - failed - */ -esp_err_t coex_preference_set(coex_prefer_t prefer); - -#ifdef __cplusplus -} -#endif - -#endif /* __COEXIST_INTERNAL_H__ */ \ No newline at end of file diff --git a/include/main.h b/include/main.h index 3e346af7..acb64e95 100644 --- a/include/main.h +++ b/include/main.h @@ -4,7 +4,6 @@ #include // needed for reading ESP32 chip attributes #include // needed for Wifi event handler #include // needed for timers -#include // needed for showing coex sw version #include "globals.h" #include "reset.h" diff --git a/include/wifiscan.h b/include/wifiscan.h index 88de6d26..0b212a9d 100644 --- a/include/wifiscan.h +++ b/include/wifiscan.h @@ -3,8 +3,6 @@ // ESP32 Functions #include -#include -#include "coexist_internal.h" #include "hash.h" // Hash function for scrambling MAC addresses #include "antenna.h" // code for switching wifi antennas diff --git a/src/blecsan.cpp b/src/blecsan.cpp index 73110fdd..6bed9cbb 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -247,10 +247,9 @@ void start_BLEscan(void) { #if (BLECOUNTER) ESP_LOGI(TAG, "Initializing bluetooth scanner ..."); - ESP_ERROR_CHECK(esp_coex_preference_set( - ESP_COEX_PREFER_BALANCE)); // configure Wifi/BT coexist lib - // Initialize BT controller to allocate task and other resource. + ESP_ERROR_CHECK(esp_coex_preference_set(ESP_COEX_PREFER_BT)); + btStart(); ESP_ERROR_CHECK(esp_bluedroid_init()); ESP_ERROR_CHECK(esp_bluedroid_enable()); @@ -269,8 +268,7 @@ void stop_BLEscan(void) { ESP_ERROR_CHECK(esp_bluedroid_disable()); ESP_ERROR_CHECK(esp_bluedroid_deinit()); btStop(); // disable bt_controller - ESP_ERROR_CHECK(esp_coex_preference_set( - ESP_COEX_PREFER_WIFI)); // configure Wifi/BT coexist lib + ESP_ERROR_CHECK(esp_coex_preference_set(ESP_COEX_PREFER_WIFI)); ESP_LOGI(TAG, "Bluetooth scanner stopped"); #endif // BLECOUNTER } // stop_BLEscan From f2b6e12bc95692d1af515265e9e5fa325e9f89ba Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 12 Sep 2020 19:11:13 +0200 Subject: [PATCH 40/48] BLE install logic changed (issue #612) --- README.md | 2 +- src/configmanager.cpp | 4 ++-- src/main.cpp | 13 +++++++++---- src/paxcounter.conf | 8 ++++---- src/wifiscan.cpp | 2 -- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 4ee4f7e4..5ea438e1 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Some 3D printable cases can be found (and, if wanted so, ordered) on Thin for example.
Power consumption was metered at around 450 - 1000mW, depending on board and user settings in paxcounter.conf. -By default bluetooth sniffing is disabled (#define *BLECOUNTER* 0 in paxcounter.conf). Enabling bluetooth costs 30% more power + 30% flash storage for the software stack. Proof of concept showed that for passenger flow metering wifi sniffing shows better results than bluetooth sniffing. 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 not installed (#define *BLECOUNTER* 0 in paxcounter.conf). Installing and enabling bluetooth costs 30% more power + 30% flash storage for the software stack. 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. # Preparing diff --git a/src/configmanager.cpp b/src/configmanager.cpp index b4de1a56..a3c9babb 100644 --- a/src/configmanager.cpp +++ b/src/configmanager.cpp @@ -29,8 +29,8 @@ void defaultConfig() { cfg.blescantime = BLESCANINTERVAL / 10; // BT channel scan cycle [seconds/100], default 1 (= 10ms) - cfg.blescan = BLECOUNTER; // 0=disabled, 1=enabled - cfg.wifiscan = WIFICOUNTER; // 0=disabled, 1=enabled + cfg.blescan = 1; // 0=disabled, 1=enabled + cfg.wifiscan = 1; // 0=disabled, 1=enabled cfg.wifiant = 0; // 0=internal, 1=external (for LoPy/LoPy4) cfg.vendorfilter = VENDORFILTER; // 0=disabled, 1=enabled cfg.rgblum = RGBLUMINOSITY; // RGB Led luminosity (0..100%) diff --git a/src/main.cpp b/src/main.cpp index 0018c53f..9cbdac1a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -315,9 +315,9 @@ void setup() { #if (HAS_SENSOR_1) #if (COUNT_ENS) ESP_LOGI(TAG, "init CWA-counter"); - if ( cwa_init() ) - strcat_P(features, " CWA"); -#else + if (cwa_init()) + strcat_P(features, " CWA"); +#else strcat_P(features, " SENS(1)"); sensor_init(); #endif @@ -402,8 +402,13 @@ void setup() { #if (WIFICOUNTER) strcat_P(features, " WIFI"); // start wifi in monitor mode and start channel rotation timer - ESP_LOGI(TAG, "Starting Wifi..."); + wifi_sniffer_init(); + if (cfg.blescan) { + ESP_LOGI(TAG, "Starting Wifi..."); + switch_wifi_sniffer(1); + } else + switch_wifi_sniffer(0); #else // switch off wifi esp_wifi_deinit(); diff --git a/src/paxcounter.conf b/src/paxcounter.conf index 9dba11bc..8a3b7758 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -7,17 +7,17 @@ // Note: After editing, before "build", use "clean" button in PlatformIO! // Verbose enables additional serial debug output -#define VERBOSE 0 // set to 0 to silence the device, for mute use build option +#define VERBOSE 1 // set to 0 to silence the device, for mute use build option // Payload send cycle and encoding #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 -#define COUNTERMODE 0 // 0=cyclic, 1=cumulative, 2=cyclic confirmed +#define COUNTERMODE 1 // 0=cyclic, 1=cumulative, 2=cyclic confirmed // Set this to include BLE counting and vendor filter functions, or to switch off WIFI counting #define VENDORFILTER 0 // set to 0 if you want to scan all devices, not filtering smartphone OUIs -#define BLECOUNTER 0 // set it to 1 if you want to use BLE count, at expense of power & memory -#define WIFICOUNTER 1 // set it to 0 if you want to switch off WIFI count +#define BLECOUNTER 0 // 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 // BLE scan parameters #define BLESCANTIME 0 // [seconds] scan duration, 0 means infinite [default], see note below diff --git a/src/wifiscan.cpp b/src/wifiscan.cpp index 6409298c..aa7a7041 100644 --- a/src/wifiscan.cpp +++ b/src/wifiscan.cpp @@ -73,14 +73,12 @@ 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 WifiChanTimer = xTimerCreate("WifiChannelTimer", pdMS_TO_TICKS(cfg.wifichancycle * 10), pdTRUE, (void *)0, switchWifiChannel); - switch_wifi_sniffer(1); } void switch_wifi_sniffer(uint8_t state) { From da845993ddc464e20a049fc3f6ac87ff0b54e841 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 12 Sep 2020 22:39:04 +0200 Subject: [PATCH 41/48] code sanitizations (fix some compiler warnings) --- include/sdcard.h | 10 ++++------ src/blecsan.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/sdcard.h b/include/sdcard.h index d95e8336..669cebc7 100644 --- a/include/sdcard.h +++ b/include/sdcard.h @@ -8,7 +8,6 @@ #if (HAS_SDCARD) #if HAS_SDCARD == 1 #include -//#include #elif HAS_SDCARD == 2 #include #else @@ -38,13 +37,12 @@ #define SDCARD_FILE_NAME "/paxcount.%02d" #define SDCARD_FILE_HEADER "date, time, wifi, bluet" -#define SDCARD_FILE_NAME "paxcount.%02d" -#define SDCARD_FILE_HEADER "date, time, wifi, bluet" + #if (COUNT_ENS) #define SDCARD_FILE_HEADER_CWA ",cwa" #endif -bool sdcard_init( void ); -void sdcardWriteData( uint16_t, uint16_t, uint16_t = 0); +bool sdcard_init(void); +void sdcardWriteData(uint16_t, uint16_t, uint16_t = 0); -#endif // _SDCARD_H +#endif // _SDCARD_H diff --git a/src/blecsan.cpp b/src/blecsan.cpp index 6bed9cbb..960825c5 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -116,7 +116,6 @@ IRAM_ATTR void gap_callback_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) { esp_ble_gap_cb_param_t *p = (esp_ble_gap_cb_param_t *)param; - uint16_t hashedmac = 0; ESP_LOGV(TAG, "BT payload rcvd -> type: 0x%.2x -> %s", *p->scan_rst.ble_adv, btsig_gap_type(*p->scan_rst.ble_adv)); @@ -162,7 +161,11 @@ IRAM_ATTR void gap_callback_handler(esp_gap_ble_cb_event_t event, // hash and add this device and show new count total if it was not // previously added - hashedmac = + +#if (COUNT_ENS) + uint16_t hashedmac = +#endif + mac_add((uint8_t *)p->scan_rst.bda, p->scan_rst.rssi, MAC_SNIFF_BLE); #if (COUNT_ENS) From 7bfb1aff2708b3f83ee72922f2b2fef62a20a1c2 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Wed, 16 Sep 2020 11:26:14 +0200 Subject: [PATCH 42/48] paxcounter.conf: default settings corrected --- src/paxcounter.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/paxcounter.conf b/src/paxcounter.conf index 8a3b7758..a4542eee 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -83,8 +83,8 @@ #define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds] // settings for syncing time of node with a time source (network / gps / rtc / timeserver) -#define TIME_SYNC_LORAWAN 0 // set to 1 to use LORA network as time source, 0 means off [default = 1] -#define TIME_SYNC_LORASERVER 1 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0] +#define TIME_SYNC_LORAWAN 1 // set to 1 to use LORA network as time source, 0 means off [default = 1] +#define TIME_SYNC_LORASERVER 0 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0] #define TIME_SYNC_INTERVAL 60 // sync time attempt each .. minutes from time source [default = 60], 0 means off #define TIME_SYNC_INTERVAL_RETRY 10 // retry time sync after lost sync each .. minutes [default = 10], 0 means off #define TIME_SYNC_SAMPLES 1 // number of time requests for averaging, max. 255 From 62674e80d3bd0045301e5efabff6d8b272ece9c1 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Mon, 21 Sep 2020 16:41:20 +0200 Subject: [PATCH 43/48] paxcounter.conf: default port for gps corrected --- src/paxcounter.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/paxcounter.conf b/src/paxcounter.conf index 8a3b7758..235b0011 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -102,7 +102,7 @@ #define RCMDPORT 2 // remote commands #define STATUSPORT 2 // remote command results #define CONFIGPORT 3 // config query results -#define GPSPORT 1 // gps - set to 1 to send combined GPS+COUNTERPORT payload +#define GPSPORT 4 // gps - NOTE: set to 1 to send combined GPS+COUNTERPORT payload #define BUTTONPORT 5 // button pressed signal #define BEACONPORT 6 // beacon alarms #define BMEPORT 7 // BME680 sensor From 715663617c58714733065104c4d629b34579a630 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Mon, 21 Sep 2020 16:42:19 +0200 Subject: [PATCH 44/48] remove "PAX" from display to show higher numbers --- src/display.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/display.cpp b/src/display.cpp index 6e181dd9..aa2289ee 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -237,7 +237,7 @@ void dp_drawPage(time_t t, bool nextpage) { // display number of unique macs total Wifi + BLE if (DisplayPage < 5) { dp_setFont(MY_FONT_STRETCHED); - dp_printf("PAX:%-4d", macs.size()); + dp_printf("%-5d", macs.size()); } switch (DisplayPage) { From e38eae90e29ac6dc99c96d1d34fd530885ca8326 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Thu, 24 Sep 2020 22:29:07 +0200 Subject: [PATCH 45/48] CWA detection improved (Issue #636) --- src/blecsan.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blecsan.cpp b/src/blecsan.cpp index 960825c5..288757a0 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -9,7 +9,7 @@ // UUID of Exposure Notification Service (ENS) // see // https://blog.google/documents/70/Exposure_Notification_-_Bluetooth_Specification_v1.2.2.pdf -static const char ensMagicBytes[] = "\x03\x03\x6F\xfd"; +static const char ensMagicBytes[] = "\x16\x6f\xfd"; // local Tag for logging static const char TAG[] = "bluetooth"; @@ -170,7 +170,7 @@ IRAM_ATTR void gap_callback_handler(esp_gap_ble_cb_event_t event, #if (COUNT_ENS) // check for ens signature - if (0 == strncmp((const char *)p->scan_rst.ble_adv, ensMagicBytes, 4)) + if (NULL != strstr((const char *)p->scan_rst.ble_adv, ensMagicBytes)) cwa_mac_add(hashedmac); #endif From deba557ee92ca5e45a83b96f9e9e6ba978553da3 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 26 Sep 2020 21:21:28 +0200 Subject: [PATCH 46/48] lorawan.cpp: bugfix in myBattLevelCb() --- src/lorawan.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lorawan.cpp b/src/lorawan.cpp index 8ed6aa14..5b673074 100644 --- a/src/lorawan.cpp +++ b/src/lorawan.cpp @@ -495,10 +495,9 @@ uint8_t myBattLevelCb(void *pUserData) { #elif defined HAS_IP5306 if (IP5306_GetPowerSource()) return MCMD_DEVS_EXT_POWER; -#else - return (batt_percent / 100.0 * - (MCMD_DEVS_BATT_MAX - MCMD_DEVS_BATT_MIN + 1)); #endif // HAS_PMU + + return (batt_percent / 100.0 * (MCMD_DEVS_BATT_MAX - MCMD_DEVS_BATT_MIN + 1)); } // event EV_RXCOMPLETE message handler @@ -582,7 +581,8 @@ const char *getCrName(rps_t rps) { #if (VERBOSE) // decode LORAWAN MAC message -// see https://github.com/mcci-catena/arduino-lmic/blob/master/doc/LoRaWAN-at-a-glance.pdf +// see +// https://github.com/mcci-catena/arduino-lmic/blob/master/doc/LoRaWAN-at-a-glance.pdf void mac_decode(const uint8_t cmd[], const uint8_t cmdlen, bool is_down) { if (!cmdlen) From d13b4ed4e52ad98f4a19f13889f4af3657a80542 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 26 Sep 2020 21:22:37 +0200 Subject: [PATCH 47/48] readme.md: update copyright notice --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5ea438e1..0e09a505 100644 --- a/README.md +++ b/README.md @@ -542,9 +542,9 @@ Send for example `8386` as Downlink on Port 2 to get battery status and time/dat # License -Copyright 2018 Oliver Brandmueller +Copyright 2018-2020 Oliver Brandmueller -Copyright 2018 Klaus Wilting +Copyright 2018-2020 Klaus Wilting Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 3e0102920a88eb06ddf58a38f4252dba2afa6f44 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 26 Sep 2020 21:22:55 +0200 Subject: [PATCH 48/48] main.cpp: update copyright notice --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9cbdac1a..e7b497c7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,8 +2,8 @@ //////////////////////// ESP32-Paxcounter \\\\\\\\\\\\\\\\\\\\\\\\\\ -Copyright 2018 Oliver Brandmueller -Copyright 2018 Klaus Wilting +Copyright 2018-2020 Oliver Brandmueller +Copyright 2018-2020 Klaus Wilting Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.