Move Data Paket Definition for HAS_NO_SENSOR

This commit is contained in:
seiichiro 2021-02-01 21:37:31 +01:00
parent 45fa51c071
commit 899dc743f2

View file

@ -31,7 +31,11 @@ void blink(uint8_t num) {
#define BLINK_LED(COUNT) #define BLINK_LED(COUNT)
#endif #endif
#if defined HAS_BME280 #if defined HAS_NO_SENSOR
struct lora_data {
uint8_t bat;
} __attribute ((packed));
#elif defined HAS_BME280
#include <BME280.h> #include <BME280.h>
BME280 sensor; BME280 sensor;
#elif defined HAS_SHT21 #elif defined HAS_SHT21
@ -142,15 +146,10 @@ uint16_t readSupplyVoltage() { //returns value in millivolts to avoid floating p
} }
// Read Sensors and Send Data // Read Sensors and Send Data
// All Sensor Code and Data Preparation goes here
void do_send(osjob_t* j) { void do_send(osjob_t* j) {
// Prepare LoRa Data Packet // Prepare LoRa Data Packet
#ifdef HAS_NO_SENSOR // The struct is defined in the sensor class (or above for use without a sensor)
struct lora_data { lora_data data;
uint8_t bat;
} __attribute ((packed));
#endif
lora_data data; // The struct is defined in the sensor class (or above for use without a sensor)
if (LMIC.opmode & OP_TXRXPEND) { if (LMIC.opmode & OP_TXRXPEND) {
delay(1); delay(1);