[RF] RF2, Pilight : fixups to RF2 transmit when using CC1100; fixups to Pilight when raw enabled (#2207)

This commit is contained in:
peshovec authored and GitHub committed 2025-06-28 14:51:15 -05:00
1 parent b8b427555a
commit 162a4d3ae9
2 files changed
+18 -3

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@
# include <ESPiLight.h> # include <ESPiLight.h>
ESPiLight rf(RF_EMITTER_GPIO); // use -1 to disable transmitter ESPiLight rf(RF_EMITTER_GPIO); // use -1 to disable transmitter
extern int currentReceiver;
# ifdef Pilight_rawEnabled # ifdef Pilight_rawEnabled
// raw output support // raw output support
bool pilightRawEnabled = 0; bool pilightRawEnabled = 0;
+17 -2
View File
@@ -42,6 +42,7 @@ sudo mosquitto_pub -t home/commands/MQTTtoRF2/CODE_8233372/UNIT_0/PERIOD_272 -m/
# ifdef ZradioCC1101 # ifdef ZradioCC1101
# include <ELECHOUSE_CC1101_SRC_DRV.h> # include <ELECHOUSE_CC1101_SRC_DRV.h>
extern void initCC1101();
# endif # endif
# include <NewRemoteReceiver.h> # include <NewRemoteReceiver.h>
@@ -61,8 +62,6 @@ struct RF2rxd {
RF2rxd rf2rd; RF2rxd rf2rd;
extern void initCC1101();
# ifdef ZmqttDiscovery # ifdef ZmqttDiscovery
# include "config_mqttDiscovery.h" # include "config_mqttDiscovery.h"
extern String getUniqueId(String name, String sufix); extern String getUniqueId(String name, String sufix);
@@ -146,7 +145,15 @@ void rf2Callback(unsigned int period, unsigned long address, unsigned long group
void XtoRF2(const char* topicOri, const char* datacallback) { void XtoRF2(const char* topicOri, const char* datacallback) {
disableCurrentReceiver(); disableCurrentReceiver();
pinMode(RF_EMITTER_GPIO, OUTPUT); pinMode(RF_EMITTER_GPIO, OUTPUT);
# ifdef ZradioCC1101
initCC1101(); initCC1101();
int txPower = RF_CC1101_TXPOWER;
ELECHOUSE_cc1101.setPA((int)txPower);
Log.notice(F("[RF] CC1101 TX Power: %d" CR), txPower);
float txFrequency = RFConfig.frequency;
ELECHOUSE_cc1101.SetTx(txFrequency);
Log.notice(F("[RF] Transmit frequency: %F" CR), txFrequency);
# endif
// RF DATA ANALYSIS // RF DATA ANALYSIS
//We look into the subject to see if a special RF protocol is defined //We look into the subject to see if a special RF protocol is defined
@@ -261,7 +268,15 @@ void XtoRF2(const char* topicOri, JsonObject& RF2data) { // json object decoding
if (boolSWITCHTYPE != 99) { if (boolSWITCHTYPE != 99) {
disableCurrentReceiver(); disableCurrentReceiver();
pinMode(RF_EMITTER_GPIO, OUTPUT); pinMode(RF_EMITTER_GPIO, OUTPUT);
# ifdef ZradioCC1101
initCC1101(); initCC1101();
int txPower = RF2data["txpower"] | RF_CC1101_TXPOWER;
ELECHOUSE_cc1101.setPA((int)txPower);
Log.notice(F("[RF] CC1101 TX Power: %d" CR), txPower);
float txFrequency = RF2data["frequency"] | RFConfig.frequency;
ELECHOUSE_cc1101.SetTx(txFrequency);
Log.notice(F("[RF] Transmit frequency: %F" CR), txFrequency);
# endif
Log.trace(F("MQTTtoRF2 switch type ok" CR)); Log.trace(F("MQTTtoRF2 switch type ok" CR));
bool isDimCommand = boolSWITCHTYPE == 2; bool isDimCommand = boolSWITCHTYPE == 2;
unsigned long valueCODE = RF2data["address"]; unsigned long valueCODE = RF2data["address"];