Add dependency switch macro

This commit is contained in:
DevilBinder 2022-06-20 22:38:28 +02:00
parent b16489b42e
commit cdb5e5e0fd
2 changed files with 10 additions and 4 deletions

View File

@ -138,6 +138,8 @@ void FDRS_EspNow::transmit(DataReading *fdrsData, uint8_t _data_count){
DBG(" ESP-NOW sent.");
}
#ifdef USE_LORA
FDRSLoRa::FDRSLoRa(uint8_t gtwy_mac, uint8_t reading_id,uint8_t miso,uint8_t mosi,uint8_t sck, uint8_t ss,uint8_t rst,uint8_t dio0,uint32_t band,uint8_t sf):
FDRSBase(gtwy_mac,reading_id),
_miso(miso),
@ -185,3 +187,5 @@ void FDRSLoRa::transmit(DataReading *fdrsData, uint8_t _data_count){
buildPacket(_gatewayAddress, fdrsData, _data_count);
DBG(" LoRa sent.");
}
#endif

View File

@ -18,6 +18,7 @@
#include <WiFi.h>
#include <esp_wifi.h>
#endif
#ifdef USE_LORA
#include "LoRa.h"
#endif
@ -69,7 +70,6 @@ typedef struct __attribute__((packed)) DataReading {
float data;
uint16_t id;
uint8_t type;
} DataReading;
class FDRSBase{
@ -99,7 +99,9 @@ private:
class FDRS_EspNow: public FDRSBase{
public:
FDRS_EspNow(uint8_t gtwy_mac, uint8_t reading_id);
private:
uint8_t _gatewayAddress[ESP_GATEWAY_ADDRESS_SIZE];
@ -110,7 +112,9 @@ private:
class FDRSLoRa: public FDRSBase{
public:
FDRSLoRa(uint8_t gtwy_mac, uint8_t reading_id,uint8_t miso,uint8_t mosi,uint8_t sck, uint8_t ss,uint8_t rst,uint8_t dio0,uint32_t band,uint8_t sf);
private:
uint8_t _gatewayAddress[LORA_GATEWAY_ADDRESS_SIZE];
@ -124,8 +128,6 @@ private:
uint8_t _sf;
void buildPacket(uint8_t* mac, DataReading * packet, uint8_t len);
void transmit(DataReading *fdrsData, uint8_t _data_count) override;
void init(void) override;