less generic, only advanced gps+counter
This commit is contained in:
parent
0ed5f73b2c
commit
ab82374bfa
@ -47,7 +47,6 @@
|
||||
#define MEM_LOW 2048 // [Bytes] low memory threshold triggering a send cycle
|
||||
#define RETRANSMIT_RCMD 5 // [seconds] wait time before retransmitting rcommand results
|
||||
#define PAYLOAD_BUFFER_SIZE 51 // maximum size of payload block per transmit
|
||||
#define PAYLOAD_COMBINE 0 // 0/1 does combine data on same port into one combined payload message
|
||||
#define LORADRDEFAULT 5 // 0 .. 15, LoRaWAN datarate, according to regional LoRaWAN specs [default = 5]
|
||||
#define LORATXPOWDEFAULT 14 // 0 .. 255, LoRaWAN TX power in dBm [default = 14]
|
||||
#define MAXLORARETRY 500 // maximum count of TX retries if LoRa busy
|
||||
@ -93,7 +92,7 @@
|
||||
#define RCMDPORT 2 // remote commands
|
||||
#define STATUSPORT 2 // remote command results
|
||||
#define CONFIGPORT 3 // config query results
|
||||
#define GPSPORT 1 // 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
|
||||
|
@ -68,6 +68,15 @@ void sendData() {
|
||||
payload.addCount(macs_wifi, MAC_SNIFF_WIFI);
|
||||
if (cfg.blescan)
|
||||
payload.addCount(macs_ble, MAC_SNIFF_BLE);
|
||||
#if (HAS_GPS) && (GPSPORT==1)
|
||||
// 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);
|
||||
// clear counter if not in cumulative counter mode
|
||||
if (cfg.countermode != 1) {
|
||||
@ -84,23 +93,19 @@ void sendData() {
|
||||
|
||||
#if (HAS_BME)
|
||||
case MEMS_DATA:
|
||||
#if !(PAYLOAD_COMBINE)
|
||||
payload.reset();
|
||||
#endif
|
||||
payload.addBME(bme_status);
|
||||
SendPayload(BMEPORT, prio_normal);
|
||||
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()) {
|
||||
gpsStatus_t gps_status;
|
||||
gps_storelocation(&gps_status);
|
||||
#if !(PAYLOAD_COMBINE)
|
||||
payload.reset();
|
||||
#endif
|
||||
payload.addGPS(gps_status);
|
||||
SendPayload(GPSPORT, prio_high);
|
||||
} else
|
||||
@ -110,23 +115,17 @@ void sendData() {
|
||||
|
||||
#if (HAS_SENSORS)
|
||||
case SENSOR1_DATA:
|
||||
#if !(PAYLOAD_COMBINE)
|
||||
payload.reset();
|
||||
#endif
|
||||
payload.addSensor(sensor_read(1));
|
||||
SendPayload(SENSOR1PORT, prio_normal);
|
||||
break;
|
||||
case SENSOR2_DATA:
|
||||
#if !(PAYLOAD_COMBINE)
|
||||
payload.reset();
|
||||
#endif
|
||||
payload.addSensor(sensor_read(2));
|
||||
SendPayload(SENSOR2PORT, prio_normal);
|
||||
break;
|
||||
case SENSOR3_DATA:
|
||||
#if !(PAYLOAD_COMBINE)
|
||||
payload.reset();
|
||||
#endif
|
||||
payload.addSensor(sensor_read(3));
|
||||
SendPayload(SENSOR3PORT, prio_normal);
|
||||
break;
|
||||
@ -134,9 +133,7 @@ void sendData() {
|
||||
|
||||
#if (defined BAT_MEASURE_ADC || defined HAS_PMU)
|
||||
case BATT_DATA:
|
||||
#if !(PAYLOAD_COMBINE)
|
||||
payload.reset();
|
||||
#endif
|
||||
payload.addVoltage(read_voltage());
|
||||
SendPayload(BATTPORT, prio_normal);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user