combined gps payload (issue #482)

This commit is contained in:
Verkehrsrot 2019-11-11 20:31:14 +01:00
parent c826240d94
commit bc9d550b7d
5 changed files with 32 additions and 18 deletions

View File

@ -169,17 +169,18 @@ Output of user sensor data can be switched by user remote control command 0x14 s
Output of sensor and peripheral data is internally switched by a bitmask register. Default mask can be tailored by editing *cfg.payloadmask* initialization value in [*configmanager.cpp*](src/configmanager.cpp) following this scheme: Output of sensor and peripheral data is internally switched by a bitmask register. Default mask can be tailored by editing *cfg.payloadmask* initialization value in [*configmanager.cpp*](src/configmanager.cpp) following this scheme:
| Bit | Sensordata | | Bit | Sensordata | Default
| --- | ------------- | | --- | ------------- | -------
| 0 | GPS | | 0 | GPS | off*
| 1 | Beacon alarm | | 1 | Beacon alarm | on
| 2 | BME280/680 | | 2 | BME280/680 | on
| 3 | Paxcounter | | 3 | Paxcounter | on
| 4 | User sensor 1 | | 4 | User sensor 1 | on
| 5 | User sensor 2 | | 5 | User sensor 2 | on
| 6 | User sensor 3 | | 6 | User sensor 3 | on
| 7 | Batterylevel | | 7 | Batterylevel | off
*) GPS data can also be combined with payload on port 1, #define PAYLOAD_GPS in paxcounter.conf to enable
# Time sync # Time sync

View File

@ -11,14 +11,14 @@
;halfile = ebox.h ;halfile = ebox.h
;halfile = eboxtube.h ;halfile = eboxtube.h
;halfile = ecopower.h ;halfile = ecopower.h
halfile = heltec.h ;halfile = heltec.h
;halfile = heltecv2.h ;halfile = heltecv2.h
;halfile = ttgov1.h ;halfile = ttgov1.h
;halfile = ttgov2.h ;halfile = ttgov2.h
;halfile = ttgov21old.h ;halfile = ttgov21old.h
;halfile = ttgov21new.h ;halfile = ttgov21new.h
;halfile = ttgofox.h ;halfile = ttgofox.h
;halfile = ttgobeam.h halfile = ttgobeam.h
;halfile = ttgobeam10.h ;halfile = ttgobeam10.h
;halfile = fipy.h ;halfile = fipy.h
;halfile = lopy.h ;halfile = lopy.h
@ -43,10 +43,10 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
[common] [common]
; for release_version use max. 10 chars total, use any decimal format like "a.b.c" ; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
release_version = 1.9.8 release_version = 1.9.81
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running! ; 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 ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
debug_level = 3 debug_level = 4
extra_scripts = pre:build.py extra_scripts = pre:build.py
otakeyfile = ota.conf otakeyfile = ota.conf
lorakeyfile = loraconf.h lorakeyfile = loraconf.h

View File

@ -9,9 +9,9 @@ nvs_handle my_handle;
esp_err_t err; esp_err_t err;
#define PAYLOADMASK \ #define PAYLOADMASK \
((GPS_DATA | ALARM_DATA | MEMS_DATA | COUNT_DATA | SENSOR1_DATA | \ ((ALARM_DATA | MEMS_DATA | COUNT_DATA | SENSOR1_DATA | SENSOR2_DATA | \
SENSOR2_DATA | SENSOR3_DATA) & \ SENSOR3_DATA) & \
~BATT_DATA) (~BATT_DATA) & (~GPS_DATA))
// populate cfg vars with factory settings // populate cfg vars with factory settings
void defaultConfig() { void defaultConfig() {

View File

@ -13,6 +13,7 @@
#define SENDCYCLE 30 // payload send cycle [seconds/2], 0 .. 255 #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 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 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 // 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 1 // set to 0 if you want to count things, not people

View File

@ -65,9 +65,21 @@ void sendData() {
#if ((WIFICOUNTER) || (BLECOUNTER)) #if ((WIFICOUNTER) || (BLECOUNTER))
case COUNT_DATA: case COUNT_DATA:
payload.reset(); payload.reset();
payload.addCount(macs_wifi, MAC_SNIFF_WIFI); if (cfg.wifiscan)
payload.addCount(macs_wifi, MAC_SNIFF_WIFI);
if (cfg.blescan) if (cfg.blescan)
payload.addCount(macs_ble, MAC_SNIFF_BLE); payload.addCount(macs_ble, MAC_SNIFF_BLE);
#if (PAYLOAD_GPS)
// send GPS position only if we have a fix
if (gps.location.isValid()) {
gpsStatus_t gps_status;
gps_storelocation(&gps_status);
payload.addGPS(gps_status);
} else
ESP_LOGD(TAG, "No valid GPS position");
#endif
SendPayload(COUNTERPORT, prio_normal); SendPayload(COUNTERPORT, prio_normal);
// clear counter if not in cumulative counter mode // clear counter if not in cumulative counter mode
if (cfg.countermode != 1) { if (cfg.countermode != 1) {