Further cleanup

This commit is contained in:
sensorsiot 2022-05-22 16:10:33 +02:00
parent 56f517d45e
commit 4f8012bac5
8 changed files with 6 additions and 26 deletions

View File

@ -19,7 +19,7 @@
#define USE_LORA
#define DEEP_SLEEP
//#define POWER_CTRL 14
// #define MAC_PREFIX 0xAA, 0xBB, 0xCC, 0xDD, 0xEE
#define MAC_PREFIX 0xAA, 0xBB, 0xCC, 0xDD, 0xEE
//LoRa Configuration
#define SCK 5

View File

@ -7,6 +7,7 @@
//
#define DEBUG
#define CREDENTIALS
#define ESPNOW_SENSOR

View File

@ -22,14 +22,6 @@
#define RST 14
#define DIO0 26
#ifdef CREDENTIALS
#include <credentials.h>
#define WIFI_NET mySSID
#define WIFI_PASS myPASSWORD
#define MQTT_ADDR MQTT_BROKER
#define BAND myBAND
#endif
typedef struct __attribute__((packed)) DataReading {
float d;
uint16_t id;
@ -73,12 +65,6 @@ typedef struct __attribute__((packed)) DataReading {
#include <LoRa.h>
#endif
#ifdef DEBUG
#define DBG(a) (Serial.println(a))
#else
#define DBG(a)
#endif
const uint16_t espnow_size = 250 / sizeof(DataReading);
uint8_t gatewayAddress[] = {MAC_PREFIX, GTWY_MAC};
uint8_t gtwyAddress[] = {gatewayAddress[3], gatewayAddress[4], GTWY_MAC};

View File

@ -5,7 +5,9 @@
// Developed by Timm Bogner (timmbogner@gmail.com) for Sola Gratia Farm in Urbana, Illinois, USA.
//
#define CREDENTIALS
#define DEBUG
#define ROLE ESPNOW_GATEWAY
#include <FDRSdefaults.h>

View File

@ -15,7 +15,6 @@
//#define USE_LORA
//#define USE_WIFI //Used only for MQTT gateway
#define CREDENTIALS
#if defined (ESP32)
#define RXD2 14
@ -32,12 +31,3 @@
#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

@ -136,10 +136,11 @@ void getLoRa() {
if (memcmp(&incLORAMAC, &LoRa1, 2) == 0) newData = 7; //Check if it is from a registered sender
else if (memcmp(&incLORAMAC, &LoRa2, 2) == 0) newData = 8;
else newData = 6;
DBG (newData);
ln = (packetSize - 5) / sizeof(DataReading);
newData = 6;
DBG("Incoming LoRa.");
DBG (newData);
}
}