[RTL_433][BREAKING] Beta support for FSK modulation, webUI frequency and active receiver change (#1812)
* [FSK] Add Lilygo Heltec environment with FSK modulation Enable RTL_433 frequency and active receiver change with WebUI Add FSK environment for Heltec and Lilygo
This commit is contained in:
1 parent
eb5b8fa291
commit
7db2e93c28
15 files changed
+742
-559
No files matched your search
+13
-62
@@ -55,21 +55,6 @@ struct RF2rxd {
|
||||
|
||||
RF2rxd rf2rd;
|
||||
|
||||
void setupRF2() {
|
||||
# ifdef ZradioCC1101 //receiving with CC1101
|
||||
ELECHOUSE_cc1101.Init();
|
||||
ELECHOUSE_cc1101.setMHZ(receiveMhz);
|
||||
ELECHOUSE_cc1101.SetRx(receiveMhz);
|
||||
# endif
|
||||
NewRemoteReceiver::init(RF_RECEIVER_GPIO, 2, rf2Callback);
|
||||
Log.notice(F("RF_EMITTER_GPIO: %d " CR), RF_EMITTER_GPIO);
|
||||
Log.notice(F("RF_RECEIVER_GPIO: %d " CR), RF_RECEIVER_GPIO);
|
||||
Log.trace(F("ZgatewayRF2 command topic: %s%s%s" CR), mqtt_topic, gateway_name, subjectMQTTtoRF2);
|
||||
Log.trace(F("ZgatewayRF2 setup done " CR));
|
||||
pinMode(RF_EMITTER_GPIO, OUTPUT);
|
||||
digitalWrite(RF_EMITTER_GPIO, LOW);
|
||||
}
|
||||
|
||||
# ifdef ZmqttDiscovery
|
||||
//Register for autodiscover in Home Assistant
|
||||
void RF2toMQTTdiscovery(JsonObject& data) {
|
||||
@@ -148,13 +133,9 @@ void rf2Callback(unsigned int period, unsigned long address, unsigned long group
|
||||
|
||||
# if simpleReceiving
|
||||
void MQTTtoRF2(char* topicOri, char* datacallback) {
|
||||
# ifdef ZradioCC1101
|
||||
NewRemoteReceiver::disable();
|
||||
disableActiveReceiver();
|
||||
ELECHOUSE_cc1101.Init();
|
||||
pinMode(RF_EMITTER_GPIO, OUTPUT);
|
||||
ELECHOUSE_cc1101.SetTx(CC1101_FREQUENCY); // set Transmit on
|
||||
# endif
|
||||
initCC1101();
|
||||
|
||||
// RF DATA ANALYSIS
|
||||
//We look into the subject to see if a special RF protocol is defined
|
||||
@@ -253,7 +234,7 @@ void MQTTtoRF2(char* topicOri, char* datacallback) {
|
||||
}
|
||||
}
|
||||
# ifdef ZradioCC1101
|
||||
ELECHOUSE_cc1101.SetRx(receiveMhz); // set Receive on
|
||||
ELECHOUSE_cc1101.SetRx(RFConfig.frequency); // set Receive on
|
||||
NewRemoteReceiver::enable();
|
||||
# endif
|
||||
}
|
||||
@@ -267,13 +248,9 @@ void MQTTtoRF2(char* topicOri, JsonObject& RF2data) { // json object decoding
|
||||
int boolSWITCHTYPE = RF2data["switchType"] | 99;
|
||||
bool success = false;
|
||||
if (boolSWITCHTYPE != 99) {
|
||||
# ifdef ZradioCC1101
|
||||
NewRemoteReceiver::disable();
|
||||
disableActiveReceiver();
|
||||
ELECHOUSE_cc1101.Init();
|
||||
pinMode(RF_EMITTER_GPIO, OUTPUT);
|
||||
ELECHOUSE_cc1101.SetTx(CC1101_FREQUENCY); // set Transmit on
|
||||
# endif
|
||||
initCC1101();
|
||||
Log.trace(F("MQTTtoRF2 switch type ok" CR));
|
||||
bool isDimCommand = boolSWITCHTYPE == 2;
|
||||
unsigned long valueCODE = RF2data["address"];
|
||||
@@ -311,19 +288,6 @@ void MQTTtoRF2(char* topicOri, JsonObject& RF2data) { // json object decoding
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
if (RF2data.containsKey("active")) {
|
||||
Log.trace(F("RF2 active:" CR));
|
||||
activeReceiver = ACTIVE_RF2;
|
||||
success = true;
|
||||
}
|
||||
# ifdef ZradioCC1101 // set Receive on and Transmitt off
|
||||
float tempMhz = RF2data["mhz"];
|
||||
if (RF2data.containsKey("mhz") && validFrequency(tempMhz)) {
|
||||
receiveMhz = tempMhz;
|
||||
Log.notice(F("Receive mhz: %F" CR), receiveMhz);
|
||||
success = true;
|
||||
}
|
||||
# endif
|
||||
if (success) {
|
||||
// we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also
|
||||
pub(subjectRF2toMQTT, RF2data);
|
||||
@@ -333,39 +297,26 @@ void MQTTtoRF2(char* topicOri, JsonObject& RF2data) { // json object decoding
|
||||
# endif
|
||||
Log.error(F("MQTTtoRF2 failed json read" CR));
|
||||
}
|
||||
enableActiveReceiver(false);
|
||||
enableActiveReceiver();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
void disableRF2Receive() {
|
||||
Log.trace(F("disableRF2Receive" CR));
|
||||
NewRemoteReceiver::deinit();
|
||||
NewRemoteReceiver::init(-1, 2, rf2Callback); // mark _interupt with -1
|
||||
NewRemoteReceiver::deinit();
|
||||
NewRemoteReceiver::disable();
|
||||
}
|
||||
|
||||
void enableRF2Receive() {
|
||||
# ifdef ZradioCC1101
|
||||
Log.notice(F("Switching to RF2 Receiver: %F" CR), receiveMhz);
|
||||
# else
|
||||
Log.notice(F("Switching to RF2 Receiver" CR));
|
||||
# endif
|
||||
# ifdef ZgatewayPilight
|
||||
disablePilightReceive();
|
||||
# endif
|
||||
# ifdef ZgatewayRTL_433
|
||||
disableRTLreceive();
|
||||
# endif
|
||||
# ifdef ZgatewayRF
|
||||
disableRFReceive();
|
||||
# endif
|
||||
|
||||
# ifdef ZradioCC1101
|
||||
ELECHOUSE_cc1101.Init();
|
||||
ELECHOUSE_cc1101.SetRx(receiveMhz); // set Receive on
|
||||
# endif
|
||||
Log.trace(F("enableRF2Receive" CR));
|
||||
NewRemoteReceiver::init(RF_RECEIVER_GPIO, 2, rf2Callback);
|
||||
|
||||
Log.notice(F("RF_EMITTER_GPIO: %d " CR), RF_EMITTER_GPIO);
|
||||
Log.notice(F("RF_RECEIVER_GPIO: %d " CR), RF_RECEIVER_GPIO);
|
||||
Log.trace(F("ZgatewayRF2 command topic: %s%s%s" CR), mqtt_topic, gateway_name, subjectMQTTtoRF2);
|
||||
pinMode(RF_EMITTER_GPIO, OUTPUT);
|
||||
digitalWrite(RF_EMITTER_GPIO, LOW);
|
||||
Log.trace(F("ZgatewayRF2 setup done " CR));
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user