Update of rtl_433_ESP to version 0.1.3 - Support for SX127X transceiver module (#1291)
The main features of the upgrade to 0.1.3 of rtl_433_ESP are 1 - Change Transceiver Library to RadioLib 2 - Add support for SX127X transceiver module ( I used the 433 Mhz version of this Heltec module for development ). 3 - Added automatic calibration of the RSSI Signal detection Threshold 4 - Removed dependency on loop for start and end of signal detection, and moved to a ESP32 Task 5 - Moved received signal decoding to a ESP32 Task 6 - Identified Blueline PowerCost Monitor decoder as source of significant memory overhead and disabled. 7 - Multi Receiver support has been validated with RF, RF2 and PiLight
This commit is contained in:
1 parent
c570eead82
commit
8bc65d62dc
10 files changed
+186
-73
No files matched your search
+23
-21
@@ -28,7 +28,7 @@
|
||||
#include "User_config.h"
|
||||
|
||||
// Macros and structure to enable the duplicates removing on the following gateways
|
||||
#if defined(ZgatewayRF) || defined(ZgatewayIR) || defined(ZgatewaySRFB) || defined(ZgatewayWeatherStation)
|
||||
#if defined(ZgatewayRF) || defined(ZgatewayIR) || defined(ZgatewaySRFB) || defined(ZgatewayWeatherStation) || defined(ZgatewayRTL_433)
|
||||
// array to store previous received RFs, IRs codes and their timestamps
|
||||
struct ReceivedSignal {
|
||||
SIGNAL_SIZE_UL_ULL value;
|
||||
@@ -260,7 +260,7 @@ void revert_hex_data(const char* in, char* out, int l) {
|
||||
out[l - 1] = '\0';
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Retrieve an unsigned long value from a char array extract representing hexadecimal data, reversed or not,
|
||||
* This value can represent a negative value if canBeNegative is set to true
|
||||
*/
|
||||
@@ -295,10 +295,10 @@ bool to_bool(String const& s) { // thanks Chris Jester-Young from stackoverflow
|
||||
|
||||
/**
|
||||
* @brief Publish the payload on default MQTT topic.
|
||||
*
|
||||
*
|
||||
* @param topicori suffix to add on default MQTT Topic
|
||||
* @param payload the message to sends
|
||||
* @param retainFlag true if you what a retain
|
||||
* @param retainFlag true if you what a retain
|
||||
*/
|
||||
void pub(const char* topicori, const char* payload, bool retainFlag) {
|
||||
String topic = String(mqtt_topic) + String(gateway_name) + String(topicori);
|
||||
@@ -307,7 +307,7 @@ void pub(const char* topicori, const char* payload, bool retainFlag) {
|
||||
|
||||
/**
|
||||
* @brief Publish the payload on default MQTT topic
|
||||
*
|
||||
*
|
||||
* @param topicori suffix to add on default MQTT Topic
|
||||
* @param data The Json Object that rapresent the message
|
||||
*/
|
||||
@@ -363,7 +363,7 @@ void pub(const char* topicori, JsonObject& data) {
|
||||
|
||||
/**
|
||||
* @brief Publish the payload on default MQTT topic
|
||||
*
|
||||
*
|
||||
* @param topicori suffix to add on default MQTT Topic
|
||||
* @param payload the message to sends
|
||||
*/
|
||||
@@ -374,10 +374,10 @@ void pub(const char* topicori, const char* payload) {
|
||||
|
||||
/**
|
||||
* @brief Publish the payload on the topic with a retantion
|
||||
*
|
||||
*
|
||||
* @param topic The topic where to publish
|
||||
* @param data The Json Object that rapresent the message
|
||||
* @param retain true if you what a retain
|
||||
* @param retain true if you what a retain
|
||||
*/
|
||||
void pub_custom_topic(const char* topic, JsonObject& data, boolean retain) {
|
||||
String buffer = "";
|
||||
@@ -387,7 +387,7 @@ void pub_custom_topic(const char* topic, JsonObject& data, boolean retain) {
|
||||
|
||||
/**
|
||||
* @brief Low level MQTT functions without retain
|
||||
*
|
||||
*
|
||||
* @param topic the topic
|
||||
* @param payload the payload
|
||||
*/
|
||||
@@ -397,8 +397,8 @@ void pubMQTT(const char* topic, const char* payload) {
|
||||
|
||||
/**
|
||||
* @brief Very Low level MQTT functions with retain Flag
|
||||
*
|
||||
* @param topic the topic
|
||||
*
|
||||
* @param topic the topic
|
||||
* @param payload the payload
|
||||
* @param retainFlag true if retain the retain Flag
|
||||
*/
|
||||
@@ -1521,14 +1521,12 @@ void loop() {
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
loopM5();
|
||||
#endif
|
||||
|
||||
// Function that doesn't need an active connection
|
||||
#if defined(ZboardHELTEC)
|
||||
loopHELTEC();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Calculate uptime and take into account the millis() rollover
|
||||
*/
|
||||
unsigned long uptime() {
|
||||
@@ -1610,14 +1608,18 @@ void stateMeasures() {
|
||||
# if defined(ZgatewayRF) || defined(ZgatewayPilight) || defined(ZgatewayRTL_433) || defined(ZgatewayRF2)
|
||||
SYSdata["actRec"] = (int)activeReceiver;
|
||||
# endif
|
||||
# ifdef ZradioCC1101
|
||||
# if defined(ZradioCC1101) || defined(ZradioSX127x)
|
||||
SYSdata["mhz"] = (float)receiveMhz;
|
||||
# endif
|
||||
# if defined(ZgatewayRTL_433)
|
||||
if (activeReceiver == ACTIVE_RTL) {
|
||||
SYSdata["RTLminRssi"] = (int)getRTLMinimumRSSI();
|
||||
SYSdata["RTLRssiThresh"] = (int)getRTLrssiThreshold();
|
||||
SYSdata["RTLRssi"] = (int)getRTLCurrentRSSI();
|
||||
SYSdata["RTLAVGRssi"] = (int)getRTLAverageRSSI();
|
||||
SYSdata["RTLCnt"] = (int)getRTLMessageCount();
|
||||
# ifdef ZradioSX127x
|
||||
SYSdata["RTLOOKThresh"] = (int)getOOKThresh();
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
SYSdata["modules"] = modules;
|
||||
@@ -1625,8 +1627,8 @@ void stateMeasures() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ZgatewayRF) || defined(ZgatewayIR) || defined(ZgatewaySRFB) || defined(ZgatewayWeatherStation)
|
||||
/**
|
||||
#if defined(ZgatewayRF) || defined(ZgatewayIR) || defined(ZgatewaySRFB) || defined(ZgatewayWeatherStation) || defined(ZgatewayRTL_433)
|
||||
/**
|
||||
* Store signal values from RF, IR, SRFB or Weather stations so as to avoid duplicates
|
||||
*/
|
||||
void storeSignalValue(SIGNAL_SIZE_UL_ULL MQTTvalue) {
|
||||
@@ -1646,7 +1648,7 @@ void storeSignalValue(SIGNAL_SIZE_UL_ULL MQTTvalue) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* get oldest time index from the values array from RF, IR, SRFB or Weather stations so as to avoid duplicates
|
||||
*/
|
||||
int getMin() {
|
||||
@@ -1661,7 +1663,7 @@ int getMin() {
|
||||
return minindex;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Check if signal values from RF, IR, SRFB or Weather stations are duplicates
|
||||
*/
|
||||
bool isAduplicateSignal(SIGNAL_SIZE_UL_ULL value) {
|
||||
@@ -1670,7 +1672,7 @@ bool isAduplicateSignal(SIGNAL_SIZE_UL_ULL value) {
|
||||
if (receivedSignal[i].value == value) {
|
||||
unsigned long now = millis();
|
||||
if (now - receivedSignal[i].time < time_avoid_duplicate) { // change
|
||||
Log.notice(F("no pub. dupl" CR));
|
||||
Log.trace(F("no pub. dupl" CR));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user