From 00a201a0d9a3c051e268a8eab27077db90fafd1c Mon Sep 17 00:00:00 2001 From: Verkehrsrot <10289836+cyberman54@users.noreply.github.com> Date: Tue, 3 Apr 2018 18:28:40 +0200 Subject: [PATCH 01/12] Update README.md --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 49e701bf..91a84fcc 100644 --- a/README.md +++ b/README.md @@ -205,14 +205,11 @@ device answers with it's current configuration. The configuration is a C structu # RGB Led color description -Description of the RGB LED color (Lopy and Lolin32 only): +Description of the RGB LED color (LoPy/LoPy4 and Lolin32 only): -- Yellow quick blink - - LoRaWAN join -- Blue blink - - LoRaWAN transmit (including receive windows) -- Magenta each blink - - BLE Scan, seen a device (new or not) +- Yellow quick blink: joining LoRaWAN network in progress or pending +- Blue blink: LoRaWAN data transmit (including waiting for receive windows) in progress or pending +- Magenta each blink: seen a BLE device, new or not, while BLE scanning # License From 2ffe78ab4f655664ff713255b5185d21a7d953da Mon Sep 17 00:00:00 2001 From: Verkehrsrot <10289836+cyberman54@users.noreply.github.com> Date: Tue, 3 Apr 2018 18:30:00 +0200 Subject: [PATCH 02/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 91a84fcc..aff62ae1 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ Note: all settings are stored in NVRAM and will be reloaded when device starts. 0x80 get device configuration -device answers with it's current configuration. The configuration is a C structure declared in file [globals.h](src/globals.h#L23-L38) with the following definition: +device answers with it's current configuration. The configuration is a C structure declared in file [globals.h](src/globals.h#L24-L41) with the following definition: byte 1: Lora SF (7..12) byte 2: Lora TXpower (2..15) From e2846d5807af0009dc49abd7bc04b6abcfbe9882 Mon Sep 17 00:00:00 2001 From: Verkehrsrot <10289836+cyberman54@users.noreply.github.com> Date: Tue, 3 Apr 2018 21:03:01 +0200 Subject: [PATCH 03/12] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index aff62ae1..28f6fe54 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,12 @@ Currently supported IoT boards: - Heltec LoRa-32 - TTGOv1 - TTGOv2 -- Pycom LoPy -- Pycom LoPy4 -- LoLin32 with [LoraNode32 shield](https://github.com/hallard/LoLin32-Lora) -- LoLin32 Lite with [LoraNode32-Lite shield](https://github.com/hallard/LoLin32-Lite-Lora) +- Pycom LoPy {1} +- Pycom LoPy4 {1} +- LoLin32 with [LoraNode32 shield](https://github.com/hallard/LoLin32-Lora) {2} +- LoLin32 Lite with [LoraNode32-Lite shield](https://github.com/hallard/LoLin32-Lite-Lora) {2} + +{1} on board OLED Display supported; {2} on board RGB LED supported Target platform must be selected in [platformio.ini](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/platformio.ini).
Hardware dependent settings (pinout etc.) are stored in board files in /hal directory.
From 42cb206789c8782c73b378a1ce315b8385f6f1b4 Mon Sep 17 00:00:00 2001 From: Verkehrsrot <10289836+cyberman54@users.noreply.github.com> Date: Tue, 3 Apr 2018 21:03:59 +0200 Subject: [PATCH 04/12] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 28f6fe54..ab30257b 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,11 @@ This can all be done with a single small and cheap ESP32 board for less than $20 # Hardware Currently supported IoT boards: -- Heltec LoRa-32 -- TTGOv1 -- TTGOv2 -- Pycom LoPy {1} -- Pycom LoPy4 {1} +- Heltec LoRa-32 {1} +- TTGOv1 {1} +- TTGOv2 {1} +- Pycom LoPy {2} +- Pycom LoPy4 {2} - LoLin32 with [LoraNode32 shield](https://github.com/hallard/LoLin32-Lora) {2} - LoLin32 Lite with [LoraNode32-Lite shield](https://github.com/hallard/LoLin32-Lite-Lora) {2} From dc7f4ca90e6250879e536b51defff4276ef7b0aa Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Tue, 3 Apr 2018 21:26:51 +0200 Subject: [PATCH 05/12] v1.2.91: enhanced RGB LED blink --- README.md | 1 + src/macsniff.cpp | 7 ++++--- src/main.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ab30257b..d824ca9c 100644 --- a/README.md +++ b/README.md @@ -211,6 +211,7 @@ Description of the RGB LED color (LoPy/LoPy4 and Lolin32 only): - Yellow quick blink: joining LoRaWAN network in progress or pending - Blue blink: LoRaWAN data transmit (including waiting for receive windows) in progress or pending +- Green each blink: seen a Wifi device, new or not, while Wifi scanning - Magenta each blink: seen a BLE device, new or not, while BLE scanning # License diff --git a/src/macsniff.cpp b/src/macsniff.cpp index 773915be..3b217135 100644 --- a/src/macsniff.cpp +++ b/src/macsniff.cpp @@ -53,11 +53,15 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { added = newmac.second; // true if hashed MAC is unique in container if (sniff_type == MAC_SNIFF_WIFI ) { + rgb_set_color(COLOR_GREEN); newmac = wifis.insert(hashedmac); // add hashed MAC to wifi container if new unique strcpy(typebuff, "WiFi"); + rgb_set_color(COLOR_NONE); } else if (sniff_type == MAC_SNIFF_BLE ) { + rgb_set_color(COLOR_MAGENTA); newmac = bles.insert(hashedmac); // add hashed MAC to BLE container if new unique strcpy(typebuff, "BLE "); + rgb_set_color(COLOR_NONE); } if (added) { // first time seen this WIFI or BLE MAC @@ -85,14 +89,11 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { void onResult(BLEAdvertisedDevice advertisedDevice) { uint8_t *p = (uint8_t *) advertisedDevice.getAddress().getNative(); - rgb_set_color(COLOR_MAGENTA); // Current devices seen on this scan session currentScanDevice++; mac_add(p, advertisedDevice.getRSSI(), MAC_SNIFF_BLE); u8x8.setCursor(12,3); u8x8.printf("%d", currentScanDevice); - rgb_set_color(COLOR_NONE); - } }; diff --git a/src/main.h b/src/main.h index dafa8329..ddaccee9 100644 --- a/src/main.h +++ b/src/main.h @@ -1,5 +1,5 @@ // program version - note: increment version after modifications to configData_t struct!! -#define PROGVERSION "1.2.9" // use max 10 chars here! +#define PROGVERSION "1.2.91" // use max 10 chars here! #define PROGNAME "PAXCNT" // Verbose enables serial output From 2edae9d51bfd2b2d7a76a8c07e9c28aa405d538f Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 3 Apr 2018 23:38:37 +0200 Subject: [PATCH 06/12] Use size of buffer instead of hard number --- src/macsniff.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macsniff.cpp b/src/macsniff.cpp index 3b217135..ce324b80 100644 --- a/src/macsniff.cpp +++ b/src/macsniff.cpp @@ -47,7 +47,7 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { // https://en.wikipedia.org/wiki/MAC_Address_Anonymization addr2int |= (uint64_t) salt << 48; // prepend 16-bit salt to 48-bit MAC - snprintf(macbuf, 21, "%llx", addr2int); // convert unsigned 64-bit salted MAC to 16 digit hex string + snprintf(macbuf, sizeof(macbuf), "%llx", addr2int); // convert unsigned 64-bit salted MAC to 16 digit hex string hashedmac = rokkit(macbuf, 5); // hash MAC string, use 5 chars to fit hash in uint16_t container newmac = macs.insert(hashedmac); // add hashed MAC to total container if new unique added = newmac.second; // true if hashed MAC is unique in container @@ -65,7 +65,7 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { } if (added) { // first time seen this WIFI or BLE MAC - snprintf(counter, 6, "%i", macs.size()); // convert 16-bit MAC counter to decimal counter value + snprintf(counter, sizeof(counter), "%i", macs.size()); // convert 16-bit MAC counter to decimal counter value u8x8.draw2x2String(0, 0, counter); // display number on unique macs total Wifi + BLE ESP_LOGI(TAG, "%s RSSI %04d -> Hash %04x -> counted #%05i", typebuff, rssi, hashedmac, macs.size()); } else { // already seen WIFI or BLE MAC From 2a9cc2b2b47573c19e938935202c2b5ea82cf1eb Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Tue, 3 Apr 2018 23:42:43 +0200 Subject: [PATCH 07/12] v1.2.92: display flip mode implemented --- src/hal/heltec.h | 1 + src/hal/lolin32_lora.h | 1 + src/hal/lolin32lite_lora.h | 1 + src/hal/ttgov1.h | 1 + src/hal/ttgov2.h | 1 + src/main.cpp | 4 ++++ src/main.h | 2 +- 7 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/hal/heltec.h b/src/hal/heltec.h index 53930484..eb9aa31c 100644 --- a/src/hal/heltec.h +++ b/src/hal/heltec.h @@ -3,6 +3,7 @@ #define CFG_sx1276_radio 1 #define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C // OLED-Display on board +//#define DISPLAY_FLIP 1 // uncomment this for rotated display #define HAS_LED GPIO_NUM_25 // white LED on board #define HAS_BUTTON GPIO_NUM_0 // button "PROG" on board diff --git a/src/hal/lolin32_lora.h b/src/hal/lolin32_lora.h index 168f5da8..a1bdbe09 100644 --- a/src/hal/lolin32_lora.h +++ b/src/hal/lolin32_lora.h @@ -5,6 +5,7 @@ #define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature #define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C // OLED-Display on board +//#define DISPLAY_FLIP 1 // uncomment this for rotated display #define HAS_LED NOT_A_PIN // Led os on same pin as Lora SS pin, to avoid problems, we don't use it #define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW // Anyway shield is on over the LoLin32 board, so we won't be able to see this LED diff --git a/src/hal/lolin32lite_lora.h b/src/hal/lolin32lite_lora.h index d631ccc0..fe2adac8 100644 --- a/src/hal/lolin32lite_lora.h +++ b/src/hal/lolin32lite_lora.h @@ -5,6 +5,7 @@ #define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature #define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C // OLED-Display on board +//#define DISPLAY_FLIP 1 // uncomment this for rotated display #define HAS_LED 22 // ESP32 GPIO12 (pin22) On Board LED #define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW #define HAS_RGB_LED 13 // ESP32 GPIO13 (pin13) On Board Shield WS2812B RGB LED diff --git a/src/hal/ttgov1.h b/src/hal/ttgov1.h index 55f6eebf..ab6b4f2c 100644 --- a/src/hal/ttgov1.h +++ b/src/hal/ttgov1.h @@ -3,6 +3,7 @@ #define CFG_sx1276_radio 1 #define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C // OLED-Display on board +//#define DISPLAY_FLIP 1 // uncomment this for rotated display #define HAS_LED GPIO_NUM_2 // white LED on board #define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW #define HAS_BUTTON GPIO_NUM_0 // button "PRG" on board diff --git a/src/hal/ttgov2.h b/src/hal/ttgov2.h index aeaaebbe..537990af 100644 --- a/src/hal/ttgov2.h +++ b/src/hal/ttgov2.h @@ -3,6 +3,7 @@ #define CFG_sx1276_radio 1 // HPD13A LoRa SoC #define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C +//#define DISPLAY_FLIP 1 // uncomment this for rotated display #define HAS_LED NOT_A_PIN // on-board LED is wired to SCL (used by display) therefore totally useless // disable brownout detection (needed on TTGOv2 for battery powered operation) diff --git a/src/main.cpp b/src/main.cpp index d808640b..74a369cb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -367,6 +367,10 @@ void init_display(const char *Productname, const char *Version) { u8x8.setFlipMode(0); u8x8.clear(); + #ifdef DISPLAY_FLIP + u8x8.setFlipMode(1); + #endif + // Display chip information #ifdef VERBOSE esp_chip_info_t chip_info; diff --git a/src/main.h b/src/main.h index ddaccee9..b6b675d5 100644 --- a/src/main.h +++ b/src/main.h @@ -1,5 +1,5 @@ // program version - note: increment version after modifications to configData_t struct!! -#define PROGVERSION "1.2.91" // use max 10 chars here! +#define PROGVERSION "1.2.92" // use max 10 chars here! #define PROGNAME "PAXCNT" // Verbose enables serial output From 16d015feae31ee20e5f010746767f53b20a897e9 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 4 Apr 2018 01:26:05 +0200 Subject: [PATCH 08/12] Fixed and Moved reading HW deveui to lorawan.cpp --- src/lorawan.cpp | 41 ++++++++++++++++++++++++++++++++++++++--- src/main.cpp | 46 ++++++++++++++++------------------------------ 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/src/lorawan.cpp b/src/lorawan.cpp index 0f0f86eb..6fde8a50 100644 --- a/src/lorawan.cpp +++ b/src/lorawan.cpp @@ -7,6 +7,10 @@ #include #include +#ifdef MCP_24AA02E64_I2C_ADDRESS +#include // Needed for 24AA02E64, does not hurt anything if included and not used +#endif + uint8_t mydata[] = "0000"; // Local logging Tag @@ -31,9 +35,9 @@ void gen_lora_deveui(uint8_t *pdeveui) { *p++ = 0xFF; *p++ = 0xFE; // Then next 6 bytes are mac address reversed - for ( i=0; i<6 ; i++) { - *p++ = dmac[5-i]; - } + for ( i=0; i<6 ; i++) { + *p++ = dmac[5-i]; + } } // Function to do a byte swap in a byte array @@ -46,6 +50,37 @@ void RevBytes(unsigned char* b, size_t c) b[c - 1 - i] = t; } } +void get_hard_deveui(uint8_t *pdeveui) { + // read DEVEUI from Microchip 24AA02E64 2Kb serial eeprom if present +#ifdef MCP_24AA02E64_I2C_ADDRESS + uint8_t i2c_ret; + // Init this just in case, no more to 100KHz + Wire.begin(OLED_SDA, OLED_SCL, 100000); + Wire.beginTransmission(MCP_24AA02E64_I2C_ADDRESS); + Wire.write(MCP_24AA02E64_MAC_ADDRESS); + i2c_ret = Wire.endTransmission(); + // check if device seen on i2c bus + if (i2c_ret == 0) { + char deveui[32]=""; + uint8_t data; + Wire.beginTransmission(MCP_24AA02E64_I2C_ADDRESS); + Wire.write(MCP_24AA02E64_MAC_ADDRESS); + Wire.requestFrom(MCP_24AA02E64_I2C_ADDRESS, 8); + while (Wire.available()) { + data = Wire.read(); + sprintf(deveui+strlen(deveui), "%02X ", data) ; + *pdeveui++ = data; + } + i2c_ret = Wire.endTransmission(); + ESP_LOGI(TAG, "Serial EEPROM 24AA02E64 found, read DEVEUI %s", deveui); + } else { + ESP_LOGI(TAG, "Serial EEPROM 24AA02E64 not found ret=%d", i2c_ret); + } + // Set back to 400KHz to speed up OLED + Wire.setClock(400000); +#endif // MCP 24AA02E64 +} + #ifdef VERBOSE // Display a key diff --git a/src/main.cpp b/src/main.cpp index d808640b..98be1130 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,7 +29,7 @@ Refer to LICENSE.txt file in repository for more details. #include // OLED driver -#include // includes if needed for other on board i2c components +#include // LMIC-Arduino LoRaWAN Stack #include "loraconf.h" @@ -85,6 +85,8 @@ void loadConfig(void); // defined in lorawan.cpp void gen_lora_deveui(uint8_t * pdeveui); void RevBytes(unsigned char* b, size_t c); +void get_hard_deveui(uint8_t *pdeveui); + #ifdef VERBOSE void printKeys(void); @@ -103,12 +105,20 @@ void os_getArtEui (u1_t *buf) { void os_getDevEui (u1_t* buf) { int i=0, k=0; memcpy(buf, DEVEUI, 8); // get fixed DEVEUI from loraconf.h - for (i=0; i<8 ; i++) + for (i=0; i<8 ; i++) { k += buf[i]; - if (k) + } + if (k) { RevBytes(buf, 8); // use fixed DEVEUI and swap bytes to LSB format - else + } else { gen_lora_deveui(buf); // generate DEVEUI from device's MAC + } + + // Get MCP 24AA02E64 hardware DEVEUI (override default settings if found) + #ifdef MCP_24AA02E64_I2C_ADDRESS + get_hard_deveui(buf); + RevBytes(buf, 8); // swap bytes to LSB format + #endif } // LMIC enhanced Pin mapping @@ -413,7 +423,7 @@ void setup() { ESP_LOGI(TAG, "Starting %s %s", PROGNAME, PROGVERSION); rgb_set_color(COLOR_NONE); - + // initialize system event handler for wifi task, needed for wifi_sniffer_init() esp_event_loop_init(NULL, NULL); @@ -457,37 +467,13 @@ void setup() { antenna_init(); #endif - // read DEVEUI from Microchip 24AA02E64 2Kb serial eeprom if present -#ifdef MCP_24AA02E64_I2C_ADDRESS - uint8_t i2c_ret; - // Init this before OLED, we just need to get value then we're done with i2c bus - Wire.begin(OLED_SDA, OLED_SDA, 100000); - Wire.beginTransmission(MCP_24AA02E64_I2C_ADDRESS); - Wire.write(MCP_24AA02E64_MAC_ADDRESS); - i2c_ret = Wire.endTransmission(); - // check if device seen on i2c bus - if (i2c_ret == 0) { - char deveui[24]; - uint8_t data; - Wire.beginTransmission(MCP_24AA02E64_I2C_ADDRESS); - while (Wire.available()) { - data = Wire.read(); - sprintf(deveui+strlen(deveui), "%02X ", data) ; - } - i2c_ret = Wire.endTransmission(); - ESP_LOGI(TAG, "Serial EEPROM 24AA02E64 found, read DEVEUI %s", deveui); - } else { - ESP_LOGI(TAG, "Serial EEPROM 24AA02E64 not found ret=%d", i2c_ret); - } -#endif // MCP 24AA02E64 - // initialize display init_display(PROGNAME, PROGVERSION); u8x8.setPowerSave(!cfg.screenon); // set display off if disabled u8x8.setCursor(0,5); u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %4i", cfg.rssilimit); u8x8.drawString(0,6,"Join Wait "); - + // output LoRaWAN keys to console #ifdef VERBOSE printKeys(); From b0d29b16b28e6a8f1935e8666fb59e99cfbbb8ba Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 4 Apr 2018 01:27:36 +0200 Subject: [PATCH 09/12] bump to v1.2.92 --- src/main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.h b/src/main.h index ddaccee9..b6b675d5 100644 --- a/src/main.h +++ b/src/main.h @@ -1,5 +1,5 @@ // program version - note: increment version after modifications to configData_t struct!! -#define PROGVERSION "1.2.91" // use max 10 chars here! +#define PROGVERSION "1.2.92" // use max 10 chars here! #define PROGNAME "PAXCNT" // Verbose enables serial output From 39b0c4eefea833ffc351c7790b295a8e6e538a7b Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 4 Apr 2018 01:37:59 +0200 Subject: [PATCH 10/12] Added warning on software deveui override by HW one --- README.md | 8 +++++--- src/loraconf.sample.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d824ca9c..0fb86f77 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,10 @@ Currently supported IoT boards: - TTGOv2 {1} - Pycom LoPy {2} - Pycom LoPy4 {2} -- LoLin32 with [LoraNode32 shield](https://github.com/hallard/LoLin32-Lora) {2} -- LoLin32 Lite with [LoraNode32-Lite shield](https://github.com/hallard/LoLin32-Lite-Lora) {2} +- LoLin32 with [LoraNode32 shield](https://github.com/hallard/LoLin32-Lora) {2}{3} +- LoLin32 Lite with [LoraNode32-Lite shield](https://github.com/hallard/LoLin32-Lite-Lora) {2}{3} -{1} on board OLED Display supported; {2} on board RGB LED supported +{1} on board OLED Display supported; {2} on board RGB LED supported; {3} on board Hardware unique DEVEUI supported Target platform must be selected in [platformio.ini](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/platformio.ini).
Hardware dependent settings (pinout etc.) are stored in board files in /hal directory.
@@ -52,6 +52,8 @@ Use PlatformIO with your preferred IDE for Before compiling the code, create file loraconf.h in the /src directory from the template [loraconf.sample.h](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/loraconf.sample.h) and populate it with your personal APPEUI und APPKEY for the LoRaWAN network. Only OTAA join is supported, not ABP. The DEVEUI will be derived from the device's MAC adress during device startup and is shown as well on the device's display (if it has one) as on the serial console for copying it to your LoRaWAN network server settings. If you enter a DEVEUI in loraconf.h it will be used instead. +**If Using a board with Microchip 24AA02E64 Unique ID for deveui, it will override the one of loraconf.h** + # Uploading To upload the code to your ESP32 board this needs to be switched from run to bootloader mode. Boards with USB bridge like Heltec and TTGO usually have an onboard logic which allows soft switching by the upload tool. In PlatformIO this happenes automatically.

diff --git a/src/loraconf.sample.h b/src/loraconf.sample.h index 300b4d0d..cbfd3d47 100644 --- a/src/loraconf.sample.h +++ b/src/loraconf.sample.h @@ -12,6 +12,8 @@ // Set your DEVEUI here, if you have one. You can leave this untouched, // then the DEVEUI will be generated during runtime from device's MAC adress // Note: Use same format as in TTN console (cut & paste, for your convenience) +// *** Take care : If Using a board with Microchip 24AA02E64 Uinique ID for deveui, ** +// *** this DEVEUI will be overwriten by the one contained in the Microchip module *** static const u1_t DEVEUI[8]={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // Note: Use msb format for APPEUI as in TTN console (cut & paste, for your convenience) From 0144a305e579f49b691ed5fd66b5d46b35b1e562 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 4 Apr 2018 01:42:10 +0200 Subject: [PATCH 11/12] Bump to v1.2.93 --- src/main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.h b/src/main.h index b6b675d5..16e8a293 100644 --- a/src/main.h +++ b/src/main.h @@ -1,5 +1,5 @@ // program version - note: increment version after modifications to configData_t struct!! -#define PROGVERSION "1.2.92" // use max 10 chars here! +#define PROGVERSION "1.2.93" // use max 10 chars here! #define PROGNAME "PAXCNT" // Verbose enables serial output From dd99c078f1ed5659e135044da3413a7d9cccb3a2 Mon Sep 17 00:00:00 2001 From: Verkehrsrot <10289836+cyberman54@users.noreply.github.com> Date: Wed, 4 Apr 2018 09:51:33 +0200 Subject: [PATCH 12/12] revert change in macsniff.cpp (to be further tested) --- src/macsniff.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macsniff.cpp b/src/macsniff.cpp index ce324b80..3b217135 100644 --- a/src/macsniff.cpp +++ b/src/macsniff.cpp @@ -47,7 +47,7 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { // https://en.wikipedia.org/wiki/MAC_Address_Anonymization addr2int |= (uint64_t) salt << 48; // prepend 16-bit salt to 48-bit MAC - snprintf(macbuf, sizeof(macbuf), "%llx", addr2int); // convert unsigned 64-bit salted MAC to 16 digit hex string + snprintf(macbuf, 21, "%llx", addr2int); // convert unsigned 64-bit salted MAC to 16 digit hex string hashedmac = rokkit(macbuf, 5); // hash MAC string, use 5 chars to fit hash in uint16_t container newmac = macs.insert(hashedmac); // add hashed MAC to total container if new unique added = newmac.second; // true if hashed MAC is unique in container @@ -65,7 +65,7 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { } if (added) { // first time seen this WIFI or BLE MAC - snprintf(counter, sizeof(counter), "%i", macs.size()); // convert 16-bit MAC counter to decimal counter value + snprintf(counter, 6, "%i", macs.size()); // convert 16-bit MAC counter to decimal counter value u8x8.draw2x2String(0, 0, counter); // display number on unique macs total Wifi + BLE ESP_LOGI(TAG, "%s RSSI %04d -> Hash %04x -> counted #%05i", typebuff, rssi, hashedmac, macs.size()); } else { // already seen WIFI or BLE MAC