Merge pull request #58 from Gulpman/dev

Bugfix: Updated fdrs_sensor.h of Universal_Sensor_beta
This commit is contained in:
Timm Bogner 2022-07-12 08:41:47 -05:00 committed by GitHub
commit b91920517f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 11 deletions

View File

@ -7,11 +7,19 @@
// An example of how to send data using "fdrs_sensor.h".
//
// compile error when defined here - why?
//#define USE_LORA
//#define USE_ESPNOW
#include "fdrs_sensor_config.h"
#include "fdrs_sensor.h"
#if defined(USE_LORA)
FDRSLoRa FDRS(GTWY_MAC,READING_ID,SPI_MISO,SPI_MOSI,SPI_SCK,LORA_SS,LORA_RST,LORA_DIO0,FDRS_BAND,FDRS_SF);
#elif defined(USE_ESPNOW)
FDRS_EspNow FDRS(GTWY_MAC, READING_ID);
#endif
float data1;
float data2;
@ -33,5 +41,5 @@ float readTemp() {
}
float readHum() {
return 21.0345;
return random(0,100);
}

View File

@ -76,6 +76,7 @@ void FDRSBase::sleep(int seconds){
delay(seconds * 1000);
}
#ifdef USE_ESPNOW
FDRS_EspNow::FDRS_EspNow(uint8_t gtwy_mac,uint16_t reading_id):
FDRSBase(gtwy_mac,reading_id)
@ -126,6 +127,8 @@ void FDRS_EspNow::transmit(DataReading_t *fdrsData, uint8_t _data_count){
DBG(" ESP-NOW sent.");
}
#endif USE_ESPNOW
#ifdef USE_LORA
FDRSLoRa::FDRSLoRa(uint8_t gtwy_mac,
@ -178,4 +181,4 @@ void FDRSLoRa::transmit(DataReading_t *fdrsData, uint8_t _data_count){
DBG(" LoRa sent.");
}
#endif
#endif USE_LORA

View File

@ -10,7 +10,7 @@
#define __FDRS_SENSOR__H__
#include "fdrs_types.h"
#include "fdrs_datatypes.h"
#include <fdrs_datatypes.h>
//1 to enable debugging prints. 0 disables the debugging prints
#define ENABLE_DEBUG 1
@ -22,6 +22,7 @@
#endif
#define USE_LORA
//#define USE_ESPNOW
#if defined(ESP8266)
#include <ESP8266WiFi.h>
@ -33,16 +34,18 @@
#endif
#ifdef USE_LORA
#include "LoRa.h"
#include <LoRa.h>
#endif
#ifdef FDRS_GLOBALS
#define FDRS_BAND GLOBAL_BAND
#define FDRS_SF GLOBAL_SF
//#ifdef FDRS_GLOBAL_LORA
#define FDRS_BAND GLOBAL_LORA_BAND
#define FDRS_SF GLOBAL_LORA_SF
#else
#define FDRS_BAND LORA_BAND
#define FDRS_SF LORA_SF
#endif
#endif //FDRS_GLOBAL_LORA
#ifdef FDRS_DEBUG
#define DBG(a) (Serial.println(a))

View File

@ -1,9 +1,11 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration File
// By default global settings will be used for this sensor.
// By default global settings defined in fdrs_globals.h will be used for all sensors.
// If you need to change a specific setting, uncomment and set to your needs further below.
//
#ifndef __FDRS_SENSOR_CONFIG__H__
#define __FDRS_SENSOR_CONFIG__H__
#define FDRS_DEBUG // Comment, if you do not want to see debug messages
#include <fdrs_globals.h> // Comment if you want to set specific values for this sensor here
@ -14,7 +16,10 @@
#define DEEP_SLEEP
//#define POWER_CTRL 14
// TODO: New, taken from Gateway - should be configured in the same way as there!
// Uncomment the sensor type you want to use
//#define USE_LORA
//#define USE_ESPNOW
//Pins for UART data interface (ESP32 only)
#define RXD2 14
#define TXD2 15
@ -30,7 +35,7 @@
#define LORA_DIO0 26
// LoRa Transport Configuration -- This should be set in the global configuration file. However, if you need a
// LoRa Transport Configuration -- This should be globally configured in fdrs_globals.h. If you need a
// specific band and spreading factor for this sensor, configure below.
//433E6 for Asia
//866E6 for Europe
@ -38,4 +43,11 @@
//#define LORA_BAND 915E6
//#define LORA_SF 7
// TODO: Addd local MQTT configuration
// MQTT Configuration -- This should be globally configured in fdrs_globals.h. If you need to specify
// a different MQTT server for this sensor, configure below.
//#define MQTT_ADDR "192.168.0.8"
//#define MQTT_AUTH //uncomment to enable MQTT authentication
//#define MQTT_USER "Your MQTT Username"
//#define MQTT_PASS "Your MQTT Password"
#endif __FDRS_SENSOR_CONFIG__H__