add send raw function for IR

#46 #9
This commit is contained in:
1technophile committed 2017-05-16 21:40:25 +02:00
1 parent 411550d8ce
commit e909f16b74
2 files changed
+27 -2

No files matched your search

+4 -2
View File
@@ -108,6 +108,7 @@ RF supported protocols
#ifdef ESP8266 //IR supported protocols on ESP8266, all supported per default
#define IR_GC
#define IR_Raw
#define IR_COOLIX
#define IR_Whynter
#define IR_LG
@@ -125,6 +126,7 @@ RF supported protocols
//#define IR_RC5
//#define IR_Sharp
//#define IR_SAMSUNG
#define IR_Raw
#endif
/*----------------------BT topics-------------------------*/
@@ -144,8 +146,8 @@ RF supported protocols
//IMPORTANT NOTE: On arduino UNO connect IR emitter pin to D9 , comment #define IR_USE_TIMER2 and uncomment #define IR_USE_TIMER1 on library <library>IRremote/IRremoteInt.h so as to free pin D3 for RF RECEIVER PIN
//RF PIN definition
#define RF_RECEIVER_PIN 1 // 1 = D3 on arduino
#define BT_RX 5
#define BT_TX 6
#define BT_RX 5 //arduino RX connect HM-10 TX
#define BT_TX 6 //arduino TX connect HM-10 RX
#endif
//RF number of signal repetition
#define RF_EMITTER_REPEAT 20
+23
View File
@@ -115,6 +115,29 @@ void MQTTtoIR(char * topicOri, char * datacallback) {
irsend.sendGC(GC, j);
signalSent = true;
}
#endif
#ifdef IR_Raw
else if(strstr(topicOri, "IR_Raw") != NULL){ // sending GC data from https://irdb.globalcache.com
trc("IR_Raw");
//buffer allocation from char datacallback
unsigned int GC[count+1];
String value = "";
int j = 0;
for(int i = 0; i < s; i++)
{
if (datacallback[i] != ',') {
value = value + String(datacallback[i]);
}
if ((datacallback[i] == ',') || (i == s - 1))
{
GC[j]= value.toInt();
value = "";
j++;
}
}
irsend.sendRaw(GC, j, 38); // frequency hardcoded as a first approach for test puroposes
signalSent = true;
}
#endif
//We look into the subject to see if a special Bits number is defined