[LORA] Improvements, change frequency, webUI, Oled support, add boards (#1742)

* [LORA] Capability to change LORA frequency and Add OLED

Merge of the 2 environments for TTGO V1

* Merge messages keys with upper level json

* Id as a sub topic

* Add display and state measures

* Add frequency configuration through WebUI

* Add parameters

* Add auto discovery

* Add node example for ttgo lora32 v1

* Add environments and fix scope

* Support for sync word as a byte

* Fix TX Power setting

* Add LoRa gateway description

* Add onlyknown filter
This commit is contained in:
Florian authored and GitHub committed 2023-09-27 11:12:55 -05:00
1 parent 3d20995b3a
commit 246423a8a8
18 files changed
+990 -121

No files matched your search

+63 -8
View File
@@ -34,19 +34,39 @@ extern void MQTTtoLORA(char* topicOri, JsonObject& RFdata);
#define subjectLORAtoMQTT "/LORAtoMQTT"
#define subjectMQTTtoLORA "/commands/MQTTtoLORA"
#define subjectGTWLORAtoMQTT "/LORAtoMQTT"
#define subjectMQTTtoLORAset "/commands/MQTTtoLORA/config"
//Default parameters used when the parameters are not set in the json data
#ifndef LORA_BAND
# define LORA_BAND 868E6
#endif
#define LORA_SIGNAL_BANDWIDTH 125E3
#define LORA_TX_POWER 17
#define LORA_SPREADING_FACTOR 7
#define LORA_CODING_RATE 5
#define LORA_PREAMBLE_LENGTH 8
#define LORA_SYNC_WORD 0x12
#define DEFAULT_CRC true
#define INVERT_IQ false
#ifndef LORA_SIGNAL_BANDWIDTH
# define LORA_SIGNAL_BANDWIDTH 125E3
#endif
#ifndef LORA_TX_POWER
# define LORA_TX_POWER 14
#endif
#ifndef LORA_SPREADING_FACTOR
# define LORA_SPREADING_FACTOR 7
#endif
#ifndef LORA_CODING_RATE
# define LORA_CODING_RATE 5
#endif
#ifndef LORA_PREAMBLE_LENGTH
# define LORA_PREAMBLE_LENGTH 8
#endif
#ifndef LORA_SYNC_WORD
# define LORA_SYNC_WORD 0x12
#endif
#ifndef DEFAULT_CRC
# define DEFAULT_CRC true
#endif
#ifndef INVERT_IQ
# define INVERT_IQ false
#endif
#ifndef LORA_ONLY_KNOWN
# define LORA_ONLY_KNOWN false
#endif
#define repeatLORAwMQTT false // do we repeat a received signal by using MQTT with LORA gateway
@@ -78,4 +98,39 @@ extern void MQTTtoLORA(char* topicOri, JsonObject& RFdata);
# define LORA_DI0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request)
#endif
struct LORAConfig_s {
long frequency;
int txPower;
int spreadingFactor;
long signalBandwidth;
int codingRateDenominator;
int preambleLength;
byte syncWord;
bool crc;
bool invertIQ;
bool onlyKnown;
};
#ifdef ZmqttDiscovery
extern void launchLORADiscovery(bool overrideDiscovery);
// This structure stores the entities of the devices and is they have been discovered or not
// The uniqueId is composed of the device id + the key
# define uniqueIdSize 30
# define modelNameSize 30
struct LORAdevice {
char uniqueId[uniqueIdSize];
char modelName[modelNameSize];
bool isDisc;
};
const char LORAparameters[3][4][12] = {
// LORA key, name, unit, device_class
{"tempc", "temperature", "°C", "temperature"},
{"hum", "humidity", "%", "humidity"},
{"moi", "moisture", "%", "humidity"}};
#endif
#endif