[RF] Fix crash on transmit with CC1101/ESP32 (#1809)

* Disable active receiver before setting transmit power or frequency.

* Fixed formatting.
This commit is contained in:
Ian Taylor authored and GitHub committed 2023-11-16 10:56:11 -06:00
1 parent 9adff6fb09
commit e015173530
1 file changed
+2 -1
+2 -1
View File
@@ -262,13 +262,14 @@ void MQTTtoRF(char* topicOri, JsonObject& RFdata) { // json object decoding
Log.notice(F("RF Pulse Lgth: %d" CR), valuePLSL);
Log.notice(F("Bits nb: %d" CR), valueBITS);
# ifdef ZradioCC1101 // set Receive off and Transmitt on
disableActiveReceiver();
int txPower = RFdata["txpower"] | RF_CC1101_TXPOWER;
ELECHOUSE_cc1101.setPA((int)txPower);
Log.notice(F("CC1101 TX Power: %d" CR), txPower);
float trMhz = RFdata["mhz"] | CC1101_FREQUENCY;
if (validFrequency((int)trMhz)) {
disableActiveReceiver();
ELECHOUSE_cc1101.SetTx(trMhz);
Log.notice(F("Transmit mhz: %F" CR), trMhz);
}