From 899dc743f2584a0c08e64d7de7c86877dfa393b5 Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Mon, 1 Feb 2021 21:37:31 +0100 Subject: [PATCH] Move Data Paket Definition for HAS_NO_SENSOR --- src/main.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9dfb6e4..b948b21 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,11 @@ void blink(uint8_t num) { #define BLINK_LED(COUNT) #endif -#if defined HAS_BME280 +#if defined HAS_NO_SENSOR + struct lora_data { + uint8_t bat; + } __attribute ((packed)); +#elif defined HAS_BME280 #include BME280 sensor; #elif defined HAS_SHT21 @@ -142,15 +146,10 @@ uint16_t readSupplyVoltage() { //returns value in millivolts to avoid floating p } // Read Sensors and Send Data -// All Sensor Code and Data Preparation goes here void do_send(osjob_t* j) { // Prepare LoRa Data Packet - #ifdef HAS_NO_SENSOR - struct lora_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) + // The struct is defined in the sensor class (or above for use without a sensor) + lora_data data; if (LMIC.opmode & OP_TXRXPEND) { delay(1);