Merge branch 'dev' into create-sd-card-logging

This commit is contained in:
Timm Bogner 2022-07-07 21:19:10 -05:00 committed by GitHub
commit 64bcbf947a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 358 additions and 202 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
fdrs_globals.h

View File

@ -23,7 +23,7 @@ These are the pins for inter-device serial communication. The single ESP8266 ser
### ```#define USE_LORA```
Enables LoRa. Make sure that you set the LoRa module configuration parameters in the lines below.
BAND and SF (spreading factor) can also be configured in 'fdrs_globals.h' if enabled.
LORA_BAND and LORA_SF (spreading factor) can also be configured in 'fdrs_globals.h' if enabled.
### ```#define USE_WIFI```
Enables WiFi. Used only on the MQTT gateway.

View File

@ -37,19 +37,21 @@
#define TXD2 15
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SCK 5
#define MISO 19
#define MOSI 27
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration -- Needed only if using LoRa
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7
// Buffer Delays - in milliseconds - Uncomment to enable any buffer

View File

@ -16,15 +16,15 @@
#define UART_IF Serial
#endif
#ifdef GLOBALS
#ifdef FDRS_GLOBALS
#define FDRS_WIFI_SSID GLOBAL_SSID
#define FDRS_WIFI_PASS GLOBAL_PASS
#define FDRS_MQTT_ADDR GLOBAL_MQTT_ADDR
#define FDRS_MQTT_PORT GLOBAL_MQTT_PORT
#define FDRS_MQTT_USER GLOBAL_MQTT_USER
#define FDRS_MQTT_PASS GLOBAL_MQTT_PASS
#define FDRS_BAND GLOBAL_BAND
#define FDRS_SF GLOBAL_SF
#define FDRS_BAND GLOBAL_LORA_BAND
#define FDRS_SF GLOBAL_LORA_SF
#else
#define FDRS_WIFI_SSID WIFI_SSID
#define FDRS_WIFI_PASS WIFI_PASS
@ -32,8 +32,8 @@
#define FDRS_MQTT_PORT MQTT_PORT
#define FDRS_MQTT_USER MQTT_USER
#define FDRS_MQTT_PASS MQTT_PASS
#define FDRS_BAND BAND
#define FDRS_SF SF
#define FDRS_BAND LORA_BAND
#define FDRS_SF LORA_SF
#endif
#if defined (MQTT_AUTH) || defined (GLOBAL_MQTT_AUTH)

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7

View File

@ -13,6 +13,9 @@ To install FDRS, download the project folder and move it to your Arduino librari
This [LoRa library](https://github.com/sandeepmistry/arduino-LoRa) is required only if you are using LoRa.
[MQTT](https://github.com/knolleary/pubsubclient/) required for MQTT Gateways.
### [Sensors](https://github.com/timmbogner/Farm-Data-Relay-System/tree/main/FDRS_Sensor)
Sensors gather data and send it to a gateway via ESP-NOW or LoRa.

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
//#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
//#define BAND 915E6
//#define SF 7
//#define LORA_BAND 915E6
//#define LORA_SF 7

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
//#define BAND 915E6
//#define SF 7
//#define LORA_BAND 915E6
//#define LORA_SF 7

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
//#define BAND 915E6
//#define SF 7
//#define LORA_BAND 915E6
//#define LORA_SF 7

View File

@ -61,8 +61,10 @@ void setup() {
#endif
#ifdef USE_LORA
DBG("Initializing LoRa!");
SPI.begin(SCK, MISO, MOSI, SS);
LoRa.setPins(SS, RST, DIO0);
#ifdef ESP32
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
#endif
LoRa.setPins(LORA_SS, LORA_RST, LORA_DIO0);
if (!LoRa.begin(FDRS_BAND)) {
while (1);
}

View File

@ -50,18 +50,20 @@
#define RXD2 14
#define TXD2 15
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration -- Needed only if using LoRa
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
//#define BAND 915E6
//#define SF 7
//#define LORA_BAND 915E6
//#define LORA_SF 7
// Buffer Delays - in milliseconds
//#define ESPNOW1_DELAY 0

View File

@ -61,8 +61,10 @@ void setup() {
#endif
#ifdef USE_LORA
DBG("Initializing LoRa!");
SPI.begin(SCK, MISO, MOSI, SS);
LoRa.setPins(SS, RST, DIO0);
#ifdef ESP32
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
#endif
LoRa.setPins(LORA_SS, LORA_RST, LORA_DIO0);
if (!LoRa.begin(FDRS_BAND)) {
while (1);
}

View File

@ -53,18 +53,20 @@
#define RXD2 14
#define TXD2 15
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration -- Needed only if using LoRa
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
//#define BAND 915E6
//#define SF 7
//#define LORA_BAND 915E6
//#define LORA_SF 7
// Buffer Delays - in milliseconds
//#define ESPNOW1_DELAY 0

View File

@ -61,8 +61,10 @@ void setup() {
#endif
#ifdef USE_LORA
DBG("Initializing LoRa!");
SPI.begin(SCK, MISO, MOSI, SS);
LoRa.setPins(SS, RST, DIO0);
#ifdef ESP32
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
#endif
LoRa.setPins(LORA_SS, LORA_RST, LORA_DIO0);
if (!LoRa.begin(FDRS_BAND)) {
while (1);
}

View File

@ -35,18 +35,20 @@
#define RXD2 14
#define TXD2 15
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration -- Needed only if using LoRa
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7
// Buffer Delays - in milliseconds - Uncomment to enable any buffer

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7

View File

@ -15,16 +15,18 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define LORA_SS 18
// RST: 23 for T-Beam or Paxcounter, 14 for Lora32 V1
#define RST 23
#define DIO0 26
#define LORA_RST 23
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 866E6
#define SF 7
#define LORA_BAND 866E6
#define LORA_SF 7

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7

View File

@ -15,15 +15,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7

View File

@ -76,7 +76,7 @@ std::vector<DataReading_t> serial_data;
#if defined(LORA_GET) || defined(LORA_SEND)
LoRa_FDRSGateWay LoRaGW(MISO,MOSI,SCK,SS,RST,DIO0,BAND,SF);
LoRa_FDRSGateWay LoRaGW(SPI_MISO,SPI_MOSI,SPI_SCK,LORA_SS,LORA_RST,LORA_DIO0,LORA_BAND,LORA_SF);
#endif

View File

@ -44,19 +44,21 @@
#define RXD2 14
#define TXD2 15
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration -- Needed only if using LoRa
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
// TODO: Needs to be commented out if FDRS_GLOBALS are assigned
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7
//#define USE_LED //Not yet fully implemented
#define LED_PIN 32

View File

@ -544,7 +544,9 @@ void LoRa_FDRSGateWay::init(uint8_t mac[6]){
memcpy(_mac,mac,6);
DBG("Initializing LoRa!");
SPI.begin(_sck, _miso, _mosi, _ss);
#ifdef ESP32
SPI.begin(_sck, _miso, _mosi);
#endif
LoRa.setPins(_ss, _rst, _dio0);
if (!LoRa.begin(_band)) {
DBG(" LoRa initialize failed");

View File

@ -11,7 +11,7 @@
#include "sensor_setup.h"
#include "fdrs_sensor.h"
FDRSLoRa FDRS(GTWY_MAC,READING_ID,MISO,MOSI,SCK,SS,RST,DIO0,FDRS_BAND,FDRS_SF);
FDRSLoRa FDRS(GTWY_MAC,READING_ID,SPI_MISO,SPI_MOSI,SPI_SCK,LORA_SS,LORA_RST,LORA_DIO0,FDRS_BAND,FDRS_SF);
float data1;
float data2;

View File

@ -152,7 +152,7 @@ void FDRSLoRa::init(void){
DBG(_band);
DBG(_sf);
#ifdef ESP32
SPI.begin(_sck, _miso, _mosi, _ss);
SPI.begin(_sck, _miso, _mosi);
#endif
LoRa.setPins(_ss, _rst, _dio0);
if (!LoRa.begin(_band)) {

View File

@ -36,12 +36,12 @@
#include "LoRa.h"
#endif
#ifdef GLOBALS
#ifdef FDRS_GLOBALS
#define FDRS_BAND GLOBAL_BAND
#define FDRS_SF GLOBAL_SF
#else
#define FDRS_BAND BAND
#define FDRS_SF SF
#define FDRS_BAND LORA_BAND
#define FDRS_SF LORA_SF
#endif
#ifdef DEBUG
@ -59,13 +59,42 @@ extern const uint8_t prefix[5];
class FDRSBase{
public:
/**
* @brief Construct a new FDRSBase object
*
* @param gtwy_mac The network MAC
* @param reading_id The network identifier for the sensor
*/
FDRSBase(uint8_t gtwy_mac,uint8_t reading_id);
~FDRSBase();
/**
* @brief Start a paticulare sensor.
*/
void begin(void);
/**
* @brief Set the data for the next transmission.
*
* @param data Data for the next transmission
* @param type The ID for the type of data that is being sent.
*/
void load(float data, uint8_t type);
/**
* @brief Time in seconds the sensor will delay before sending data.
*
* @note This is blocking.
*
* @param seconds Number of seconds to delay.
*/
void sleep(int seconds);
/**
* @brief Send the data out on the network.
*
*/
void send();
private:
@ -76,7 +105,17 @@ private:
uint8_t _data_count;
DataReading_t *fdrsData;
/**
* @brief Required impalamnetation of a paticulare sensors initialization.
*/
virtual void init(void) = 0;
/**
* @brief Required impalamnetation of how a sensor will send its data out on the network.
*
* @param fdrsData Pointer to the data that the sensor will be seding.
* @param _data_count The number of data packets the sensor will be sending.
*/
virtual void transmit(DataReading_t *fdrsData, uint8_t _data_count) = 0;
};
@ -84,12 +123,31 @@ private:
class FDRS_EspNow: public FDRSBase{
public:
/**
* @brief Construct a new fdrs espnow object
*
* @param gtwy_mac The network MAC.
* @param reading_id The network identifier for the sensor.
*/
FDRS_EspNow(uint8_t gtwy_mac, uint8_t reading_id);
private:
uint8_t _gatewayAddress[ESP_GATEWAY_ADDRESS_SIZE];
/**
* @brief Send data out on the ESPNOW network.
*
* @param fdrsData Pointer to the data that the sensor will be seding.
* @param _data_count The number of data packets the sensor will be sending.
*/
void transmit(DataReading_t *fdrsData, uint8_t _data_count) override;
/**
* @brief Initialize the ESPNOW network
*
*/
void init(void) override;
};
@ -97,6 +155,21 @@ private:
class FDRSLoRa: public FDRSBase{
public:
/**
* @brief Construct a new FDRSLoRa object
*
* @param gtwy_mac The network MAC.
* @param reading_id The network identifier for the sensor.
* @param miso Master in slave out pin.
* @param mosi Master out slave in pin.
* @param sck Master clock pin.
* @param ss Slave select pin
* @param rst Reset Pin
* @param dio0 LoRa data pin
* @param band LoRa frequency band
* @param sf LoRa spread factor
*/
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:
@ -111,8 +184,26 @@ private:
uint32_t _band;
uint8_t _sf;
/**
* @brief Construct a LoRa packet
*
* @param mac Network Mac address
* @param packet Data to create the packet with
* @param len Length of the data in bytes
*/
void buildPacket(uint8_t* mac, DataReading_t * packet, uint8_t len);
/**
* @brief Send data out on the LoRa network.
*
* @param fdrsData Pointer to the data that the sensor will be seding.
* @param _data_count The number of data packets the sensor will be sending.
*/
void transmit(DataReading_t *fdrsData, uint8_t _data_count) override;
/**
* @brief Initialize the LoRa module
*/
void init(void) override;
};

View File

@ -13,15 +13,17 @@
//#define POWER_CTRL 14
#define DEBUG
//SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19
#define SPI_MOSI 27
//LoRa Configuration
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
#define LORA_BAND 915E6
#define LORA_SF 7

View File

@ -16,15 +16,15 @@
#define UART_IF Serial
#endif
#ifdef GLOBALS
#ifdef FDRS_GLOBALS
#define FDRS_WIFI_SSID GLOBAL_SSID
#define FDRS_WIFI_PASS GLOBAL_PASS
#define FDRS_MQTT_ADDR GLOBAL_MQTT_ADDR
#define FDRS_MQTT_PORT GLOBAL_MQTT_PORT
#define FDRS_MQTT_USER GLOBAL_MQTT_USER
#define FDRS_MQTT_PASS GLOBAL_MQTT_PASS
#define FDRS_BAND GLOBAL_BAND
#define FDRS_SF GLOBAL_SF
#define FDRS_BAND GLOBAL_LORA_BAND
#define FDRS_SF GLOBAL_LORA_SF
#else
#define FDRS_WIFI_SSID WIFI_SSID
#define FDRS_WIFI_PASS WIFI_PASS
@ -32,8 +32,8 @@
#define FDRS_MQTT_PORT MQTT_PORT
#define FDRS_MQTT_USER MQTT_USER
#define FDRS_MQTT_PASS MQTT_PASS
#define FDRS_BAND BAND
#define FDRS_SF SF
#define FDRS_BAND LORA_BAND
#define FDRS_SF LORA_SF
#endif
#if defined (MQTT_AUTH) || defined (GLOBAL_MQTT_AUTH)

View File

@ -1,6 +1,5 @@
// ToDo: refactor the global GLOBALS to FDRS_GLOBALS as GLOBALS is ... well, too global ;)
#ifndef GLOBALS
#define GLOBALS
#ifndef FDRS_GLOBALS
#define FDRS_GLOBALS
#define GLOBAL_SSID "Your SSID"
#define GLOBAL_PASS "Password"
#define GLOBAL_MQTT_ADDR "192.168.0.8"
@ -9,7 +8,7 @@
#define GLOBAL_MQTT_USER "Your MQTT Username"
#define GLOBAL_MQTT_PASS "Your MQTT Password"
#define GLOBAL_BAND 915E6 //LoRa Frequency Band
#define GLOBAL_SF 7 //LoRa Spreading Factor
#define GLOBAL_LORA_BAND 915E6 //LoRa Frequency Band
#define GLOBAL_LORA_SF 7 //LoRa Spreading Factor
#endif GLOBALS
#endif FDRS_GLOBALS

View File

@ -17,12 +17,12 @@
#include <LoRa.h>
#endif
#ifdef GLOBALS
#ifdef FDRS_GLOBALS
#define FDRS_BAND GLOBAL_BAND
#define FDRS_SF GLOBAL_SF
#else
#define FDRS_BAND BAND
#define FDRS_SF SF
#define FDRS_BAND LORA_BAND
#define FDRS_SF LORA_SF
#endif
#ifdef DEBUG
@ -92,12 +92,12 @@ void beginFDRS() {
#endif
#ifdef USE_LORA
DBG("Initializing LoRa!");
DBG(BAND);
DBG(SF);
DBG(LORA_BAND);
DBG(LORA_SF);
#ifdef ESP32
SPI.begin(SCK, MISO, MOSI, SS);
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
#endif
LoRa.setPins(SS, RST, DIO0);
LoRa.setPins(LORA_SS, LORA_RST, LORA_DIO0);
if (!LoRa.begin(FDRS_BAND)) {
DBG("Unable to initialize LoRa!");
while (1);

View File

@ -5,25 +5,41 @@
##########################################################
# Datatypes and Class names (KEYWORD1)
##########################################################
DataReading KEYWORD1
##########################################################
# Methods and Functions (KEYWORD2)
##########################################################
beginFDRS KEYWORD2
loadFDRS KEYWORD2
sendFDRS KEYWORD2
sleepFDRS KEYWORD2
DBG KEYWORD2
getLoRa KEYWORD2
sendESPNOW KEYWORD2
sendSerial KEYWORD2
sendMQTT KEYWORD2
beginFDRS KEYWORD2
bufferESPNOW KEYWORD2
bufferSerial KEYWORD2
bufferMQTT KEYWORD2
bufferLoRa KEYWORD2
transmitLoRa KEYWORD2
bufferMQTT KEYWORD2
bufferSerial KEYWORD2
getLoRa KEYWORD2
getSerial KEYWORD2
loadFDRS KEYWORD2
sendESPNOW KEYWORD2
sendFDRS KEYWORD2
sendMQTT KEYWORD2
sendSerial KEYWORD2
sleepFDRS KEYWORD2
transmitLoRa KEYWORD2
##########################################################
# Literals (LITERAL1)
##########################################################
DEBUG LITERAL1
DEBUG LITERAL1
DEEP_SLEEP LITERAL1
FDRS_BAND LITERAL1
FDRS_GLOBALS LITERAL1
FDRS_SF LITERAL1
//GTWY_MAC LITERAL1
MAC_PREFIX LITERAL1
POWER_CTRL LITERAL1
READING_ID LITERAL1
UNIT_MAC LITERAL1
USE_LORA LITERAL1