changed peers to neighbors

Better reflects the concept and clears ambiguity
This commit is contained in:
Timm Bogner 2022-09-29 14:31:07 -05:00
parent 8516730650
commit 4721e72b47
9 changed files with 42 additions and 44 deletions

View File

@ -5,7 +5,7 @@
#include <fdrs_globals.h>
#define FDRS_DEBUG //Enable USB-Serial debugging
#define DEBUG_NODE_CONFIG //displays full config of node after power up
#define DEBUG_NODE_CONFIG // Displays full config info on startup
#define UNIT_MAC 0x00 // The address of this gateway
@ -25,11 +25,11 @@
//#define USE_LORA
#define USE_WIFI //Used only for MQTT gateway
// Peer addresses
#define ESPNOW1_PEER 0x0E // ESPNOW1 Address
#define ESPNOW2_PEER 0x0F // ESPNOW2 Address
#define LORA1_PEER 0x0E // LoRa1 Address
#define LORA2_PEER 0x0F // LoRa2 Address
// Neighbor addresses
#define ESPNOW_NEIGHBOR_1 0x0E // ESPNOW1 Address
#define ESPNOW_NEIGHBOR_2 0x0F // ESPNOW2 Address
#define LORA_NEIGHBOR_1 0x0E // LoRa1 Address
#define LORA_NEIGHBOR_2 0x0F // LoRa2 Address
// Peer Actions
#define ESPNOW1_ACT

View File

@ -4,7 +4,7 @@
#include <fdrs_globals.h>
#define FDRS_DEBUG //Enable USB-Serial debugging
#define DEBUG_NODE_CONFIG //displays full config of node after power up
#define DEBUG_NODE_CONFIG // Displays full config info on startup
#define UNIT_MAC 0x01 // The address of this gateway
@ -24,11 +24,11 @@
//#define USE_LORA
//#define USE_WIFI //Used only for MQTT gateway
// Peer addresses
#define ESPNOW1_PEER 0x0E // ESPNOW1 Address
#define ESPNOW2_PEER 0x0F // ESPNOW2 Address
#define LORA1_PEER 0x02 // LoRa1 Address
#define LORA2_PEER 0x0F // LoRa2 Address
// Neighboring gateway addresses
#define ESPNOW_NEIGHBOR_1 0x0E // ESPNOW1 Address
#define ESPNOW_NEIGHBOR_2 0x0F // ESPNOW2 Address
#define LORA_NEIGHBOR_1 0x02 // LoRa1 Address
#define LORA_NEIGHBOR_2 0x0F // LoRa2 Address
// Peer Actions
#define ESPNOW1_ACT
@ -48,7 +48,7 @@
#define SD_FILENAME "fdrs_log.csv"
#define FS_FILENAME "fdrs_log.csv"
// SPI Configuration -- Needed only on Boards with multiple SPI interfaces like the ESP32
// SPI Configuration -- Needed only on boards with multiple SPI interfaces like the ESP32
#define SPI_SCK 5
#define SPI_MISO 19

View File

@ -5,7 +5,7 @@
#include <fdrs_globals.h>
#define FDRS_DEBUG //Enable USB-Serial debugging
#define DEBUG_NODE_CONFIG //displays full config of node after power up
#define DEBUG_NODE_CONFIG // Displays full config info on startup
#define UNIT_MAC 0x02 // The address of this gateway
@ -25,11 +25,11 @@
//#define USE_LORA
//#define USE_WIFI //Used only for MQTT gateway
// Peer addresses
#define ESPNOW1_PEER 0x01 // ESPNOW1 Address
#define ESPNOW2_PEER 0x0F // ESPNOW2 Address
#define LORA1_PEER 0x0E // LoRa1 Address
#define LORA2_PEER 0x0F // LoRa2 Address
// Neighbor addresses
#define ESPNOW_NEIGHBOR_1 0x01 // ESPNOW1 Address
#define ESPNOW_NEIGHBOR_2 0x0F // ESPNOW2 Address
#define LORA_NEIGHBOR_1 0x0E // LoRa1 Address
#define LORA_NEIGHBOR_2 0x0F // LoRa2 Address
// Peer Actions
#define ESPNOW1_ACT sendSerial(); // This would display packets arriving *from* the front-end.

View File

@ -4,7 +4,7 @@
#include <fdrs_globals.h>
#define FDRS_DEBUG //Enable USB-Serial debugging
#define DEBUG_NODE_CONFIG //displays full config of node after power up
#define DEBUG_NODE_CONFIG // Displays full config info on startup
#define UNIT_MAC 0x03 // The address of this gateway
@ -24,11 +24,11 @@
#define USE_LORA
//#define USE_WIFI //Used only for MQTT gateway
// Peer addresses
#define ESPNOW1_PEER 0x0E // ESPNOW1 Address
#define ESPNOW2_PEER 0x0F // ESPNOW2 Address
#define LORA1_PEER 0x01 // LoRa1 Address
#define LORA2_PEER 0x0F // LoRa2 Address
// Neighbor addresses
#define ESPNOW_NEIGHBOR_1 0x0E // ESPNOW1 Address
#define ESPNOW_NEIGHBOR_2 0x0F // ESPNOW2 Address
#define LORA_NEIGHBOR_1 0x01 // LoRa1 Address
#define LORA_NEIGHBOR_2 0x0F // LoRa2 Address
// Peer Actions
#define ESPNOW1_ACT

View File

@ -12,7 +12,7 @@
#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
#define DEBUG_NODE_CONFIG //displays full config of node after power up
#define DEBUG_NODE_CONFIG // Displays full config info on startup
//SPI Configuration -- Needed only on chipsets with multiple SPI interfaces (ESP32)
#define SPI_SCK 5

View File

@ -12,7 +12,7 @@
//#define DEEP_SLEEP
//#define POWER_CTRL 14
//#define FDRS_DEBUG
//#define DEBUG_NODE_CONFIG //displays full config of node after power up
//#define DEBUG_NODE_CONFIG // Displays full config info on startup
//SPI Configuration -- Needed only on chipsets with multiple SPI interfaces (ESP32)
#define SPI_SCK 5

View File

@ -12,7 +12,7 @@
#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
#define DEBUG_NODE_CONFIG //displays full config of node after power up
#define DEBUG_NODE_CONFIG // Displays full config info on startup
//SPI Configuration -- Needed only on chipsets with multiple SPI interfaces (ESP32)
#define SPI_SCK 5

View File

@ -49,7 +49,7 @@ void printConfigHeader(const char* headerText) {
// check which logging method(s) have been activated for a node
void printLoggingInformation() {
printSectionHeader("LOG SETTINGS OF NODE");
printSectionHeader("LOG SETTINGS OF DEVICE");
#if defined(USE_SD_LOG) && defined(USE_FS_LOG)
DBG("Logging to SD card AND file system is active! You should better use only one of them at a time");
@ -124,8 +124,8 @@ void printEspnowDetails() {
#ifdef UNIT_MAC
printSmallSectionHeader("ESP-Now Details:");
DBG("Peer 1 address: " + String(ESPNOW1_PEER, HEX));
DBG("Peer 2 address: " + String(ESPNOW2_PEER, HEX));
DBG("Neighbor 1 address: " + String(ESPNOW_NEIGHBOR_1, HEX));
DBG("Neighbor 2 address: " + String(ESPNOW_NEIGHBOR_2, HEX));
#endif //UNIT_MAC
#endif //USE_ESPNOW
@ -292,9 +292,9 @@ void printLoraDetails() {
#endif //LORA_ACK || GLOBAL_LORA_ACK
#ifdef UNIT_MAC
DBG("LoRa peers");
DBG("Peer 1 address: " + String(LORA1_PEER, HEX));
DBG("Peer 2 address: " + String(LORA2_PEER, HEX));
DBG("LoRa Neighbors");
DBG("Neighbor 1 address: " + String(LORA_NEIGHBOR_1, HEX));
DBG("Neighbor 2 address: " + String(LORA_NEIGHBOR_2, HEX));
#endif //UNIT_MAC
#endif //USE_LORA
@ -304,14 +304,14 @@ void printLoraDetails() {
void checkConfig() {
printConfigHeader("NODE CONFIGURATION OVERVIEW");
#ifdef UNIT_MAC
DBG("Node Type : Gateway");
DBG("Device Type : Gateway");
DBG("Gateway ID : " + String(UNIT_MAC, HEX));
#elif defined (READING_ID)
DBG("Node Type : Sensor");
DBG("Device Type : Node");
DBG("Reading ID : " + String(READING_ID));
DBG("Sensor's Gateway: " + String(GTWY_MAC, HEX));
DBG("Node's Gateway: " + String(GTWY_MAC, HEX));
#else
DBG("Node Type : UNKNOWN!");
DBG("Device Type : UNKNOWN!");
DBG("Please check config!");
DBG("If you have just created a new node type,");
DBG("please add it's config check to:");

View File

@ -45,8 +45,6 @@ enum {
#define UART_IF Serial
#endif
// enable to get detailed info from where single configuration macros have been taken
#define DEBUG_NODE_CONFIG
#ifdef USE_WIFI
@ -177,19 +175,19 @@ uint8_t selfAddress[] = {MAC_PREFIX, UNIT_MAC};
uint8_t incMAC[6];
#ifdef ESPNOW1_PEER
uint8_t ESPNOW1[] = {MAC_PREFIX, ESPNOW1_PEER};
uint8_t ESPNOW1[] = {MAC_PREFIX, ESPNOW_NEIGHBOR_1};
#else
uint8_t ESPNOW1[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
#endif
#ifdef ESPNOW2_PEER
uint8_t ESPNOW2[] = {MAC_PREFIX, ESPNOW2_PEER};
uint8_t ESPNOW2[] = {MAC_PREFIX, ESPNOW_NEIGHBOR_2};
#else
uint8_t ESPNOW2[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
#endif
#ifdef USE_LORA
uint16_t LoRa1 = ((mac_prefix[4] << 8) | LORA1_PEER); // Use 2 bytes for LoRa addressing instead of previous 3 bytes
uint16_t LoRa2 = ((mac_prefix[4] << 8) | LORA2_PEER);
uint16_t LoRa1 = ((mac_prefix[4] << 8) | LORA_NEIGHBOR_1); // Use 2 bytes for LoRa addressing instead of previous 3 bytes
uint16_t LoRa2 = ((mac_prefix[4] << 8) | LORA_NEIGHBOR_2);
uint16_t loraGwAddress = ((selfAddress[4] << 8) | selfAddress[5]); // last 2 bytes of gateway address
uint16_t loraBroadcast = 0xFFFF;
unsigned long receivedLoRaMsg = 0; // Number of total LoRa packets destined for us and of valid size