From 2c102f69a954a205109af037e4ecc7d0604051a6 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Mon, 18 Nov 2019 13:25:52 +0100 Subject: [PATCH 1/5] combined GPS data revised logic --- README.md | 2 +- src/paxcounter.conf | 5 ++--- src/senddata.cpp | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 214e9d40..68fe86bd 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,7 @@ Output of sensor and peripheral data is internally switched by a bitmask registe | 6 | User sensor 3 | on | 7 | Batterylevel | off -*) GPS data can also be combined with payload on port 1, #define PAYLOAD_GPS in paxcounter.conf to enable +*) GPS data can also be combined with payload on port 1, *#define GPSPORT 1* in paxcounter.conf to enable # Time sync diff --git a/src/paxcounter.conf b/src/paxcounter.conf index d9b2990d..bc3da7b6 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -13,7 +13,6 @@ #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 PAYLOAD_GPS 1 // add gps location to pax count payload: 0=no, 1=yes // 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 @@ -76,7 +75,7 @@ #define TIME_SYNC_INTERVAL_RETRY 10 // retry time sync after lost sync each .. minutes [default = 10], 0 means off #define TIME_SYNC_COMPILEDATE 0 // set to 1 to use compile date to initialize RTC after power outage [default = 0] #define TIME_SYNC_LORAWAN 0 // set to 1 to use LORA network as time source, 0 means off [default = 0] -#define TIME_SYNC_LORASERVER 0 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0] +#define TIME_SYNC_LORASERVER 1 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0] // settings for syncing time with timeserver applications #define TIME_SYNC_SAMPLES 1 // number of time requests for averaging @@ -93,7 +92,7 @@ #define RCMDPORT 2 // remote commands #define STATUSPORT 2 // remote command results #define CONFIGPORT 3 // config query results -#define GPSPORT 4 // gps +#define GPSPORT 4 // gps - set to 1 to send combined GPS+COUNT payload #define BUTTONPORT 5 // button pressed signal #define BEACONPORT 6 // beacon alarms #define BMEPORT 7 // BME680 sensor diff --git a/src/senddata.cpp b/src/senddata.cpp index 4e230cb8..3df51b3c 100644 --- a/src/senddata.cpp +++ b/src/senddata.cpp @@ -70,7 +70,7 @@ void sendData() { if (cfg.blescan) payload.addCount(macs_ble, MAC_SNIFF_BLE); -#if (PAYLOAD_GPS) +#if (HAS_GPS) && (GPSPORT == 1) // send GPS position only if we have a fix if (gps.location.isValid()) { gpsStatus_t gps_status; @@ -102,7 +102,7 @@ void sendData() { break; #endif -#if (HAS_GPS) +#if (HAS_GPS) && (GPSPORT != 1) case GPS_DATA: // send GPS position only if we have a fix if (gps.location.isValid()) { From f86fda1cb6a74564f58f91d7edece11732ad3a5a Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Tue, 19 Nov 2019 15:44:55 +0100 Subject: [PATCH 2/5] sanitizations in some files --- src/hal/octopus32.h | 2 ++ src/hal/ttgobeam.h | 6 +++--- src/main.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hal/octopus32.h b/src/hal/octopus32.h index f34f609b..7ff3d76b 100644 --- a/src/hal/octopus32.h +++ b/src/hal/octopus32.h @@ -9,6 +9,8 @@ // Hardware related definitions for #IoT Octopus32 with the Adafruit LoRaWAN Wing // You can use this configuration also with the Adafruit ESP32 Feather + the LoRaWAN Wing // In this config we use the Adafruit OLED Wing which is only 128x32 pixel, need to find a smaller font +// NPTE: if LORA_IRQ and LORA_IO1 are tied to the same GPIO by diodes on the board, +// you must disable LMIC_USE_INTERRUPTS in lmic_config.h // disable brownout detection (avoid unexpected reset on some boards) #define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature diff --git a/src/hal/ttgobeam.h b/src/hal/ttgobeam.h index be9c1ff7..a4d81926 100644 --- a/src/hal/ttgobeam.h +++ b/src/hal/ttgobeam.h @@ -28,9 +28,9 @@ // enable only if device has these sensors, otherwise comment these lines // BME680 sensor on I2C bus -//#define HAS_BME 1 // Enable BME sensors in general -//#define HAS_BME680 SDA, SCL -//#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! +#define HAS_BME 1 // Enable BME sensors in general +#define HAS_BME680 SDA, SCL +#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! // display (if connected) #define HAS_DISPLAY 1 diff --git a/src/main.cpp b/src/main.cpp index f1452fb1..6d96d7b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -62,7 +62,7 @@ PMUIRQ -> PMU chip gpio -> irqHandlerTask (Core 1) fired by software (Ticker.h) TIMESYNC_IRQ -> timeSync() -> irqHandlerTask (Core 1) -CYLCIC_IRQ -> housekeeping() -> irqHandlerTask (Core 1) +CYCLIC_IRQ -> housekeeping() -> irqHandlerTask (Core 1) SENDCYCLE_IRQ -> sendcycle() -> irqHandlerTask (Core 1) BME_IRQ -> bmecycle() -> irqHandlerTask (Core 1) From fb682196a94ba2f379e7a128dace110bd1f87b3b Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Tue, 19 Nov 2019 19:48:29 +0100 Subject: [PATCH 3/5] octopus32.h edit notes --- src/hal/octopus32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hal/octopus32.h b/src/hal/octopus32.h index 7ff3d76b..19ed4ca5 100644 --- a/src/hal/octopus32.h +++ b/src/hal/octopus32.h @@ -9,7 +9,7 @@ // Hardware related definitions for #IoT Octopus32 with the Adafruit LoRaWAN Wing // You can use this configuration also with the Adafruit ESP32 Feather + the LoRaWAN Wing // In this config we use the Adafruit OLED Wing which is only 128x32 pixel, need to find a smaller font -// NPTE: if LORA_IRQ and LORA_IO1 are tied to the same GPIO by diodes on the board, +// NOTE: if LORA_IRQ and LORA_IO1 are tied to the same GPIO using diodes on the board, // you must disable LMIC_USE_INTERRUPTS in lmic_config.h // disable brownout detection (avoid unexpected reset on some boards) From 9a4f82b5119919aa048670bad08ae5748406c155 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Tue, 19 Nov 2019 21:30:23 +0100 Subject: [PATCH 4/5] sanitizations --- src/hal/ttgobeam.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hal/ttgobeam.h b/src/hal/ttgobeam.h index a4d81926..be9c1ff7 100644 --- a/src/hal/ttgobeam.h +++ b/src/hal/ttgobeam.h @@ -28,9 +28,9 @@ // enable only if device has these sensors, otherwise comment these lines // BME680 sensor on I2C bus -#define HAS_BME 1 // Enable BME sensors in general -#define HAS_BME680 SDA, SCL -#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! +//#define HAS_BME 1 // Enable BME sensors in general +//#define HAS_BME680 SDA, SCL +//#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! // display (if connected) #define HAS_DISPLAY 1 From b1a0790531e883da7ad7546861a8bd0a275f4a17 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Tue, 19 Nov 2019 21:32:09 +0100 Subject: [PATCH 5/5] sanitizations --- src/hal/ttgobeam.h | 6 +++--- src/paxcounter.conf | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hal/ttgobeam.h b/src/hal/ttgobeam.h index a4d81926..be9c1ff7 100644 --- a/src/hal/ttgobeam.h +++ b/src/hal/ttgobeam.h @@ -28,9 +28,9 @@ // enable only if device has these sensors, otherwise comment these lines // BME680 sensor on I2C bus -#define HAS_BME 1 // Enable BME sensors in general -#define HAS_BME680 SDA, SCL -#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! +//#define HAS_BME 1 // Enable BME sensors in general +//#define HAS_BME680 SDA, SCL +//#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! // display (if connected) #define HAS_DISPLAY 1 diff --git a/src/paxcounter.conf b/src/paxcounter.conf index bc3da7b6..e4fe6a15 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -75,7 +75,7 @@ #define TIME_SYNC_INTERVAL_RETRY 10 // retry time sync after lost sync each .. minutes [default = 10], 0 means off #define TIME_SYNC_COMPILEDATE 0 // set to 1 to use compile date to initialize RTC after power outage [default = 0] #define TIME_SYNC_LORAWAN 0 // set to 1 to use LORA network as time source, 0 means off [default = 0] -#define TIME_SYNC_LORASERVER 1 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0] +#define TIME_SYNC_LORASERVER 0 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0] // settings for syncing time with timeserver applications #define TIME_SYNC_SAMPLES 1 // number of time requests for averaging