mirror of
https://github.com/timmbogner/Farm-Data-Relay-System
synced 2024-11-10 07:10:42 +00:00
Add dependency switch macro
This commit is contained in:
parent
b16489b42e
commit
cdb5e5e0fd
@ -138,6 +138,8 @@ void FDRS_EspNow::transmit(DataReading *fdrsData, uint8_t _data_count){
|
|||||||
DBG(" ESP-NOW sent.");
|
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):
|
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),
|
FDRSBase(gtwy_mac,reading_id),
|
||||||
_miso(miso),
|
_miso(miso),
|
||||||
@ -184,4 +186,6 @@ void FDRSLoRa::buildPacket(uint8_t* mac, DataReading * packet, uint8_t len) {
|
|||||||
void FDRSLoRa::transmit(DataReading *fdrsData, uint8_t _data_count){
|
void FDRSLoRa::transmit(DataReading *fdrsData, uint8_t _data_count){
|
||||||
buildPacket(_gatewayAddress, fdrsData, _data_count);
|
buildPacket(_gatewayAddress, fdrsData, _data_count);
|
||||||
DBG(" LoRa sent.");
|
DBG(" LoRa sent.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <esp_wifi.h>
|
#include <esp_wifi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_LORA
|
#ifdef USE_LORA
|
||||||
#include "LoRa.h"
|
#include "LoRa.h"
|
||||||
#endif
|
#endif
|
||||||
@ -69,7 +70,6 @@ typedef struct __attribute__((packed)) DataReading {
|
|||||||
float data;
|
float data;
|
||||||
uint16_t id;
|
uint16_t id;
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
|
||||||
} DataReading;
|
} DataReading;
|
||||||
|
|
||||||
class FDRSBase{
|
class FDRSBase{
|
||||||
@ -99,7 +99,9 @@ private:
|
|||||||
|
|
||||||
class FDRS_EspNow: public FDRSBase{
|
class FDRS_EspNow: public FDRSBase{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FDRS_EspNow(uint8_t gtwy_mac, uint8_t reading_id);
|
FDRS_EspNow(uint8_t gtwy_mac, uint8_t reading_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint8_t _gatewayAddress[ESP_GATEWAY_ADDRESS_SIZE];
|
uint8_t _gatewayAddress[ESP_GATEWAY_ADDRESS_SIZE];
|
||||||
@ -110,7 +112,9 @@ private:
|
|||||||
|
|
||||||
class FDRSLoRa: public FDRSBase{
|
class FDRSLoRa: public FDRSBase{
|
||||||
public:
|
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);
|
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:
|
private:
|
||||||
|
|
||||||
uint8_t _gatewayAddress[LORA_GATEWAY_ADDRESS_SIZE];
|
uint8_t _gatewayAddress[LORA_GATEWAY_ADDRESS_SIZE];
|
||||||
@ -124,8 +128,6 @@ private:
|
|||||||
uint8_t _sf;
|
uint8_t _sf;
|
||||||
|
|
||||||
void buildPacket(uint8_t* mac, DataReading * packet, uint8_t len);
|
void buildPacket(uint8_t* mac, DataReading * packet, uint8_t len);
|
||||||
|
|
||||||
|
|
||||||
void transmit(DataReading *fdrsData, uint8_t _data_count) override;
|
void transmit(DataReading *fdrsData, uint8_t _data_count) override;
|
||||||
void init(void) override;
|
void init(void) override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user