From b7a640e02fe639e1154f2233748967559fd9a43c Mon Sep 17 00:00:00 2001 From: nerdyscout Date: Wed, 27 Nov 2019 20:26:03 +0000 Subject: [PATCH] enable GPS default,fix SenseBox payload,whitespace --- README.md | 2 +- src/configmanager.cpp | 8 ++++---- src/paxcounter.conf | 2 +- src/payload.cpp | 2 ++ src/senddata.cpp | 8 ++++---- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2eed00c1..7b885de5 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ Output of sensor and peripheral data is internally switched by a bitmask registe | Bit | Sensordata | Default | --- | ------------- | ------- -| 0 | GPS | off* +| 0 | GPS* | on | 1 | Beacon alarm | on | 2 | BME280/680 | on | 3 | Paxcounter | on diff --git a/src/configmanager.cpp b/src/configmanager.cpp index 40d4a0a8..3b32470d 100644 --- a/src/configmanager.cpp +++ b/src/configmanager.cpp @@ -8,10 +8,10 @@ static const char TAG[] = "flash"; nvs_handle my_handle; esp_err_t err; -#define PAYLOADMASK \ - ((ALARM_DATA | MEMS_DATA | COUNT_DATA | SENSOR1_DATA | SENSOR2_DATA | \ - SENSOR3_DATA) & \ - (~BATT_DATA) & (~GPS_DATA)) +#define PAYLOADMASK \ + ((GPS_DATA | ALARM_DATA | MEMS_DATA | COUNT_DATA | \ + SENSOR1_DATA | SENSOR2_DATA | SENSOR3_DATA) & \ + (~BATT_DATA) ) // populate cfg vars with factory settings void defaultConfig() { diff --git a/src/paxcounter.conf b/src/paxcounter.conf index 061510d1..0c936ed8 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -93,7 +93,7 @@ #define RCMDPORT 2 // remote commands #define STATUSPORT 2 // remote command results #define CONFIGPORT 3 // config query results -#define GPSPORT 4 // gps - set to 1 to send combined GPS+COUNT payload +#define GPSPORT 4 // gps - 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 diff --git a/src/payload.cpp b/src/payload.cpp index 813aed87..323e402b 100644 --- a/src/payload.cpp +++ b/src/payload.cpp @@ -195,10 +195,12 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp, void PayloadConvert::addGPS(gpsStatus_t value) { #if(HAS_GPS) writeLatLng(value.latitude, value.longitude); +#if (!PAYLOAD_OPENSENSEBOX) writeUint8(value.satellites); writeUint16(value.hdop); writeUint16(value.altitude); #endif +#endif } void PayloadConvert::addSensor(uint8_t buf[]) { diff --git a/src/senddata.cpp b/src/senddata.cpp index e4c55198..2dfcbbf3 100644 --- a/src/senddata.cpp +++ b/src/senddata.cpp @@ -68,7 +68,7 @@ void sendData() { payload.reset(); #if !(PAYLOAD_OPENSENSEBOX) if (cfg.wifiscan) - payload.addCount(macs_wifi, MAC_SNIFF_WIFI); + payload.addCount(macs_wifi, MAC_SNIFF_WIFI); if (cfg.blescan) payload.addCount(macs_ble, MAC_SNIFF_BLE); #endif @@ -76,15 +76,15 @@ void sendData() { if (GPSPORT == COUNTERPORT) { // send GPS position only if we have a fix if (gps.location.isValid()) { - gps_storelocation(&gps_status); - payload.addGPS(gps_status); + gps_storelocation(&gps_status); + payload.addGPS(gps_status); } else ESP_LOGD(TAG, "No valid GPS position"); } #endif #if (PAYLOAD_OPENSENSEBOX) if (cfg.wifiscan) - payload.addCount(macs_wifi, MAC_SNIFF_WIFI); + payload.addCount(macs_wifi, MAC_SNIFF_WIFI); if (cfg.blescan) payload.addCount(macs_ble, MAC_SNIFF_BLE); #endif