Farm-Data-Relay-System/Examples/5_MQTT_Gateway/fdrs_config.h

71 lines
1.9 KiB
C
Raw Normal View History

2022-05-21 02:05:29 +00:00
// FARM DATA RELAY SYSTEM
//
// GATEWAY 2.000 Configuration
2022-05-25 21:53:39 +00:00
#include <fdrs_globals.h> //Uncomment if you install the globals file
#define DEBUG
#define UNIT_MAC 0x00 // The address of this gateway
2022-05-21 02:05:29 +00:00
//Actions -- Define what happens when a packet arrives at each interface:
//Current function options are: sendESPNOW(MAC), sendSerial(), sendMQTT(), bufferESPNOW(interface), bufferSerial(), and bufferLoRa(interface).
2022-05-26 00:11:38 +00:00
#define ESPNOWG_ACT sendSerial();
#define SERIAL_ACT //sendMQTT();
2022-05-21 02:05:29 +00:00
#define MQTT_ACT
2022-05-26 00:11:38 +00:00
#define LORAG_ACT sendSerial();
2022-05-25 21:53:39 +00:00
2022-05-26 00:11:38 +00:00
//#define USE_LORA
//#define USE_WIFI //Used only for MQTT gateway
2022-05-25 21:53:39 +00:00
2022-05-26 00:11:38 +00:00
#define WIFI_SSID "Your SSID"
#define WIFI_PASS "Your Password"
#define MQTT_ADDR "192.168.0.8"
2022-05-21 02:05:29 +00:00
2022-05-25 21:53:39 +00:00
// Peer addresses
#define ESPNOW1_PEER 0x04 // ESPNOW1 Address
#define ESPNOW2_PEER 0x05 // ESPNOW2 Address
#define LORA1_PEER 0x04 // LoRa1 Address
#define LORA2_PEER 0x05 // LoRa2 Address
2022-05-26 00:11:38 +00:00
// Peer Actions
#define ESPNOW1_ACT
#define ESPNOW2_ACT
#define LORA1_ACT
#define LORA2_ACT
2022-05-25 21:53:39 +00:00
//Pins for UART data interface (ESP32 only)
2022-05-21 02:05:29 +00:00
#define RXD2 14
#define TXD2 15
2022-05-25 21:53:39 +00:00
//LoRa Configuration -- Needed only if using LoRa
2022-05-21 02:05:29 +00:00
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
2022-05-25 21:53:39 +00:00
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
#define SF 7
2022-05-26 00:11:38 +00:00
// Buffer Delays - in milliseconds
//#define ESPNOW1_DELAY 0
//#define ESPNOW2_DELAY 0
//#define ESPNOWG_DELAY 0
//#define SERIAL_DELAY 0
//#define MQTT_DELAY 0
//#define LORAG_DELAY 1000
//#define LORA1_DELAY 1000
//#define LORA2_DELAY 1000
2022-05-25 21:53:39 +00:00
//#define USE_LED //Not yet fully implemented
#define LED_PIN 32
#define NUM_LEDS 4
// MQTT Topics
#define TOPIC_DATA "FDRS/DATA"
#define TOPIC_STATUS "FDRS/STATUS"
#define TOPIC_COMMAND "FDRS/COMMAND"