Adapted the numbering of the nodes to the numbers of the diagram

This commit is contained in:
sensorsiot 2022-05-22 22:56:58 +02:00
parent f165cfd20e
commit b5082b3f33
10 changed files with 31 additions and 62 deletions

View File

@ -1,6 +1,6 @@
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x00 //Address of the nearest gateway
#define GTWY_MAC 0x04 //Address of the nearest gateway
//#define USE_ESPNOW
#define USE_LORA

View File

@ -1,5 +1,5 @@
#define READING_ID 2 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define GTWY_MAC 0x03 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA

View File

@ -8,8 +8,6 @@
#define CREDENTIALS
#define DEBUG
#define ROLE ESPNOW_GATEWAY
#include <FDRSdefaults.h>
#include "fdrs_config.h"
#ifdef ESP8266

View File

@ -2,7 +2,7 @@
//
// GATEWAY 2.000 Configuration
#define UNIT_MAC 0x01 // The address of this gateway
#define UNIT_MAC 0x03 // The address of this gateway
#define ESPNOW1_PEER 0xFD // ESPNOW1 Address
#define ESPNOW2_PEER 0xFE // ESPNOW2 Address
#define LORA1_PEER 0xFD // LoRa1 Address
@ -11,7 +11,7 @@
//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).
#define ESPNOWG_ACT sendESPNOW(0x00);
#define ESPNOWG_ACT sendESPNOW(0x04);
#define SERIAL_ACT
#define MQTT_ACT
#define LORAG_ACT

View File

@ -7,8 +7,6 @@
#define DEBUG
#define CREDENTIALS
#define ROLE UART_GATEWAY
#include <FDRSdefaults.h>
#include "fdrs_config.h"
#ifdef ESP8266

View File

@ -2,7 +2,7 @@
//
// GATEWAY 2.000 Configuration
#define UNIT_MAC 0x00 // The address of this gateway
#define UNIT_MAC 0x04 // The address of this gateway
#define ESPNOW1_PEER 0xFD // ESPNOW1 Address
#define ESPNOW2_PEER 0xFE // ESPNOW2 Address
#define LORA1_PEER 0xFD // LoRa1 Address

View File

@ -8,11 +8,8 @@
#define DEBUG
#define CREDENTIALS
#define ROLE MQTT_GATEWAY
#include <FDRSdefaults.h>
#include "fdrs_config.h"
#include "DataReading.h"
#ifdef ESP8266
#include <ESP8266WiFi.h>
@ -34,7 +31,6 @@
#endif
#include "fdrs_functions.h"
void setup() {
#if defined(ESP8266)
Serial.begin(115200);

View File

@ -1,29 +0,0 @@
typedef struct __attribute__((packed)) DataReading {
float d;
uint16_t id;
uint8_t t;
} DataReading;
//Type definitions in progress:
#define STATUS_T 0 // Status
#define TEMP_T 1 // Temperature
#define TEMP2_T 2 // Temperature #2
#define HUMIDITY_T 3 // Relative Humidity
#define PRESSURE_T 4 // Atmospheric Pressure
#define LIGHT_T 5 // Light (lux)
#define SOIL_T 6 // Soil Moisture
#define SOIL2_T 7 // Soil Moisture #2
#define OXYGEN_T 8 // Oxygen
#define CO2_T 9 // Carbon Dioxide
#define WINDSPD_T 10 // Wind Speed
#define WINDHDG_T 11 // Wind Direction
#define RAINFALL_T 12 // Rainfall
#define MOTION_T 13 // Motion
#define VOLTAGE_T 14 // Voltage
#define VOLTAGE2_T 15 // Voltage #2
#define CURRENT_T 16 // Current
#define CURRENT2_T 17 // Current #2
#define IT_T 18 // Iterations

View File

@ -2,43 +2,41 @@
//
// GATEWAY 2.000 Configuration
//#define UNIT_MAC 0x00 // The address of this gateway
#define UNIT_MAC 0x00 // The address of this gateway
#define UNIT_MAC 0x01 // The address of this gateway
#define ESPNOW1_PEER 0xFD // ESPNOW1 Address
#define ESPNOW2_PEER 0xFE // ESPNOW2 Address
#define LORA1_PEER 0xFD // LoRa1 Address
#define LORA2_PEER 0xFE // LoRa2 Address
//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).
#define ESPNOWG_ACT
#define SERIAL_ACT sendMQTT();
#define ESPNOWG_ACT
#define SERIAL_ACT sendMQTT();
#define MQTT_ACT
#define LORAG_ACT
#define LORAG_ACT
#define ESPNOW1_ACT
#define ESPNOW2_ACT
#define LORA1_ACT
#define LORA2_ACT
//#define USE_LORA
//#define USE_LORA
#define USE_WIFI //Used only for MQTT gateway
#define CREDENTIALS
#if defined (ESP32)
#define RXD2 14
#define TXD2 15
#define UART_IF Serial1
#else
#else
#define UART_IF Serial
#endif
////LoRa Configuration -- Needed only if using LoRa
////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
// default.h values are overwritten by the #defines of credentials.h files in the library folder
#ifdef CREDENTIALS
#include <credentials.h>
#define WIFI_NET my_SSID
#define WIFI_PASS my_PASSWORD
#define MQTT_ADDR my_MQTT_BROKER
#define BAND my_BAND
#endif

View File

@ -3,6 +3,14 @@
#else
#define DBG(a)
#endif
typedef struct __attribute__((packed)) DataReading {
float d;
uint16_t id;
uint8_t t;
} DataReading;
const uint8_t espnow_size = 250 / sizeof(DataReading);
const uint8_t lora_size = 256 / sizeof(DataReading);
const uint8_t mac_prefix[] = {MAC_PREFIX};