Add ability to specify repeats for raw Pilight strings (#803)
* Add ability to specify repeats for raw Pilight strings * Updated RF Pilight doc to add raw transmission tut Added information about transmitting raw messages using the MQTTtoPilight topic, including using the new repeats functionality. Fixed some scattered English mistakes.
This commit is contained in:
1 parent
5890bf7be6
commit
fd2d25bf31
4 files changed
+34
-8
No files matched your search
@@ -108,10 +108,21 @@ void MQTTtoPilight(char* topicOri, JsonObject& Pilightdata) {
|
||||
const char* raw = Pilightdata["raw"];
|
||||
if (raw) {
|
||||
uint16_t codes[MAXPULSESTREAMLENGTH];
|
||||
int msgLength = rf.stringToPulseTrain(
|
||||
raw, codes, MAXPULSESTREAMLENGTH);
|
||||
int repeats = rf.stringToRepeats(raw);
|
||||
if (repeats < 0) {
|
||||
switch (repeats) {
|
||||
case ESPiLight::ERROR_INVALID_PULSETRAIN_MSG_R:
|
||||
Log.trace(F("'r' not found in string, or has no data" CR));
|
||||
break;
|
||||
case ESPiLight::ERROR_INVALID_PULSETRAIN_MSG_END:
|
||||
Log.trace(F("';' or '@' not found in data string" CR));
|
||||
break;
|
||||
}
|
||||
repeats = 10;
|
||||
}
|
||||
int msgLength = rf.stringToPulseTrain(raw, codes, MAXPULSESTREAMLENGTH);
|
||||
if (msgLength > 0) {
|
||||
rf.sendPulseTrain(codes, msgLength);
|
||||
rf.sendPulseTrain(codes, msgLength, repeats);
|
||||
Log.notice(F("MQTTtoPilight raw ok" CR));
|
||||
} else {
|
||||
Log.trace(F("MQTTtoPilight raw KO" CR));
|
||||
|
||||
@@ -78,7 +78,6 @@ extern void MQTTtoPilight(char* topicOri, JsonObject& RFdata);
|
||||
#define subjectMQTTtoPilight "/commands/MQTTtoPilight"
|
||||
#define subjectPilighttoMQTT "/PilighttoMQTT"
|
||||
#define subjectGTWPilighttoMQTT "/PilighttoMQTT"
|
||||
#define PilightRAW "RAW"
|
||||
#define repeatPilightwMQTT false // do we repeat a received signal by using mqtt with Pilight gateway
|
||||
|
||||
/*-------------------CC1101 frequency----------------------*/
|
||||
|
||||
Reference in new issue
Block a user