compile flag for do no payload reset

This commit is contained in:
nerdyscout 2019-11-10 08:00:28 +00:00
parent d5cef5f159
commit 0ed5f73b2c
2 changed files with 14 additions and 1 deletions

View File

@ -47,6 +47,7 @@
#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
@ -92,7 +93,7 @@
#define RCMDPORT 2 // remote commands
#define STATUSPORT 2 // remote command results
#define CONFIGPORT 3 // config query results
#define GPSPORT 4 // gps
#define GPSPORT 1 // gps
#define BUTTONPORT 5 // button pressed signal
#define BEACONPORT 6 // beacon alarms
#define BMEPORT 7 // BME680 sensor

View File

@ -84,7 +84,9 @@ void sendData() {
#if (HAS_BME)
case MEMS_DATA:
#if !(PAYLOAD_COMBINE)
payload.reset();
#endif
payload.addBME(bme_status);
SendPayload(BMEPORT, prio_normal);
break;
@ -96,7 +98,9 @@ void sendData() {
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
@ -106,17 +110,23 @@ 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;
@ -124,7 +134,9 @@ 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;